Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2047963lqb; Mon, 27 May 2024 06:22:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWkPU79U/v8FRPntN2j8foHOdq0vnDIyIs+YPMMUlbxB+iQftPvn+Bsp6tE3WhtxuQccYtBtb83il1veFoAo9ifgwGiucma5Ux1NqdAlA== X-Google-Smtp-Source: AGHT+IHHYN+qOtAdsiaT3yHoK/K/7RVK1Ube2Om/A5NWPO2jauJO2wtax9UYnxDnlKL3mSX19/RO X-Received: by 2002:a17:903:2344:b0:1f2:fbda:8671 with SMTP id d9443c01a7336-1f4486b9c06mr93475825ad.6.1716816142229; Mon, 27 May 2024 06:22:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716816142; cv=pass; d=google.com; s=arc-20160816; b=BaYqTybGc6e+N69gQwNVv7Pd2Hm/aL4XyyJarpHymW41tDKPf6StWny6pm4FEq8uVj 9ObWssrdwQ7EdyEyKUY4d39TbXKPYnVKpsfp/jkiEP7K1G7MP2/K/IZnar3EdtNt1PgY ZdbGOins/6Heyds/+xR4n9BsY3ZQeRe1Y9+p6lSwZVVA8h9jlZrXctTkzneQtWnPVPaS hBGG1Msy8l2plG2ALJGTf3vtNh0ZxTPFDbdBJqMbCNymh7QedsGKF8WrvQAlzwiVEcxW 9RUqF06ylKuL2OXBeBEes/rj3z9ypnehl0UPOtCK2SvE7UYTWiVMipWrrQsg8bMDH/gL oeCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=tP4yk4/Uayk8wt9Gk2gHXPKGv+GJOPE6usk9NPwjp3k=; fh=Jf+7DuEFq6b30uyyAUn4Iv2fD8++6ZZbAKO/hv8hJS4=; b=mSBt79Vasae/z8B8KwZ4C9ScXh7MAT2INu9cfNg9fdLhHIIxp+zstKWaAanzL7lf9f dM6DNX7yTjO9d4heHxm28K5b6D73v3RCnF9qkgskPGtIzzhhasX0jiA19wwlPBLUzcXs oFBCRCAQ0vXAcDqTi5IUqmTvCv6kVdicmCEtCpcm5xSmNJls2PV5fzbXBPRnZQXJHjjO EwhLE6Jp14YbpfS8zH0l64LxrngRCzfTTnQVdzNw+Kccy56iYbsczvLrnQXrIc+35aBP czLl0PwAwEaD3uWkx+Nm6wMLXt1AmUY6FyJTfQrVdwlNxRmAqOmxMMoT/ANsGbecgs1y FJgQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-190644-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190644-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c96fb00si62240025ad.235.2024.05.27.06.22.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 06:22:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190644-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-190644-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190644-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id CBFF5B23272 for ; Mon, 27 May 2024 13:03:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18E1E15F318; Mon, 27 May 2024 12:58:20 +0000 (UTC) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 916DF15ECCD for ; Mon, 27 May 2024 12:58:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716814699; cv=none; b=ijYm9O2WM1/Qc7haVhFpCTpv2JMnNJscREl3ndSvMdL46zhEE2tJoum1aaBseCpIP6ejSVG6ofk2VzdZKnrTcfyvarobxScQfgejN1MYC0lahsJsQIipxI0+rgp2O0Yo7IpNPhUesIOMZvA1XQExeZyO1vkO1MRswat7WwPYbog= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716814699; c=relaxed/simple; bh=v0J+sOVDHQy2wLhWEYp0vZ3fGEo6tOMovB9cWlyGRcQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=iXhyaC30r3jY13/+ZlYBDewA4/+0pEmHfJKtIHOvr3o7D8Jgl640yHtoxT3TtOs1fb/NOS1YoN/b4voL8FzL0NubQ/K4CGiKVARQiPhzg1plF592hH63SVAOkZOLeQAN3PqmpVNe3fdYt3Hn2mO7mAzJILJugbKDc9/JF1g9u9M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr; spf=pass smtp.mailfrom=ghiti.fr; arc=none smtp.client-ip=217.70.183.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ghiti.fr Received: by mail.gandi.net (Postfix) with ESMTPSA id 2C3D620008; Mon, 27 May 2024 12:58:15 +0000 (UTC) Message-ID: <2e092f39-0716-4b73-9268-da9211a4b600@ghiti.fr> Date: Mon, 27 May 2024 14:58:14 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 7/7] riscv: remove limit on the size of read-only section for XIP kernel Content-Language: en-US To: Nam Cao , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: kernel test robot References: <9eea4b61f7b6300def3b6582d8e465ef4207501e.1715286093.git.namcao@linutronix.de> From: Alexandre Ghiti In-Reply-To: <9eea4b61f7b6300def3b6582d8e465ef4207501e.1715286093.git.namcao@linutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Sasl: alex@ghiti.fr On 10/05/2024 08:28, Nam Cao wrote: > XIP_OFFSET is the hard-coded offset of writable data section within the > kernel. > > By hard-coding this value, the read-only section of the kernel (which is > placed before the writable data section) is restricted in size. This causes > build failures if the kernel get too big (an example is in Closes:). s/get/gets I think you can use: Closes: https://lore.kernel.org/oe-kbuild-all/202404211031.J6l2AfJk-lkp@intel.com/ [1] And instead use: s/an example is in Closes:/[1] > > Remove this limit. > > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-kbuild-all/202404211031.J6l2AfJk-lkp@intel.com/ > Signed-off-by: Nam Cao > --- > arch/riscv/include/asm/pgtable.h | 7 ------- > arch/riscv/kernel/vmlinux-xip.lds.S | 4 ++-- > 2 files changed, 2 insertions(+), 9 deletions(-) > > diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h > index fbf342f4afee..75f4a92ea5bb 100644 > --- a/arch/riscv/include/asm/pgtable.h > +++ b/arch/riscv/include/asm/pgtable.h > @@ -104,13 +104,6 @@ > > #endif > > -#ifdef CONFIG_XIP_KERNEL > -#define XIP_OFFSET SZ_32M > -#define XIP_OFFSET_MASK (SZ_32M - 1) > -#else > -#define XIP_OFFSET 0 > -#endif > - > #ifndef __ASSEMBLY__ > > #include > diff --git a/arch/riscv/kernel/vmlinux-xip.lds.S b/arch/riscv/kernel/vmlinux-xip.lds.S > index 8c3daa1b0531..01f73f2ffecc 100644 > --- a/arch/riscv/kernel/vmlinux-xip.lds.S > +++ b/arch/riscv/kernel/vmlinux-xip.lds.S > @@ -65,10 +65,10 @@ SECTIONS > * From this point, stuff is considered writable and will be copied to RAM > */ > __data_loc = ALIGN(PAGE_SIZE); /* location in file */ > - . = KERNEL_LINK_ADDR + XIP_OFFSET; /* location in memory */ > + . = ALIGN(SZ_2M); /* location in memory */ You can't use SZ_2M here since it corresponds to PMD_SIZE for rv64 but on rv32 (which is allowed to use xip kernels), it's 4MB. Use SECTION_ALIGN instead. > > #undef LOAD_OFFSET > -#define LOAD_OFFSET (KERNEL_LINK_ADDR + XIP_OFFSET - (__data_loc & XIP_OFFSET_MASK)) > +#define LOAD_OFFSET (KERNEL_LINK_ADDR + _sdata - __data_loc) > > _sdata = .; /* Start of data section */ > _data = .; When the above comment is fixed, you can add: Reviewed-by: Alexandre Ghiti And many thanks for this big cleanup. Alex