Skip to content

Commit acd3e35

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 97e0c6d commit acd3e35

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
@@ -2232,6 +2232,25 @@ static void arm_smmu_setup_msis(struct arm_smmu_device *smmu)
22322232
devm_add_action(dev, arm_smmu_free_msis, dev);
22332233
}
22342234

2235+
static int get_irq_flags(struct arm_smmu_device *smmu, int irq)
2236+
{
2237+
int match_count = 0;
2238+
2239+
if (irq == smmu->evtq.q.irq)
2240+
match_count++;
2241+
if (irq == smmu->cmdq.q.irq)
2242+
match_count++;
2243+
if (irq == smmu->gerr_irq)
2244+
match_count++;
2245+
if (irq == smmu->priq.q.irq)
2246+
match_count++;
2247+
2248+
if (match_count > 1)
2249+
return IRQF_SHARED | IRQF_ONESHOT;
2250+
2251+
return IRQF_ONESHOT;
2252+
}
2253+
22352254
static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22362255
{
22372256
int ret, irq;
@@ -2252,7 +2271,7 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22522271
if (irq) {
22532272
ret = devm_request_threaded_irq(smmu->dev, irq, NULL,
22542273
arm_smmu_evtq_thread,
2255-
IRQF_ONESHOT,
2274+
get_irq_flags(smmu, irq),
22562275
"arm-smmu-v3-evtq", smmu);
22572276
if (ret < 0)
22582277
dev_warn(smmu->dev, "failed to enable evtq irq\n");
@@ -2261,7 +2280,8 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22612280
irq = smmu->cmdq.q.irq;
22622281
if (irq) {
22632282
ret = devm_request_irq(smmu->dev, irq,
2264-
arm_smmu_cmdq_sync_handler, 0,
2283+
arm_smmu_cmdq_sync_handler,
2284+
get_irq_flags(smmu, irq),
22652285
"arm-smmu-v3-cmdq-sync", smmu);
22662286
if (ret < 0)
22672287
dev_warn(smmu->dev, "failed to enable cmdq-sync irq\n");
@@ -2270,7 +2290,8 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22702290
irq = smmu->gerr_irq;
22712291
if (irq) {
22722292
ret = devm_request_irq(smmu->dev, irq, arm_smmu_gerror_handler,
2273-
0, "arm-smmu-v3-gerror", smmu);
2293+
get_irq_flags(smmu, irq),
2294+
"arm-smmu-v3-gerror", smmu);
22742295
if (ret < 0)
22752296
dev_warn(smmu->dev, "failed to enable gerror irq\n");
22762297
}
@@ -2280,7 +2301,7 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
22802301
if (irq) {
22812302
ret = devm_request_threaded_irq(smmu->dev, irq, NULL,
22822303
arm_smmu_priq_thread,
2283-
IRQF_ONESHOT,
2304+
get_irq_flags(smmu, irq),
22842305
"arm-smmu-v3-priq",
22852306
smmu);
22862307
if (ret < 0)

0 commit comments

Comments
 (0)