From patchwork Mon Mar 9 14:41:54 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Medve X-Patchwork-Id: 448063 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8485314011D for ; Tue, 10 Mar 2015 01:57:19 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 62D271A3705 for ; Tue, 10 Mar 2015 01:57:19 +1100 (AEDT) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bn0102.outbound.protection.outlook.com [157.56.110.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 624331A1118 for ; Tue, 10 Mar 2015 01:47:50 +1100 (AEDT) Received: from BY2PR03CA039.namprd03.prod.outlook.com (10.141.249.12) by BL2PR03MB451.namprd03.prod.outlook.com (10.141.92.16) with Microsoft SMTP Server (TLS) id 15.1.112.13; Mon, 9 Mar 2015 14:47:44 +0000 Received: from BN1AFFO11FD009.protection.gbl (2a01:111:f400:7c10::143) by BY2PR03CA039.outlook.office365.com (2a01:111:e400:2c5d::12) with Microsoft SMTP Server (TLS) id 15.1.106.15 via Frontend Transport; Mon, 9 Mar 2015 14:47:43 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD009.mail.protection.outlook.com (10.58.52.69) with Microsoft SMTP Server (TLS) id 15.1.112.13 via Frontend Transport; Mon, 9 Mar 2015 14:47:43 +0000 Received: from right.am.freescale.net (right.am.freescale.net [10.81.116.70]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t29ElcYu024469; Mon, 9 Mar 2015 07:47:42 -0700 From: Emil Medve To: , , Subject: [RFC v3 09/10] fsl_bman: Add HOTPLUG_CPU support Date: Mon, 9 Mar 2015 09:41:54 -0500 Message-ID: <1425912115-27398-10-git-send-email-Emilian.Medve@Freescale.com> X-Mailer: git-send-email 2.3.0 In-Reply-To: <1425912115-27398-1-git-send-email-Emilian.Medve@Freescale.com> References: <1425912115-27398-1-git-send-email-Emilian.Medve@Freescale.com> X-EOPAttributedMessage: 0 Received-SPF: Fail (protection.outlook.com: domain of Freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=Emilian.Medve@Freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(339900001)(189002)(199003)(104016003)(229853001)(85426001)(46102003)(76176999)(48376002)(50986999)(50466002)(50226001)(36756003)(105606002)(19580405001)(2201001)(6806004)(19580395003)(87936001)(77156002)(92566002)(86362001)(47776003)(2950100001)(62966003)(77096005)(2101003); DIR:OUT; SFP:1102; SCL:1; SRVR:BL2PR03MB451; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB451; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5002009)(5005006); SRVR:BL2PR03MB451; BCL:0; PCL:0; RULEID:; SRVR:BL2PR03MB451; X-Forefront-PRVS: 05102978A2 X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2015 14:47:43.1741 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR03MB451 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Hai-Ying Wang Signed-off-by: Hai-Ying Wang --- drivers/soc/fsl/bman_portal.c | 45 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/soc/fsl/bman_portal.c b/drivers/soc/fsl/bman_portal.c index b06339a..60c966e 100644 --- a/drivers/soc/fsl/bman_portal.c +++ b/drivers/soc/fsl/bman_portal.c @@ -29,6 +29,9 @@ */ #include "bman_priv.h" +#ifdef CONFIG_HOTPLUG_CPU +#include +#endif /* * Global variables of the max portal/pool number this bman version supported @@ -179,7 +182,7 @@ static int __init parse_bportals(char *str) } __setup("bportals=", parse_bportals); -static void bman_offline_cpu(unsigned int cpu) +static void __cold bman_offline_cpu(unsigned int cpu) { struct bman_portal *p = (struct bman_portal *)affine_bportals[cpu]; const struct bm_portal_config *pcfg; @@ -191,6 +194,42 @@ static void bman_offline_cpu(unsigned int cpu) } } +#ifdef CONFIG_HOTPLUG_CPU +static void __cold bman_online_cpu(unsigned int cpu) +{ + struct bman_portal *p = (struct bman_portal *)affine_bportals[cpu]; + const struct bm_portal_config *pcfg; + + if (p) { + pcfg = bman_get_bm_portal_config(p); + if (pcfg) + irq_set_affinity(pcfg->public_cfg.irq, cpumask_of(cpu)); + } +} + +static int __cold bman_hotplug_cpu_callback(struct notifier_block *nfb, + unsigned long action, void *hcpu) +{ + unsigned int cpu = (unsigned long)hcpu; + + switch (action) { + case CPU_ONLINE: + case CPU_ONLINE_FROZEN: + bman_online_cpu(cpu); + break; + case CPU_DOWN_PREPARE: + case CPU_DOWN_PREPARE_FROZEN: + bman_offline_cpu(cpu); + } + + return NOTIFY_OK; +} + +static struct notifier_block bman_hotplug_cpu_notifier = { + .notifier_call = bman_hotplug_cpu_callback, +}; +#endif /* CONFIG_HOTPLUG_CPU */ + /* Initialise the BMan driver. The meat of this function deals with portals. The * following describes the flow of portal-handling, the code "steps" refer to * this description; @@ -325,5 +364,9 @@ int __init bman_init(void) for_each_cpu(cpu, &offline_cpus) bman_offline_cpu(cpu); +#ifdef CONFIG_HOTPLUG_CPU + register_hotcpu_notifier(&bman_hotplug_cpu_notifier); +#endif + return 0; }