Message ID | 20200724164619.1245-4-paul@xen.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | IOMMU cleanup | expand |
On 24/07/2020 17:46, Paul Durrant wrote: > From: Paul Durrant <pdurrant@amazon.com> > > ... from iommu_ops. > > This patch is essentially a reversion of dd93d54f "vtd: add lookup_page method > to iommu_ops". The code was intended to be used by a patch that has long- > since been abandoned. Therefore it is dead code and can be removed. And by this, you mean the work that you only partial unstreamed, with the remainder of the feature still very much in use by XenServer? Please don't go breaking in-use things, simply because we're fixing Xen's IOMMU mess once large XSA at a time... As far as I can tell, this patch doesn't interact with any others in the series. ~Andrew
> -----Original Message----- > From: Andrew Cooper <andrew.cooper3@citrix.com> > Sent: 24 July 2020 19:39 > To: Paul Durrant <paul@xen.org>; xen-devel@lists.xenproject.org > Cc: Paul Durrant <pdurrant@amazon.com>; Kevin Tian <kevin.tian@intel.com>; Jan Beulich > <jbeulich@suse.com> > Subject: Re: [PATCH 3/6] iommu: remove iommu_lookup_page() and the lookup_page() method... > > On 24/07/2020 17:46, Paul Durrant wrote: > > From: Paul Durrant <pdurrant@amazon.com> > > > > ... from iommu_ops. > > > > This patch is essentially a reversion of dd93d54f "vtd: add lookup_page method > > to iommu_ops". The code was intended to be used by a patch that has long- > > since been abandoned. Therefore it is dead code and can be removed. > > And by this, you mean the work that you only partial unstreamed, with > the remainder of the feature still very much in use by XenServer? > I thought we basically decided to bin the original PV IOMMU idea though? > Please don't go breaking in-use things, simply because we're fixing > Xen's IOMMU mess once large XSA at a time... > > As far as I can tell, this patch doesn't interact with any others in the > series. > I can leave it, but I still don't think anything other than current XenServer will ever use it... so it really ought to just be in the downstream patch queue IMO. Paul > ~Andrew
On 24.07.2020 20:53, Paul Durrant wrote: >> From: Andrew Cooper <andrew.cooper3@citrix.com> >> Sent: 24 July 2020 19:39 >> >> On 24/07/2020 17:46, Paul Durrant wrote: >>> From: Paul Durrant <pdurrant@amazon.com> >>> >>> ... from iommu_ops. >>> >>> This patch is essentially a reversion of dd93d54f "vtd: add lookup_page method >>> to iommu_ops". The code was intended to be used by a patch that has long- >>> since been abandoned. Therefore it is dead code and can be removed. >> >> And by this, you mean the work that you only partial unstreamed, with >> the remainder of the feature still very much in use by XenServer? >> > > I thought we basically decided to bin the original PV IOMMU idea though? Did we? It's the first time I hear of it, I think. Jan
> -----Original Message----- > From: Jan Beulich <jbeulich@suse.com> > Sent: 26 July 2020 09:28 > To: paul@xen.org > Cc: 'Andrew Cooper' <andrew.cooper3@citrix.com>; xen-devel@lists.xenproject.org; Durrant, Paul > <pdurrant@amazon.co.uk>; 'Kevin Tian' <kevin.tian@intel.com> > Subject: RE: [EXTERNAL] [PATCH 3/6] iommu: remove iommu_lookup_page() and the lookup_page() method... > > CAUTION: This email originated from outside of the organization. Do not click links or open > attachments unless you can confirm the sender and know the content is safe. > > > > On 24.07.2020 20:53, Paul Durrant wrote: > >> From: Andrew Cooper <andrew.cooper3@citrix.com> > >> Sent: 24 July 2020 19:39 > >> > >> On 24/07/2020 17:46, Paul Durrant wrote: > >>> From: Paul Durrant <pdurrant@amazon.com> > >>> > >>> ... from iommu_ops. > >>> > >>> This patch is essentially a reversion of dd93d54f "vtd: add lookup_page method > >>> to iommu_ops". The code was intended to be used by a patch that has long- > >>> since been abandoned. Therefore it is dead code and can be removed. > >> > >> And by this, you mean the work that you only partial unstreamed, with > >> the remainder of the feature still very much in use by XenServer? > >> > > > > I thought we basically decided to bin the original PV IOMMU idea though? > > Did we? It's the first time I hear of it, I think. > I circulated a doc. ages ago, while I was still at Citrix: https://docs.google.com/document/d/12-z6JD41J_oNrCg_c0yAxGWg5ADBQ8_bSiP_NH6Hqwo/edit?usp=sharing In there I propose that we don't follow the original idea of keeping a single set of per-domain tables but instead have a set of tables (or IOMMU contexts) for groups of devices. 'Context 0' is the current set of static 1:1 tables but other contexts are manipulated by hypercall so, in this plan, I don't envisage the need to look up mappings in the tables in this way... but I guess I can't rule it out. Paul
diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index dad4088531..327df17c5d 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -350,17 +350,6 @@ int iommu_legacy_unmap(struct domain *d, dfn_t dfn, unsigned int page_order) return rc; } -int iommu_lookup_page(struct domain *d, dfn_t dfn, mfn_t *mfn, - unsigned int *flags) -{ - const struct domain_iommu *hd = dom_iommu(d); - - if ( !is_iommu_enabled(d) || !hd->platform_ops->lookup_page ) - return -EOPNOTSUPP; - - return iommu_call(hd->platform_ops, lookup_page, d, dfn, mfn, flags); -} - int iommu_iotlb_flush(struct domain *d, dfn_t dfn, unsigned int page_count, unsigned int flush_flags) { diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 40834e2e7a..149d7122c3 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1808,46 +1808,6 @@ static int __must_check intel_iommu_unmap_page(struct domain *d, dfn_t dfn, return 0; } -static int intel_iommu_lookup_page(struct domain *d, dfn_t dfn, mfn_t *mfn, - unsigned int *flags) -{ - struct domain_iommu *hd = dom_iommu(d); - struct dma_pte *page, val; - u64 pg_maddr; - - /* - * If VT-d shares EPT page table or if the domain is the hardware - * domain and iommu_passthrough is set then pass back the dfn. - */ - if ( iommu_use_hap_pt(d) || - (iommu_hwdom_passthrough && is_hardware_domain(d)) ) - return -EOPNOTSUPP; - - spin_lock(&hd->arch.mapping_lock); - - pg_maddr = addr_to_dma_page_maddr(d, dfn_to_daddr(dfn), 0); - if ( !pg_maddr ) - { - spin_unlock(&hd->arch.mapping_lock); - return -ENOENT; - } - - page = map_vtd_domain_page(pg_maddr); - val = page[dfn_x(dfn) & LEVEL_MASK]; - - unmap_vtd_domain_page(page); - spin_unlock(&hd->arch.mapping_lock); - - if ( !dma_pte_present(val) ) - return -ENOENT; - - *mfn = maddr_to_mfn(dma_pte_addr(val)); - *flags = dma_pte_read(val) ? IOMMUF_readable : 0; - *flags |= dma_pte_write(val) ? IOMMUF_writable : 0; - - return 0; -} - static int __init vtd_ept_page_compatible(struct vtd_iommu *iommu) { u64 ept_cap, vtd_cap = iommu->cap; @@ -2710,7 +2670,6 @@ static struct iommu_ops __initdata vtd_ops = { .teardown = iommu_domain_teardown, .map_page = intel_iommu_map_page, .unmap_page = intel_iommu_unmap_page, - .lookup_page = intel_iommu_lookup_page, .reassign_device = reassign_device_ownership, .get_device_group_id = intel_iommu_group_id, .enable_x2apic = intel_iommu_enable_eim, diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index 51c29180a4..271bd8e546 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -158,9 +158,6 @@ int __must_check iommu_legacy_map(struct domain *d, dfn_t dfn, mfn_t mfn, int __must_check iommu_legacy_unmap(struct domain *d, dfn_t dfn, unsigned int page_order); -int __must_check iommu_lookup_page(struct domain *d, dfn_t dfn, mfn_t *mfn, - unsigned int *flags); - int __must_check iommu_iotlb_flush(struct domain *d, dfn_t dfn, unsigned int page_count, unsigned int flush_flags); @@ -260,8 +257,6 @@ struct iommu_ops { unsigned int *flush_flags); int __must_check (*unmap_page)(struct domain *d, dfn_t dfn, unsigned int *flush_flags); - int __must_check (*lookup_page)(struct domain *d, dfn_t dfn, mfn_t *mfn, - unsigned int *flags); #ifdef CONFIG_X86 int (*enable_x2apic)(void);