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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2021-06-15 at 08:01 -0600, Rob Herring wrote:
> On Tue, Jun 15, 2021 at 6:18 AM Geert Uytterhoeven <
> geert@xxxxxxxxxxxxxx> wrote:
> > 
> > > +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.

thanks,
 -lakshmi

> 
> The code in drivers/of/fdt.c handles either case. We should probably
> refactor early_init_dt_check_for_initrd() and this function to use a
> common routine.
> 
> > linux/Documentation/arm/uefi.rst says 64-bit,
> > dt-schema/schemas/chosen.yaml says 32-bit.
> 
> We should fix that.
> 
> Rob




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux