Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752116AbdFTOiC (ORCPT ); Tue, 20 Jun 2017 10:38:02 -0400 Received: from mail-cys01nam02on0066.outbound.protection.outlook.com ([104.47.37.66]:45472 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751138AbdFTOhu (ORCPT ); Tue, 20 Jun 2017 10:37:50 -0400 Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=caviumnetworks.com; From: Geetha sowjanya 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 , Geetha sowjanya 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 Message-Id: <1497968259-16390-4-git-send-email-gakula@caviumnetworks.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1497968259-16390-1-git-send-email-gakula@caviumnetworks.com> References: <1497968259-16390-1-git-send-email-gakula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: PN1PR01CA0105.INDPRD01.PROD.OUTLOOK.COM (10.174.144.21) To SN1PR0701MB2031.namprd07.prod.outlook.com (10.163.132.14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad116add-4245-4e4e-e205-08d4b7e9ec17 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131423075)(201703031133081);SRVR:SN1PR0701MB2031; X-Microsoft-Exchange-Diagnostics: 1;SN1PR0701MB2031;3:mig2LHBWzwpcIzjNbzVRxuhekt3lXHc717ShoVRuit+XAoFGxZ1x5lR6zUt3qdphtX/7tZhj6bccqDfhdy/qPYciYCLih6CuaEgYsNA3qFhToRB/MhtGeg1PLcMnX0u3Tb4lZi6uhxvN2sLpXmFYvRuGwGUGmpP54Y1pJ/pVtxMLNuQXgXpmCfmZinYrWvl3h/ui4ZB2HiziTWfIiU2gF8vahYBcXsTCCd/aScxyqjL8Jxa61c9Qk1qyCiOINnw3LlJMAHivzwjDZBPy/mGxIbNA+qa8iMIxSfODrWZmy7QRHWLaaavGIR0VZNVn9HKyZ+V6+b4mM43hegdXXvTLXw==;25:4xIFZ0IP4La3wfjBvlqAK+FREF5pFdLWtweP7EWwq8xX+a8YBTCzbjAHmNrxh4513rssuAvam3m2f+W417RUvIlEiC/BdkbiUbdiyetPmU/i25w8sTuRIbatu3KNPGkL4LSK1IRp7hvJXVm7na9/UDsSBNnSqfBRFDQ9OfsAa26+WHpNQlx2ZvLJMA3nuHiGa+nhrFGJlAYwaKCfeWOt33BqmvUf+t+M20weDwAepMISqpKuddQeTPNQycuEZ9ZrNIsebGDqUFbN/J2Z9NHasC3z0p/7L+OYizgWv/WvCsIJy2cGdGgrTnR8x6ZJHvEf/Ngcv2Pylf0rVdaPMtbZ+QWnFLOrNZEQMcBR1Rb6n28bx1ttj3jL8MZ40MXdNawo2VM/mnnz6I9tFoDpREVANhpF1qd+rY+hJ517ngDFPETOXm/mOseVSbT2bi7CR1eGSFmSic1PVywe4C2KDeod5Tp529MPGD24gXQW41zSfPc= X-MS-TrafficTypeDiagnostic: SN1PR0701MB2031: X-Microsoft-Exchange-Diagnostics: 1;SN1PR0701MB2031;31:IF7kbhwGqQTnZnlkmLK1neKWLynLJbdvt6FK61MOhGZJxVFclSFTVMKEP3dttxf+zmX9ZbTL0iFyWEhHKr7LQENstGblbZCZtaed18JiAYjeRXKq5xPPSfCce2KbuxAK0PresxX7fS4Kd/7HXjrp6IVJoVhgls7Fv8zeP2VkaLQANTZ5+xIb0AXOjjX3K4G3wxLub6cLjdrRO/hZ6yRTXPYVAF//BvZvLN3otSnucG4=;20:NKabQTtMGhKlNmk4p2jaqRFRqCt4Dnttr1LKTa31qK9ylZL3ctKJzvFsOxrvwfe4ryKlgku/peul+CrygYCMlQbbX9PlroQEfDfEFCzRtZerf/q1QoT6gzvO1cuvoVBFodHazJ0nZBWaRxgAosPfCUE1GYZKX/GDqDdV6tnkZjeXKTl9/wwnB4HJalCc+egWZxG0wJ4kQ5yFzCWW64s4/Rbc4np+eeSIWaWeayoJ0AVHLK48K0HaWFGgrnoVNretSYVWFM0RsERwVIBjliVIfrSwKbV4dpPMLnbJOYQ6tvTyt2z+89DHUvVCl4+GyNgMCpQ/BGOZarcOZ8R5L+B5oUWFX6jqU8nGqZC26MZE/0utvonQZ4Kr4CNYcfrgiXVaPC7XNFDTDKmhbbu2QO6wQrXkymumJWEr7LmQeex+9DT+ox+CcnGuTsGZdPhXqJ1pwzXN98qjPSxEGCk2VXX3tee7ksdXH9f9zVuXEHE0YMRFOKYnyk/n9WeXnVnRZDVK7yrOTZrkFhb3a4DFhIIm9CxQNNyyYPW7o4rYBqAd9vEVG55qYgJoH1Qtqylo6wPDoP8Z2cWcnVTL+Su1ftRicAzVmV3SUMVrHKU2MUly1dE= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(100000703101)(100105400095)(93006095)(3002001)(6041248)(20161123564025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(20161123558100)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:SN1PR0701MB2031;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:SN1PR0701MB2031; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR0701MB2031;4:62SQ/IRItXhKfxoPcoJDAgyYkn9EXQQatByUHRJ9?= =?us-ascii?Q?qzgaxKq1ixEyNzXmUzWh2dfqFLXQHv/0F1R/BVj3tthxfE9lPVdJbp7cz1eF?= =?us-ascii?Q?0YcvTLWhar9SN8cCNjA3+gzxiVM7jQNBXCDsksuDbx4eld5jfn00TSu2wog2?= =?us-ascii?Q?koZ2Ma9PZ2jVa5FQNfVpDeUwOsMGckOTeIlGTHi70QfpbUuklAFtBrkKpqQp?= =?us-ascii?Q?w3zA5yKyQHCAbNtdjDxHfoo1ymVRsnsJG2eIS6L82NYKmzCTRGRvVVgg9/Yg?= =?us-ascii?Q?X5XMS5ziMQkLPX2UsV/z2TV3qSPedEJfYTXfKRa3l2kzgKyEcOIzgCyVozqE?= =?us-ascii?Q?NoCSPioGdch7/zHlXxO9PenWfv8wQD1rLIgG7N9s0gob3e95nEFKLCTMghy/?= =?us-ascii?Q?yucfAopalY9XMecOEqqjwOYQjZs92Fp4+oNWf22rLd6feCA//7IDcUMtGfUz?= =?us-ascii?Q?aWpoNlH9p6AkvbOPXjFMObvZQ8j4sxepGLCw+00ff+g/s1lSvC7jv770uf1e?= =?us-ascii?Q?wEDfQlbEUOUWjRozbMNYvoZapaYXKcb1epPzDBAl5/3Q+e8zuUowo66Krci4?= =?us-ascii?Q?mHH9CbDLKi3VloDYvWqSBAGddLDv0myb4H77kHV8MRWYNa/sTSvjMievzrDM?= =?us-ascii?Q?JIRoZ3TwHgOvgPmLHFFK46+moqpGTyr3e0exDCDy5kSFK3Xx+HklD1Uby6xb?= =?us-ascii?Q?nr2PnjTK/hW05KfSe0YV7C4OtVEQMXJvDWHzImel8hAaiihArhdbl+p2WHf+?= =?us-ascii?Q?2QN6ZnwCRe05HOFnZKbzdK2ujjpPAFQHPTF8/b6u1QTnprwW1QLBAdM4NZ0k?= =?us-ascii?Q?6LuT4Bi2YrN8KWEnaK9MY57xnjKic5rz35uVJQrMNNpbqZ+PU2lHHAWviWpY?= =?us-ascii?Q?imKPFlv7D66rnT87DBwjp7CAFzYt+iGFFrTh/CSWVFNH+d+/7aCeK2Jle3Xh?= =?us-ascii?Q?ODclVuHTEL4unB44j7N5NNGUgZpm5gqbnBgwe0UrUfbFlUXxZ1eumw+twCjH?= =?us-ascii?Q?7oAPVbCGsi7JDZX6xSPuKrdDZKwWPGR2MLkRZDeNo6ZLarneLPgmKMrG5s66?= =?us-ascii?Q?TBXIyH/NDF4O/TA0fYxADubFSPPVUkXaTO+ntB/2gNZhrxfZgTtNoL6WKfoG?= =?us-ascii?Q?uIV3BDFfric=3D?= X-Forefront-PRVS: 03449D5DD1 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(39410400002)(39840400002)(39850400002)(39450400003)(39400400002)(4326008)(7416002)(3846002)(6116002)(50226002)(5009440100003)(5660300001)(305945005)(54906002)(230783001)(38730400002)(110136004)(107886003)(53936002)(6512007)(6506006)(66066001)(47776003)(575784001)(81166006)(8676002)(5003940100001)(478600001)(6486002)(2906002)(2950100002)(42882006)(48376002)(72206003)(189998001)(33646002)(50466002)(36756003)(50986999)(25786009)(76176999)(42186005)(110426004)(42262002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR0701MB2031;H:localhost.localdomain;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR0701MB2031;23:WJWMpGu+/zr9tG9wyO78KvipZ9jvGCckTuj8lFs?= =?us-ascii?Q?u0gspJcQlojmDF2NsiBv6wYd++7MixYMkgicVn+NIezlTGJkaKQTFwNKXSoW?= =?us-ascii?Q?5+MUMyBb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FlgNHVUsN9VTTcjebiWK67OlnZ2EsLxinBNH2+o5ZwcHam4VpiJ7E4W5QL1jOGg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR0701MB2031;7:h/XAbhWY5HzHt3fYuHwS7O9VKEUX7N/4e7ouHPFfIoZUHQiOM5GN2pQQJER4NZbVZAtxHkjyUxpUIYLalpsRLt67t9VyUQxA2p7qGbDwwnRVrrBknn6SugQc2DZS9VunYFMuRTRDuzVDK7lNq3cQ3l1hvwavJal7LY2zQE2zLg+DsKk/Sk6M3ti6AHOJsQGdDRz71kEUr8QArTe1L6TZprtsFkEJD8I3du8uZ8E0cm2AtnjViRmePK14MD/qbqiGxkZr4J33Wpsd3JkWovUcorPEWSUFM5q+w/DGw2QznpXV73zYKCe8fbQkEJhz7FIqI0pPyKFoPneR7cb0PvFyV5I5yqnL2B1TqUWrIWL/wNiOfh43iHlq28LIli9pZXqDeHhybDZu15SUC/1XBoRTbmCGCqYy0ImOjsSAaiQtV6ZMv3ekLL1hwLwRM5bOTqrAjpKL7wGIp6r7J67n1g48+ggohimezplwVfqpS8wAb257CI29uls+fDMDhLC4w4Zh6KXSopJ1+Hd2rjAOUHAzIbgbqLFLtojBHnL31tE+l6eWwnK7+GRDIn/xF21To/tbiTJRI4HrT6U3FXxPaLOTXmKUV6yxVSWcNm4/0q9I+nzqvNk/NHxeE6vl0rYJTXPPh8j9twVfQuHhfz+7xZkVNxd9IkTn7dQOoC3HUtnFe14qLylxLEy4+ZEcICHDKfFYirtWAl1SipPWu8sHTzqXIif+1e6j3PJKS5sEWnc/QV+9C/DW2qYQu4SJgSyRABMjLklT7PjVftkgbxn7dcLOrWWqxI0mgopR9yUUSwMBLqo= X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2017 14:37:41.5924 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0701MB2031 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5073 Lines: 154 From: Geetha Sowjanya 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 --- .../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