[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1425912115-27398-10-git-send-email-Emilian.Medve@Freescale.com>
Date: Mon, 9 Mar 2015 09:41:54 -0500
From: Emil Medve <Emilian.Medve@...escale.com>
To: <scottwood@...escale.com>, <linuxppc-dev@...ts.ozlabs.org>,
<linux-kernel@...r.kernel.org>
CC: Hai-Ying Wang <Haiying.Wang@...escale.com>
Subject: [RFC v3 09/10] fsl_bman: Add HOTPLUG_CPU support
From: Hai-Ying Wang <Haiying.Wang@...escale.com>
Signed-off-by: Hai-Ying Wang <Haiying.Wang@...escale.com>
---
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 <linux/cpu.h>
+#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;
}
--
2.3.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists