Skip to content

Commit ac3c456

Browse files
committed
Merge tag 'arm-smmu-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into arm/smmu
Arm SMMU updates for 6.5 - Device-tree binding updates: * Add missing clocks for SC8280XP and SA8775 Adreno SMMUs * Add two new Qualcomm SMMUs in SDX75 and SM6375 - Workarounds for Arm MMU-700 errata: * 1076982: Avoid use of SEV-based cmdq wakeup * 2812531: Terminate command batches with a CMD_SYNC * Enforce single-stage translation to avoid nesting-related errata - Set the correct level hint for range TLB invalidation on teardown
2 parents 44c026a + c5fb66a commit ac3c456

File tree

4 files changed

+78
-5
lines changed

4 files changed

+78
-5
lines changed

Documentation/arm64/silicon-errata.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ stable kernels.
140140
+----------------+-----------------+-----------------+-----------------------------+
141141
| ARM | MMU-500 | #841119,826419 | N/A |
142142
+----------------+-----------------+-----------------+-----------------------------+
143+
| ARM | MMU-600 | #1076982,1209401| N/A |
144+
+----------------+-----------------+-----------------+-----------------------------+
145+
| ARM | MMU-700 | #2268618,2812531| N/A |
146+
+----------------+-----------------+-----------------+-----------------------------+
143147
+----------------+-----------------+-----------------+-----------------------------+
144148
| Broadcom | Brahma-B53 | N/A | ARM64_ERRATUM_845719 |
145149
+----------------+-----------------+-----------------+-----------------------------+

Documentation/devicetree/bindings/iommu/arm,smmu.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ properties:
2929
- qcom,msm8996-smmu-v2
3030
- qcom,msm8998-smmu-v2
3131
- qcom,sdm630-smmu-v2
32+
- qcom,sm6375-smmu-v2
3233
- const: qcom,smmu-v2
3334

