Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932418AbdCFPlg (ORCPT ); Mon, 6 Mar 2017 10:41:36 -0500 Received: from mail-by2nam03on0083.outbound.protection.outlook.com ([104.47.42.83]:25139 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932300AbdCFPlZ (ORCPT ); Mon, 6 Mar 2017 10:41:25 -0500 Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=cavium.com; From: Robert Richter To: Marc Zyngier Cc: Thomas Gleixner , Jason Cooper , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Robert Richter Subject: [PATCH v2 4/8] irqchip/gic-v3-its: Decouple its initialization from gic Date: Mon, 6 Mar 2017 13:57:35 +0100 Message-Id: <20170306125739.19445-5-rrichter@cavium.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170306125739.19445-1-rrichter@cavium.com> References: <20170306125739.19445-1-rrichter@cavium.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [92.224.60.20] X-ClientProxiedBy: VI1PR0501CA0018.eurprd05.prod.outlook.com (10.172.9.156) To SN1PR07MB2351.namprd07.prod.outlook.com (10.169.127.17) X-MS-Office365-Filtering-Correlation-Id: 5eee2f7b-b9ad-4840-9b8d-08d4649080f0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2351; X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2351;3:Sy/Cv+gVd8gIPcwlIWStNDHHvuZLtOWm1p0J5mVQU+NlA1qKf7swvamN3+f7qXuo7VJrH1VU68RtwC1CnIG04twOB2kG0Kshs4VlMw4bGlwUqrJNmAU+kwqv6/rkeMQpWE2do1WG5RDUikuNqjhclGk1GfYDc/Amddz02RDEFG8zk7YXt598Sn1sb2efoZIXXzmPI40uosINK2jYZYZwMh5TqS/EaXdyiadZZMn0ra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FOZ/ELLDrkQMowlqKzLk/l7gwhQ0ekkAHIyH+VnFCrEcAAzx3+jwJuHN7wDwiXqA3TsN0Ua/TyZmDXncXcENgEtLTJ0dmdJv6VMBRcFOcvjzLHNcM04PFUyqqPhGaxD14FT97vVffdYlZJT0PbusJuuZiSMC7cUN1t5eWcqtWZm4rC2UoU5Nf8XDiYqIWOdBKg6Xs56CveSDv62w7xKvoNsoEGrCdM5Uwyl7jJR8oUhvU4T X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192374486261705); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123562025)(20161123564025)(20161123555025)(20161123558025)(20161123560025)(6072148);SRVR:SN1PR07MB2351;BCL:0;PCL:0;RULEID:;SRVR:SN1PR07MB2351; X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2351;4:xUgptkWKbsjmwLQdMFV1J8/X+VJB4X8yWQGEcKY4GEqg6lH6GPMt26WauIWILxsirG35scGSHWhdgX7Epuptvu0Gx2IlCc03gYbxILFg/uiau67wyaA9xidHeD++EgSB3Z8Mry+wZtlGSOe5LqLwpUbFkA+iSCOTW62agOmaeLzxuTMzeP9uwAg3/Q00+QNp+pbNHRMqwNhjmf8mVlqh7t14kivYf6GrVYEzusqrwIxSEbHT10hbyRE4RCSx9c8VKS/9fEoVQzN1+oo5opule/MvhmdMDuwe8tKqkz1zPQSqu+Pg/H00JpelFTDyQvI5vwv6kNE6bHc6CJgTWlXjybTBtwQsjKgvWk8sM4oI6fiYs4RhzwQhDXqwfGgPdUBh03lc5RD3ioYZX7uctM0wEjGWBEJPAYOzBH1ptVZiknA54XSZ8wGtw/xK8qdvQ/Zxm5pS7qIhnH/ovz+dP6nZWUMbOd6rm3O1wVjWr0HqupiuQfBw+QTlsZC7D1QuWN1MlY/pZqWoEhtBRrISWPxEiL8SRq1U/6nMFBE1SJfzLOCLKcHqabY4eMdSruYl6FlulYEIF3e0QmboD/Le0Zei6l/W67P9+1UBNE/4/zNkdZNb7e6BgSuDnYXOkzL/vyE3GHn7R52hK7n00R7zolNx8w== X-Forefront-PRVS: 0238AEEDB0 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(6116002)(3846002)(2906002)(76176999)(7736002)(1076002)(47776003)(5003940100001)(6506006)(25786008)(6486002)(66066001)(92566002)(5660300001)(305945005)(4326008)(33646002)(50986999)(81166006)(50226002)(230783001)(6916009)(48376002)(42186005)(53936002)(54906002)(6512007)(50466002)(189998001)(575784001)(36756003)(38730400002)(110136004)(8676002)(2950100002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR07MB2351;H:rric.localdomain;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR07MB2351;23:NITVpbDMC9LcYAVJW+GYxTBmHb26hpnSq8B+NOB4m?= =?us-ascii?Q?96UhYZH2VSagKziXtvIIvHYku854z4T7TZg2Wx+te66NNUEjzmDd48bWGMOY?= =?us-ascii?Q?7Qz4LpSmCVi21jyFK72XgM8iqtRxObFJe66NfJ2HH8840aomLx/n9Wx7luDM?= =?us-ascii?Q?TbK3Homeql1PYtAzJNQJf3SLWWVqnhxLC3YXQwo2Nylr9025++OVF/B7bEfR?= =?us-ascii?Q?4JThqInzHmktJ8L3ORhcfCuaSnI2a6wfK+WNp+xSZz60V0TSJAYnBlPPJiW/?= =?us-ascii?Q?SWhx4bcP08qXse20/0QSZVS04bp3ypwi4hw1kNAgPRPI62jJyh2QlDPw1IKi?= =?us-ascii?Q?TN3ktAFiubOWjCS5YEDQXTbdl10CtnxjLDEsQhOC7zDYDg2+lRP6KXrZiILG?= =?us-ascii?Q?c7uTVeFg7ohruFeMSLHownLLLUoxrI4Mu6BIdFSdQWqs3PPEmw+h0lgXSdR/?= =?us-ascii?Q?nF+uMx1KRtnohgc8nzvhN1SR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DCqJ61STEG5CC5BCQw==;5:hm7nshM1mEUhqQOelvm3zWRANJ5lvnfz/Uvtv30NYVKwxbvQh4wDPT/7Xu0+eCwMjIKc+ljXVnz4O5UM0xcOt4EXeQia6tYLg+WbQTfXtqIypsiWN5KoiTYsDnfWSUNtn6BQu6XapbAJ/hzcUy2WaA==;24:3THwTa9DT9CFTrbPyILiN7NEi4vfcm6Q+Q46pihAzD4Xx4ytHPiLjvDsvwIo25HjHgvQr/ST5rFIwxNvb6bh+JXyRChXkdElyUcrwUq0Cbo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;SN1PR07MB2351;7:z3SLD1NV3Iql8ampVC+KXbeLF9NiXWQA/rdauY8lgOiEwFwhUAEc+jgTdCBHUEVrlMZQvTlqcQf6Pbb6E+357Q1t05uF2JygmKJ+rwpGyqo/rAiO/I6pGzAIwbFbYHr8D++TfEh+ZoHA7NCqNcZf9PRDKcgiZ0kNj+eSMnf3CNUSkIzfVw2C7HAJlZT28BdxafuXLTgw5pXnaA9o1WEGe3NDB3G0vWSoCj8892NV1oaELkMXpzZuDa91CYMHFIwwOnG+BsvuJkTyKDSbvYt5fYzCl6B0oc5mPEl/u8xCDM/OZ7Wdd+mx9fNGKsfq3c/HOA/oaT8uYAVSuf2jz+71/Q== X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2017 12:58:35.3964 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2351 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5069 Lines: 190 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 | 55 ++++++++++++++++++++++++++------------ drivers/irqchip/irq-gic-v3.c | 11 ++++---- include/linux/cpuhotplug.h | 1 + include/linux/irqchip/arm-gic-v3.h | 2 +- 4 files changed, 46 insertions(+), 23 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index a0ab1b83c548..8badc230af4b 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1658,20 +1658,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) @@ -1691,11 +1684,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) @@ -1798,7 +1787,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()) { @@ -1891,8 +1880,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) { @@ -1912,13 +1899,47 @@ 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) { + 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) { + pr_warn("ITS: Failed to initialize (%d), not enabling LPIs\n", + err); + return err; + } + its_alloc_lpi_tables(); its_lpi_init(gic_rdists->id_bits); + 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 b46dc9396331..2b9be256a9ec 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(); } @@ -672,7 +668,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 */ @@ -1168,6 +1164,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: @@ -1457,6 +1456,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 62d240e962f0..649122ceff81 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -79,6 +79,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 a7dc1e3030ef..bf256ce1715d 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h @@ -465,9 +465,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