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

Re: [PATCH v3 1/3] xen/riscv: introduce setup_initial_pages



Hi Julien,

On Wed, 2023-03-29 at 14:06 +0200, Jan Beulich wrote:
> > > > +void __init setup_initial_pagetables(void)
> > > > +{
> > > > +    struct mmu_desc mmu_desc = { 0, 0, NULL, 0 };
> > > > +
> > > > +    /*
> > > > +     * Access to _{stard, end } is always PC-relative
> > > > +     * thereby when access them we will get load adresses
> > > > +     * of start and end of Xen
> > > > +     * To get linker addresses LOAD_TO_LINK() is required
> > > > +     * to use
> > > > +     */
> > > > +    unsigned long load_start    = (unsigned long)_start;
> > > > +    unsigned long load_end      = (unsigned long)_end;
> > > > +    unsigned long linker_start  = LOAD_TO_LINK(load_start);
> > > > +    unsigned long linker_end    = LOAD_TO_LINK(load_end);
> > > > +
> > > > +    if ( (linker_start != load_start) &&
> > > > +         (linker_start <= load_end) && (load_start <=
> > > > linker_end)
> > > > ) {
> > > > +        early_printk("(XEN) linker and load address ranges
> > > > overlap\n");
> > > > +        die();
> > > > +    }
> > > > +
> > > > +    calc_pgtbl_lvls_num(&mmu_desc);
> > > > +
> > > > +    mmu_desc.pgtbl_base = stage1_pgtbl_root;
> > > > +    mmu_desc.next_pgtbl = stage1_pgtbl_nonroot;
> > > > +
> > > > +    setup_initial_mapping(&mmu_desc,
> > > > +                          linker_start,
> > > > +                          linker_end,
> > > > +                          load_start,
> > > > +                          PTE_LEAF_DEFAULT);
> > > > +
> > > > +    setup_ptes_permission(&mmu_desc);
> > > 
> > > ...: Why does this require a 2nd pass / function in the first
> > > place?
> > Probably I misunderstood Julien and it setup_pte_permission can be
> > done
> > in setup_initial_mapping() but here is the reply:
> > https://lore.kernel.org/xen-devel/79e83610-5980-d9b5-7994-6b0cb2b9049a@xxxxxxx/
> 
> Hmm, yes, his option 2 looks like what you've implemented. Still I
> don't see why the permissions can't be got right on the first pass.
I would like to ask you again about separation of mapping Xen and
setting permission for specific sections.

I am not using setup_initial_mapping to change permission flags as it
was before so do we still need to do two passes? Can't we set
permission during the first pass?

It looks like there is a sense in merging setup_initial_mapping() and
setup_ptes_permission().

Probably I misunderstood your opinion from the link above.

~ Oleksii



 


Rackspace

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