3435
- description: Qcom SoCs implementing "qcom,smmu-500" and "arm,mmu-500"
@@ -45,6 +46,7 @@ properties:
4546
- qcom,sdm845-smmu-500
4647
- qcom,sdx55-smmu-500
4748
- qcom,sdx65-smmu-500
49+
- qcom,sdx75-smmu-500
4850
- qcom,sm6115-smmu-500
4951
- qcom,sm6125-smmu-500
5052
- qcom,sm6350-smmu-500
@@ -79,7 +81,9 @@ properties:
7981
- description: Qcom Adreno GPUs implementing "qcom,smmu-500" and "arm,mmu-500"
8082
items:
8183
- enum:
84+
- qcom,sa8775p-smmu-500
8285
- qcom,sc7280-smmu-500
86+
- qcom,sc8280xp-smmu-500
8387
- qcom,sm6115-smmu-500
8488
- qcom,sm6125-smmu-500
8589
- qcom,sm8150-smmu-500
@@ -267,6 +271,7 @@ allOf:
267271
enum:
268272
- qcom,msm8998-smmu-v2
269273
- qcom,sdm630-smmu-v2
274+
- qcom,sm6375-smmu-v2
270275
then:
271276
anyOf:
272277
- properties:
@@ -331,7 +336,10 @@ allOf:
331336
properties:
332337
compatible:
333338
contains:
334-
const: qcom,sc7280-smmu-500
339+
enum:
340+
- qcom,sa8775p-smmu-500
341+
- qcom,sc7280-smmu-500
342+
- qcom,sc8280xp-smmu-500
335343
then:
336344
properties:
337345
clock-names:
@@ -413,10 +421,8 @@ allOf:
413421
- nvidia,smmu-500
414422
- qcom,qcm2290-smmu-500
415423
- qcom,qdu1000-smmu-500
416-
- qcom,sa8775p-smmu-500
417424
- qcom,sc7180-smmu-500
418425
- qcom,sc8180x-smmu-500
419-
- qcom,sc8280xp-smmu-500
420426
- qcom,sdm670-smmu-500
421427
- qcom,sdm845-smmu-500
422428
- qcom,sdx55-smmu-500

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

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,12 @@ static void arm_smmu_cmdq_batch_add(struct arm_smmu_device *smmu,
894894
{
895895
int index;
896896

897+
if (cmds->num == CMDQ_BATCH_ENTRIES - 1 &&
898+
(smmu->options & ARM_SMMU_OPT_CMDQ_FORCE_SYNC)) {
899+
arm_smmu_cmdq_issue_cmdlist(smmu, cmds->cmds, cmds->num, true);
900+
cmds->num = 0;
901+
}
902+
897903
if (cmds->num == CMDQ_BATCH_ENTRIES) {
898904
arm_smmu_cmdq_issue_cmdlist(smmu, cmds->cmds, cmds->num, false);
899905
cmds->num = 0;
@@ -1892,8 +1898,13 @@ static void __arm_smmu_tlb_inv_range(struct arm_smmu_cmdq_ent *cmd,
18921898
/* Convert page size of 12,14,16 (log2) to 1,2,3 */
18931899
cmd->tlbi.tg = (tg - 10) / 2;
18941900

1895-
/* Determine what level the granule is at */
1896-
cmd->tlbi.ttl = 4 - ((ilog2(granule) - 3) / (tg - 3));
1901+
/*
1902+
* Determine what level the granule is at. For non-leaf, io-pgtable
1903+
* assumes .tlb_flush_walk can invalidate multiple levels at once,
1904+
* so ignore the nominal last-level granule and leave TTL=0.
1905+
*/
1906+
if (cmd->tlbi.leaf)
1907+
cmd->tlbi.ttl = 4 - ((ilog2(granule) - 3) / (tg - 3));
18971908

18981909
num_pages = size >> tg;
18991910
}
@@ -3429,6 +3440,44 @@ static int arm_smmu_device_reset(struct arm_smmu_device *smmu, bool bypass)
34293440
return 0;
34303441
}
34313442

3443+
#define IIDR_IMPLEMENTER_ARM 0x43b
3444+
#define IIDR_PRODUCTID_ARM_MMU_600 0x483
3445+
#define IIDR_PRODUCTID_ARM_MMU_700 0x487
3446+
3447+
static void arm_smmu_device_iidr_probe(struct arm_smmu_device *smmu)
3448+
{
3449+
u32 reg;
3450+
unsigned int implementer, productid, variant, revision;
3451+
3452+
reg = readl_relaxed(smmu->base + ARM_SMMU_IIDR);
3453+
implementer = FIELD_GET(IIDR_IMPLEMENTER, reg);
3454+
productid = FIELD_GET(IIDR_PRODUCTID, reg);
3455+
variant = FIELD_GET(IIDR_VARIANT, reg);
3456+
revision = FIELD_GET(IIDR_REVISION, reg);
3457+
3458+
switch (implementer) {
3459+
case IIDR_IMPLEMENTER_ARM:
3460+
switch (productid) {
3461+
case IIDR_PRODUCTID_ARM_MMU_600:
3462+
/* Arm erratum 1076982 */
3463+
if (variant == 0 && revision <= 2)
3464+
smmu->features &= ~ARM_SMMU_FEAT_SEV;
3465+
/* Arm erratum 1209401 */
3466+
if (variant < 2)
3467+
smmu->features &= ~ARM_SMMU_FEAT_NESTING;
3468+
break;
3469+
case IIDR_PRODUCTID_ARM_MMU_700:
3470+
/* Arm erratum 2812531 */
3471+
smmu->features &= ~ARM_SMMU_FEAT_BTM;
3472+
smmu->options |= ARM_SMMU_OPT_CMDQ_FORCE_SYNC;
3473+
/* Arm errata 2268618, 2812531 */
3474+
smmu->features &= ~ARM_SMMU_FEAT_NESTING;
3475+
break;
3476+
}
3477+
break;
3478+
}
3479+
}
3480+
34323481
static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
34333482
{
34343483
u32 reg;
@@ -3635,6 +3684,12 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
36353684

36363685
smmu->ias = max(smmu->ias, smmu->oas);
36373686

3687+
if ((smmu->features & ARM_SMMU_FEAT_TRANS_S1) &&
3688+
(smmu->features & ARM_SMMU_FEAT_TRANS_S2))
3689+
smmu->features |= ARM_SMMU_FEAT_NESTING;
3690+
3691+
arm_smmu_device_iidr_probe(smmu);
3692+
36383693
if (arm_smmu_sva_supported(smmu))
36393694
smmu->features |= ARM_SMMU_FEAT_SVA;
36403695

drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969
#define IDR5_VAX GENMASK(11, 10)
7070
#define IDR5_VAX_52_BIT 1
7171

72+
#define ARM_SMMU_IIDR 0x18
73+
#define IIDR_PRODUCTID GENMASK(31, 20)
74+
#define IIDR_VARIANT GENMASK(19, 16)
75+
#define IIDR_REVISION GENMASK(15, 12)
76+
#define IIDR_IMPLEMENTER GENMASK(11, 0)
77+
7278
#define ARM_SMMU_CR0 0x20
7379
#define CR0_ATSCHK (1 << 4)
7480
#define CR0_CMDQEN (1 << 3)
@@ -639,11 +645,13 @@ struct arm_smmu_device {
639645
#define ARM_SMMU_FEAT_BTM (1 << 16)
640646
#define ARM_SMMU_FEAT_SVA (1 << 17)
641647
#define ARM_SMMU_FEAT_E2H (1 << 18)
648+
#define ARM_SMMU_FEAT_NESTING (1 << 19)
642649
u32 features;
643650

644651
#define ARM_SMMU_OPT_SKIP_PREFETCH (1 << 0)
645652
#define ARM_SMMU_OPT_PAGE0_REGS_ONLY (1 << 1)
646653
#define ARM_SMMU_OPT_MSIPOLL (1 << 2)
654+
#define ARM_SMMU_OPT_CMDQ_FORCE_SYNC (1 << 3)
647655
u32 options;
648656

649657
struct arm_smmu_cmdq cmdq;

0 commit comments

Comments
 (0)