From: AngeloGioacchino Del Regno <[email protected]>

Some IOMMUs may be in need of overriding the stream mapping reset
function and this is seen on at least some Qualcomm SoCs:
add a stream_mapping_reset function to the implementation details
and call it in the appropriate function.

Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
---
 drivers/iommu/arm/arm-smmu/arm-smmu.c | 5 +++++
 drivers/iommu/arm/arm-smmu/arm-smmu.h | 1 +
 2 files changed, 6 insertions(+)

diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c 
b/drivers/iommu/arm/arm-smmu/arm-smmu.c
index 8c070c493315..44571873f148 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c
@@ -1656,6 +1656,11 @@ static void arm_smmu_stream_mapping_reset(struct 
arm_smmu_device *smmu)
 {
        int i;
 
+       if (smmu->impl && smmu->impl->stream_mapping_reset) {
+               smmu->impl->stream_mapping_reset(smmu);
+               return;
+       }
+
        /*
         * Reset stream mapping groups: Initial values mark all SMRn as
         * invalid and all S2CRn as bypass unless overridden.
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.h 
b/drivers/iommu/arm/arm-smmu/arm-smmu.h
index 2cd3d126f675..9c045594b8cf 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu.h
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu.h
@@ -387,6 +387,7 @@ struct arm_smmu_impl {
        int (*cfg_probe)(struct arm_smmu_device *smmu);
        int (*reset)(struct arm_smmu_device *smmu);
        int (*init_context)(struct arm_smmu_domain *smmu_domain);
+       void (*stream_mapping_reset)(struct arm_smmu_device *smmu);
        void (*test_smr_masks)(struct arm_smmu_device *smmu);
        void (*tlb_sync)(struct arm_smmu_device *smmu, int page, int sync,
                         int status);
-- 
2.28.0

Reply via email to