Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756496AbbBPPxe (ORCPT ); Mon, 16 Feb 2015 10:53:34 -0500 Received: from mail-by2on0107.outbound.protection.outlook.com ([207.46.100.107]:36352 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756511AbbBPPvX (ORCPT ); Mon, 16 Feb 2015 10:51:23 -0500 From: Emil Medve To: , CC: Hai-Ying Wang Subject: [RFC v2 10/10] fsl_qman: Add HOTPLUG_CPU support Date: Mon, 16 Feb 2015 09:46:21 -0600 Message-ID: <1424101581-22109-11-git-send-email-Emilian.Medve@Freescale.com> X-Mailer: git-send-email 2.3.0 In-Reply-To: <1424101581-22109-1-git-send-email-Emilian.Medve@Freescale.com> References: <1424101581-22109-1-git-send-email-Emilian.Medve@Freescale.com> X-EOPAttributedMessage: 0 Authentication-Results: spf=fail (sender IP is 192.88.168.50) 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.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(339900001)(50466002)(575784001)(77156002)(19580405001)(19580395003)(85426001)(62966003)(36756003)(86362001)(48376002)(87936001)(229853001)(6806004)(50226001)(2950100001)(77096005)(76176999)(47776003)(104016003)(105606002)(50986999)(106466001)(46102003)(92566002)(2101003);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR03MB459;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB459; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004);SRVR:BY2PR03MB459; X-Forefront-PRVS: 0489CFBAC9 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BY2PR03MB459; X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2015 15:51:20.5862 (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: BY2PR03MB459 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2291 Lines: 84 From: Hai-Ying Wang Change-Id: Ica4d1b2b0fd3c3ae5e043663febd9f4cb7c762cf Signed-off-by: Hai-Ying Wang --- drivers/soc/freescale/qman_portal.c | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/soc/freescale/qman_portal.c b/drivers/soc/freescale/qman_portal.c index 7216de1..b008b41 100644 --- a/drivers/soc/freescale/qman_portal.c +++ b/drivers/soc/freescale/qman_portal.c @@ -30,6 +30,9 @@ */ #include "qman_priv.h" +#ifdef CONFIG_HOTPLUG_CPU +#include +#endif /* Global variable containing revision id (even on non-control plane systems * where CCSR isn't available) */ @@ -381,6 +384,45 @@ static void qman_offline_cpu(unsigned int cpu) } } +#ifdef CONFIG_HOTPLUG_CPU +static void qman_online_cpu(unsigned int cpu) +{ + struct qman_portal *p; + const struct qm_portal_config *pcfg; + p = (struct qman_portal *)affine_portals[cpu]; + if (p) { + pcfg = qman_get_qm_portal_config(p); + if (pcfg) { + irq_set_affinity(pcfg->public_cfg.irq, cpumask_of(cpu)); + qman_portal_update_sdest(pcfg, cpu); + } + } +} + +static int __cpuinit qman_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: + qman_online_cpu(cpu); + break; + case CPU_DOWN_PREPARE: + case CPU_DOWN_PREPARE_FROZEN: + qman_offline_cpu(cpu); + default: + break; + } + return NOTIFY_OK; +} + +static struct notifier_block qman_hotplug_cpu_notifier = { + .notifier_call = qman_hotplug_cpu_callback, +}; +#endif /* CONFIG_HOTPLUG_CPU */ + __init int qman_init(void) { struct cpumask slave_cpus; @@ -499,5 +541,8 @@ __init int qman_init(void) cpumask_andnot(&offline_cpus, cpu_possible_mask, cpu_online_mask); for_each_cpu(cpu, &offline_cpus) qman_offline_cpu(cpu); +#ifdef CONFIG_HOTPLUG_CPU + register_hotcpu_notifier(&qman_hotplug_cpu_notifier); +#endif return 0; } -- 2.3.0 -- 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/