All of lore.kernel.org
 help / color / mirror / Atom feed
From: Schspa Shi <schspa@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org
Subject: Re: [PATCH] hw/arm/boot: set initrd parameters to 64bit in fdt
Date: Tue, 08 Nov 2022 23:36:44 +0800	[thread overview]
Message-ID: <875yfpbg38.fsf@gmail.com> (raw)
In-Reply-To: <CAFEAcA8KnNE90tHQjRNEVny=s7YLD5Wmff9R8ZyLxxz47bwRGA@mail.gmail.com>


Peter Maydell <peter.maydell@linaro.org> writes:

> On Tue, 8 Nov 2022 at 13:54, Peter Maydell <peter.maydell@linaro.org> wrote:
>>
>> On Tue, 8 Nov 2022 at 12:52, Schspa Shi <schspa@gmail.com> wrote:
>> > Alex Bennée <alex.bennee@linaro.org> writes:
>> > > There is a whole comment in boot.c talking about keeping initrd within
>> > > lowmem:
>> > >
>> > >     /*
>> > >      * We want to put the initrd far enough into RAM that when the
>> > >      * kernel is uncompressed it will not clobber the initrd. However
>> > >      * on boards without much RAM we must ensure that we still leave
>> > >      * enough room for a decent sized initrd, and on boards with large
>> > >      * amounts of RAM we must avoid the initrd being so far up in RAM
>> > >      * that it is outside lowmem and inaccessible to the kernel.
>> > >      * So for boards with less  than 256MB of RAM we put the initrd
>> > >      * halfway into RAM, and for boards with 256MB of RAM or more we put
>> > >      * the initrd at 128MB.
>> > >      * We also refuse to put the initrd somewhere that will definitely
>> > >      * overlay the kernel we just loaded, though for kernel formats which
>> > >      * don't tell us their exact size (eg self-decompressing 32-bit kernels)
>> > >      * we might still make a bad choice here.
>> > >      */
>> > >
>> >
>> > I think this lowmem does not mean below 4GB. and it is to make sure
>> > the initrd_start > memblock_start_of_DRAM for Linux address range check.
>>
>> The wording of this comment pre-dates 64-bit CPU support: it
>> is talking about the requirement in the 32-bit booting doc
>> https://www.kernel.org/doc/Documentation/arm/Booting
>> that says
>> "If an initramfs is in use then, as with the dtb, it must be placed in
>> a region of memory where the kernel decompressor will not overwrite it
>> while also with the region which will be covered by the kernel's
>> low-memory mapping."
>>
>> So it does mean "below 4GB", because you can't boot a 32-bit kernel
>> if you don't put the kernel, initrd, etc below 4GB.
>
> A kernel person corrects me on the meaning of "lowmem" here -- the
> kernel means by it "within the first 768MB of RAM". There is also
> an implicit requirement that everything be within the bottom 32-bits
> of the physical address space.
>

Thanks for your comment.

In this view, initrd shouldn't be placed higher than 4GB ? But it
seems the Linux kernel can boot when there is no memory below 4GB.

I know that lowmem is needed for SWIOTLB etc. It will be used to make
the 32bit IP work without IOMMU. But it seems it's not required to
boot.

> -- PMM

-- 
BRs
Schspa Shi

  reply	other threads:[~2022-11-08 15:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08  2:35 [PATCH] hw/arm/boot: set initrd parameters to 64bit in fdt Schspa Shi
2022-11-08  9:14 ` Alex Bennée
2022-11-08 12:52   ` Schspa Shi
2022-11-08 13:54     ` Peter Maydell
2022-11-08 14:16       ` Peter Maydell
2022-11-08 15:36         ` Schspa Shi [this message]
2022-11-10 17:19           ` Peter Maydell
2022-11-16  6:07             ` Schspa Shi
2022-11-16 13:14               ` Peter Maydell
2022-11-16 13:52                 ` Schspa Shi
2022-11-22 13:27                 ` Peter Maydell
2022-11-28 19:01 ` Peter Maydell
2022-11-29  7:50   ` Schspa Shi

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=875yfpbg38.fsf@gmail.com \
    --to=schspa@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.