Skip to content

Commit

Permalink
iommu/arm-smmu-v3: Add workaround for Cavium ThunderX2 erratum torval…
Browse files Browse the repository at this point in the history
…ds#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]>
  • Loading branch information
Geetha Sowjanya authored and 0day robot committed May 12, 2017
1 parent 2e2e4f3 commit 4d7e0c1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions Documentation/arm64/silicon-errata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ stable kernels.
| Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 |
| Cavium | ThunderX SMMUv2 | #27704 | N/A |
| Cavium | ThunderX2 SMMUv3| #74 | N/A |
| Cavium | ThunderX2 SMMUv3| #126 | N/A |
| | | | |
| Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
| | | | |
Expand Down
29 changes: 25 additions & 4 deletions drivers/iommu/arm-smmu-v3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,25 @@ static void arm_smmu_setup_msis(struct arm_smmu_device *smmu)
devm_add_action(dev, arm_smmu_free_msis, dev);
}

static int get_irq_flags(struct arm_smmu_device *smmu, int irq)
{
int match_count = 0;

if (irq == smmu->evtq.q.irq)
match_count++;
if (irq == smmu->cmdq.q.irq)
match_count++;
if (irq == smmu->gerr_irq)
match_count++;
if (irq == smmu->priq.q.irq)
match_count++;

if (match_count > 1)
return IRQF_SHARED | IRQF_ONESHOT;

return IRQF_ONESHOT;
}

static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
{
int ret, irq;
Expand All @@ -2231,7 +2250,7 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
if (irq) {
ret = devm_request_threaded_irq(smmu->dev, irq, NULL,
arm_smmu_evtq_thread,
IRQF_ONESHOT,
get_irq_flags(smmu, irq),
"arm-smmu-v3-evtq", smmu);
if (ret < 0)
dev_warn(smmu->dev, "failed to enable evtq irq\n");
Expand All @@ -2240,7 +2259,8 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
irq = smmu->cmdq.q.irq;
if (irq) {
ret = devm_request_irq(smmu->dev, irq,
arm_smmu_cmdq_sync_handler, 0,
arm_smmu_cmdq_sync_handler,
get_irq_flags(smmu, irq),
"arm-smmu-v3-cmdq-sync", smmu);
if (ret < 0)
dev_warn(smmu->dev, "failed to enable cmdq-sync irq\n");
Expand All @@ -2249,7 +2269,8 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
irq = smmu->gerr_irq;
if (irq) {
ret = devm_request_irq(smmu->dev, irq, arm_smmu_gerror_handler,
0, "arm-smmu-v3-gerror", smmu);
get_irq_flags(smmu, irq),
"arm-smmu-v3-gerror", smmu);
if (ret < 0)
dev_warn(smmu->dev, "failed to enable gerror irq\n");
}
Expand All @@ -2259,7 +2280,7 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
if (irq) {
ret = devm_request_threaded_irq(smmu->dev, irq, NULL,
arm_smmu_priq_thread,
IRQF_ONESHOT,
get_irq_flags(smmu, irq),
"arm-smmu-v3-priq",
smmu);
if (ret < 0)
Expand Down

0 comments on commit 4d7e0c1

Please sign in to comment.