Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752479AbdHHMXn (ORCPT ); Tue, 8 Aug 2017 08:23:43 -0400 Received: from mail-by2nam01on0046.outbound.protection.outlook.com ([104.47.34.46]:55616 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752412AbdHHMXf (ORCPT ); Tue, 8 Aug 2017 08:23:35 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Robert.Richter@cavium.com; From: Robert Richter To: Thomas Gleixner , Jason Cooper , Marc Zyngier Cc: Shanker Donthineni , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Robert Richter Subject: [PATCH v3 4/8] irqchip/gic-v3-its: Decouple its initialization from gic Date: Tue, 8 Aug 2017 14:22:54 +0200 Message-Id: <20170808122259.6299-5-rrichter@cavium.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170808122259.6299-1-rrichter@cavium.com> References: <20170808122259.6299-1-rrichter@cavium.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [78.55.120.224] X-ClientProxiedBy: AM5PR06CA0030.eurprd06.prod.outlook.com (10.167.168.43) To CY1PR07MB2346.namprd07.prod.outlook.com (10.166.194.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d94e539-df1a-4bbe-3b29-08d4de584903 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:CY1PR07MB2346; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2346;3:4Q1loN+MI56drPrJNZLAoBtfn18AOjSfS8ysv5RHApt0xoqHpZ/jV0VZ91NT7Pu4GyKblqgQlBjD6C9ySn0qnt53di/Jqnn4U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TdqMIsxhGHd/1iKywJAHNS96mMWxnZQ7ScxNok6PV0y7fegqueSLiiA3TQpKCwu1sBAJtdf05UQjChGJQPC3o8IV/JwhmRnCrXXtAecfw1WxaHCDWLMtG/D23aBQiup0/suNTb/r7QPF0TpA4c7zAqnIxqsXwZKVWtF7zU6pF3uqx1P0i+ANYFsAcx5MrXzOiu/F8iOdv9YdHb3/7FFe81/VwfmifD71IUqswUIyVBSAtg90;4:UUjEKMJcAdQ2605homthby/qhHCtgfhig4ZkQyy7geQArBBdSVw05Y6oewgv8RA9Gfmtnr3fnCKqxA8SSPTvy8VYELH9l4dZhCGgmJiE/8avr09ZM+Q1fVq/ROJLlAvT7dKioUeKXhBjN+9DjA3JSo/5ks2L5mMkbPYGctxGRrVuiQyQDmEHsqG+AdqFA8HZOLjLiMVFGnaTOGTQsUNrbLmbWKkadIVDijHn+9JWtFRfkG2mJfVoFj4qErF9OQe0qB4Q86J0+rCHSaHhy+IarimfAjIFGF1QznCV3hZvklE= X-Exchange-Antispam-Report-Test: UriScan:(192374486261705); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(93001095)(10201501046)(3002001)(6041248)(20161123558100)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:CY1PR07MB2346;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:CY1PR07MB2346; X-Forefront-PRVS: 03932714EB X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(7370300001)(4630300001)(6009001)(39840400002)(39410400002)(39850400002)(39400400002)(39450400003)(199003)(189002)(33646002)(66066001)(106356001)(68736007)(2950100002)(189998001)(54906002)(6116002)(3846002)(97736004)(72206003)(6666003)(81166006)(50226002)(6486002)(25786009)(5003940100001)(107886003)(38730400002)(4326008)(305945005)(50986999)(101416001)(5660300001)(42186005)(81156014)(230783001)(2906002)(7736002)(6512007)(36756003)(76176999)(1076002)(105586002)(7350300001)(6506006)(48376002)(47776003)(575784001)(478600001)(53936002)(50466002)(8676002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2346;H:rric.localdomain;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR07MB2346;23:x+XPJ907UIloGXSwn+opAwGjMpubEZzJpVLrY2QqV?= =?us-ascii?Q?YFGB80Y5T9ldtHpGIwQpT6QNI7rqiAqT+RmIv5oXN2BOoZG+lB+IOwElZT0Q?= =?us-ascii?Q?RQkNUzUYjNqdOcybVVQMGtECoxzuSXQVIFJUPU6ZROH2qfYkrlvnuIeeKbdJ?= =?us-ascii?Q?o9B7MTo5r5pifnu9R4fUuK6KYElwkFsqT+76IAfZFo4KB6IwNwFNiBhhWU2j?= =?us-ascii?Q?p9koeBE5IC+fYnvjtL39sAyg2VpYVKMiHCQObxnZSMPu5KvwRqy9/uc775pT?= =?us-ascii?Q?Y3Aw7OnY3Hwci5dT/sk6FDwofvGZmRS8MCl9FZWS0tHdik+c38yQjqEJrwOC?= =?us-ascii?Q?SUeOIqQrURZJ2Gmr2xTgDc3FwvT4D6X4gEpH7epIrQI50daUyP+A0OEhgHcW?= =?us-ascii?Q?5oP7C/uYEaM+TEvr+7SJkA7JFbn9X/Ywd4VrJFbAvZtP0ZgdeXtHyMN4Gu8f?= =?us-ascii?Q?jIJXAnx0A8GwzOwwwDXlS/JK+Zk+TBVNJlfseBW6qgSdJMGPUqGDC/6tT6kK?= =?us-ascii?Q?L/BblpDCOyXKGpKUHKxQMXl6nIKtUHNCe3VUgwBk3lj2qe8s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qeWcEcu98HEhODZpJPm9AXhPWXjoMSBZVV5N0/5/q9FC8zNa20lq+DCH4N6/EZ5LLCf4A9BmXNWVzSEmfWmsiDSKC12jlEXA9SlLKmxVHP4FF+1GbYVJ/c7YBZ4klcoBJr/lcpVUrjfH4/rxd+Lz2/2vtBH8fulfCziKGRb75OgC0ZbMtFyS9xKVVdGKL2ZEzDXAQn8YI0x76aI2tftrPuiHrr1+m+esmdBQrHR1bfztcBbHlcQ==;5:jHB+Bs7LxZAeSogathcjxRSVbrVI3NcD2hal+suNqLLL6wHJTw5QQwrl1lb+WYYP5GmwW5DKx+gAxsjBOgGTgGrtbhy/8//fRCRMZ0MJD73VgvFVp1IvxpySH1xPYfslaxz2+r65DhYx1DEcC4Vrdg==;24:raCkSC/HF3ATyfRgw2nFblxJG8qac4WhveNPg/dQTDmIEEx99YJtpv/0UCoqyNyDGue/REJIqJ/YglqYreHxOX4oCSsGIl/5gc+EfZd26sY=;7:hTKYnpbDuj9XCR9W4b5Yv+AU25Ubz41UNcxNQFPtozufW7kT+N55BPUUQfxTDLA6hZtQKAYaojL5g6m4F42TSFNTdhH+Mt7UXnUkK/Emj5P1Yq7Pea2eMoqOyasc7NlPTm+0XHXKhZE0vBSPHCC40WDDr6+rM+w/w6Duke+6bcdjop+cno8lkL3Dl8/Ev9EkQlwonMMbLOvK33cO0rQ03zY4rIIQA4RgFPzEyQ5xu2c= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2017 12:23:31.4206 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2346 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5085 Lines: 192 This patch separates its initialization from the gic. Probing and initialization of its nodes is separate now. There is an own cpu notifier for its now. Signed-off-by: Robert Richter --- drivers/irqchip/irq-gic-v3-its.c | 61 +++++++++++++++++++++++++++----------- drivers/irqchip/irq-gic-v3.c | 11 +++---- include/linux/cpuhotplug.h | 1 + include/linux/irqchip/arm-gic-v3.h | 2 +- 4 files changed, 51 insertions(+), 24 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index b51a1208588b..5e2d4f2876d8 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1676,20 +1676,13 @@ static int its_init_domain(struct its_node *its) static void its_free(struct its_node *its) { - spin_lock(&its_lock); - list_del(&its->entry); - spin_unlock(&its_lock); - kfree(its); } -static int __init its_init_one(struct its_node *its); - static int __init its_probe_one(struct resource *res, struct fwnode_handle *handle, int numa_node) { struct its_node *its; - int err; its = kzalloc(sizeof(*its), GFP_KERNEL); if (!its) @@ -1709,11 +1702,7 @@ static int __init its_probe_one(struct resource *res, pr_info("ITS %pR\n", res); - err = its_init_one(its); - if (err) - its_free(its); - - return err; + return 0; } static int __init its_init_one(struct its_node *its) @@ -1816,7 +1805,7 @@ static bool gic_rdists_supports_plpis(void) return !!(gic_read_typer(gic_data_rdist_rd_base() + GICR_TYPER) & GICR_TYPER_PLPIS); } -int its_cpu_init(void) +static int its_cpu_init(unsigned int cpu) { if (!list_empty(&its_nodes)) { if (!gic_rdists_supports_plpis()) { @@ -1983,8 +1972,6 @@ static void __init its_acpi_probe(void) static void __init its_acpi_probe(void) { } #endif -static int __init its_init(void); - int __init its_probe(struct fwnode_handle *handle, struct rdists *rdists, struct irq_domain *parent_domain) { @@ -2004,10 +1991,48 @@ int __init its_probe(struct fwnode_handle *handle, struct rdists *rdists, gic_rdists = rdists; - return its_init(); + return 0; } -static int __init its_init(void) +int __init its_init(void) { - return its_alloc_lpi_tables(); + struct its_node *its, *tmp; + int err = 0, err2; + + if (list_empty(&its_nodes)) + return 0; + + spin_lock(&its_lock); + + list_for_each_entry(its, &its_nodes, entry) { + err2 = its_init_one(its); + if (!err && err2) + err = err2; + } + + if (!err) + goto unlock; + + list_for_each_entry_safe(its, tmp, &its_nodes, entry) { + list_del(&its->entry); + its_free(its); + } + +unlock: + spin_unlock(&its_lock); + + if (!err) + err = its_alloc_lpi_tables(); + + if (err) { + pr_warn("ITS: Failed to initialize (%d), not enabling LPIs\n", + err); + return err; + } + + cpuhp_setup_state(CPUHP_AP_IRQ_GIC_ITS_STARTING, + "irqchip/arm/gicv3-its:starting", + its_cpu_init, NULL); + + return 0; } diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 886e70ab2159..1476ce12b3b8 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -536,10 +536,6 @@ static void gic_cpu_init(void) gic_cpu_config(rbase, gic_redist_wait_for_rwp); - /* Give LPIs a spin */ - if (IS_ENABLED(CONFIG_ARM_GIC_V3_ITS) && gic_dist_supports_lpis()) - its_cpu_init(); - /* initialise system registers */ gic_cpu_sys_reg_init(); } @@ -675,7 +671,7 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, #else #define gic_set_affinity NULL #define gic_smp_init() do { } while(0) -#endif +#endif /* CONFIG_SMP */ #ifdef CONFIG_CPU_PM /* Check whether it's single security state view */ @@ -1171,6 +1167,9 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare gic_populate_ppi_partitions(node); gic_of_setup_kvm_info(node); + + its_init(); + return 0; out_unmap_rdist: @@ -1460,6 +1459,8 @@ gic_acpi_init(struct acpi_subtable_header *header, const unsigned long end) acpi_set_irq_model(ACPI_IRQ_MODEL_GIC, domain_handle); gic_acpi_setup_kvm_info(); + its_init(); + return 0; out_fwhandle_free: diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index b56573bf440d..6b2fc0e22efc 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -78,6 +78,7 @@ enum cpuhp_state { CPUHP_AP_SCHED_STARTING, CPUHP_AP_RCUTREE_DYING, CPUHP_AP_IRQ_GIC_STARTING, + CPUHP_AP_IRQ_GIC_ITS_STARTING, CPUHP_AP_IRQ_HIP04_STARTING, CPUHP_AP_IRQ_ARMADA_XP_STARTING, CPUHP_AP_IRQ_BCM2836_STARTING, diff --git a/include/linux/irqchip/arm-gic-v3.h b/include/linux/irqchip/arm-gic-v3.h index c4f9c968728f..15cbedbd82f1 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h @@ -491,9 +491,9 @@ struct rdists { struct irq_domain; struct fwnode_handle; -int its_cpu_init(void); int its_probe(struct fwnode_handle *handle, struct rdists *rdists, struct irq_domain *domain); +int its_init(void); static inline bool gic_enable_sre(void) { -- 2.11.0