Skip to content

Commit dbea6c0

Browse files
Geetha Sowjanya0day robot
authored andcommitted
iommu/arm-smmu-v3: Add workaround for Cavium ThunderX2 erratum torvalds#126
Cavium ThunderX2 SMMU doesn't support MSI and also doesn't have unique irq lines for gerror, eventq and cmdq-sync. This patch addresses the issue by checking if any interrupt sources are using same irq number, then they are registered as shared irqs. Signed-off-by: Geetha Sowjanya <[email protected]>
1 parent 541c85f commit dbea6c0

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

Documentation/arm64/silicon-errata.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ stable kernels.
6363
| Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 |
6464
| Cavium | ThunderX SMMUv2 | #27704 | N/A |
6565
| Cavium | ThunderX2 SMMUv3| #74 | N/A |
66+
| Cavium | ThunderX2 SMMUv3| #126 | N/A |
6667
| | | | |
6768
| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
6869
| | | | |

drivers/iommu/arm-smmu-v3.c

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,6 +2211,25 @@ static void arm_smmu_setup_msis(struct arm_smmu_device *smmu)
22112211
devm_add_action(dev, arm_smmu_free_msis, dev);
22122212
}
22132213

2214+
static int get_irq_flags(struct arm_smmu_device *smmu, int irq)
2215+
{
2216+
int match_count = 0;
2217+
2218+
if (irq == smmu->evtq.q.irq)
2219+
match_count++;
2220+
if (irq == smmu->cmdq.q.irq)
2221+
match_count++;
2222+
if (irq == smmu->gerr_irq)
2223+
match_count++;
2224+
if (irq == smmu->priq.q.irq)
2225+
match_count++;
2226+
2227+
if (match_count > 1)
2228+
return IRQF_SHARED | IRQF_ONESHOT;
2229+
2230+
return IRQF_ONESHOT;
2231+
}
2232+
22142233
static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22152234
{
22162235
int ret, irq;
@@ -2231,7 +2250,7 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22312250
if (irq) {
22322251
ret = devm_request_threaded_irq(smmu->dev, irq, NULL,
22332252
arm_smmu_evtq_thread,
2234-
IRQF_ONESHOT,
2253+
get_irq_flags(smmu, irq),
22352254
"arm-smmu-v3-evtq", smmu);
22362255
if (ret < 0)
22372256
dev_warn(smmu->dev, "failed to enable evtq irq\n");
@@ -2240,7 +2259,8 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22402259
irq = smmu->cmdq.q.irq;
22412260
if (irq) {
22422261
ret = devm_request_irq(smmu->dev, irq,
2243-
arm_smmu_cmdq_sync_handler, 0,
2262+
arm_smmu_cmdq_sync_handler,
2263+
get_irq_flags(smmu, irq),
22442264
"arm-smmu-v3-cmdq-sync", smmu);
22452265
if (ret < 0)
22462266
dev_warn(smmu->dev, "failed to enable cmdq-sync irq\n");
@@ -2249,7 +2269,8 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22492269
irq = smmu->gerr_irq;
22502270
if (irq) {
22512271
ret = devm_request_irq(smmu->dev, irq, arm_smmu_gerror_handler,
2252-
0, "arm-smmu-v3-gerror", smmu);
2272+
get_irq_flags(smmu, irq),
2273+
"arm-smmu-v3-gerror", smmu);
22532274
if (ret < 0)
22542275
dev_warn(smmu->dev, "failed to enable gerror irq\n");
22552276
}
@@ -2259,7 +2280,7 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22592280
if (irq) {
22602281
ret = devm_request_threaded_irq(smmu->dev, irq, NULL,
22612282
arm_smmu_priq_thread,
2262-
IRQF_ONESHOT,
2283+
get_irq_flags(smmu, irq),
22632284
"arm-smmu-v3-priq",
22642285
smmu);
22652286
if (ret < 0)

0 commit comments

Comments
 (0)