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

Arnd Bergmann arnd at arndb.de
Thu Aug 18 05:03:52 PDT 2022


On Thu, Aug 18, 2022 at 10:39 AM Matija Glavinic Pecotic
<matija.glavinic-pecotic.ext at nokia.com> wrote:
> +
> +#ifdef CONFIG_ARM
> +       /*
> +        * If initrd is not on valid physical address, reason could
> +        * be due to bootloader passing address from bootalias region.
> +        * Try to sanitize such address for platforms supporting boot
> +        * aliases.
> +        */
> +       if (!pfn_valid(__phys_to_pfn(phys_initrd_start))) {
> +               pr_info("initrd at invalid address, trying to use boot alias\n");
> +               if (arm_has_idmap_alias())
> +                       phys_initrd_start = idmap_to_phys(phys_initrd_start);
> +       }
> +#endif

Hi Matija,

I think the logic looks correct, but I' would not put this into init/initramfs.c
when the problem is specific to Arm. The function is called from
arch/arm/mm/init.c, so you could just put it there.

I'm fairly sure that only keystone2 is affected by this, so it might
even be possible to do this inside of keystone specific code,
e.g. in keystone_pv_fixup(), which is called a little earlier.

        Arnd



More information about the linux-arm-kernel mailing list