Commit 56b75b51 authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Will Deacon
Browse files

iommu/arm-smmu: Allow implementation specific write_s2cr



The firmware found in some Qualcomm platforms intercepts writes to the
S2CR register in order to replace the BYPASS type with FAULT. Further
more it treats faults at this level as catastrophic and restarts the
device.

Add support for providing implementation specific versions of the S2CR
write function, to allow the Qualcomm driver to work around this
behavior.

Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: default avatarSteev Klimaszewski <steev@kali.org>
Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20201019182323.3162386-2-bjorn.andersson@linaro.org


Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 3650b228
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -929,7 +929,14 @@ static void arm_smmu_write_smr(struct arm_smmu_device *smmu, int idx)
static void arm_smmu_write_s2cr(struct arm_smmu_device *smmu, int idx)
{
	struct arm_smmu_s2cr *s2cr = smmu->s2crs + idx;
	u32 reg = FIELD_PREP(ARM_SMMU_S2CR_TYPE, s2cr->type) |
	u32 reg;

	if (smmu->impl && smmu->impl->write_s2cr) {
		smmu->impl->write_s2cr(smmu, idx);
		return;
	}

	reg = FIELD_PREP(ARM_SMMU_S2CR_TYPE, s2cr->type) |
	      FIELD_PREP(ARM_SMMU_S2CR_CBNDX, s2cr->cbndx) |
	      FIELD_PREP(ARM_SMMU_S2CR_PRIVCFG, s2cr->privcfg);

+1 −0
Original line number Diff line number Diff line
@@ -436,6 +436,7 @@ struct arm_smmu_impl {
	int (*alloc_context_bank)(struct arm_smmu_domain *smmu_domain,
				  struct arm_smmu_device *smmu,
				  struct device *dev, int start);
	void (*write_s2cr)(struct arm_smmu_device *smmu, int idx);
};

#define INVALID_SMENDX			-1