Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1526812
| From | tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:smp/hotplug] PCI/xgene-msi: Convert to hotplug state machine |
| Date | 2016-11-21 16:50 +0100 |
| Message-ID | <sFZ0Z-2ZM-5@gated-at.bofh.it> (permalink) |
| References | <sEzV0-4p4-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Commit-ID: 93405c5d155576801b0f6e96db339858541262dd
Gitweb: http://git.kernel.org/tip/93405c5d155576801b0f6e96db339858541262dd
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Thu, 17 Nov 2016 19:35:28 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 21 Nov 2016 16:37:06 +0100
PCI/xgene-msi: Convert to hotplug state machine
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-pci@vger.kernel.org
Cc: Duc Dang <dhdang@apm.com>
Cc: rt@linuxtronix.de
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/20161117183541.8588-8-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
drivers/pci/host/pci-xgene-msi.c | 69 +++++++++++-----------------------------
include/linux/cpuhotplug.h | 1 +
2 files changed, 20 insertions(+), 50 deletions(-)
diff --git a/drivers/pci/host/pci-xgene-msi.c b/drivers/pci/host/pci-xgene-msi.c
index a6456b5..1f38d08 100644
--- a/drivers/pci/host/pci-xgene-msi.c
+++ b/drivers/pci/host/pci-xgene-msi.c
@@ -360,16 +360,16 @@ static void xgene_msi_isr(struct irq_desc *desc)
chained_irq_exit(chip, desc);
}
+static enum cpuhp_state pci_xgene_online;
+
static int xgene_msi_remove(struct platform_device *pdev)
{
- int virq, i;
struct xgene_msi *msi = platform_get_drvdata(pdev);
- for (i = 0; i < NR_HW_IRQS; i++) {
- virq = msi->msi_groups[i].gic_irq;
- if (virq != 0)
- irq_set_chained_handler_and_data(virq, NULL, NULL);
- }
+ if (pci_xgene_online)
+ cpuhp_remove_state(pci_xgene_online);
+ cpuhp_remove_state(CPUHP_PCI_XGENE_DEAD);
+
kfree(msi->msi_groups);
kfree(msi->bitmap);
@@ -427,7 +427,7 @@ static int xgene_msi_hwirq_alloc(unsigned int cpu)
return 0;
}
-static void xgene_msi_hwirq_free(unsigned int cpu)
+static int xgene_msi_hwirq_free(unsigned int cpu)
{
struct xgene_msi *msi = &xgene_msi_ctrl;
struct xgene_msi_group *msi_group;
@@ -441,33 +441,9 @@ static void xgene_msi_hwirq_free(unsigned int cpu)
irq_set_chained_handler_and_data(msi_group->gic_irq, NULL,
NULL);
}
+ return 0;
}
-static int xgene_msi_cpu_callback(struct notifier_block *nfb,
- unsigned long action, void *hcpu)
-{
- unsigned cpu = (unsigned long)hcpu;
-
- switch (action) {
- case CPU_ONLINE:
- case CPU_ONLINE_FROZEN:
- xgene_msi_hwirq_alloc(cpu);
- break;
- case CPU_DEAD:
- case CPU_DEAD_FROZEN:
- xgene_msi_hwirq_free(cpu);
- break;
- default:
- break;
- }
-
- return NOTIFY_OK;
-}
-
-static struct notifier_block xgene_msi_cpu_notifier = {
- .notifier_call = xgene_msi_cpu_callback,
-};
-
static const struct of_device_id xgene_msi_match_table[] = {
{.compatible = "apm,xgene1-msi"},
{},
@@ -478,7 +454,6 @@ static int xgene_msi_probe(struct platform_device *pdev)
struct resource *res;
int rc, irq_index;
struct xgene_msi *xgene_msi;
- unsigned int cpu;
int virt_msir;
u32 msi_val, msi_idx;
@@ -540,28 +515,22 @@ static int xgene_msi_probe(struct platform_device *pdev)
}
}
- cpu_notifier_register_begin();
-
- for_each_online_cpu(cpu)
- if (xgene_msi_hwirq_alloc(cpu)) {
- dev_err(&pdev->dev, "failed to register MSI handlers\n");
- cpu_notifier_register_done();
- goto error;
- }
-
- rc = __register_hotcpu_notifier(&xgene_msi_cpu_notifier);
- if (rc) {
- dev_err(&pdev->dev, "failed to add CPU MSI notifier\n");
- cpu_notifier_register_done();
- goto error;
- }
-
- cpu_notifier_register_done();
+ rc = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "pci/xgene:online",
+ xgene_msi_hwirq_alloc, NULL);
+ if (rc)
+ goto err_cpuhp;
+ pci_xgene_online = rc;
+ rc = cpuhp_setup_state(CPUHP_PCI_XGENE_DEAD, "pci/xgene:dead", NULL,
+ xgene_msi_hwirq_free);
+ if (rc)
+ goto err_cpuhp;
dev_info(&pdev->dev, "APM X-Gene PCIe MSI driver loaded\n");
return 0;
+err_cpuhp:
+ dev_err(&pdev->dev, "failed to add CPU MSI notifier\n");
error:
xgene_msi_remove(pdev);
return rc;
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index 79b96f6..94c6a18 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -38,6 +38,7 @@ enum cpuhp_state {
CPUHP_RADIX_DEAD,
CPUHP_PAGE_ALLOC_DEAD,
CPUHP_NET_DEV_DEAD,
+ CPUHP_PCI_XGENE_DEAD,
CPUHP_WORKQUEUE_PREP,
CPUHP_POWER_NUMA_PREPARE,
CPUHP_HRTIMERS_PREPARE,
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
cpu hotplug: convert more drivers (batch #5) Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
[PATCH 12/20] net/iucv: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
[tip:smp/hotplug] net/iucv: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 17:00 +0100
[tip:smp/hotplug] net/iucv: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-23 00:20 +0100
Re: [PATCH 12/20] net/iucv: Convert to hotplug state machine Ursula Braun <ubraun@linux.vnet.ibm.com> - 2016-11-23 20:40 +0100
Re: [PATCH 12/20] net/iucv: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-24 10:20 +0100
[PATCH 12/20 v2] net/iucv: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-24 15:20 +0100
[PATCH] net/iucv: use explicit clean up labels in iucv_init() Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-24 17:20 +0100
[tip:smp/hotplug] net/iucv: Use explicit clean up labels in iucv_init() tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-24 21:00 +0100
[PATCH 09/20] powercap/intel rapl: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
[tip:smp/hotplug] powercap/intel rapl: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 17:00 +0100
[PATCH 19/20] x86/oprofile/nmi: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
[tip:smp/hotplug] x86/oprofile/nmi: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 17:00 +0100
[tip:smp/hotplug] x86/oprofile/nmi: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-22 23:50 +0100
[PATCH 14/20] arm/bL_switcher: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
[tip:smp/hotplug] arm/bL_switcher: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 17:00 +0100
[tip:smp/hotplug] arm/bL_switcher: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-22 23:50 +0100
[PATCH 13/20] sched/nohz: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
[tip:smp/hotplug] sched/nohz: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 17:00 +0100
[tip:smp/hotplug] sched/nohz: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-23 00:20 +0100
[PATCH 16/20] powerpc/sysfs: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:40 +0100
[tip:smp/hotplug] powerpc/sysfs: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 17:00 +0100
[tip:smp/hotplug] powerpc/sysfs: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-22 23:50 +0100
[PATCH 10/20] powercap/intel_rapl: Cleanup duplicated init code Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
[tip:smp/hotplug] powercap/intel_rapl: Cleanup duplicated init code tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-11-21 17:00 +0100
[PATCH 01/20] x86/mce/therm_throt: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
[tip:smp/hotplug] x86/mce/therm_throt: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 16:50 +0100
[tip:smp/hotplug] x86/mce/therm_throt: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-22 23:50 +0100
[PATCH 07/20] pci/xgene-msi: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
[tip:smp/hotplug] PCI/xgene-msi: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 16:50 +0100
[tip:smp/hotplug] PCI/xgene-msi: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-23 00:20 +0100
[PATCH 06/20] hwmon/via-cputemp: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
[PATCH 06/20 v2] hwmon/via-cputemp: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-18 16:20 +0100
Re: [PATCH 06/20] hwmon/via-cputemp: Convert to hotplug state machine Guenter Roeck <linux@roeck-us.net> - 2016-11-23 16:40 +0100
[PATCH 05/20] hwmon/via-cputemp: Remove pointless CPU check on each CPU Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
Re: [05/20] hwmon/via-cputemp: Remove pointless CPU check on each CPU Guenter Roeck <linux@roeck-us.net> - 2016-11-19 18:30 +0100
Re: [05/20] hwmon/via-cputemp: Remove pointless CPU check on each CPU Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-20 00:00 +0100
Re: [05/20] hwmon/via-cputemp: Remove pointless CPU check on each CPU Guenter Roeck <linux@roeck-us.net> - 2016-11-20 05:00 +0100
Re: [05/20] hwmon/via-cputemp: Remove pointless CPU check on each CPU Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-20 21:40 +0100
[PATCH 08/20] powercap/intel_rapl: Add missing domain data update on hotplug Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
[tip:smp/hotplug] powercap/intel_rapl: Add missing domain data update on hotplug tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-11-21 16:50 +0100
[PATCH 03/20] x86/msr: Convert to hotplug state machine Sebastian Andrzej Siewior <bigeasy@linutronix.de> - 2016-11-17 19:50 +0100
[tip:smp/hotplug] x86/msr: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-21 16:50 +0100
[tip:smp/hotplug] x86/msr: Convert to hotplug state machine tip-bot for Sebastian Andrzej Siewior <tipbot@zytor.com> - 2016-11-22 23:50 +0100
csiph-web