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.
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Kevin Tian <kevin.tian@intel.com>
---
xen/drivers/passthrough/iommu.c | 11 --------
xen/drivers/passthrough/vtd/iommu.c | 41 -----------------------------
xen/include/xen/iommu.h | 5 ----
3 files changed, 57 deletions(-)
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);
--
2.20.1
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
© 2016 - 2026 Red Hat, Inc.