Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934103AbbBDPIL (ORCPT ); Wed, 4 Feb 2015 10:08:11 -0500 Received: from mail-bl2on0136.outbound.protection.outlook.com ([65.55.169.136]:9946 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932877AbbBDPIG (ORCPT ); Wed, 4 Feb 2015 10:08:06 -0500 From: Emil Medve To: , , CC: Hai-Ying Wang Subject: [RFC 09/10] fsl_bman: Add HOTPLUG_CPU support Date: Wed, 4 Feb 2015 08:48:41 -0600 Message-ID: <1423061322-16059-10-git-send-email-Emilian.Medve@Freescale.com> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1423061322-16059-1-git-send-email-Emilian.Medve@Freescale.com> References: <1423061322-16059-1-git-send-email-Emilian.Medve@Freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(229853001)(50226001)(106466001)(62966003)(77156002)(36756003)(77096005)(6806004)(87936001)(2201001)(104016003)(46102003)(2950100001)(86362001)(76176999)(50986999)(19580395003)(48376002)(19580405001)(47776003)(92566002)(50466002)(2101003);DIR:OUT;SFP:1102;SCL:1;SRVR:DM2PR03MB464;H:tx30smr01.am.freescale.net;FPR:;SPF:None;MLV:sfv;LANG:en; MIME-Version: 1.0 Content-Type: text/plain Authentication-Results: freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:DM2PR03MB464; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004);SRVR:DM2PR03MB464; X-Forefront-PRVS: 04772EA191 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:DM2PR03MB464; X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2015 14:53:06.0720 (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.168.50] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR03MB464 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2616 Lines: 91 From: Hai-Ying Wang Change-Id: I863d5c15c7f35f9de4ea3d985e4ff467167924b7 Signed-off-by: Hai-Ying Wang --- drivers/staging/fsl_qbman/bman_driver.c | 45 ++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fsl_qbman/bman_driver.c b/drivers/staging/fsl_qbman/bman_driver.c index bab2283..18a6cdd 100644 --- a/drivers/staging/fsl_qbman/bman_driver.c +++ b/drivers/staging/fsl_qbman/bman_driver.c @@ -30,6 +30,9 @@ */ #include "bman_private.h" +#ifdef CONFIG_HOTPLUG_CPU +#include +#endif /* * Global variables of the max portal/pool number this bman version supported @@ -180,7 +183,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; @@ -192,6 +195,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; @@ -326,5 +365,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; } -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/