Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp123653imu; Wed, 7 Nov 2018 14:06:03 -0800 (PST) X-Google-Smtp-Source: AJdET5eghM3TMYtimEIOG93a8nIdvq2QIdgTS8n5wLvFAbfwHpbiBY/2uBPpJuFSO+W8zDraYUrO X-Received: by 2002:a65:64d5:: with SMTP id t21-v6mr1770071pgv.428.1541628362967; Wed, 07 Nov 2018 14:06:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541628362; cv=none; d=google.com; s=arc-20160816; b=xRRyHX5Te+c4XzNdt5BVcMnYxjbVo9i9SDwRku5TZHaFfIaq0oIicDxQHm8QxzNcc4 cpjB/33o+snPGCfpkamFZbE23Xz+AymrbjIeOpBixeh+C7uBD66fGJx4tRQ9wXHlKCm3 73H9oHV9NQUWVkM476NwOUgicF7zwUJKz6OI2GUWIO3j+v15Z1W18RLh+ESD6AzVYMXa fbKA/NthqgoNCt6FFdO1+RcFdyZ8CJfoZt0eddFIHJjH/yZwJQB/ogRiX42yRktd+1Yv DhR8KBJtoqMocPevIB5DhGKtSSdN6YDwhV9b5FrM0F79Yp+5m/7RRWwFs7dHnO1ozHPw jZzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=IXb+GAEoraiyNOmdqnTOtP3SeGPlwUy8jnhcvWxXRDg=; b=SlnSjhNm0gnJz7Wq+gni8d4c7Lb6AFCwI5N1WcWrFdXnAtx8RTKnr2ezTT7K8sb8Io 8d+sR2HXeF7ldeGH+AqfBRKjStd+lWJJBxNTMPXSSCixGI5m1FFJndy5MEnM5qs5RjLY o3VIgrtueQsJrvkoSeP9SvwIxw7V9Q/iksuhjoZn6po/E4ycwUrU/QA3pXBdImpMFL5i 2CG2fHKPnvl5EtISEV48HT8OgBn4lTCUlkYDGaAscy/KRPr1iseN5plMF86+xkRPep/v gEb74RIterTJHHzrJuT5OBxrU5oq+XQ53askXNMESoLkHnQ7Oulv3GpYCnnIgi8qZHU4 eVMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=e8V2b0Ne; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u10-v6si1880369pls.307.2018.11.07.14.05.48; Wed, 07 Nov 2018 14:06:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=e8V2b0Ne; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728115AbeKHHgP (ORCPT + 99 others); Thu, 8 Nov 2018 02:36:15 -0500 Received: from mail-eopbgr730056.outbound.protection.outlook.com ([40.107.73.56]:17664 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728056AbeKHHgO (ORCPT ); Thu, 8 Nov 2018 02:36:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IXb+GAEoraiyNOmdqnTOtP3SeGPlwUy8jnhcvWxXRDg=; b=e8V2b0NemnfgA83ypjrI9jBompZMEOVHzQrjzV4bIYs5CNWDVL2E+k7n+KbYXx/RvFBRcxE1J+Vtv5AQZSsQVap8cDYc6Bm91FKJm5CBYWKLIz3zqZfAJanEhSmcnOIGNHcXwLYm+lASruwc1qB70mZsw+rFKMNcDBeV33HaiOI= Received: from SN6PR07MB5326.namprd07.prod.outlook.com (52.135.105.33) by SN6PR07MB5232.namprd07.prod.outlook.com (52.135.120.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.22; Wed, 7 Nov 2018 22:03:36 +0000 Received: from SN6PR07MB5326.namprd07.prod.outlook.com ([fe80::f0b9:acf9:7513:c149]) by SN6PR07MB5326.namprd07.prod.outlook.com ([fe80::f0b9:acf9:7513:c149%5]) with mapi id 15.20.1294.034; Wed, 7 Nov 2018 22:03:36 +0000 From: Robert Richter To: Marc Zyngier , Thomas Gleixner , Jason Cooper CC: "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Stuart Yoder , Laurentiu Tudor , Matthias Brugger , Will Deacon , Lorenzo Pieralisi , "Richter, Robert" Subject: [PATCH 08/10] irqchip/gic-v3-its: Decouple its initialization from gic Thread-Topic: [PATCH 08/10] irqchip/gic-v3-its: Decouple its initialization from gic Thread-Index: AQHUduW606qvYKxACUS/t7Q6A777CA== Date: Wed, 7 Nov 2018 22:03:35 +0000 Message-ID: <20181107220254.6116-9-rrichter@cavium.com> References: <20181107220254.6116-1-rrichter@cavium.com> In-Reply-To: <20181107220254.6116-1-rrichter@cavium.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6PR03CA0033.eurprd03.prod.outlook.com (2603:10a6:20b::46) To SN6PR07MB5326.namprd07.prod.outlook.com (2603:10b6:805:73::33) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Robert.Richter@cavium.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [77.180.181.154] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;SN6PR07MB5232;6:P4u2XC0M/FRONswrGncFocv0hylvBw/E9puHI4JDu5QWeaP3uwxa73HLnLNL9vCmZ8QKwhw815gf9QkZKihgpxQKLli6L6RbhEOG9FQWv1nlx1aMze6UBKAK3ZC4zEQOhA2unh3dNLF1ldPUh9wiTQjIY7q/QV39qSOF6Sg5GlGb0URVc5ujS2Dacw58ysmgWtXGYU1heNE89I38MY8jLT1qCDovqCBf7WjZV/x+vw7Ci36PUsdczi+cHuxi39ZPG+UUkoD6hwVMAwlXWtMuUxI8HtUjRTovrXt0+ohm4mIuE0PXAeaYx4pigxZfdSoPjv0iFjYoG/OYa7H1pl0OpN//v/fKDw4k7PbeoqkAY/pcGVHVJ30bC6ufHyB2qUzDw94ps8twM0kFs+A+jIrqo/hlty4gilJbguRuvxJTeoHun0+/10s0AiWkXDkLuDT8rnecI1cYOTBCdkmIgX9nIA==;5:ut4SxifV7OA84EROapD2gqVcq2LlYTV7V1XxbaW9dCz8mRnq7eH44Z5Vk6g5KJDfz5fziUpVEJtoEh7yDqAHW63fFFuPtZ1/M4zBeCDXtQyJooqHK8boqTQO01ZWSZYRUga7AwmkPN1lzzWhHau9DkgfmdCZT1NWb2dPWGWJm3A=;7:P2oEkaw91jqVNiFWlZS3g8s+u6xLndIN8YeVMzsicsDqO4Maj4LYG7O99WWq2N1//A0S/Qcj6jnDGTuxrqWZkrUvmJp5CjFydapXPbXGshydXCdJ6++xg4qXkPQZyEvRHcJ1abWGN/mJLf9v7icFIw== x-ms-office365-filtering-correlation-id: f6775881-154e-4e85-5bed-08d644fcdd1a x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(5600074)(711020)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:SN6PR07MB5232; x-ms-traffictypediagnostic: SN6PR07MB5232: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(192374486261705)(269456686620040); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231382)(944501410)(52105095)(148016)(149066)(150057)(6041310)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:SN6PR07MB5232;BCL:0;PCL:0;RULEID:;SRVR:SN6PR07MB5232; x-forefront-prvs: 08497C3D99 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(366004)(39860400002)(346002)(396003)(376002)(189003)(199004)(71200400001)(7736002)(71190400001)(39060400002)(6486002)(3846002)(66066001)(6436002)(186003)(36756003)(476003)(478600001)(2616005)(53936002)(256004)(14444005)(446003)(305945005)(11346002)(6512007)(54906003)(1076002)(316002)(107886003)(25786009)(110136005)(6116002)(2906002)(97736004)(4326008)(6506007)(386003)(72206003)(105586002)(99286004)(486006)(5660300001)(7416002)(8936002)(102836004)(106356001)(68736007)(8676002)(14454004)(81156014)(76176011)(81166006)(575784001)(2900100001)(52116002)(26005);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB5232;H:SN6PR07MB5326.namprd07.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Kw9/SS4eXovT2RujH7sV6iREvvd1GQP5hCqZ8IfCi9Wly8DaegzL/qofPXWcxOtAUcS1kRYaJr3NI7tR6U/RKCTXYKbegNN5z6VzNw6b4UfeBMglTHHYbn4OD7TgzP5x03VU8xJLUABUEsl4tM3x+8FZxokXxMaOA2XYOLnzGg3Tpt4ldJwIkSDK+c7wPfVsXVKpxFEx2eMtEkLKsehRNumZlqpd27L9akhYu7DDbXRmECQm+qOqKzeEOLSCKIWx/nLl/dG3Q8QPAW9Fe90z+g/kyWhm3sfgwOIOpMtGdpjOJpd1KP6C0TO6t++GgFlqlybsbhjD9HzUAJH9DXShhu+USuB2MejCGJM5QXgoDPM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6775881-154e-4e85-5bed-08d644fcdd1a X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Nov 2018 22:03:35.7137 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB5232 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 58 +++++++++++++++++++++++++---------= ---- drivers/irqchip/irq-gic-v3.c | 14 ++++----- include/linux/cpuhotplug.h | 1 + include/linux/irqchip/arm-gic-v3.h | 2 +- 4 files changed, 48 insertions(+), 27 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-= its.c index c28f4158ff70..fd8561fcfdf3 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -167,6 +167,7 @@ static struct { } vpe_proxy; =20 static LIST_HEAD(its_nodes); +static LIST_HEAD(its_probed); static DEFINE_RAW_SPINLOCK(its_lock); static struct rdists *gic_rdists; static struct irq_domain *its_parent; @@ -3482,20 +3483,13 @@ static int __init its_compute_its_list_map(struct i= ts_node *its) =20 static void its_free(struct its_node *its) { - raw_spin_lock(&its_lock); - list_del(&its->entry); - raw_spin_unlock(&its_lock); - kfree(its); } =20 -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; =20 its =3D kzalloc(sizeof(*its), GFP_KERNEL); if (!its) @@ -3510,16 +3504,12 @@ static int __init its_probe_one(struct resource *re= s, its->numa_node =3D numa_node; =20 raw_spin_lock(&its_lock); - list_add_tail(&its->entry, &its_nodes); + list_add_tail(&its->entry, &its_probed); raw_spin_unlock(&its_lock); =20 pr_info("ITS %pR\n", res); =20 - err =3D its_init_one(its); - if (err) - its_free(its); - - return err; + return 0; } =20 static int __init its_init_one(struct its_node *its) @@ -3717,7 +3707,7 @@ static int redist_disable_lpis(void) return 0; } =20 -int its_cpu_init(void) +static int its_cpu_init(unsigned int cpu) { if (!list_empty(&its_nodes)) { int ret; @@ -3913,8 +3903,6 @@ static void __init its_acpi_probe(void) static void __init its_acpi_probe(void) { } #endif =20 -static int __init its_init(void); - int __init its_probe(struct fwnode_handle *handle, struct rdists *rdists, struct irq_domain *parent_domain) { @@ -3929,23 +3917,51 @@ int __init its_probe(struct fwnode_handle *handle, = struct rdists *rdists, =20 gic_rdists =3D rdists; =20 - return its_init(); + return 0; } =20 -static int __init its_init(void) +int __init its_init(void) { struct its_node *its; bool has_v4 =3D false; int err; =20 + if (list_empty(&its_probed)) + return 0; + + raw_spin_lock(&its_lock); +redo: + list_for_each_entry(its, &its_probed, entry) { + list_del_init(&its->entry); + + raw_spin_unlock(&its_lock); + + /* Needs to be called in non-atomic context */ + err =3D its_init_one(its); + if (err) + its_free(its); + + raw_spin_lock(&its_lock); + + if (!err) + list_add_tail(&its->entry, &its_nodes); + + goto redo; + } + + raw_spin_unlock(&its_lock); + if (list_empty(&its_nodes)) { pr_warn("ITS: No ITS available, not enabling LPIs\n"); return -ENXIO; } =20 err =3D allocate_lpi_tables(); - if (err) + if (err) { + pr_warn("ITS: Failed to initialize (%d), not enabling LPIs\n", + err); return err; + } =20 list_for_each_entry(its, &its_nodes, entry) has_v4 |=3D its->is_v4; @@ -3960,5 +3976,9 @@ static int __init its_init(void) =20 register_syscore_ops(&its_syscore_ops); =20 + 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 e04108b7c6b7..d2942efdb6d5 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -685,9 +685,6 @@ static int gic_starting_cpu(unsigned int cpu) { gic_cpu_init(); =20 - if (gic_dist_supports_lpis()) - its_cpu_init(); - return 0; } =20 @@ -815,7 +812,7 @@ static int gic_set_affinity(struct irq_data *d, const s= truct cpumask *mask_val, #else #define gic_set_affinity NULL #define gic_smp_init() do { } while(0) -#endif +#endif /* CONFIG_SMP */ =20 #ifdef CONFIG_CPU_PM /* Check whether it's single security state view */ @@ -1131,10 +1128,8 @@ static int __init gic_init_bases(void __iomem *dist_= base, gic_cpu_init(); gic_cpu_pm_init(); =20 - if (gic_dist_supports_lpis()) { + if (gic_dist_supports_lpis()) its_probe(handle, &gic_data.rdists, gic_data.domain); - its_cpu_init(); - } =20 return 0; =20 @@ -1327,6 +1322,9 @@ static int __init gic_of_init(struct device_node *nod= e, struct device_node *pare =20 if (static_branch_likely(&supports_deactivate_key)) gic_of_setup_kvm_info(node); + + its_init(); + return 0; =20 out_unmap_rdist: @@ -1630,6 +1628,8 @@ gic_acpi_init(struct acpi_subtable_header *header, co= nst unsigned long end) if (static_branch_likely(&supports_deactivate_key)) gic_acpi_setup_kvm_info(); =20 + its_init(); + return 0; =20 out_fwhandle_free: diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index e0cd2baa8380..584f73585142 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -96,6 +96,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 a6fdb2910f73..f4348fa4260a 100644 --- a/include/linux/irqchip/arm-gic-v3.h +++ b/include/linux/irqchip/arm-gic-v3.h @@ -602,9 +602,9 @@ struct rdists { =20 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); int mbi_init(struct fwnode_handle *fwnode, struct irq_domain *parent); =20 static inline bool gic_enable_sre(void) --=20 2.11.0