Skip to content

Commit 1226113

Browse files
Mani-Sadhasivamwilldeacon
authored andcommitted
iommu/arm-smmu-qcom: Limit the SMR groups to 128
Some platforms support more than 128 stream matching groups than what is defined by the ARM SMMU architecture specification. But due to some unknown reasons, those additional groups don't exhibit the same behavior as the architecture supported ones. For instance, the additional groups will not detect the quirky behavior of some firmware versions intercepting writes to S2CR register, thus skipping the quirk implemented in the driver and causing boot crash. So let's limit the groups to 128 for now until the issue with those groups are fixed and issue a notice to users in that case. Reviewed-by: Johan Hovold <johan+linaro@kernel.org> Tested-by: Johan Hovold <johan+linaro@kernel.org> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/20230327080029.11584-1-manivannan.sadhasivam@linaro.org [will: Reworded the comment slightly] Signed-off-by: Will Deacon <will@kernel.org>
1 parent 8c15364 commit 1226113

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,12 +268,26 @@ static int qcom_smmu_init_context(struct arm_smmu_domain *smmu_domain,
268268

269269
static int qcom_smmu_cfg_probe(struct arm_smmu_device *smmu)
270270
{
271-
unsigned int last_s2cr = ARM_SMMU_GR0_S2CR(smmu->num_mapping_groups - 1);
272271
struct qcom_smmu *qsmmu = to_qcom_smmu(smmu);
272+
unsigned int last_s2cr;
273273
u32 reg;
274274
u32 smr;
275275
int i;
276276

277+
/*
278+
* Some platforms support more than the Arm SMMU architected maximum of
279+
* 128 stream matching groups. For unknown reasons, the additional
280+
* groups don't exhibit the same behavior as the architected registers,
281+
* so limit the groups to 128 until the behavior is fixed for the other
282+
* groups.
283+
*/
284+
if (smmu->num_mapping_groups > 128) {
285+
dev_notice(smmu->dev, "\tLimiting the stream matching groups to 128\n");
286+
smmu->num_mapping_groups = 128;
287+
}
288+
289+
last_s2cr = ARM_SMMU_GR0_S2CR(smmu->num_mapping_groups - 1);
290+
277291
/*
278292
* With some firmware versions writes to S2CR of type FAULT are
279293
* ignored, and writing BYPASS will end up written as FAULT in the

0 commit comments

Comments
 (0)