domain_context_clear_one() only handles the context entry teardown in
legacy mode. Remove the scalable mode check in it to avoid dead code.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
---
drivers/iommu/intel/iommu.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index d682eb6ad4d2..50eb9aed47cc 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2175,9 +2175,6 @@ static void domain_context_clear_one(struct device_domain_info *info, u8 bus, u8
struct context_entry *context;
u16 did_old;
- if (!iommu)
- return;
-
spin_lock(&iommu->lock);
context = iommu_context_addr(iommu, bus, devfn, 0);
if (!context) {
@@ -2185,14 +2182,7 @@ static void domain_context_clear_one(struct device_domain_info *info, u8 bus, u8
return;
}
- if (sm_supported(iommu)) {
- if (hw_pass_through && domain_type_is_si(info->domain))
- did_old = FLPT_DEFAULT_DID;
- else
- did_old = domain_id_iommu(info->domain, iommu);
- } else {
- did_old = context_domain_id(context);
- }
+ did_old = context_domain_id(context);
context_clear_entry(context);
__iommu_flush_cache(iommu, context, sizeof(*context));
@@ -2203,9 +2193,6 @@ static void domain_context_clear_one(struct device_domain_info *info, u8 bus, u8
DMA_CCMD_MASK_NOBIT,
DMA_CCMD_DEVICE_INVL);
- if (sm_supported(iommu))
- qi_flush_pasid_cache(iommu, did_old, QI_PC_ALL_PASIDS, 0);
-
iommu->flush.flush_iotlb(iommu,
did_old,
0,
--
2.34.1
> From: Lu Baolu <baolu.lu@linux.intel.com> > Sent: Thursday, February 29, 2024 5:48 PM > > @@ -2175,9 +2175,6 @@ static void domain_context_clear_one(struct > device_domain_info *info, u8 bus, u8 > struct context_entry *context; > u16 did_old; > > - if (!iommu) > - return; > - is this check only relevant to sm mode or should it be removed for both legacy/sm? If the latter please add a note in the commit msg. otherwise, Reviewed-by: Kevin Tian <kevin.tian@intel.com>
On 2024/3/4 15:53, Tian, Kevin wrote: >> From: Lu Baolu<baolu.lu@linux.intel.com> >> Sent: Thursday, February 29, 2024 5:48 PM >> >> @@ -2175,9 +2175,6 @@ static void domain_context_clear_one(struct >> device_domain_info *info, u8 bus, u8 >> struct context_entry *context; >> u16 did_old; >> >> - if (!iommu) >> - return; >> - > is this check only relevant to sm mode or should it be removed for > both legacy/sm? If the latter please add a note in the commit msg. This kind of check makes no sense. I didn't take it to sm mode. So only need to remove it in the legacy path. Anyway, let me update the commit message to reflect this change. Best regards, baolu
© 2016 - 2026 Red Hat, Inc.