[PATCH 32/37] iommu/arm-smmu-v3: Hook up ATC invalidation to mm ops
Jean-Philippe Brucker
jean-philippe.brucker at arm.com
Mon Feb 12 10:33:47 PST 2018
The core calls us when an mm is modified. Perform the required ATC
invalidations.
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker at arm.com>
---
drivers/iommu/arm-smmu-v3.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 76513135310f..8d09615fab35 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -1805,6 +1805,15 @@ static int arm_smmu_atc_inv_master_all(struct arm_smmu_master_data *master,
return arm_smmu_atc_inv_master(master, &cmd);
}
+static int arm_smmu_atc_inv_master_range(struct arm_smmu_master_data *master,
+ int ssid, unsigned long iova, size_t size)
+{
+ struct arm_smmu_cmdq_ent cmd;
+
+ arm_smmu_atc_inv_to_cmd(ssid, iova, size, &cmd);
+ return arm_smmu_atc_inv_master(master, &cmd);
+}
+
static size_t
arm_smmu_atc_inv_domain(struct arm_smmu_domain *smmu_domain, int ssid,
unsigned long iova, size_t size)
@@ -2450,11 +2459,12 @@ static void arm_smmu_mm_detach(struct iommu_domain *domain, struct device *dev,
struct arm_smmu_mm *smmu_mm = to_smmu_mm(io_mm);
struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain);
struct iommu_pasid_table_ops *ops = smmu_domain->s1_cfg.ops;
+ struct arm_smmu_master_data *master = dev->iommu_fwspec->iommu_priv;
if (detach_domain)
ops->clear_entry(ops, io_mm->pasid, smmu_mm->cd);
- /* TODO: Invalidate ATC. */
+ arm_smmu_atc_inv_master_all(master, io_mm->pasid);
/* TODO: Invalidate all mappings if last and not DVM. */
}
@@ -2462,8 +2472,10 @@ static void arm_smmu_mm_invalidate(struct iommu_domain *domain,
struct device *dev, struct io_mm *io_mm,
unsigned long iova, size_t size)
{
+ struct arm_smmu_master_data *master = dev->iommu_fwspec->iommu_priv;
+
+ arm_smmu_atc_inv_master_range(master, io_mm->pasid, iova, size);
/*
- * TODO: Invalidate ATC.
* TODO: Invalidate mapping if not DVM
*/
}
--
2.15.1
More information about the linux-arm-kernel
mailing list