Merge branch 'drm-next' of git://anongit.freedesktop.org/drm/drm into msm-next-lumag...
[sfrench/cifs-2.6.git] / drivers / iommu / arm / arm-smmu / arm-smmu-qcom.c
index ec743a9ec67a51db5e77557c29a61545bdf032d2..c71afda79d6442f57026b945fd7ff8fe08cd35a4 100644 (file)
@@ -268,12 +268,26 @@ static int qcom_smmu_init_context(struct arm_smmu_domain *smmu_domain,
 
 static int qcom_smmu_cfg_probe(struct arm_smmu_device *smmu)
 {
-       unsigned int last_s2cr = ARM_SMMU_GR0_S2CR(smmu->num_mapping_groups - 1);
        struct qcom_smmu *qsmmu = to_qcom_smmu(smmu);
+       unsigned int last_s2cr;
        u32 reg;
        u32 smr;
        int i;
 
+       /*
+        * Some platforms support more than the Arm SMMU architected maximum of
+        * 128 stream matching groups. For unknown reasons, the additional
+        * groups don't exhibit the same behavior as the architected registers,
+        * so limit the groups to 128 until the behavior is fixed for the other
+        * groups.
+        */
+       if (smmu->num_mapping_groups > 128) {
+               dev_notice(smmu->dev, "\tLimiting the stream matching groups to 128\n");
+               smmu->num_mapping_groups = 128;
+       }
+
+       last_s2cr = ARM_SMMU_GR0_S2CR(smmu->num_mapping_groups - 1);
+
        /*
         * With some firmware versions writes to S2CR of type FAULT are
         * ignored, and writing BYPASS will end up written as FAULT in the