[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] 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.durrant@xxxxxxxxxx> > --- > Cc: Jan Beulich <jbeulich@xxxxxxxx> > Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> > Cc: George Dunlap <George.Dunlap@xxxxxxxxxxxxx> > Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> > Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> > Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx> > Cc: Tim Deegan <tim@xxxxxxx> > Cc: Wei Liu <wei.liu2@xxxxxxxxxx> > --- > 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, ®ion, > + 1) ) > + return -EFAULT; RMRR entries are device specific. it's why a 'id' (i.e. sbdf) field is introduced for such check. > + } > + > + 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? Thanks Kevin _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |