From: Geetha sowjanya <gakula@caviumnetworks.com>
To: will.deacon@arm.com, robin.murphy@arm.com,
lorenzo.pieralisi@arm.com, hanjun.guo@linaro.org,
sudeep.holla@arm.com, iommu@lists.linux-foundation.org
Cc: robert.moore@intel.com, lv.zheng@intel.com, rjw@rjwysocki.net,
jcm@redhat.com, linux-kernel@vger.kernel.org,
robert.richter@cavium.com, catalin.marinas@arm.com,
sgoutham@cavium.com, linux-arm-kernel@lists.infradead.org,
linux-acpi@vger.kernel.org, geethasowjanya.akula@gmail.com,
devel@acpica.org, linu.cherian@cavium.com,
Charles.Garcia-Tobin@arm.com, robh@kernel.org,
Geetha Sowjanya <geethasowjanya.akula@cavium.com>,
Geetha sowjanya <gakula@caviumnetworks.com>
Subject: [PATCH v8 3/3] iommu/arm-smmu-v3: Add workaround for Cavium ThunderX2 erratum #126
Date: Tue, 20 Jun 2017 19:47:39 +0530 [thread overview]
Message-ID: <1497968259-16390-4-git-send-email-gakula@caviumnetworks.com> (raw)
In-Reply-To: <1497968259-16390-1-git-send-email-gakula@caviumnetworks.com>
From: Geetha Sowjanya <geethasowjanya.akula@cavium.com>
Cavium ThunderX2 SMMU doesn't support MSI and also doesn't have unique irq
lines for gerror, eventq and cmdq-sync.
SHARED_IRQ option is set as a errata workaround, which allows to share the irq
line by register single irq handler for all the interrupts.
Signed-off-by: Geetha sowjanya <gakula@caviumnetworks.com>
---
.../devicetree/bindings/iommu/arm,smmu-v3.txt | 5 ++
drivers/iommu/arm-smmu-v3.c | 73 ++++++++++++++++----
2 files changed, 64 insertions(+), 14 deletions(-)
diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt b/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt
index 6ecc48c..44b40e0 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu-v3.txt
@@ -55,6 +55,11 @@ the PCIe specification.
Set for Caviun ThunderX2 silicon that doesn't support
SMMU page1 register space.
+- cavium,cn9900-broken-unique-irqline
+ : Use single irq line for all the SMMUv3 interrupts.
+ Set for Caviun ThunderX2 silicon that doesn't support
+ MSI and also doesn't have unique irq lines for gerror,
+ eventq and cmdq-sync.
** Example
smmu@2b400000 {
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 2dea4a9..6c0c632 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -598,6 +598,7 @@ struct arm_smmu_device {
#define ARM_SMMU_OPT_SKIP_PREFETCH (1 << 0)
#define ARM_SMMU_OPT_PAGE0_REGS_ONLY (1 << 1)
+#define ARM_SMMU_OPT_SHARED_IRQ (1 << 2)
u32 options;
struct arm_smmu_cmdq cmdq;
@@ -665,6 +666,7 @@ struct arm_smmu_option_prop {
static struct arm_smmu_option_prop arm_smmu_options[] = {
{ ARM_SMMU_OPT_SKIP_PREFETCH, "hisilicon,broken-prefetch-cmd" },
{ ARM_SMMU_OPT_PAGE0_REGS_ONLY, "cavium,cn9900-broken-page1-regspace"},
+ { ARM_SMMU_OPT_SHARED_IRQ, "cavium,cn9900-broken-unique-irqline"},
{ 0, NULL},
};
@@ -1313,6 +1315,21 @@ static irqreturn_t arm_smmu_gerror_handler(int irq, void *dev)
writel(gerror, smmu->base + ARM_SMMU_GERRORN);
return IRQ_HANDLED;
}
+/* Shared irq handler*/
+static irqreturn_t arm_smmu_shared_irq_thread(int irq, void *dev)
+{
+ struct arm_smmu_device *smmu = dev;
+ irqreturn_t ret;
+
+ ret = arm_smmu_gerror_handler(irq, dev);
+ if (ret == IRQ_NONE) {
+ arm_smmu_evtq_thread(irq, dev);
+ arm_smmu_cmdq_sync_handler(irq, dev);
+ if (smmu->features & ARM_SMMU_FEAT_PRI)
+ arm_smmu_priq_thread(irq, dev);
+ }
+ return IRQ_HANDLED;
+}
/* IO_PGTABLE API */
static void __arm_smmu_tlb_sync(struct arm_smmu_device *smmu)
@@ -2230,18 +2247,9 @@ static void arm_smmu_setup_msis(struct arm_smmu_device *smmu)
devm_add_action(dev, arm_smmu_free_msis, dev);
}
-static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
+static void arm_smmu_setup_unique_irqs(struct arm_smmu_device *smmu)
{
- int ret, irq;
- u32 irqen_flags = IRQ_CTRL_EVTQ_IRQEN | IRQ_CTRL_GERROR_IRQEN;
-
- /* Disable IRQs first */
- ret = arm_smmu_write_reg_sync(smmu, 0, ARM_SMMU_IRQ_CTRL,
- ARM_SMMU_IRQ_CTRLACK);
- if (ret) {
- dev_err(smmu->dev, "failed to disable irqs\n");
- return ret;
- }
+ int irq, ret;
arm_smmu_setup_msis(smmu);
@@ -2284,10 +2292,46 @@ static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
if (ret < 0)
dev_warn(smmu->dev,
"failed to enable priq irq\n");
- else
- irqen_flags |= IRQ_CTRL_PRIQ_IRQEN;
}
}
+}
+
+static void arm_smmu_setup_shared_irqs(struct arm_smmu_device *smmu)
+{
+ int ret, irq;
+
+ /* Single irq is used for all queues, request single interrupt lines */
+ irq = smmu->evtq.q.irq;
+ if (irq) {
+ ret = devm_request_threaded_irq(smmu->dev, irq, NULL,
+ arm_smmu_shared_irq_thread,
+ IRQF_ONESHOT | IRQF_SHARED,
+ "arm-smmu-v3-shared_irq", smmu);
+ if (ret < 0)
+ dev_warn(smmu->dev, "failed to enable shared irq\n");
+ }
+}
+
+static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
+{
+ int ret;
+ u32 irqen_flags = IRQ_CTRL_EVTQ_IRQEN | IRQ_CTRL_GERROR_IRQEN;
+
+ /* Disable IRQs first */
+ ret = arm_smmu_write_reg_sync(smmu, 0, ARM_SMMU_IRQ_CTRL,
+ ARM_SMMU_IRQ_CTRLACK);
+ if (ret) {
+ dev_err(smmu->dev, "failed to disable irqs\n");
+ return ret;
+ }
+
+ if (smmu->options & ARM_SMMU_OPT_SHARED_IRQ)
+ arm_smmu_setup_shared_irqs(smmu);
+ else
+ arm_smmu_setup_unique_irqs(smmu);
+
+ if (smmu->features & ARM_SMMU_FEAT_PRI)
+ irqen_flags |= IRQ_CTRL_PRIQ_IRQEN;
/* Enable interrupt generation on the SMMU */
ret = arm_smmu_write_reg_sync(smmu, irqen_flags,
@@ -2622,7 +2666,8 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu)
static void acpi_smmu_get_options(u32 model, struct arm_smmu_device *smmu)
{
if (model == ACPI_IORT_SMMU_V3_CAVIUM_CN99XX)
- smmu->options |= ARM_SMMU_OPT_PAGE0_REGS_ONLY;
+ smmu->options |= ARM_SMMU_OPT_PAGE0_REGS_ONLY
+ | ARM_SMMU_OPT_SHARED_IRQ;
dev_notice(smmu->dev, "option mask 0x%x\n", smmu->options);
}
--
1.7.1
next prev parent reply other threads:[~2017-06-20 14:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-20 14:17 [PATCH v8 0/3] Cavium ThunderX2 SMMUv3 errata workarounds Geetha sowjanya
2017-06-20 14:17 ` [PATCH v8 1/3] ACPI/IORT: Fixup SMMUv3 resource size for Cavium ThunderX2 SMMUv3 model Geetha sowjanya
2017-06-20 18:01 ` Will Deacon
2017-06-20 19:27 ` Lorenzo Pieralisi
2017-06-20 14:17 ` [PATCH v8 2/3] iommu/arm-smmu-v3: Add workaround for Cavium ThunderX2 erratum #74 Geetha sowjanya
2017-06-20 18:06 ` Will Deacon
2017-06-20 14:17 ` Geetha sowjanya [this message]
2017-06-20 18:00 ` [PATCH v8 3/3] iommu/arm-smmu-v3: Add workaround for Cavium ThunderX2 erratum #126 Will Deacon
2017-06-21 6:39 ` Geetha Akula
2017-06-21 9:08 ` Will Deacon
2017-06-21 9:30 ` Marc Zyngier
2017-06-21 18:19 ` Robert Richter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1497968259-16390-4-git-send-email-gakula@caviumnetworks.com \
--to=gakula@caviumnetworks.com \
--cc=Charles.Garcia-Tobin@arm.com \
--cc=catalin.marinas@arm.com \
--cc=devel@acpica.org \
--cc=geethasowjanya.akula@cavium.com \
--cc=geethasowjanya.akula@gmail.com \
--cc=hanjun.guo@linaro.org \
--cc=iommu@lists.linux-foundation.org \
--cc=jcm@redhat.com \
--cc=linu.cherian@cavium.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=lv.zheng@intel.com \
--cc=rjw@rjwysocki.net \
--cc=robert.moore@intel.com \
--cc=robert.richter@cavium.com \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=sgoutham@cavium.com \
--cc=sudeep.holla@arm.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®