From: Tim Deegan Subject: Re: [PATCH 2/3] iommu: exports set_entry Date: Thu, 18 Nov 2010 11:54:14 +0000 Message-ID: <20101118115414.GH21112@whitby.uk.xensource.com> References: <20101115180015.GC10475@spongy.cam.xci-test.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Return-path: Content-Disposition: inline In-Reply-To: <20101115180015.GC10475@spongy.cam.xci-test.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jean Guyader Cc: "xen-devel@lists.xensource.com" , "Kay, Allen M" List-Id: xen-devel@lists.xenproject.org At 18:00 +0000 on 15 Nov (1289844015), Jean Guyader wrote: > diff -r 93ae9939b4a5 xen/drivers/passthrough/iommu.c > --- a/xen/drivers/passthrough/iommu.c Mon Nov 15 11:52:14 2010 +0000 > +++ b/xen/drivers/passthrough/iommu.c Mon Nov 15 11:53:59 2010 +0000 > @@ -418,6 +418,23 @@ > ops->suspend(); > } > > +int iommu_set_entry(struct domain *d, unsigned long gfn, unsigned long mfn, > + unsigned int flags, int map) > +{ > + const struct iommu_ops *ops = iommu_get_ops(); > + if ( iommu_enabled ) > + return ops->set_entry(d, gfn, mfn, flags, map); Needs a check that set_entry() isn't NULL or it'll crash on AMD IOMMUs. > + return -1; > +} > + > +int iommu_flush_iotlb(struct domain *d, unsigned long gfn, unsigned int nr) > +{ > + const struct iommu_ops *ops = iommu_get_ops(); > + if ( iommu_enabled ) > + return ops->flush_iotlb(d, gfn, nr); Likewise. > + return -1; > +} > + > /* > * Local variables: > * mode: C > diff -r 93ae9939b4a5 xen/drivers/passthrough/vtd/iommu.c > --- a/xen/drivers/passthrough/vtd/iommu.c Mon Nov 15 11:52:14 2010 +0000 > +++ b/xen/drivers/passthrough/vtd/iommu.c Mon Nov 15 11:53:59 2010 +0000 > @@ -2197,6 +2197,8 @@ > .read_msi_from_ire = msi_msg_read_remap_rte, > .suspend = vtd_suspend, > .resume = vtd_resume, > + .set_entry = intel_iommu_set_entry, > + .flush_iotlb = intel_iommu_flush_iotlb > }; > > /* > diff -r 93ae9939b4a5 xen/include/xen/iommu.h > --- a/xen/include/xen/iommu.h Mon Nov 15 11:52:14 2010 +0000 > +++ b/xen/include/xen/iommu.h Mon Nov 15 11:53:59 2010 +0000 > @@ -84,6 +84,10 @@ > unsigned int flags); > int iommu_unmap_page(struct domain *d, unsigned long gfn); > > +int iommu_set_entry(struct domain *d, unsigned long gfn, unsigned long mfn, > + unsigned int flags, int map); > +int iommu_flush_iotlb(struct domain *d, unsigned long gfn, unsigned int nr); > + > void iommu_domain_teardown(struct domain *d); > int hvm_do_IRQ_dpci(struct domain *d, unsigned int irq); > int dpci_ioport_intercept(ioreq_t *p); > @@ -130,6 +134,9 @@ > unsigned int (*read_apic_from_ire)(unsigned int apic, unsigned int reg); > void (*suspend)(void); > void (*resume)(void); > + int (*set_entry)(struct domain *d, unsigned long gfn, unsigned long mfn, > + unsigned int flags, int map); > + int (*flush_iotlb)(struct domain *d, unsigned long gfn, unsigned int nr); > }; > > void iommu_update_ire_from_apic(unsigned int apic, unsigned int reg, unsigned int value); > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel -- Tim Deegan Principal Software Engineer, Xen Platform Team Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)