Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932291AbcDOTuk (ORCPT ); Fri, 15 Apr 2016 15:50:40 -0400 Received: from mail-by2on0073.outbound.protection.outlook.com ([207.46.100.73]:15968 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751139AbcDOTui (ORCPT ); Fri, 15 Apr 2016 15:50:38 -0400 X-Greylist: delayed 356 seconds by postgrey-1.27 at vger.kernel.org; Fri, 15 Apr 2016 15:50:37 EDT Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=caviumnetworks.com; From: Robert Richter To: Catalin Marinas , Will Deacon , Jonathan Corbet , Thomas Gleixner , Jason Cooper , Marc Zyngier CC: David Daney , , Ganapatrao Kulkarni , Robert Richter , , , Subject: [PATCH] irqchip, gicv3-its, numa: Enable workaround for Cavium thunderx erratum 23144 Date: Fri, 15 Apr 2016 21:15:34 +0200 Message-ID: <1460747734-25833-1-git-send-email-rrichter@caviumnetworks.com> X-Mailer: git-send-email 2.7.0.rc3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [78.53.83.138] X-ClientProxiedBy: HE1PR06CA0056.eurprd06.prod.outlook.com (10.164.28.152) To BL2PR07MB2338.namprd07.prod.outlook.com (10.167.101.16) X-MS-Office365-Filtering-Correlation-Id: e1ee14ab-dc84-46f2-0de4-08d3656265ae X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;2:r818rYYFD0wJjgrvi49VOpG7HJBDcYSMuFDolpBgfSqIjW+V8M2GgkqBQS3SSVCPjW6ePfpxLGWC0CWq7rgaOd5z4+5Useg25SdvcbeCifSUHM3l4hzw+9CCZk2ywAXcETlxAWg6ePYNsnDugbmpTabZj2DCEjN6ZK4jQ88kkGzfB8oQdO5TXBH31uEXlawm;3:gagZ54gMvHzGnSHB1vYY6hUkqNr3V0VuWvEw+m3AF0PBCAcxYnJRnEimB/M+0C6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KdVU+KOLmuQMRvYTa9Q2zQXXD4JlmPK6omIJntPu0IiNqbHMzh1G7veWMHURA259DS3c9VG4s7biKGrdC5fSEm7bJ/MS3dpQFHVViqEoQwdaNXdhHwehPS480h0Y96OxDi8VDCGNGF3ya5vTdgI83x0kyj7XrlD2lBfc+hoUJtQ4neC/Iz22sM0aXELV/lVQ1IjWYD4AoSglN8DZ+0CisuW1IjVUg5Gysiax0POd1A4u9bAej3GmIUzj0gkm4rPIG7KbshlCUfnITt7i5XKWoR5eOi4npqOwJsaN195rtInCxuGovSDSLnNw4Geknn5JY6ljWb01Zj3HFhHZiK5JpV+I4la3PYFmkATU3IxUMzx3LSbL5+LNMH8X0PW9JGgchrfxORdA3hX2OynRHNh0NbwbQC7ufTuWqjOp7gW4iX8YttuieCJ3UpFoqkVjWzsfXfXIYdnvbjiRH6w5j1Y4GbqowC0CUOdXDXELQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(9101521026)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:BL2PR07MB2338;BCL:0;PCL:0;RULEID:;SRVR:BL2PR07MB2338; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;4:QQ2AAhwsFy0qKoPOoFbCJPoPKW4N6VgJB00zeJCm8AZ9KZ9W0vNlH+qXAd8NbL/fhkr3uz8wVvYpbVc5e9nLQi7uSrN+m4gxXyRyaPw7X+QwzYT29fhInd6bzn3Q+ovNAM+iUvpHDdzlfOuBCaQ9OlbuniADnjdfqRmS8XciNWAZ+1KFhWsvgMPPha8ZKKjLod6qxhCLMbB6xdxPorD9ws7F3qWgFH7c1VRraIxW7299ZFLnYRXR1E25pfypd55TZWFWoT7DSwpcii0Wsbk8BSgXDE4l/oS8aRZiAjIq39/kLHrAb0Gjr6h7Hbcawuq1x8+WtYCQxh3EBcyvO+IXozWlHB/GIM3fDA3eXF64OiXtWjMPNcLUkCj32mBkjZrKLq0NYSIjofiecTzP/TQ0Sw== X-Forefront-PRVS: 0913EA1D60 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(586003)(81166005)(4326007)(48376002)(50226001)(3846002)(5001770100001)(5003940100001)(1096002)(6116002)(189998001)(229853001)(42186005)(575784001)(92566002)(36756003)(33646002)(77096005)(5004730100002)(50986999)(15975445007)(47776003)(19580395003)(5008740100001)(2906002)(19580405001)(325944007)(66066001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL2PR07MB2338;H:rric.localdomain;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;23:AVj4ESUsBLvoVzJirK+Z7hR0mba974NFMninv2Z7xY2g3rTzGhzarT2Tqfpuadh56ukBRT2YlDlC+jL+uO7f44gurmnLPtpAwJl1YDOcThhCcnOyED0rXyeGzqt1zb3j5fOlLlwbJoGQ1n+9uewgBTy3pPfJGS2IsbwM+hrMNjWGRYFVwFetrkE8XXyOGzXhwNMoLzVah8l08WxrP4MR8KlVwVJML+CuevCQJyIrVe4/4ul9IQn5OdJ9WQzYOfGEneXWj03o7gFF1F/hAp667vKetNQXYcPaxWOhFF1+HNTbfXAklsZaqXdM32Ls33wpFFYQo6CbiFq0HsAl3K7/5ksowpL/MUxIiGAJ35eMHbrNncCi5qPWoG+Sv+ZeU3dxEAdisNFXwh6a9+EdCi9EnifY9qWT/hHb+ZGeMWtWS8c9APGVdo5X1wUuK+UQt17nIu8Wmp3QEpd6gv1Q3jgt+vAHacitcuhebUKgBl6YHVqjYKD1Fo+I6gqvLv86y+4Y7/JV2fvMgxPRcnZdcjPeLnF6zlJa1UjPQQz3xPNXWuDcJIkqq213XXdoNlT0QDp/9Ex9CaHywiH2gmW6LJ/LrPihizuTZ7xvsFDZ8026RnmyF9s4AMxXbvF9zwrWerskvQGI9SJZ+lk8Yk2Ii7/+HB6FipEvc/lrwcgT9k19CImGQamV5AdATtf113h7cgnUgHrNRsknJIR5W1VuNmcBRxkBrAaxANGzBuCgOwRtGYTLo6gCPFzCRW/Ycg9ZNE8/GHEZ8nD6MkkLSOgDGjSDpa6QEggHYdAFzA/KbPRjmCHufGsbnZ+GvEYI/DOsiFZL/uS1JlDBu/B0q9rVidZJ1/csM7IzAV9Yal4ww9g1VrA= X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;5:aTLp+Al3ylB/mxOs6p8AigkVoCUM2gfAtOStmmpZEMH5cmP2k+7B87Dy7xDeA3hFsj449FNTbo09v4SFXKqYfNC0p5PzjsEh5aG/FR66Rq2Qt5YzPNFTQmpC4AcKBIgHPScJUT0WC5hiQ4prbvgHpw==;24:YHFeAjo6BlUuk77BVg1RPKVWtQP4mg/umif8M4VGurp9u+hYSv04K7PD3uo/t9x0gp/RT4zmk3T2A0sjtc1sDZ3FLV96fJlGBIQrU/RVxFk= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2016 19:16:04.8519 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR07MB2338 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6124 Lines: 182 From: Ganapatrao Kulkarni The erratum fixes the hang of ITS SYNC command by avoiding inter node io and collections/cpu mapping on thunderx dual-socket platform. This fix is only applicable for Cavium's ThunderX dual-socket platform. This is based on NUMA v16 series. Message-Id: <1460155828-8690-1-git-send-email-ddaney.cavm@gmail.com> v5 (by Robert Richter): fixed use of cpumask_of_node() only for (node >= 0) minor style fixes v4: updated silicon-errata.txt updated as per Robert Richter review comment. v3: updatated as per Marc Zyngier's review comments. http://www.spinics.net/lists/arm-kernel/msg443462.html v2: updatated as per Marc Zyngier's review comments. Reviewed-by: Robert Richter Signed-off-by: Ganapatrao Kulkarni Signed-off-by: Robert Richter --- Documentation/arm64/silicon-errata.txt | 1 + arch/arm64/Kconfig | 9 +++++++ drivers/irqchip/irq-gic-v3-its.c | 49 ++++++++++++++++++++++++++++++++-- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt index ba4b6acfc545..ab19e709d05e 100644 --- a/Documentation/arm64/silicon-errata.txt +++ b/Documentation/arm64/silicon-errata.txt @@ -55,5 +55,6 @@ stable kernels. | ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 | | | | | | | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | +| Cavium | ThunderX ITS | #23144 | CAVIUM_ERRATUM_23144 | | Cavium | ThunderX GICv3 | #23154 | CAVIUM_ERRATUM_23154 | | Cavium | ThunderX Core | #27456 | CAVIUM_ERRATUM_27456 | diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a578080ae7a0..40efc0e29d62 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -426,6 +426,15 @@ config CAVIUM_ERRATUM_22375 If unsure, say Y. +config CAVIUM_ERRATUM_23144 + bool "Cavium erratum 23144: ITS SYNC hang on dual socket system" + depends on NUMA + default y + help + ITS SYNC command hang for cross node io and collections/cpu mapping. + + If unsure, say Y. + config CAVIUM_ERRATUM_23154 bool "Cavium erratum 23154: Access to ICC_IAR1_EL1 is not sync'ed" default y diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 39261798c59f..75f258fbf1d0 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -41,6 +41,7 @@ #define ITS_FLAGS_CMDQ_NEEDS_FLUSHING (1ULL << 0) #define ITS_FLAGS_WORKAROUND_CAVIUM_22375 (1ULL << 1) +#define ITS_FLAGS_WORKAROUND_CAVIUM_23144 (1ULL << 2) #define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0) @@ -74,6 +75,7 @@ struct its_node { struct list_head its_device_list; u64 flags; u32 ite_size; + int numa_node; }; #define ITS_ITT_ALIGN SZ_256 @@ -605,11 +607,23 @@ static void its_unmask_irq(struct irq_data *d) static int its_set_affinity(struct irq_data *d, const struct cpumask *mask_val, bool force) { - unsigned int cpu = cpumask_any_and(mask_val, cpu_online_mask); + unsigned int cpu; + const struct cpumask *cpu_mask = cpu_online_mask; struct its_device *its_dev = irq_data_get_irq_chip_data(d); struct its_collection *target_col; u32 id = its_get_event_id(d); + /* lpi cannot be routed to a redistributor that is on a foreign node */ + if (its_dev->its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) { + if (its_dev->its->numa_node >= 0) { + cpu_mask = cpumask_of_node(its_dev->its->numa_node); + if (!cpumask_intersects(mask_val, cpu_mask)) + return -EINVAL; + } + } + + cpu = cpumask_any_and(mask_val, cpu_mask); + if (cpu >= nr_cpu_ids) return -EINVAL; @@ -1090,6 +1104,16 @@ static void its_cpu_init_collection(void) list_for_each_entry(its, &its_nodes, entry) { u64 target; + /* avoid cross node collections and its mapping */ + if (its->flags & ITS_FLAGS_WORKAROUND_CAVIUM_23144) { + struct device_node *cpu_node; + + cpu_node = of_get_cpu_node(cpu, NULL); + if (its->numa_node != NUMA_NO_NODE && + its->numa_node != of_node_to_nid(cpu_node)) + continue; + } + /* * We now have to bind each collection to its target * redistributor. @@ -1317,9 +1341,14 @@ static void its_irq_domain_activate(struct irq_domain *domain, { struct its_device *its_dev = irq_data_get_irq_chip_data(d); u32 event = its_get_event_id(d); + const struct cpumask *cpu_mask = cpu_online_mask; + + /* get the cpu_mask of local node */ + if (its_dev->its->numa_node >= 0) + cpu_mask = cpumask_of_node(its_dev->its->numa_node); /* Bind the LPI to the first possible CPU */ - its_dev->event_map.col_map[event] = cpumask_first(cpu_online_mask); + its_dev->event_map.col_map[event] = cpumask_first(cpu_mask); /* Map the GIC IRQ and event to the device */ its_send_mapvi(its_dev, d->hwirq, event); @@ -1409,6 +1438,13 @@ static void __maybe_unused its_enable_quirk_cavium_22375(void *data) its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_22375; } +static void __maybe_unused its_enable_quirk_cavium_23144(void *data) +{ + struct its_node *its = data; + + its->flags |= ITS_FLAGS_WORKAROUND_CAVIUM_23144; +} + static const struct gic_quirk its_quirks[] = { #ifdef CONFIG_CAVIUM_ERRATUM_22375 { @@ -1418,6 +1454,14 @@ static const struct gic_quirk its_quirks[] = { .init = its_enable_quirk_cavium_22375, }, #endif +#ifdef CONFIG_CAVIUM_ERRATUM_23144 + { + .desc = "ITS: Cavium erratum 23144", + .iidr = 0xa100034c, /* ThunderX pass 1.x */ + .mask = 0xffff0fff, + .init = its_enable_quirk_cavium_23144, + }, +#endif { } }; @@ -1480,6 +1524,7 @@ static int __init its_probe(struct device_node *node, its->base = its_base; its->phys_base = res.start; its->ite_size = ((readl_relaxed(its_base + GITS_TYPER) >> 4) & 0xf) + 1; + its->numa_node = of_node_to_nid(node); its->cmd_base = kzalloc(ITS_CMD_QUEUE_SZ, GFP_KERNEL); if (!its->cmd_base) { -- 2.7.0.rc3