linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Emil Medve <Emilian.Medve@Freescale.com>
To: <linuxppc-dev@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>
Subject: [RFC v2 09/10] fsl_bman: Add HOTPLUG_CPU support
Date: Mon, 16 Feb 2015 09:46:20 -0600	[thread overview]
Message-ID: <1424101581-22109-10-git-send-email-Emilian.Medve@Freescale.com> (raw)
In-Reply-To: <1424101581-22109-1-git-send-email-Emilian.Medve@Freescale.com>

From: Hai-Ying Wang <Haiying.Wang@freescale.com>

Change-Id: I863d5c15c7f35f9de4ea3d985e4ff467167924b7
Signed-off-by: Hai-Ying Wang <Haiying.Wang@freescale.com>
---
 drivers/soc/freescale/bman_portal.c | 45 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 44 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/freescale/bman_portal.c b/drivers/soc/freescale/bman_portal.c
index a91081c..f484a91 100644
--- a/drivers/soc/freescale/bman_portal.c
+++ b/drivers/soc/freescale/bman_portal.c
@@ -30,6 +30,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
@@ -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.3.0

  parent reply	other threads:[~2015-02-16 15:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16 15:46 [RFC v2 00/10] Freescale DPAA B/QMan drivers Emil Medve
2015-02-16 15:46 ` [RFC v2 01/10] fsl_bman: Add drivers for the Freescale DPAA BMan Emil Medve
2015-02-17  0:50   ` Scott Wood
2015-02-18 17:43   ` Kumar Gala
2015-02-18 17:59     ` Emil Medve
2015-02-16 15:46 ` [RFC v2 02/10] fsl_qman: Add drivers for the Freescale DPAA QMan Emil Medve
2015-02-16 15:46 ` [RFC v2 03/10] powerpc/mpc85xx: Add platform support for the Freescale DPAA BMan Emil Medve
2015-02-16 15:46 ` [RFC v2 04/10] powerpc/mpc85xx: Add platform support for the Freescale DPAA QMan Emil Medve
2015-02-16 15:46 ` [RFC v2 05/10] fsl_bman: Add self-tester Emil Medve
2015-02-16 15:46 ` [RFC v2 06/10] fsl_qman: " Emil Medve
2015-02-16 15:46 ` [RFC v2 07/10] fsl_bman: Add debugfs support Emil Medve
2015-02-16 15:46 ` [RFC v2 08/10] fsl_qman: " Emil Medve
2015-02-16 15:46 ` Emil Medve [this message]
2015-02-16 15:46 ` [RFC v2 10/10] fsl_qman: Add HOTPLUG_CPU support Emil Medve
2015-02-18 17:45 ` [RFC v2 00/10] Freescale DPAA B/QMan drivers Kumar Gala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1424101581-22109-10-git-send-email-Emilian.Medve@Freescale.com \
    --to=emilian.medve@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).