[PATCH] arm: Support initrd with address in boot alias region

Matija Glavinic Pecotic matija.glavinic-pecotic.ext at nokia.com
Wed Sep 30 07:07:01 EDT 2020


On 09/30/2020 12:35 PM, Russell King - ARM Linux admin wrote:
> It seems strange to pass the initrd in using an address that is not
> listed as part of the system memory map, especially as the initrd is
> freed during kernel initialisation.
> 
> Which boot loader is this, and is there a reason it operates this way?

It is kexec which populates this address. Kexec is allowed to do that
as this region is listed as boot alias:

$ cat /proc/iomem 
[cut]
c0000000-d4da1fff : System RAM (boot alias)
840000000-854da1fff : System RAM
  840008000-840bfffff : Kernel code
  840e00000-840ee56fb : Kernel data
[cut]
880000000-8ffffffff : System RAM

it is arch/arm/kernel/setup.c which populates this entry on line 870:

/*
 * Some systems have a special memory alias which is only
 * used for booting.  We need to advertise this region to
 * kexec-tools so they know where bootable RAM is located.
 */
boot_alias_start = phys_to_idmap(start);
if (arm_has_idmap_alias() && boot_alias_start != IDMAP_INVALID_ADDR) {
        res = memblock_alloc(sizeof(*res), SMP_CACHE_BYTES);
        if (!res)
                panic("%s: Failed to allocate %zu bytes\n",
                      __func__, sizeof(*res));
        res->name = "System RAM (boot alias)";
        res->start = boot_alias_start;
        res->end = phys_to_idmap(end);
        res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
        request_resource(&iomem_resource, res);
}

This is likely reason why problem has gone unnoticed for so long. I dont
think there is large number of platforms which have boot alias regions +
they use kexec. As noted earlier, bootloader passes correct address, it
is kexec which passes invalid one resulting with:

[    0.000000] INITRD: 0xc49bb000+0x01a1a000 is not a memory region - disabling initrd

and later with failure to mount it.

Regards,

Matija



More information about the linux-arm-kernel mailing list