Skip to content

Commit 6e19221

Browse files
rmurphy-armwilldeacon
authored andcommitted
iommu/arm-smmu-v3: Document SVA interaction with new pagetable features
Process pagetables may now be using new permission-indirection-based features which an SMMU may not understand when given such a table for SVA. Although SMMUv3.4 does add its own S1PIE feature, realistically we're still going to have to cope with feature mismatches between CPUs and SMMUs, so let's start simple and essentially just document the expectations for what falls out as-is. Although it seems unlikely for SVA applications to also depend on memory-hardening features, or vice-versa, the relative lifecycles make it tricky to enforce mutual exclusivity. Thankfully our PIE index allocation makes it relatively benign for an SMMU to keep interpreting them as direct permissions, the only real implication is that an SVA application cannot harden itself against its own devices with these features. Thus, inform the user about that just in case they have other expectations. Also we don't (yet) support LPA2, so deny SVA entirely if we're going to misunderstand the pagetable format altogether. Signed-off-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/68a37b00a720f0827cac0e4f40e4d3a688924054.1733406275.git.robin.murphy@arm.com Signed-off-by: Will Deacon <[email protected]>
1 parent 46b3df8 commit 6e19221

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ void arm_smmu_make_sva_cd(struct arm_smmu_cd *target,
112112
* from the current CPU register
113113
*/
114114
target->data[3] = cpu_to_le64(read_sysreg(mair_el1));
115+
116+
/*
117+
* Note that we don't bother with S1PIE on the SMMU, we just rely on
118+
* our default encoding scheme matching direct permissions anyway.
119+
* SMMU has no notion of S1POE nor GCS, so make sure that is clear if
120+
* either is enabled for CPUs, just in case anyone imagines otherwise.
121+
*/
122+
if (system_supports_poe() || system_supports_gcs())
123+
dev_warn_once(master->smmu->dev, "SVA devices ignore permission overlays and GCS\n");
115124
}
116125
EXPORT_SYMBOL_IF_KUNIT(arm_smmu_make_sva_cd);
117126

@@ -206,8 +215,12 @@ bool arm_smmu_sva_supported(struct arm_smmu_device *smmu)
206215
unsigned long asid_bits;
207216
u32 feat_mask = ARM_SMMU_FEAT_COHERENCY;
208217

209-
if (vabits_actual == 52)
218+
if (vabits_actual == 52) {
219+
/* We don't support LPA2 */
220+
if (PAGE_SIZE != SZ_64K)
221+
return false;
210222
feat_mask |= ARM_SMMU_FEAT_VAX;
223+
}
211224

212225
if ((smmu->features & feat_mask) != feat_mask)
213226
return false;

0 commit comments

Comments
 (0)