diff options
author | Lu Baolu <baolu.lu@linux.intel.com> | 2021-01-14 16:50:21 +0800 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2021-08-26 08:35:50 -0400 |
commit | 81578e587c089c8aeb25b8b4c501fe1fbdf2b0f5 (patch) | |
tree | 13a3c86c242ad10f5dc7c24553042661597f39ec /drivers/iommu/intel/pasid.c | |
parent | eee84eafc3bb78d575b482abe7aaa281cb6bf84f (diff) | |
download | kernel_replicant_linux-81578e587c089c8aeb25b8b4c501fe1fbdf2b0f5.tar.gz kernel_replicant_linux-81578e587c089c8aeb25b8b4c501fe1fbdf2b0f5.tar.bz2 kernel_replicant_linux-81578e587c089c8aeb25b8b4c501fe1fbdf2b0f5.zip |
iommu/vt-d: Consolidate duplicate cache invaliation code
[ Upstream commit 9872f9bd9dbd68f75e8db782717d71e8594f6a02 ]
The pasid based IOTLB and devTLB invalidation code is duplicate in
several places. Consolidate them by using the common helpers.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20210114085021.717041-1-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/iommu/intel/pasid.c')
-rw-r--r-- | drivers/iommu/intel/pasid.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c index 1e7c17989084..77fbe9908abd 100644 --- a/drivers/iommu/intel/pasid.c +++ b/drivers/iommu/intel/pasid.c @@ -467,20 +467,6 @@ pasid_cache_invalidation_with_pasid(struct intel_iommu *iommu, } static void -iotlb_invalidation_with_pasid(struct intel_iommu *iommu, u16 did, u32 pasid) -{ - struct qi_desc desc; - - desc.qw0 = QI_EIOTLB_PASID(pasid) | QI_EIOTLB_DID(did) | - QI_EIOTLB_GRAN(QI_GRAN_NONG_PASID) | QI_EIOTLB_TYPE; - desc.qw1 = 0; - desc.qw2 = 0; - desc.qw3 = 0; - - qi_submit_sync(iommu, &desc, 1, 0); -} - -static void devtlb_invalidation_with_pasid(struct intel_iommu *iommu, struct device *dev, u32 pasid) { @@ -524,7 +510,7 @@ void intel_pasid_tear_down_entry(struct intel_iommu *iommu, struct device *dev, clflush_cache_range(pte, sizeof(*pte)); pasid_cache_invalidation_with_pasid(iommu, did, pasid); - iotlb_invalidation_with_pasid(iommu, did, pasid); + qi_flush_piotlb(iommu, did, pasid, 0, -1, 0); /* Device IOTLB doesn't need to be flushed in caching mode. */ if (!cap_caching_mode(iommu->cap)) @@ -540,7 +526,7 @@ static void pasid_flush_caches(struct intel_iommu *iommu, if (cap_caching_mode(iommu->cap)) { pasid_cache_invalidation_with_pasid(iommu, did, pasid); - iotlb_invalidation_with_pasid(iommu, did, pasid); + qi_flush_piotlb(iommu, did, pasid, 0, -1, 0); } else { iommu_flush_write_buffer(iommu); } |