On Tue, 8 Nov 2022 at 13:54, Peter Maydell <peter.mayd...@linaro.org> wrote: > > On Tue, 8 Nov 2022 at 12:52, Schspa Shi <sch...@gmail.com> wrote: > > Alex Bennée <alex.ben...@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. -- PMM