Thread (29 messages) 29 messages, 5 authors, 2021-06-16

Re: [PATCH v19 05/13] of: Add a common kexec FDT setup function

From: Rob Herring <robh@kernel.org>
Date: 2021-06-15 16:35:15
Also in: linux-arm-kernel, linux-devicetree, linux-integrity, lkml

On Tue, Jun 15, 2021 at 10:13 AM nramas [off-list ref] wrote:
On Tue, 2021-06-15 at 08:01 -0600, Rob Herring wrote:
quoted
On Tue, Jun 15, 2021 at 6:18 AM Geert Uytterhoeven <
geert@linux-m68k.org> wrote:
quoted
quoted
+void *of_kexec_alloc_and_setup_fdt(const struct kimage *image,
+                                  unsigned long
initrd_load_addr,
+                                  unsigned long initrd_len,
+                                  const char *cmdline, size_t
extra_fdt_size)
+{
+       /* Did we boot using an initrd? */
+       prop = fdt_getprop(fdt, chosen_node, "linux,initrd-
start", NULL);
+       if (prop) {
+               u64 tmp_start, tmp_end, tmp_size;
+
+               tmp_start = fdt64_to_cpu(*((const fdt64_t *)
prop));
+
+               prop = fdt_getprop(fdt, chosen_node,
"linux,initrd-end", NULL);
+               if (!prop) {
+                       ret = -EINVAL;
+                       goto out;
+               }
+
+               tmp_end = fdt64_to_cpu(*((const fdt64_t *)
prop));
Some kernel code assumes "linux,initrd-{start,end}" are 64-bit,
other code assumes 32-bit.
It can be either. The above code was a merge of arm64 and powerpc
both
of which use 64-bit and still only runs on those arches. It looks
like
some powerpc platforms may use 32-bit, but this would have been
broken
before.
of_kexec_alloc_and_setup_fdt() is called from elf_64.c (in
arch/powerpc/kexec) which is for 64-bit powerpc platform only.
64-bit PPC could be writing 32-bit property values. The architecture
size doesn't necessarily matter. And if the values came from the
bootloader, who knows what size it used.

This code is 32-bit powerpc only?:

arch/powerpc/boot/main.c-       /* Tell the kernel initrd address via
device tree */
arch/powerpc/boot/main.c:       setprop_val(chosen,
"linux,initrd-start", (u32)(initrd_addr));
arch/powerpc/boot/main.c-       setprop_val(chosen,
"linux,initrd-end", (u32)(initrd_addr+initrd_size));

Rob
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help