> -----Original Message-----
> From: Tian, Kevin [mailto:kevin.t...@intel.com]
> Sent: 13 February 2018 06:52
> To: Paul Durrant <paul.durr...@citrix.com>; xen-devel@lists.xenproject.org
> Cc: Stefano Stabellini <sstabell...@kernel.org>; Wei Liu
> <wei.l...@citrix.com>; George Dunlap <george.dun...@citrix.com>;
> Andrew Cooper <andrew.coop...@citrix.com>; Ian Jackson
> <ian.jack...@citrix.com>; Tim (Xen.org) <t...@xen.org>; Jan Beulich
> <jbeul...@suse.com>
> Subject: RE: [Xen-devel] [PATCH 6/7] x86: add iommu_op to query reserved
> ranges
> 
> > From: Paul Durrant
> > Sent: Monday, February 12, 2018 6:47 PM
> >
> > Certain areas of memory, such as RMRRs, must be mapped 1:1
> > (i.e. BFN == MFN) through the IOMMU.
> >
> > This patch adds an iommu_op to allow these ranges to be queried.
> >
> > Signed-off-by: Paul Durrant <paul.durr...@citrix.com>
> > ---
> > Cc: Jan Beulich <jbeul...@suse.com>
> > Cc: Andrew Cooper <andrew.coop...@citrix.com>
> > Cc: George Dunlap <george.dun...@eu.citrix.com>
> > Cc: Ian Jackson <ian.jack...@eu.citrix.com>
> > Cc: Konrad Rzeszutek Wilk <konrad.w...@oracle.com>
> > Cc: Stefano Stabellini <sstabell...@kernel.org>
> > Cc: Tim Deegan <t...@xen.org>
> > Cc: Wei Liu <wei.l...@citrix.com>
> > ---
> >  xen/arch/x86/iommu_op.c       | 121
> > ++++++++++++++++++++++++++++++++++++++++++
> >  xen/include/public/iommu_op.h |  35 ++++++++++++
> >  xen/include/xlat.lst          |   2 +
> >  3 files changed, 158 insertions(+)
> >
> > diff --git a/xen/arch/x86/iommu_op.c b/xen/arch/x86/iommu_op.c
> > index edd8a384b3..ac81b98b7a 100644
> > --- a/xen/arch/x86/iommu_op.c
> > +++ b/xen/arch/x86/iommu_op.c
> > @@ -22,6 +22,58 @@
> >  #include <xen/event.h>
> >  #include <xen/guest_access.h>
> >  #include <xen/hypercall.h>
> > +#include <xen/iommu.h>
> > +
> > +struct get_rdm_ctxt {
> > +    unsigned int max_entries;
> > +    unsigned int nr_entries;
> > +    XEN_GUEST_HANDLE(xen_iommu_reserved_region_t) regions;
> > +};
> > +
> > +static int get_rdm(xen_pfn_t start, xen_ulong_t nr, u32 id, void *arg)
> > +{
> > +    struct get_rdm_ctxt *ctxt = arg;
> > +
> > +    if ( ctxt->nr_entries < ctxt->max_entries )
> > +    {
> > +        xen_iommu_reserved_region_t region = {
> > +            .start_bfn = start,
> > +            .nr_frames = nr,
> > +        };
> > +
> > +        if ( copy_to_guest_offset(ctxt->regions, ctxt->nr_entries, &region,
> > +                                  1) )
> > +            return -EFAULT;
> 
> RMRR entries are device specific. it's why a 'id' (i.e. sbdf) field
> is introduced for such check.

What I want here is the union of all RMRRs for all devices in the domain. I 
believe that is what the code will currently query, but I could be wrong.

> 
> > +    }
> > +
> > +    ctxt->nr_entries++;
> > +
> > +    return 1;
> > +}
> > +
> > +static int iommuop_query_reserved(struct
> > xen_iommu_op_query_reserved *op)
> 
> I didn't get why we cannot reuse existing XENMEM_reserved_
> device_memory_map?
> 

This hypercall is not intended to be tools-only. That one is, unless I misread 
the #ifdefs.

  Paul

> Thanks
> Kevin
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to