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

Re: [Xen-devel] [PATCH RFC 22/35] xen/arm: Create chosen node for DOM0



On Fri, 6 Feb 2015, Julien Grall wrote:
> Hi Stefano,
> 
> On 06/02/2015 00:09, Stefano Stabellini wrote:
> > On Wed, 4 Feb 2015, parth.dixit@xxxxxxxxxx wrote:
> > > From: Naresh Bhat <naresh.bhat@xxxxxxxxxx>
> > > 
> > > Create a chosen node for DOM0 with
> > >   - bootargs
> > >   - rsdp
> > > 
> > > Signed-off-by: Naresh Bhat <naresh.bhat@xxxxxxxxxx>
> > > Signed-off-by: Parth Dixit <parth.dixit@xxxxxxxxxx>
> > > ---
> > >   xen/arch/arm/domain_build.c | 41
> > > +++++++++++++++++++++++++++++++++++++++++
> > >   1 file changed, 41 insertions(+)
> > > 
> > > diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> > > index 30bebe5..d781c63 100644
> > > --- a/xen/arch/arm/domain_build.c
> > > +++ b/xen/arch/arm/domain_build.c
> > > @@ -19,6 +19,7 @@
> > >   #include <asm/setup.h>
> > >   #include <asm/cpufeature.h>
> > >   #include <asm/acpi.h>
> > > +#include <xen/acpi.h>
> > > 
> > >   #include <asm/gic.h>
> > >   #include <xen/irq.h>
> > > @@ -1199,6 +1200,41 @@ static int make_memory_node_acpi(const struct
> > > domain *d,
> > >       return res;
> > >   }
> > > 
> > > +static int make_chosen_node(const struct domain *d, const struct
> > > kernel_info *kinfo)
> > > +{
> > > +   int res = 0;
> > > +   const char *bootargs = NULL;
> > > +   const struct bootmodule *mod = kinfo->kernel_bootmodule;
> > > +   u64 a = acpi_os_get_root_pointer();
> > > +   void *fdt = kinfo->fdt;
> > > +   __be32 val[2];
> > > +   __be32 *cellp;
> > > +
> > > +   DPRINT("Create bootargs chosen node\n");
> > > +
> > > +   if ( mod && mod->cmdline[0] )
> > > +        bootargs = &mod->cmdline[0];
> > > +
> > > +   res = fdt_begin_node(fdt, "chosen");
> > > +   if ( res )
> > > +       return res;
> > > +
> > > +   res = fdt_property(fdt, "bootargs", bootargs, (strlen(bootargs)+1));
> > > +   if ( res )
> > > +      return res;
> > > +
> > > +   cellp = (__be32 *)val;
> > > +   dt_set_cell(&cellp, ARRAY_SIZE(val), a);
> > > +
> > > +   res = fdt_property(fdt, "rsdp", &val, sizeof(val));
> > > +   if ( res )
> > > +       return res;
> > > +
> > > +    res = fdt_end_node(fdt);
> > > +
> > > +    return res;
> > > +}
> > 
> > This is similar to setup_chosen_node in xen/arch/arm/efi/efi-boot.h.
> > It might make sense to refactor the code to avoid code duplication.
> 
> I don't think it make sense to have a common function between efi-boot.h
> (which create the DT for Xen) and here (which create the DT for DOM0).
> 
> The former one is adding a node into an existing device tree while the former
> creating the device tree. Futhermore, the rsdp property doesn't exist on EFI
> boot.
 
I meant to share just the very basic creation of a chosen node, but you
are right, it might not be worth it.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.