Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp342150lqj; Sun, 2 Jun 2024 00:32:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVmadav2xdd/IDAXIwuhUel7RWI2/kBudtl+unB7cM8cM595WtuhogqoO8hqi2yoy0/c3+MZhz8ThlpZn5CT9y+7T8fkhadUqRspfPVQg== X-Google-Smtp-Source: AGHT+IFNYQ9B3tIllvDynwdiVuMSbye92A318ls90i8YcYGKAgOh9hJMVh9oJKFE+GdJgR8xFkwS X-Received: by 2002:a05:6122:16a5:b0:4e4:e998:bf7f with SMTP id 71dfb90a1353d-4eb02e79566mr6597485e0c.11.1717313547771; Sun, 02 Jun 2024 00:32:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717313547; cv=pass; d=google.com; s=arc-20160816; b=ArZgO27IJNZhE3z+oZcCNnEN0zxU8Z9SFyKPY5S3b0X5IPVepI5ld0Ndd7GOF+lFjF 8oItHPe4pvvxqeMQ0xDGApWIVJ7HorqKS2yHQH30LIp92KKty5RFFrIBG6Gncw3luYYO SE4+kp3cY1a6P1J1Uj2iCBV3lpb6/b5XsWF2ZveuhIaXFmtSYpWMKNH+nIY6tD7EIV3k yEH3fwr9ZgsEn1Yw4yVRMkgGoYhdGKSOO8jnSQx/acxvOBLoRLuWoAoq5yFuS/mirAnz 6HUVT7NGvBhNkoyyIJSzEW7Z8ExU8iv/Ty4285u8UnZi+expEwj2KuEKmQUOfYxWG87+ iPGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:dkim-signature:date; bh=/MaeXkfU5+d9iME/l5SX4YTaljCevq2NVRlbP81IKuU=; fh=czskVHE+mExG7Gz0LSaPuPgCa2hS9b1KMIuhEULmfyc=; b=ToAmbVSKRncjE0H6TD8w01xeMQMzTDK4z8ys1qJP83dqCInLAklajk67DMFmaGzIlX msAv1IKOsn0z/qdPqVj5BbpVj/8KD2W4j9JuY93ZLQWK8CTwrOcRpfrmHQpicQ58+e34 GAevWrSqDSYsate3piTGd2gDWV8jCTvBqOwTwhTNzYIrfHV5vg8QNFN6HY3nTXFcw0W4 SIpqVM2bfnHSK9Wpjn5DrjGKQDiJoFfqLuy9AfQsUQyACWqOiCJdq1lZJvxichM/fJNJ AfXulmNtItMhorI9IoVaDTT/v1YfNs55oOpsZT4gdfsJNywUY7qbKq+kCOvERa0Hozoi +9hQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=OZc6I9qs; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="joR/8rMo"; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-198152-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198152-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-794f2f165desi623023285a.161.2024.06.02.00.32.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 00:32:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198152-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=OZc6I9qs; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="joR/8rMo"; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-198152-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198152-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7D7C51C20ADE for ; Sun, 2 Jun 2024 07:32:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D551D1CAA4; Sun, 2 Jun 2024 07:32:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="OZc6I9qs"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="joR/8rMo" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 872D519A for ; Sun, 2 Jun 2024 07:32:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717313541; cv=none; b=kZlOw55UJrg/NPtO0mov4le0SNi/GGEiDh6wQEQ/gPlB3dzAxAUwPYIGOzYRFuzcCIdydNl+tpAiodeUwKUw5ke5fr3Gr4SCbPhWLN5tRJoXSQdYLDYbqTaop69GzTvwZdo2rfRccbBWllVpEpEtVdiBZrcs+ydodQTUdE1O128= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717313541; c=relaxed/simple; bh=sqdBlSVKcse7rRSf3r40Go/w+iJ9VJ4VK9R+9tRQmhQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hyBANYIpmamGFtL5PsguyjGsaI4PM31cE46XXgQAxdQTWAYZSPDlpT7THKysFrguCfs5LbIWZv1IOMTjzam8xE0FgZhWx05DogxUIdlAD0FRXKbD8A+gd9ES3WEbz2BVbCNNuO0Woz02FoZSESxh0KGAKevXKFVnVRjEkvKbZW4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=OZc6I9qs; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=joR/8rMo; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Sun, 2 Jun 2024 09:32:10 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1717313537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/MaeXkfU5+d9iME/l5SX4YTaljCevq2NVRlbP81IKuU=; b=OZc6I9qsg1cGXYuLdROyGA49u1EnXdtNWafGGioa6SDOp12ApWkTyVUDBep4y1wzszdaG7 sGalfIeBgA/EAHqPc+sXNbxNJm035sVKzr/NkfLIWLiuNzEQdHf7knJTk11VlmJjtQXizg hBabohPZdGdwrxFlUVrXN3e+nKYFapWwnyKb9otg9W51jsee9/jTBAEOJaCy7Ag8BCWVsx uyV9FPYbGCclvHvGqAFAWdlrgpXq5DlbWFVj9BbNgn6Z5eUxivgsHFr41yso0KmRPjixln 7dmGF8yAcuHi1N39J9ZQQ+Zf/9LPnBkRWuZjLPZNXUNI8K6LrXQPpfrm0msXUg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1717313537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/MaeXkfU5+d9iME/l5SX4YTaljCevq2NVRlbP81IKuU=; b=joR/8rMo8+qdZcxRgUK4sNXpNs4h81q5qpBECmx26RwTojRNGMqDkD69QD86U8H5vV3SoQ g4LoyxDl42IAaNDA== From: Nam Cao To: Alexandre Ghiti Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kernel test robot Subject: Re: [PATCH 7/7] riscv: remove limit on the size of read-only section for XIP kernel Message-ID: <20240602073210.w0CKrGlj@linutronix.de> References: <9eea4b61f7b6300def3b6582d8e465ef4207501e.1715286093.git.namcao@linutronix.de> <2e092f39-0716-4b73-9268-da9211a4b600@ghiti.fr> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2e092f39-0716-4b73-9268-da9211a4b600@ghiti.fr> On Mon, May 27, 2024 at 02:58:14PM +0200, Alexandre Ghiti wrote: > > 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. SECTION_ALIGN doesn't work unfortunately. For XIP, SECTION_ALIGN is L1_CACHE_BYTES which is 64 bytes, but we need at least PMD_SIZE alignment to setup virtual mapping. Ideally we use PMD_SIZE here, but I can't #include that header file. Probably we can refactor the header files so that we can #include the header file that PMD_SIZE is in. But I am not sure if it's worth it. I'm thinking just go for: ifdef CONFIG_64_BIT . = ALIGN(SZ_2M); #else . = ALIGN(SZ_4M); #endif Or even simpler, just: . = ALIGN(SZ_4M); As much as I hate magic numbers, I think we can give linker script some leeway. Perhaps with an explanation why this alignment is chosen? Or do you have a better idea? Best regards, Nam