|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] arm/smmuv3: invalidate L1 descriptors after publishing L2 tables
The SMMU may cache an invalid L1 stream-table descriptor before its L2
table is allocated. Updating the descriptor in memory does not remove
that cached entry. Existing leaf-only STE invalidations need not remove
it either.
Issue CMD_CFGI_STE with Leaf=0 after publishing a new L2 table, then wait
for CMD_SYNC. Keep Leaf=1 for ordinary STE updates. This is needed for
both coherent and non-coherent SMMUs; CPU cache maintenance is separate.
Arm IHI 0070 D.a, sections 4.3.1 and 5.1, specify the non-leaf
invalidation and require it when an L1 descriptor becomes active.
Fixes: 452ddbe3592b ("xen/arm: smmuv3: Add support for SMMUv3 driver")
Assisted-by: Codex:GPT-6.1
Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
---
xen/drivers/passthrough/arm/smmu-v3.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/xen/drivers/passthrough/arm/smmu-v3.c
b/xen/drivers/passthrough/arm/smmu-v3.c
index 232df2421c..996f78f83e 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -649,13 +649,14 @@ arm_smmu_write_strtab_l1_desc(__le64 *dst, struct
arm_smmu_strtab_l1_desc *desc)
write_atomic(dst, cpu_to_le64(val));
}
-static void arm_smmu_sync_ste_for_sid(struct arm_smmu_device *smmu, u32 sid)
+static void arm_smmu_sync_ste_for_sid(struct arm_smmu_device *smmu, u32 sid,
+ bool leaf)
{
struct arm_smmu_cmdq_ent cmd = {
.opcode = CMDQ_OP_CFGI_STE,
.cfgi = {
.sid = sid,
- .leaf = true,
+ .leaf = leaf,
},
};
@@ -736,7 +737,7 @@ static void arm_smmu_write_strtab_ent(struct
arm_smmu_master *master, u32 sid,
* the STE regardless of whether the old value was live.
*/
if (smmu)
- arm_smmu_sync_ste_for_sid(smmu, sid);
+ arm_smmu_sync_ste_for_sid(smmu, sid, true);
return;
}
@@ -762,9 +763,9 @@ static void arm_smmu_write_strtab_ent(struct
arm_smmu_master *master, u32 sid,
dst[1] |= cpu_to_le64(FIELD_PREP(STRTAB_STE_1_EATS,
STRTAB_STE_1_EATS_TRANS));
- arm_smmu_sync_ste_for_sid(smmu, sid);
+ arm_smmu_sync_ste_for_sid(smmu, sid, true);
write_atomic(&dst[0], cpu_to_le64(val));
- arm_smmu_sync_ste_for_sid(smmu, sid);
+ arm_smmu_sync_ste_for_sid(smmu, sid, true);
/* It's likely that we'll want to use the new STE soon */
if (!(smmu->options & ARM_SMMU_OPT_SKIP_PREFETCH))
@@ -806,6 +807,8 @@ static int arm_smmu_init_l2_strtab(struct arm_smmu_device
*smmu, u32 sid)
arm_smmu_init_bypass_stes(desc->l2ptr, 1 << STRTAB_SPLIT);
arm_smmu_write_strtab_l1_desc(strtab, desc);
+ /* IHI 0070 D.a, section 5.1: L1STD changes need non-leaf CFGI_STE. */
+ arm_smmu_sync_ste_for_sid(smmu, sid, false);
return 0;
}
--
2.53.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |