Re: [PATCH 05/19] LoongArch: Add boot and setup routines

From
Ard Biesheuvel <ardb@kernel.org>
Date
2021-07-27 12:51:58
Reply to
Arnd Bergmann, 2021-07-27
On Tue, 27 Jul 2021 at 14:41, Arnd Bergmann [off-list ref] wrote:
On Tue, Jul 27, 2021 at 1:53 PM Huacai Chen [off-list ref] wrote:
quoted
On Tue, Jul 6, 2021 at 6:16 PM Arnd Bergmann [off-list ref] wrote:
quoted
On Tue, Jul 6, 2021 at 6:18 AM Huacai Chen [off-list ref] wrote:
quoted
+
+#ifdef CONFIG_64BIT
+       /* Guess if the sign extension was forgotten by bootloader */
+       if (start < CAC_BASE)
+               start = (int)start;
+#endif
+       initrd_start = start;
+       initrd_end += start;
+       return 0;
+}
+early_param("rd_start", rd_start_early);
+
+static int __init rd_size_early(char *p)
+{
+       initrd_end += memparse(p, &p);
+       return 0;
+}
+early_param("rd_size", rd_size_early);
The early parameters should not be used for this, I'm fairly sure the UEFI
boot protocol already has ways to communicate all necessary information.
We use grub to boot the Linux kernel. We found X86 uses private data
structures (seems not UEFI-specific) to pass initrd information from
grub to kernel. Some archs use fdt, and other archs use cmdline with
"initrd=start,size" (init/do_mounts_initrd.c). So, I think use cmdline
is not unacceptable, but we do can remove the the rd_start/rd_size
parsing code here
(adding Ard Biesheuvel to Cc for clarification)

As far as I understand it, this should be using the kernel's UEFI stub
as documented in Documentation/admin-guide/efi-stub.rst
That document describes how the EFI stub can load an initrd from the
partition that the kernel image itself was loaded from.

After loading it, the EFI stub still needs to tell the kernel proper
where the initrd lives in memory, and it uses either struct bootparam
(x86) or DT's /chosen node (other arches) for this.

I think we should avoid inventing yet another way of passing this
information, but if the architecture in question does not use DT (and
is != x86), I don't think we have a choice. Does this system boot via
EFI to begin with?

This lets you load the initrd from within the kernel and pass the
address using the architecture specific boot information.

Maybe I misunderstood and you already do it like this?

       Arnd
Thread (110 messages) 110 messages, 12 authors, last reply 2021-08-27
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help