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

Re: [Xen-devel] [PATCH 3/7] xen/arm: Reserve FDT via early module mechanism



On Thu, 2013-09-12 at 14:39 +0100, Julien Grall wrote:
> On 09/12/2013 01:42 PM, Ian Campbell wrote:
> > This will stop us putting any heaps or relocating Xen itself over the FDT.
> > 
> > The devicetree will be copied to allocated memory in setup_mm and the 
> > original
> > copy will be freed by discard_initial_modules.
> > 
> > Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> > ---
> >  xen/arch/arm/setup.c          |    3 ++-
> >  xen/common/device_tree.c      |    9 ++++++++-
> >  xen/include/xen/device_tree.h |   11 ++++++-----
> >  3 files changed, 16 insertions(+), 7 deletions(-)
> > 
> > diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> > index 1ba2eb3..ab3d9aa 100644
> > --- a/xen/arch/arm/setup.c
> > +++ b/xen/arch/arm/setup.c
> > @@ -510,9 +510,10 @@ void __init start_xen(unsigned long boot_phys_offset,
> >  
> >      smp_clear_cpu_maps();
> >  
> > +    /* This is mapped by head.S */
> >      device_tree_flattened = (void *)BOOT_MISC_VIRT_START
> >          + (fdt_paddr & ((1 << SECOND_SHIFT) - 1));
> > -    fdt_size = device_tree_early_init(device_tree_flattened);
> > +    fdt_size = device_tree_early_init(device_tree_flattened, fdt_paddr);
> >  
> >      cpus = smp_get_max_cpus();
> >      cmdline_parse(device_tree_bootargs(device_tree_flattened));
> > diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> > index c4f0f2c..9e0c224 100644
> > --- a/xen/common/device_tree.c
> > +++ b/xen/common/device_tree.c
> > @@ -510,14 +510,21 @@ static void __init early_print_info(void)
> >   *
> >   * Returns the size of the DTB.
> >   */
> > -size_t __init device_tree_early_init(const void *fdt)
> > +size_t __init device_tree_early_init(const void *fdt, paddr_t paddr)
> >  {
> > +    struct dt_mb_module *mod;
> >      int ret;
> >  
> >      ret = fdt_check_header(fdt);
> >      if ( ret < 0 )
> >          early_panic("No valid device tree\n");
> >  
> > +    mod = &early_info.modules.module[MOD_FDT];
> > +    mod->start = paddr & PAGE_MASK;
> > +    mod->size = (fdt_totalsize(fdt) + ~PAGE_MASK) & PAGE_MASK;
> 
> I'm not sure, s/~PAGE_MASK/PAGE_SIZE ?

~PAGE_MASK == 0xfff while PAGE_SIZE == 0x1000. PAGE_SIZE - 1 maybe, but
what's there works, unless I've gotten myself confused somewhere.

Ian.


_______________________________________________
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®.