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

Re: [Xen-devel] [PATCH v3 2/3] xen: introduce arch_grant_(un)map_page_identity



On Thu, 24 Jul 2014, Julien Grall wrote:
> Hi Stefano,
> 
> On 07/24/2014 02:31 PM, Stefano Stabellini wrote:
> > Introduce two arch specific functions to create a new p2m mapping of
> > granted pages at pfn == mfn.
> > The x86 implementation just returns ENOSYS.
> > 
> > Base the implementation of arm_smmu_(un)map_page on
> > arch_grant_(un)map_page_identity.
> > 
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> > 
> > ---
> > Changes in v3:
> > - fix commit title;
> > - use p2m_iommu types;
> > - call arch_grant_(un)map_page_identity functions from
> > arm_smmu_(un)map_page.
> > ---
> >  xen/arch/arm/p2m.c                 |   22 ++++++++++++++++++++++
> >  xen/drivers/passthrough/arm/smmu.c |   13 ++-----------
> >  xen/include/asm-arm/p2m.h          |    4 ++++
> >  xen/include/asm-x86/p2m.h          |   13 +++++++++++++
> >  4 files changed, 41 insertions(+), 11 deletions(-)
> > 
> > diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
> > index 9960e17..6024b03 100644
> > --- a/xen/arch/arm/p2m.c
> > +++ b/xen/arch/arm/p2m.c
> > @@ -555,6 +555,28 @@ void guest_physmap_remove_page(struct domain *d,
> >                        pfn_to_paddr(mfn), MATTR_MEM, p2m_invalid);
> >  }
> >  
> > +int arch_grant_map_page_identity(struct domain *d, unsigned long frame,
> > +                                 bool_t writeable)
> > +{
> > +    p2m_type_t t;
> 
> NIT: I would add an ASSERT(!is_domain_direct_mapped(d)) for sanity check.
>

you mean ASSERT(is_domain_direct_mapped(d))

> > +
> > +    /* This is not an IOMMU mapping but it is not a regular RAM p2m type
> > +     * either. We are using IOMMU p2m types here to prevent the pages
> > +     * from being used as grants. */
> > +    if ( writeable )
> > +        t = p2m_iommu_map_rw;
> > +    else
> > +        t = p2m_iommu_map_ro;
> > +
> > +    return guest_physmap_add_entry(d, frame, frame, 0, t);
> > +}
> > +
> > +int arch_grant_unmap_page_identity(struct domain *d, unsigned long frame)
> > +{
> 
> Same here.
> 
> > +    guest_physmap_remove_page(d, frame, frame, 0);
> > +    return 0;
> > +}
> > +
> 
> In any case:
> 
> Acked-by: Julien Grall <julien.grall@xxxxxxxxxx>

thanks


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