Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751562AbcDOVDf (ORCPT ); Fri, 15 Apr 2016 17:03:35 -0400 Received: from mail-by2on0084.outbound.protection.outlook.com ([207.46.100.84]:36875 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750896AbcDOVDd (ORCPT ); Fri, 15 Apr 2016 17:03:33 -0400 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 v5] irqchip, gicv3-its, numa: Enable workaround for Cavium thunderx erratum 23144 Date: Fri, 15 Apr 2016 21:30:05 +0200 Message-ID: <1460748606-28390-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: HE1PR02CA0049.eurprd02.prod.outlook.com (10.163.170.17) To BL2PR07MB2338.namprd07.prod.outlook.com (10.167.101.16) X-MS-Office365-Filtering-Correlation-Id: 583e49ae-1704-406d-2ed6-08d3656465b5 X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;2:QNbafOFPBJenKzxqjbyPM8Pjmx2N1dzAaD/Uci0+JtqUN5jQXenCzGmC199wjJ++hCy1JNeCSf8QNRkrJ0YqBzHMrqQWacTfyZQIuwG5ZUZv4wpgMqfrq1HQjVEwo4Bh0jE4hTp9voyzZSD1mlyr3L+9fsAX8GGAO9tUgTfUiY1/slNNOPg7B/9nE+OK5AFv;3:ZXOiD9i4OBXu8Ufx5+USMu6oK/9LMqN7BqN0fs3q5nGNIh3LYxibIusfwbZ4UqgigbKz3GLgZBxBEMlUCmzz+Yrxlz5b4DQ/xibaTiLHwwmjJrgt+ohXF20gxUWNoBnO X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR07MB2338; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;25:C+Oq2hKzqi0FsMMT/6TsUoU/yxNLQHhB6SaZQDwOxeRUqZSmnDGDX3jbBoR8sAoyAigIqPfgUv2r3YGEuBftseSiZj/vxuKmSGAeKKX4RVqKNJDM8p+Q+IdYl8prT6EKcV5m9I+89+lzlQtblFVY71uJS6EZuCUkCe5VNln2abOi25eTLy7RP/GMEqsz3VywL+CUannvrqImukypsitu3Gnu3pSwdL8T0NyYjm5d9RU5d/X/ZuXcPauksuYEFWV3Zb1SkEB/JkoSeUQPmLID6TpLDOzoWchJ7SscKHLh3ijGvaB/H5IyHJmtNpj9uvM1zP8FqmSXf8iktSQlJv+KCAoUQdsvalQSWkjuAzFLBozKom9ItoqLa+jt/OPzhP1D34W3nQHMhOPXE9NSX26AT8JK+gIZLeik5VDLvhoPJzW51PEYEaPX2ERhpL6bp3H5V7bEu0si84KKAetxPFidjSqRqP7Jb+r7Ag6Gys30GcO4hXJ0TpR7+VdPkiAtv4dnrmU7ii8WQkLsZzKDUB8NilzOfAqksTtNkiKpfXCw6c7EwUfkxBjGNSp+aXsJPJgq/Gr2IVNcpILUvg5WPdmp8vR2BdBIhVdn8MuJpHOj/6xCPq+E8arxevO1xORiWXojGrP3yz6sxzXOrfYGKFjXSeP6pMyLKUfnKc6gIfc9g594zoDBQIKUka59cb/uja1FJnBthgqjpmwd+QWJDyefDOQ3f8AJ83ogQTp4DF+OoDw= X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;20:f1JvRFDVSDOVH5Tz5U5glIMalPsyZMw8FrHdFltz4CtB0RfB/j8HSQfl66rac3qcIAz7koz+D8f/Ceba8p01oyKRRuqQkTzhPXw7hpJv7jEGklymQB5gYdZtgDJIL5hDT1w94GcSEJ0VD3qZ4oEl1VJCdGmxkdlGmoZJj07chguBkhHp0Q43AvZmA0HzdkGnm98OsCm4NBizfBE0IAlOtIGRKmtTNccQH28ffCVgWjw/QNA/ywvdQ7Onv5FiQblLVnMHgMQzufFAw8sHEhqPrNb5WwCPBtfriozUlUob5kxwqNWLj6+MxoeohTBSlBly2HL/Yz2T/mFRAwzpP5H7SYf0aR0nAVcnUrzyZI6XRE8PrjRkcIE+dlf4YleqW/NTOPaekPazWEod9I5jPHfdDIP2QS0DiboP8bOh+CTAorhIJe+gq1vG1JqDa4jdBoy/MH1OUdeUqeToke9uIA72wVS3/yhAGKiQUcbgklHwDnguTrld5LkZ/J0eGygFyRiYXNopoC9bmKAdbDvhcUagrgQNwE0b/luswvIO5QIUQA2FX1YXgVv3tar2sio1IOVxd5gwhJXzroRUaXQB6SxrJXnpt1jpAqzWZNJwMRNEiNs= 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)(3002001)(10201501046);SRVR:BL2PR07MB2338;BCL:0;PCL:0;RULEID:;SRVR:BL2PR07MB2338; X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;4:ZARDqlAZfRWJUu97kAXWUpp7BVeUQpSwYgbpFFQ9toBij1BywPyb2IxjelRIkltrZLJ+kXHOuQUD+1BTSblvLdzLqNJtcDin9trvFi7NOk6w9peoB5CpAMWP/BW7LuZ8sNIyFkLlIZrqVXbrTbEdIOiTDum1HSjzHj0IIZi6huxzW9RAWc4CYOADVkU5FnkY7kT+YGCe6gPOi6hIjfSXWzQ+wnR8MT50aPuAOGx99puoN76YlyhG6r6hmW/5m+uWXKorpKNONueewfNKqMhIkflxE9q4rng9nQNbj5bRTKqwSpHic55Kgcj0tQgg/nKM5A2GxHFZJpKRakJOyvDBBImMSZfB7+G2avhdt3nHFLzJYf7YOZzVkmyM6vbrddz2Cuf21yQHmK81IxvDnRq4JA== X-Forefront-PRVS: 0913EA1D60 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(5004730100002)(33646002)(77096005)(36756003)(92566002)(575784001)(19580395003)(66066001)(325944007)(19580405001)(2906002)(5008740100001)(15975445007)(50986999)(47776003)(1096002)(6116002)(5003940100001)(189998001)(4326007)(48376002)(586003)(81166005)(5001770100001)(3846002)(50226001)(229853001)(42186005);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:ntLfon23FhlrFofqbtuTAs+S+PdVWJbzuxLv6EHMe8tK0zhrFses3XlSuntCBvN0QVL287Miv4uA2z7cDdD6o6/7gcYD9I+hG4xH4Wz7USuA8NIawCooWNdU4CZe+hS1aQ8hQ93MKlPgDsFuKQR89BlWbnDHW1AVZo156HR0Lt9udpUFvLGsShqGgI0VdaNkYurjE8LMBsOeIFlAC5EevV0tnXnn9Zx6YiCC7G9O2eORhiReY9DOUALiFO3FxyRrQzATLniuTJXzbiuic/xvZtgFuxgd/mv1B6Er0StCCnEKiS2SHNV8QT2e68XSys7JCMsiaC1Pifqt+RBwAF3DjMR9uRRkLAN4shdqu24cJvjPvhUKRKntcGtLdK3OwP0TMa1owDPo27+vPdS1ayIxnRFGqQh5s9sDTKzmqMaNIp0FkCZQaUbEelp48W3TaIu040EMnUrQbLoJAF70bbHNgsBYih7x2E8QduUY1MmZwf9rdGe6jiSLhDsFObIuzPhmx3gdgsWwWC44qZV/SKuVJXHAPGYuOUy759Zd9aV0P/4jkX4T9grGqGfmPhueQB8WaDTmHLNUNqr1oVIk2SBKqfLo3HbqeIvjLcdWmqFj4pczmw2qVoTy7AiDmMi0842FKsn0xnrg005Mh4Sgqlk+TvfCOMeEOHSpdSkAfCl4fnpNzwY/LckX6IsEN6TIRO6CZYW7yG1uB4mQrgaaDISn/70z7d6aEsL7wUtAGaa943PrxB0ldYbAfWhzSuzFu99sqyZ2W5W+RZ7CLO9iSWNRbsrQkFQ51M2JKFIOtrW6mBB/IZSo5IaB+D83so8dIZ61HsjVwRS7FD/b9o5PpUYhgcy96nTlqxob+kT5EecKyN0= X-Microsoft-Exchange-Diagnostics: 1;BL2PR07MB2338;5:9lcQNgMFNHw39QZAei7BoAkw5zndcBZIiHtelTpXuN/val3AfcSduRx5aKROkGk61wo9T8HS/hCgHqvvSPzuopzqJmhdDHvP0funq9M/azEFDF5JivcjfFh+8ggy51rNKtCIbeQB9wQghThQEowJ7Q==;24:q7san0iyXGyi+d06PZeu5DtzxWFnT1hZIxgskk/Xjy976DRmCmLkCeWi6r39Qfn9No4hG4p5gl8mFef4vftBsyRq3qcFjVU4Z1Q7H9TMQg4= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Apr 2016 19:30:23.8514 (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