Skip to content

Commit 9f6453a

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 8e046a3 commit 9f6453a

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
@@ -2215,6 +2215,25 @@ static void arm_smmu_setup_msis(struct arm_smmu_device *smmu)
22152215
devm_add_action(dev, arm_smmu_free_msis, dev);
22162216
}
22172217

2218+
static int get_irq_flags(struct arm_smmu_device *smmu, int irq)
2219+
{
2220+
int match_count = 0;
2221+
2222+
if (irq == smmu->evtq.q.irq)
2223+
match_count++;
2224+
if (irq == smmu->cmdq.q.irq)
2225+
match_count++;
2226+
if (irq == smmu->gerr_irq)
2227+
match_count++;
2228+
if (irq == smmu->priq.q.irq)
2229+
match_count++;
2230+
2231+
if (match_count > 1)
2232+
return IRQF_SHARED | IRQF_ONESHOT;
2233+
2234+
return IRQF_ONESHOT;
2235+
}
2236+
22182237
static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22192238
{
22202239
int ret, irq;
@@ -2235,7 +2254,7 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22352254
if (irq) {
22362255
ret = devm_request_threaded_irq(smmu->dev, irq, NULL,
22372256
arm_smmu_evtq_thread,
2238-
IRQF_ONESHOT,
2257+
get_irq_flags(smmu, irq),
22392258
"arm-smmu-v3-evtq", smmu);
22402259
if (ret < 0)
22412260
dev_warn(smmu->dev, "failed to enable evtq irq\n");
@@ -2244,7 +2263,8 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22442263
irq = smmu->cmdq.q.irq;
22452264
if (irq) {
22462265
ret = devm_request_irq(smmu->dev, irq,
2247-
arm_smmu_cmdq_sync_handler, 0,
2266+
arm_smmu_cmdq_sync_handler,
2267+
get_irq_flags(smmu, irq),
22482268
"arm-smmu-v3-cmdq-sync", smmu);
22492269
if (ret < 0)
22502270
dev_warn(smmu->dev, "failed to enable cmdq-sync irq\n");
@@ -2253,7 +2273,8 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22532273
irq = smmu->gerr_irq;
22542274
if (irq) {
22552275
ret = devm_request_irq(smmu->dev, irq, arm_smmu_gerror_handler,
2256-
0, "arm-smmu-v3-gerror", smmu);
2276+
get_irq_flags(smmu, irq),
2277+
"arm-smmu-v3-gerror", smmu);
22572278
if (ret < 0)
22582279
dev_warn(smmu->dev, "failed to enable gerror irq\n");
22592280
}
@@ -2263,7 +2284,7 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22632284
if (irq) {
22642285
ret = devm_request_threaded_irq(smmu->dev, irq, NULL,
22652286
arm_smmu_priq_thread,
2266-
IRQF_ONESHOT,
2287+
get_irq_flags(smmu, irq),
22672288
"arm-smmu-v3-priq",
22682289
smmu);
22692290
if (ret < 0)

0 commit comments

Comments
 (0)