From: Nam Cao <namcao@linutronix.de>
To: Alexandre Ghiti <alex@ghiti.fr>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH 7/7] riscv: remove limit on the size of read-only section for XIP kernel
Date: Sun, 2 Jun 2024 09:32:10 +0200 [thread overview]
Message-ID: <20240602073210.w0CKrGlj@linutronix.de> (raw)
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
next prev parent reply other threads:[~2024-06-02 7:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-10 6:28 [PATCH 0/7] remove size limit on " Nam Cao
2024-05-10 6:28 ` [PATCH 1/7] riscv: cleanup XIP_FIXUP macro Nam Cao
2024-05-27 12:16 ` Alexandre Ghiti
2024-05-10 6:28 ` [PATCH 2/7] riscv: replace va_kernel_pa_offset with va_kernel_data_pa_offset on XIP Nam Cao
2024-05-27 12:32 ` Alexandre Ghiti
2024-05-10 6:28 ` [PATCH 3/7] riscv: drop the use of XIP_OFFSET in XIP_FIXUP_OFFSET Nam Cao
2024-05-27 12:37 ` Alexandre Ghiti
2024-05-10 6:28 ` [PATCH 4/7] riscv: drop the use of XIP_OFFSET in XIP_FIXUP_FLASH_OFFSET Nam Cao
2024-05-27 12:47 ` Alexandre Ghiti
2024-05-10 6:28 ` [PATCH 5/7] riscv: drop the use of XIP_OFFSET in kernel_mapping_va_to_pa() Nam Cao
2024-05-27 12:49 ` Alexandre Ghiti
2024-05-10 6:28 ` [PATCH 6/7] riscv: drop the use of XIP_OFFSET in create_kernel_page_table() Nam Cao
2024-05-27 12:53 ` Alexandre Ghiti
2024-05-10 6:28 ` [PATCH 7/7] riscv: remove limit on the size of read-only section for XIP kernel Nam Cao
2024-05-27 12:58 ` Alexandre Ghiti
2024-06-02 7:32 ` Nam Cao [this message]
2024-06-07 19:17 ` Nam Cao
2024-05-12 15:47 ` [PATCH 0/7] remove size limit on " Alexandre Ghiti
2024-05-13 8:19 ` Nam Cao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240602073210.w0CKrGlj@linutronix.de \
--to=namcao@linutronix.de \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=lkp@intel.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®