Skip to content

Commit 391d0fe

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.4 - Device-tree binding updates: * Allow Qualcomm GPU SMMUs to accept relevant clock properties * Document Qualcomm 8550 SoC as implementing an MMU-500 * Favour new "qcom,smmu-500" binding for Adreno SMMUs - Fix S2CR quirk detection on non-architectural Qualcomm SMMU implementations - Acknowledge SMMUv3 PRI queue overflow when consuming events - Document (in a comment) why ATS is disabled for bypass streams
2 parents e8d018d + ca08b2a commit 391d0fe

File tree

3 files changed

+77
-10
lines changed

3 files changed

+77
-10
lines changed

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

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ properties:
5353
- qcom,sm8250-smmu-500
5454
- qcom,sm8350-smmu-500
5555
- qcom,sm8450-smmu-500
56+
- qcom,sm8550-smmu-500
5657
- const: qcom,smmu-500
5758
- const: arm,mmu-500
5859

@@ -75,9 +76,22 @@ properties:
7576
- qcom,sm8350-smmu-500
7677
- qcom,sm8450-smmu-500
7778
- const: arm,mmu-500
78-
79-
- description: Qcom Adreno GPUs implementing "arm,smmu-500"
79+
- description: Qcom Adreno GPUs implementing "qcom,smmu-500" and "arm,mmu-500"
80+
items:
81+
- enum:
82+
- qcom,sc7280-smmu-500
83+
- qcom,sm6115-smmu-500
84+
- qcom,sm6125-smmu-500
85+
- qcom,sm8150-smmu-500
86+
- qcom,sm8250-smmu-500
87+
- qcom,sm8350-smmu-500
88+
- const: qcom,adreno-smmu
89+
- const: qcom,smmu-500
90+
- const: arm,mmu-500
91+
- description: Qcom Adreno GPUs implementing "arm,mmu-500" (legacy binding)
92+
deprecated: true
8093
items:
94+
# Do not add additional SoC to this list. Instead use previous list.
8195
- enum:
8296
- qcom,sc7280-smmu-500
8397
- qcom,sm8150-smmu-500
@@ -364,6 +378,30 @@ allOf:
364378
- description: interface clock required to access smmu's registers
365379
through the TCU's programming interface.
366380

381+
- if:
382+
properties:
383+
compatible:
384+
items:
385+
- enum:
386+
- qcom,sm6115-smmu-500
387+
- qcom,sm6125-smmu-500
388+
- const: qcom,adreno-smmu
389+
- const: qcom,smmu-500
390+
- const: arm,mmu-500
391+
then:
392+
properties:
393+
clock-names:
394+
items:
395+
- const: mem
396+
- const: hlos
397+
- const: iface
398+
399+
clocks:
400+
items:
401+
- description: GPU memory bus clock
402+
- description: Voter clock required for HLOS SMMU access
403+
- description: Interface clock required for register access
404+
367405
# Disallow clocks for all other platforms with specific compatibles
368406
- if:
369407
properties:
@@ -383,12 +421,11 @@ allOf:
383421
- qcom,sdm845-smmu-500
384422
- qcom,sdx55-smmu-500
385423
- qcom,sdx65-smmu-500
386-
- qcom,sm6115-smmu-500
387-
- qcom,sm6125-smmu-500
388424
- qcom,sm6350-smmu-500
389425
- qcom,sm6375-smmu-500
390426
- qcom,sm8350-smmu-500
391427
- qcom,sm8450-smmu-500
428+
- qcom,sm8550-smmu-500
392429
then:
393430
properties:
394431
clock-names: false

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

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,18 @@ static void queue_inc_cons(struct arm_smmu_ll_queue *q)
152152
q->cons = Q_OVF(q->cons) | Q_WRP(q, cons) | Q_IDX(q, cons);
153153
}
154154

155+
static void queue_sync_cons_ovf(struct arm_smmu_queue *q)
156+
{
157+
struct arm_smmu_ll_queue *llq = &q->llq;
158+
159+
if (likely(Q_OVF(llq->prod) == Q_OVF(llq->cons)))
160+
return;
161+
162+
llq->cons = Q_OVF(llq->prod) | Q_WRP(llq, llq->cons) |
163+
Q_IDX(llq, llq->cons);
164+
queue_sync_cons_out(q);
165+
}
166+
155167
static int queue_sync_prod_in(struct arm_smmu_queue *q)
156168
{
157169
u32 prod;
@@ -1577,8 +1589,7 @@ static irqreturn_t arm_smmu_evtq_thread(int irq, void *dev)
15771589
} while (!queue_empty(llq));
15781590

15791591
/* Sync our overflow flag, as we believe we're up to speed */
1580-
llq->cons = Q_OVF(llq->prod) | Q_WRP(llq, llq->cons) |
1581-
Q_IDX(llq, llq->cons);
1592+
queue_sync_cons_ovf(q);
15821593
return IRQ_HANDLED;
15831594
}
15841595

@@ -1636,9 +1647,7 @@ static irqreturn_t arm_smmu_priq_thread(int irq, void *dev)
16361647
} while (!queue_empty(llq));
16371648

16381649
/* Sync our overflow flag, as we believe we're up to speed */
1639-
llq->cons = Q_OVF(llq->prod) | Q_WRP(llq, llq->cons) |
1640-
Q_IDX(llq, llq->cons);
1641-
queue_sync_cons_out(q);
1650+
queue_sync_cons_ovf(q);
16421651
return IRQ_HANDLED;
16431652
}
16441653

@@ -2447,6 +2456,13 @@ static int arm_smmu_attach_dev(struct iommu_domain *domain, struct device *dev)
24472456

24482457
master->domain = smmu_domain;
24492458

2459+
/*
2460+
* The SMMU does not support enabling ATS with bypass. When the STE is
2461+
* in bypass (STE.Config[2:0] == 0b100), ATS Translation Requests and
2462+
* Translated transactions are denied as though ATS is disabled for the
2463+
* stream (STE.EATS == 0b00), causing F_BAD_ATS_TREQ and
2464+
* F_TRANSL_FORBIDDEN events (IHI0070Ea 5.2 Stream Table Entry).
2465+
*/
24502466
if (smmu_domain->stage != ARM_SMMU_DOMAIN_BYPASS)
24512467
master->ats_enabled = arm_smmu_ats_supported(master);
24522468

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)