Linux-RISC-V Archive mirror
 help / color / mirror / Atom feed
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
Subject: Re: [PATCH 0/7] remove size limit on XIP kernel
Date: Mon, 13 May 2024 10:19:45 +0200	[thread overview]
Message-ID: <20240513081941.A_sou6Zn@linutronix.de> (raw)
In-Reply-To: <46c70799-87b1-4478-95bb-4d4c90519f5b@ghiti.fr>

On Sun, May 12, 2024 at 05:47:24PM +0200, Alexandre Ghiti wrote:
> XIP kernels are intended for use with flash devices so the XIP_OFFSET
> restriction actually represents the size of the flash device: IIRC this 32MB
> was chosen because it would fit "most devices". I think it would be good to
> come up with a mechanism that allows to restrict the size at build time: a
> config? XIP kernels are custom kernels so the user could enter its flash
> size so that if kernel ends up being too large, it fails. And by default, we
> could a very large size to avoid kernel test robot build failures.

I'm not sure if it is beneficial to do that. Users' flash tool would
complain about the kernel not fitting in flash anyway. I think this would
only make it (a bit more) complicated to build the kernel.

Furthermore XIP_OFFSET at the moment is not the flash size, it is size of
.text (and some other read-only sections). Kernel's data sections are in
flash too, which is copied to RAM during boot.

With the current linker setting, the first 32MB of virtual memory is
occupied by .text. Then at 32MB offset, .data section starts. So if
XIP_OFFSET limit is exceeded, the kernel's size is already way more than
32MB.

Instead, this series moves .data and .text right next to each other (well,
almost, because we need PMD_SIZE alignment). So that if .text size exceed
32MB, the offset that .data resides would increase as well.

If we really want to set flash size during build time (which, again, I
doubt the benefit of), this series would still be relevant: it is not just
removing the size limit, it is also removing the fixed position of the
.data section in virtual address space (in other words, removing the
useless "hole" between .text section and .data section).

Best regards,
Nam


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

      reply	other threads:[~2024-05-13  8:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10  6:28 [PATCH 0/7] remove size limit on XIP kernel 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-05-12 15:47 ` [PATCH 0/7] remove size limit on " Alexandre Ghiti
2024-05-13  8:19   ` Nam Cao [this message]

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=20240513081941.A_sou6Zn@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=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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).