* [patch 07/66] ARM: mvebu: Convert to hotplug state machine
[not found] <20160711122450.923603742@linutronix.de>
@ 2016-07-11 12:28 ` Anna-Maria Gleixner
2016-07-11 12:28 ` [patch 33/66] arm: Convert VFP hotplug notifiers to " Anna-Maria Gleixner
` (6 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Anna-Maria Gleixner @ 2016-07-11 12:28 UTC (permalink / raw)
To: linux-arm-kernel
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Install the callbacks via the state machine.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
---
arch/arm/mach-mvebu/coherency.c | 19 ++++++-------------
include/linux/cpuhotplug.h | 1 +
2 files changed, 7 insertions(+), 13 deletions(-)
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -111,20 +111,12 @@ static struct notifier_block mvebu_hwcc_
.notifier_call = mvebu_hwcc_notifier,
};
-static int armada_xp_clear_shared_l2_notifier_func(struct notifier_block *nfb,
- unsigned long action, void *hcpu)
+static int armada_xp_clear_l2_starting(unsigned int cpu)
{
- if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
- armada_xp_clear_shared_l2();
-
- return NOTIFY_OK;
+ armada_xp_clear_shared_l2();
+ return 0;
}
-static struct notifier_block armada_xp_clear_shared_l2_notifier = {
- .notifier_call = armada_xp_clear_shared_l2_notifier_func,
- .priority = 100,
-};
-
static void __init armada_370_coherency_init(struct device_node *np)
{
struct resource res;
@@ -155,8 +147,9 @@ static void __init armada_370_coherency_
of_node_put(cpu_config_np);
- register_cpu_notifier(&armada_xp_clear_shared_l2_notifier);
-
+ cpuhp_setup_state_nocalls(CPUHP_AP_ARM_MVEBU_COHERENCY,
+ "AP_ARM_MVEBU_COHERENCY",
+ armada_xp_clear_l2_starting, NULL);
exit:
set_cpu_coherent();
}
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -15,6 +15,7 @@ enum cpuhp_state {
CPUHP_AP_IRQ_ARMADA_XP_STARTING,
CPUHP_AP_IRQ_ARMADA_CASC_STARTING,
CPUHP_AP_IRQ_BCM2836_STARTING,
+ CPUHP_AP_ARM_MVEBU_COHERENCY,
CPUHP_AP_NOTIFY_STARTING,
CPUHP_AP_ONLINE,
CPUHP_TEARDOWN_CPU,
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 33/66] arm: Convert VFP hotplug notifiers to state machine
[not found] <20160711122450.923603742@linutronix.de>
2016-07-11 12:28 ` [patch 07/66] ARM: mvebu: Convert to hotplug state machine Anna-Maria Gleixner
@ 2016-07-11 12:28 ` Anna-Maria Gleixner
2016-07-11 12:28 ` [patch 38/66] clocksource/arm_global_timer: Convert to hotplug " Anna-Maria Gleixner
` (5 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Anna-Maria Gleixner @ 2016-07-11 12:28 UTC (permalink / raw)
To: linux-arm-kernel
From: Thomas Gleixner <tglx@linutronix.de>
Straight forward conversion plus commentary why code which is executed
in hotplug callbacks needs to be invoked before installing them.
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: linux-arm-kernel at lists.infradead.org
---
arch/arm/vfp/vfpmodule.c | 28 +++++++++++++++++-----------
include/linux/cpuhotplug.h | 1 +
2 files changed, 18 insertions(+), 11 deletions(-)
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -643,19 +643,19 @@ int vfp_restore_user_hwstate(struct user
* hardware state at every thread switch. We clear our held state when
* a CPU has been killed, indicating that the VFP hardware doesn't contain
* a threads VFP state. When a CPU starts up, we re-enable access to the
- * VFP hardware.
- *
- * Both CPU_DYING and CPU_STARTING are called on the CPU which
+ * VFP hardware. The callbacks below are called on the CPU which
* is being offlined/onlined.
*/
-static int vfp_hotplug(struct notifier_block *b, unsigned long action,
- void *hcpu)
+static int vfp_dying_cpu(unsigned int cpu)
{
- if (action == CPU_DYING || action == CPU_DYING_FROZEN)
- vfp_current_hw_state[(long)hcpu] = NULL;
- else if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
- vfp_enable(NULL);
- return NOTIFY_OK;
+ vfp_force_reload(cpu, current_thread_info());
+ return 0;
+}
+
+static int vfp_starting_cpu(unsigned int unused)
+{
+ vfp_enable(NULL);
+ return 0;
}
void vfp_kmode_exception(void)
@@ -732,6 +732,10 @@ static int __init vfp_init(void)
unsigned int vfpsid;
unsigned int cpu_arch = cpu_architecture();
+ /*
+ * Enable the access to the VFP on all online CPUs so the
+ * following test on FPSID will succeed.
+ */
if (cpu_arch >= CPU_ARCH_ARMv6)
on_each_cpu(vfp_enable, NULL, 1);
@@ -794,7 +798,9 @@ static int __init vfp_init(void)
VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT;
}
- hotcpu_notifier(vfp_hotplug, 0);
+ cpuhp_setup_state_nocalls(CPUHP_AP_ARM_VFP_STARTING,
+ "AP_ARM_VFP_STARTING", vfp_starting_cpu,
+ vfp_dying_cpu);
vfp_vector = vfp_support_entry;
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -35,6 +35,7 @@ enum cpuhp_state {
CPUHP_AP_PERF_X86_CQM_STARTING,
CPUHP_AP_PERF_X86_CSTATE_STARTING,
CPUHP_AP_PERF_XTENSA_STARTING,
+ CPUHP_AP_ARM_VFP_STARTING,
CPUHP_AP_NOTIFY_STARTING,
CPUHP_AP_ONLINE,
CPUHP_TEARDOWN_CPU,
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 38/66] clocksource/arm_global_timer: Convert to hotplug state machine.
[not found] <20160711122450.923603742@linutronix.de>
2016-07-11 12:28 ` [patch 07/66] ARM: mvebu: Convert to hotplug state machine Anna-Maria Gleixner
2016-07-11 12:28 ` [patch 33/66] arm: Convert VFP hotplug notifiers to " Anna-Maria Gleixner
@ 2016-07-11 12:28 ` Anna-Maria Gleixner
2016-07-11 12:28 ` [patch 51/66] arm: twd: " Anna-Maria Gleixner
` (4 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Anna-Maria Gleixner @ 2016-07-11 12:28 UTC (permalink / raw)
To: linux-arm-kernel
From: Richard Cochran <rcochran@linutronix.de>
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Signed-off-by: Richard Cochran <rcochran@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Srinivas Kandagatla <srinivas.kandagatla@gmail.com>
Cc: Maxime Coquelin <maxime.coquelin@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-arm-kernel at lists.infradead.org
Cc: kernel at stlinux.com
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
---
drivers/clocksource/arm_global_timer.c | 41 ++++++++-------------------------
include/linux/cpuhotplug.h | 1
2 files changed, 11 insertions(+), 31 deletions(-)
--- a/drivers/clocksource/arm_global_timer.c
+++ b/drivers/clocksource/arm_global_timer.c
@@ -165,9 +165,9 @@ static irqreturn_t gt_clockevent_interru
return IRQ_HANDLED;
}
-static int gt_clockevents_init(struct clock_event_device *clk)
+static int gt_starting_cpu(unsigned int cpu)
{
- int cpu = smp_processor_id();
+ struct clock_event_device *clk = this_cpu_ptr(gt_evt);
clk->name = "arm_global_timer";
clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
@@ -186,10 +186,13 @@ static int gt_clockevents_init(struct cl
return 0;
}
-static void gt_clockevents_stop(struct clock_event_device *clk)
+static int gt_dying_cpu(unsigned int cpu)
{
+ struct clock_event_device *clk = this_cpu_ptr(gt_evt);
+
gt_clockevent_shutdown(clk);
disable_percpu_irq(clk->irq);
+ return 0;
}
static cycle_t gt_clocksource_read(struct clocksource *cs)
@@ -252,24 +255,6 @@ static void __init gt_clocksource_init(v
clocksource_register_hz(>_clocksource, gt_clk_rate);
}
-static int gt_cpu_notify(struct notifier_block *self, unsigned long action,
- void *hcpu)
-{
- switch (action & ~CPU_TASKS_FROZEN) {
- case CPU_STARTING:
- gt_clockevents_init(this_cpu_ptr(gt_evt));
- break;
- case CPU_DYING:
- gt_clockevents_stop(this_cpu_ptr(gt_evt));
- break;
- }
-
- return NOTIFY_OK;
-}
-static struct notifier_block gt_cpu_nb = {
- .notifier_call = gt_cpu_notify,
-};
-
static void __init global_timer_of_register(struct device_node *np)
{
struct clk *gt_clk;
@@ -325,21 +310,15 @@ static void __init global_timer_of_regis
goto out_free;
}
- err = register_cpu_notifier(>_cpu_nb);
- if (err) {
- pr_warn("global-timer: unable to register cpu notifier.\n");
- goto out_irq;
- }
-
- /* Immediately configure the timer on the boot CPU */
+ /* Register and immediately configure the timer on the boot CPU */
gt_clocksource_init();
- gt_clockevents_init(this_cpu_ptr(gt_evt));
+ cpuhp_setup_state(CPUHP_AP_ARM_GLOBAL_TIMER_STARTING,
+ "AP_ARM_GLOBAL_TIMER_STARTING", gt_starting_cpu,
+ gt_dying_cpu);
gt_delay_timer_init();
return;
-out_irq:
- free_percpu_irq(gt_ppi, gt_evt);
out_free:
free_percpu(gt_evt);
out_clk:
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -38,6 +38,7 @@ enum cpuhp_state {
CPUHP_AP_ARM_VFP_STARTING,
CPUHP_AP_PERF_ARM_STARTING,
CPUHP_AP_ARM_ARCH_TIMER_STARTING,
+ CPUHP_AP_ARM_GLOBAL_TIMER_STARTING,
CPUHP_AP_KVM_STARTING,
CPUHP_AP_NOTIFY_STARTING,
CPUHP_AP_ONLINE,
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 50/66] arm: l2c: Convert to hotplug state machine
[not found] <20160711122450.923603742@linutronix.de>
` (3 preceding siblings ...)
2016-07-11 12:28 ` [patch 51/66] arm: twd: " Anna-Maria Gleixner
@ 2016-07-11 12:28 ` Anna-Maria Gleixner
2016-07-11 12:29 ` [patch 54/66] hwtracing: coresight-etm3x: " Anna-Maria Gleixner
` (2 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Anna-Maria Gleixner @ 2016-07-11 12:28 UTC (permalink / raw)
To: linux-arm-kernel
From: Richard Cochran <rcochran@linutronix.de>
Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Signed-off-by: Richard Cochran <rcochran@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
---
arch/arm/mm/cache-l2x0.c | 27 +++++++++++++--------------
include/linux/cpuhotplug.h | 1 +
2 files changed, 14 insertions(+), 14 deletions(-)
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -597,17 +597,16 @@ static void l2c310_configure(void __iome
L310_POWER_CTRL);
}
-static int l2c310_cpu_enable_flz(struct notifier_block *nb, unsigned long act, void *data)
+static int l2c310_starting_cpu(unsigned int cpu)
{
- switch (act & ~CPU_TASKS_FROZEN) {
- case CPU_STARTING:
- set_auxcr(get_auxcr() | BIT(3) | BIT(2) | BIT(1));
- break;
- case CPU_DYING:
- set_auxcr(get_auxcr() & ~(BIT(3) | BIT(2) | BIT(1)));
- break;
- }
- return NOTIFY_OK;
+ set_auxcr(get_auxcr() | BIT(3) | BIT(2) | BIT(1));
+ return 0;
+}
+
+static int l2c310_dying_cpu(unsigned int cpu)
+{
+ set_auxcr(get_auxcr() & ~(BIT(3) | BIT(2) | BIT(1)));
+ return 0;
}
static void __init l2c310_enable(void __iomem *base, unsigned num_lock)
@@ -678,10 +677,10 @@ static void __init l2c310_enable(void __
power_ctrl & L310_STNDBY_MODE_EN ? "en" : "dis");
}
- if (aux & L310_AUX_CTRL_FULL_LINE_ZERO) {
- set_auxcr(get_auxcr() | BIT(3) | BIT(2) | BIT(1));
- cpu_notifier(l2c310_cpu_enable_flz, 0);
- }
+ if (aux & L310_AUX_CTRL_FULL_LINE_ZERO)
+ cpuhp_setup_state(CPUHP_AP_ARM_L2X0_STARTING,
+ "AP_ARM_L2X0_STARTING", l2c310_starting_cpu,
+ l2c310_dying_cpu);
}
static void __init l2c310_fixup(void __iomem *base, u32 cache_id,
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -38,6 +38,7 @@ enum cpuhp_state {
CPUHP_AP_PERF_METAG_STARTING,
CPUHP_AP_ARM_VFP_STARTING,
CPUHP_AP_PERF_ARM_STARTING,
+ CPUHP_AP_ARM_L2X0_STARTING,
CPUHP_AP_ARM_ARCH_TIMER_STARTING,
CPUHP_AP_ARM_GLOBAL_TIMER_STARTING,
CPUHP_AP_DUMMY_TIMER_STARTING,
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 51/66] arm: twd: Convert to hotplug state machine
[not found] <20160711122450.923603742@linutronix.de>
` (2 preceding siblings ...)
2016-07-11 12:28 ` [patch 38/66] clocksource/arm_global_timer: Convert to hotplug " Anna-Maria Gleixner
@ 2016-07-11 12:28 ` Anna-Maria Gleixner
2016-07-11 12:28 ` [patch 50/66] arm: l2c: " Anna-Maria Gleixner
` (3 subsequent siblings)
7 siblings, 0 replies; 10+ messages in thread
From: Anna-Maria Gleixner @ 2016-07-11 12:28 UTC (permalink / raw)
To: linux-arm-kernel
From: Richard Cochran <rcochran@linutronix.de>
Install the callbacks via the state machine. The callbacks won't be invoked on
already online CPUs.
Signed-off-by: Richard Cochran <rcochran@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
---
arch/arm/kernel/smp_twd.c | 31 +++++++++++--------------------
include/linux/cpuhotplug.h | 1 +
2 files changed, 12 insertions(+), 20 deletions(-)
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -310,24 +310,17 @@ static void twd_timer_setup(void)
enable_percpu_irq(clk->irq, 0);
}
-static int twd_timer_cpu_notify(struct notifier_block *self,
- unsigned long action, void *hcpu)
+static int twd_timer_starting_cpu(unsigned int cpu)
{
- switch (action & ~CPU_TASKS_FROZEN) {
- case CPU_STARTING:
- twd_timer_setup();
- break;
- case CPU_DYING:
- twd_timer_stop();
- break;
- }
-
- return NOTIFY_OK;
+ twd_timer_setup();
+ return 0;
}
-static struct notifier_block twd_timer_cpu_nb = {
- .notifier_call = twd_timer_cpu_notify,
-};
+static int twd_timer_dying_cpu(unsigned int cpu)
+{
+ twd_timer_stop();
+ return 0;
+}
static int __init twd_local_timer_common_register(struct device_node *np)
{
@@ -345,9 +338,9 @@ static int __init twd_local_timer_common
goto out_free;
}
- err = register_cpu_notifier(&twd_timer_cpu_nb);
- if (err)
- goto out_irq;
+ cpuhp_setup_state_nocalls(CPUHP_AP_ARM_TWD_STARTING,
+ "AP_ARM_TWD_STARTING",
+ twd_timer_starting_cpu, twd_timer_dying_cpu);
twd_get_clock(np);
if (!of_property_read_bool(np, "always-on"))
@@ -365,8 +358,6 @@ static int __init twd_local_timer_common
return 0;
-out_irq:
- free_percpu_irq(twd_ppi, twd_evt);
out_free:
iounmap(twd_base);
twd_base = NULL;
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -42,6 +42,7 @@ enum cpuhp_state {
CPUHP_AP_ARM_ARCH_TIMER_STARTING,
CPUHP_AP_ARM_GLOBAL_TIMER_STARTING,
CPUHP_AP_DUMMY_TIMER_STARTING,
+ CPUHP_AP_ARM_TWD_STARTING,
CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING,
CPUHP_AP_METAG_TIMER_STARTING,
CPUHP_AP_QCOM_TIMER_STARTING,
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 55/66] hwtracing: coresight-etm4x: Convert to hotplug state machine
[not found] <20160711122450.923603742@linutronix.de>
` (5 preceding siblings ...)
2016-07-11 12:29 ` [patch 54/66] hwtracing: coresight-etm3x: " Anna-Maria Gleixner
@ 2016-07-11 12:29 ` Anna-Maria Gleixner
2016-07-12 15:21 ` Mathieu Poirier
2016-07-11 12:29 ` [patch 56/66] arm64: armv8 deprecated: " Anna-Maria Gleixner
7 siblings, 1 reply; 10+ messages in thread
From: Anna-Maria Gleixner @ 2016-07-11 12:29 UTC (permalink / raw)
To: linux-arm-kernel
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
This driver has an asymmetry of ONLINE code without any corresponding tear
down code. Otherwise, this is a straightforward conversion.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
---
drivers/hwtracing/coresight/coresight-etm4x.c | 93 ++++++++++++++------------
include/linux/cpuhotplug.h | 1
2 files changed, 53 insertions(+), 41 deletions(-)
--- a/drivers/hwtracing/coresight/coresight-etm4x.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x.c
@@ -673,53 +673,52 @@ void etm4_config_trace_mode(struct etmv4
config->addr_acc[ETM_DEFAULT_ADDR_COMP + 1] = addr_acc;
}
-static int etm4_cpu_callback(struct notifier_block *nfb, unsigned long action,
- void *hcpu)
+static int etm4_online_cpu(unsigned int cpu)
{
- unsigned int cpu = (unsigned long)hcpu;
+ if (!etmdrvdata[cpu])
+ return 0;
+
+ if (etmdrvdata[cpu]->boot_enable && !etmdrvdata[cpu]->sticky_enable)
+ coresight_enable(etmdrvdata[cpu]->csdev);
+ return 0;
+}
+
+static int etm4_starting_cpu(unsigned int cpu)
+{
+ if (!etmdrvdata[cpu])
+ return 0;
+
+ spin_lock(&etmdrvdata[cpu]->spinlock);
+ if (!etmdrvdata[cpu]->os_unlock) {
+ etm4_os_unlock(etmdrvdata[cpu]);
+ etmdrvdata[cpu]->os_unlock = true;
+ }
+ if (local_read(&etmdrvdata[cpu]->mode))
+ etm4_enable_hw(etmdrvdata[cpu]);
+ spin_unlock(&etmdrvdata[cpu]->spinlock);
+ return 0;
+}
+
+static int etm4_dying_cpu(unsigned int cpu)
+{
if (!etmdrvdata[cpu])
- goto out;
+ return 0;
- switch (action & (~CPU_TASKS_FROZEN)) {
- case CPU_STARTING:
- spin_lock(&etmdrvdata[cpu]->spinlock);
- if (!etmdrvdata[cpu]->os_unlock) {
- etm4_os_unlock(etmdrvdata[cpu]);
- etmdrvdata[cpu]->os_unlock = true;
- }
-
- if (local_read(&etmdrvdata[cpu]->mode))
- etm4_enable_hw(etmdrvdata[cpu]);
- spin_unlock(&etmdrvdata[cpu]->spinlock);
- break;
-
- case CPU_ONLINE:
- if (etmdrvdata[cpu]->boot_enable &&
- !etmdrvdata[cpu]->sticky_enable)
- coresight_enable(etmdrvdata[cpu]->csdev);
- break;
-
- case CPU_DYING:
- spin_lock(&etmdrvdata[cpu]->spinlock);
- if (local_read(&etmdrvdata[cpu]->mode))
- etm4_disable_hw(etmdrvdata[cpu]);
- spin_unlock(&etmdrvdata[cpu]->spinlock);
- break;
- }
-out:
- return NOTIFY_OK;
-}
-
-static struct notifier_block etm4_cpu_notifier = {
- .notifier_call = etm4_cpu_callback,
-};
+ spin_lock(&etmdrvdata[cpu]->spinlock);
+ if (local_read(&etmdrvdata[cpu]->mode))
+ etm4_disable_hw(etmdrvdata[cpu]);
+ spin_unlock(&etmdrvdata[cpu]->spinlock);
+ return 0;
+}
static void etm4_init_trace_id(struct etmv4_drvdata *drvdata)
{
drvdata->trcid = coresight_get_trace_id(drvdata->cpu);
}
+static enum cpuhp_state hp_online;
+
static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
{
int ret;
@@ -767,8 +766,17 @@ static int etm4_probe(struct amba_device
etm4_init_arch_data, drvdata, 1))
dev_err(dev, "ETM arch init failed\n");
- if (!etm4_count++)
- register_hotcpu_notifier(&etm4_cpu_notifier);
+ if (!etm4_count++) {
+ cpuhp_setup_state_nocalls(CPUHP_AP_ARM_CORESIGHT4_STARTING,
+ "AP_ARM_CORESIGHT4_STARTING",
+ etm4_starting_cpu, etm4_dying_cpu);
+ ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
+ "AP_ARM_CORESIGHT4_ONLINE",
+ etm4_online_cpu, NULL);
+ if (ret < 0)
+ goto err_arch_supported;
+ hp_online = ret;
+ }
put_online_cpus();
@@ -809,8 +817,11 @@ static int etm4_probe(struct amba_device
return 0;
err_arch_supported:
- if (--etm4_count == 0)
- unregister_hotcpu_notifier(&etm4_cpu_notifier);
+ if (--etm4_count == 0) {
+ cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT4_STARTING);
+ if (hp_online)
+ cpuhp_remove_state_nocalls(hp_online);
+ }
return ret;
}
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -55,6 +55,7 @@ enum cpuhp_state {
CPUHP_AP_KVM_ARM_TIMER_STARTING,
CPUHP_AP_ARM_XEN_STARTING,
CPUHP_AP_ARM_CORESIGHT_STARTING,
+ CPUHP_AP_ARM_CORESIGHT4_STARTING,
CPUHP_AP_LEDTRIG_STARTING,
CPUHP_AP_NOTIFY_STARTING,
CPUHP_AP_ONLINE,
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 54/66] hwtracing: coresight-etm3x: Convert to hotplug state machine
[not found] <20160711122450.923603742@linutronix.de>
` (4 preceding siblings ...)
2016-07-11 12:28 ` [patch 50/66] arm: l2c: " Anna-Maria Gleixner
@ 2016-07-11 12:29 ` Anna-Maria Gleixner
2016-07-12 15:19 ` Mathieu Poirier
2016-07-11 12:29 ` [patch 55/66] hwtracing: coresight-etm4x: " Anna-Maria Gleixner
2016-07-11 12:29 ` [patch 56/66] arm64: armv8 deprecated: " Anna-Maria Gleixner
7 siblings, 1 reply; 10+ messages in thread
From: Anna-Maria Gleixner @ 2016-07-11 12:29 UTC (permalink / raw)
To: linux-arm-kernel
From: Richard Cochran <rcochran@linutronix.de>
This driver has an asymmetry of ONLINE code without any corresponding tear
down code. Otherwise, this is a straightforward conversion.
Signed-off-by: Richard Cochran <rcochran@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
---
drivers/hwtracing/coresight/coresight-etm3x.c | 90 ++++++++++++++------------
include/linux/cpuhotplug.h | 1
2 files changed, 50 insertions(+), 41 deletions(-)
--- a/drivers/hwtracing/coresight/coresight-etm3x.c
+++ b/drivers/hwtracing/coresight/coresight-etm3x.c
@@ -481,8 +481,7 @@ static int etm_enable_sysfs(struct cores
/*
* Configure the ETM only if the CPU is online. If it isn't online
- * hw configuration will take place when 'CPU_STARTING' is received
- * in @etm_cpu_callback.
+ * hw configuration will take place on the local CPU during bring up.
*/
if (cpu_online(drvdata->cpu)) {
ret = smp_call_function_single(drvdata->cpu,
@@ -641,47 +640,44 @@ static const struct coresight_ops etm_cs
.source_ops = &etm_source_ops,
};
-static int etm_cpu_callback(struct notifier_block *nfb, unsigned long action,
- void *hcpu)
+static int etm_online_cpu(unsigned int cpu)
{
- unsigned int cpu = (unsigned long)hcpu;
-
if (!etmdrvdata[cpu])
- goto out;
+ return 0;
- switch (action & (~CPU_TASKS_FROZEN)) {
- case CPU_STARTING:
- spin_lock(&etmdrvdata[cpu]->spinlock);
- if (!etmdrvdata[cpu]->os_unlock) {
- etm_os_unlock(etmdrvdata[cpu]);
- etmdrvdata[cpu]->os_unlock = true;
- }
-
- if (local_read(&etmdrvdata[cpu]->mode))
- etm_enable_hw(etmdrvdata[cpu]);
- spin_unlock(&etmdrvdata[cpu]->spinlock);
- break;
+ if (etmdrvdata[cpu]->boot_enable && !etmdrvdata[cpu]->sticky_enable)
+ coresight_enable(etmdrvdata[cpu]->csdev);
+ return 0;
+}
- case CPU_ONLINE:
- if (etmdrvdata[cpu]->boot_enable &&
- !etmdrvdata[cpu]->sticky_enable)
- coresight_enable(etmdrvdata[cpu]->csdev);
- break;
+static int etm_starting_cpu(unsigned int cpu)
+{
+ if (!etmdrvdata[cpu])
+ return 0;
- case CPU_DYING:
- spin_lock(&etmdrvdata[cpu]->spinlock);
- if (local_read(&etmdrvdata[cpu]->mode))
- etm_disable_hw(etmdrvdata[cpu]);
- spin_unlock(&etmdrvdata[cpu]->spinlock);
- break;
+ spin_lock(&etmdrvdata[cpu]->spinlock);
+ if (!etmdrvdata[cpu]->os_unlock) {
+ etm_os_unlock(etmdrvdata[cpu]);
+ etmdrvdata[cpu]->os_unlock = true;
}
-out:
- return NOTIFY_OK;
+
+ if (local_read(&etmdrvdata[cpu]->mode))
+ etm_enable_hw(etmdrvdata[cpu]);
+ spin_unlock(&etmdrvdata[cpu]->spinlock);
+ return 0;
}
-static struct notifier_block etm_cpu_notifier = {
- .notifier_call = etm_cpu_callback,
-};
+static int etm_dying_cpu(unsigned int cpu)
+{
+ if (!etmdrvdata[cpu])
+ return 0;
+
+ spin_lock(&etmdrvdata[cpu]->spinlock);
+ if (local_read(&etmdrvdata[cpu]->mode))
+ etm_disable_hw(etmdrvdata[cpu]);
+ spin_unlock(&etmdrvdata[cpu]->spinlock);
+ return 0;
+}
static bool etm_arch_supported(u8 arch)
{
@@ -750,6 +746,8 @@ static void etm_init_trace_id(struct etm
drvdata->traceid = coresight_get_trace_id(drvdata->cpu);
}
+static enum cpuhp_state hp_online;
+
static int etm_probe(struct amba_device *adev, const struct amba_id *id)
{
int ret;
@@ -806,9 +804,17 @@ static int etm_probe(struct amba_device
etm_init_arch_data, drvdata, 1))
dev_err(dev, "ETM arch init failed\n");
- if (!etm_count++)
- register_hotcpu_notifier(&etm_cpu_notifier);
-
+ if (!etm_count++) {
+ cpuhp_setup_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING,
+ "AP_ARM_CORESIGHT_STARTING",
+ etm_starting_cpu, etm_dying_cpu);
+ ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
+ "AP_ARM_CORESIGHT_ONLINE",
+ etm_online_cpu, NULL);
+ if (ret < 0)
+ goto err_arch_supported;
+ hp_online = ret;
+ }
put_online_cpus();
if (etm_arch_supported(drvdata->arch) == false) {
@@ -839,7 +845,6 @@ static int etm_probe(struct amba_device
pm_runtime_put(&adev->dev);
dev_info(dev, "%s initialized\n", (char *)id->data);
-
if (boot_enable) {
coresight_enable(drvdata->csdev);
drvdata->boot_enable = true;
@@ -848,8 +853,11 @@ static int etm_probe(struct amba_device
return 0;
err_arch_supported:
- if (--etm_count == 0)
- unregister_hotcpu_notifier(&etm_cpu_notifier);
+ if (--etm_count == 0) {
+ cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING);
+ if (hp_online)
+ cpuhp_remove_state_nocalls(hp_online);
+ }
return ret;
}
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -54,6 +54,7 @@ enum cpuhp_state {
CPUHP_AP_KVM_ARM_VGIC_STARTING,
CPUHP_AP_KVM_ARM_TIMER_STARTING,
CPUHP_AP_ARM_XEN_STARTING,
+ CPUHP_AP_ARM_CORESIGHT_STARTING,
CPUHP_AP_LEDTRIG_STARTING,
CPUHP_AP_NOTIFY_STARTING,
CPUHP_AP_ONLINE,
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 56/66] arm64: armv8 deprecated: Convert to hotplug state machine
[not found] <20160711122450.923603742@linutronix.de>
` (6 preceding siblings ...)
2016-07-11 12:29 ` [patch 55/66] hwtracing: coresight-etm4x: " Anna-Maria Gleixner
@ 2016-07-11 12:29 ` Anna-Maria Gleixner
7 siblings, 0 replies; 10+ messages in thread
From: Anna-Maria Gleixner @ 2016-07-11 12:29 UTC (permalink / raw)
To: linux-arm-kernel
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Install the callbacks via the state machine.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel at lists.infradead.org
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
---
arch/arm64/kernel/armv8_deprecated.c | 22 +++++-----------------
include/linux/cpuhotplug.h | 1 +
2 files changed, 6 insertions(+), 17 deletions(-)
--- a/arch/arm64/kernel/armv8_deprecated.c
+++ b/arch/arm64/kernel/armv8_deprecated.c
@@ -121,7 +121,7 @@ static int run_all_cpu_set_hw_mode(struc
* 0 - If all the hooks ran successfully.
* -EINVAL - At least one hook is not supported by the CPU.
*/
-static int run_all_insn_set_hw_mode(unsigned long cpu)
+static int run_all_insn_set_hw_mode(unsigned int cpu)
{
int rc = 0;
unsigned long flags;
@@ -131,7 +131,7 @@ static int run_all_insn_set_hw_mode(unsi
list_for_each_entry(insn, &insn_emulation, node) {
bool enable = (insn->current_mode == INSN_HW);
if (insn->ops->set_hw_mode && insn->ops->set_hw_mode(enable)) {
- pr_warn("CPU[%ld] cannot support the emulation of %s",
+ pr_warn("CPU[%u] cannot support the emulation of %s",
cpu, insn->ops->name);
rc = -EINVAL;
}
@@ -617,20 +617,6 @@ static struct insn_emulation_ops setend_
.set_hw_mode = setend_set_hw_mode,
};
-static int insn_cpu_hotplug_notify(struct notifier_block *b,
- unsigned long action, void *hcpu)
-{
- int rc = 0;
- if ((action & ~CPU_TASKS_FROZEN) == CPU_STARTING)
- rc = run_all_insn_set_hw_mode((unsigned long)hcpu);
-
- return notifier_from_errno(rc);
-}
-
-static struct notifier_block insn_cpu_hotplug_notifier = {
- .notifier_call = insn_cpu_hotplug_notify,
-};
-
/*
* Invoked as late_initcall, since not needed before init spawned.
*/
@@ -649,7 +635,9 @@ static int __init armv8_deprecated_init(
pr_info("setend instruction emulation is not supported on the system");
}
- register_cpu_notifier(&insn_cpu_hotplug_notifier);
+ cpuhp_setup_state_nocalls(CPUHP_AP_ARM64_ISNDEP_STARTING,
+ "AP_ARM64_ISNDEP_STARTING",
+ run_all_insn_set_hw_mode, NULL);
register_insn_emulation_sysctl(ctl_abi);
return 0;
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -56,6 +56,7 @@ enum cpuhp_state {
CPUHP_AP_ARM_XEN_STARTING,
CPUHP_AP_ARM_CORESIGHT_STARTING,
CPUHP_AP_ARM_CORESIGHT4_STARTING,
+ CPUHP_AP_ARM64_ISNDEP_STARTING,
CPUHP_AP_LEDTRIG_STARTING,
CPUHP_AP_NOTIFY_STARTING,
CPUHP_AP_ONLINE,
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 54/66] hwtracing: coresight-etm3x: Convert to hotplug state machine
2016-07-11 12:29 ` [patch 54/66] hwtracing: coresight-etm3x: " Anna-Maria Gleixner
@ 2016-07-12 15:19 ` Mathieu Poirier
0 siblings, 0 replies; 10+ messages in thread
From: Mathieu Poirier @ 2016-07-12 15:19 UTC (permalink / raw)
To: linux-arm-kernel
On 11 July 2016 at 06:29, Anna-Maria Gleixner <anna-maria@linutronix.de> wrote:
> From: Richard Cochran <rcochran@linutronix.de>
>
> This driver has an asymmetry of ONLINE code without any corresponding tear
> down code. Otherwise, this is a straightforward conversion.
>
> Signed-off-by: Richard Cochran <rcochran@linutronix.de>
> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: linux-arm-kernel at lists.infradead.org
> Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
>
> ---
> drivers/hwtracing/coresight/coresight-etm3x.c | 90 ++++++++++++++------------
> include/linux/cpuhotplug.h | 1
> 2 files changed, 50 insertions(+), 41 deletions(-)
>
> --- a/drivers/hwtracing/coresight/coresight-etm3x.c
> +++ b/drivers/hwtracing/coresight/coresight-etm3x.c
> @@ -481,8 +481,7 @@ static int etm_enable_sysfs(struct cores
>
> /*
> * Configure the ETM only if the CPU is online. If it isn't online
> - * hw configuration will take place when 'CPU_STARTING' is received
> - * in @etm_cpu_callback.
> + * hw configuration will take place on the local CPU during bring up.
> */
> if (cpu_online(drvdata->cpu)) {
> ret = smp_call_function_single(drvdata->cpu,
> @@ -641,47 +640,44 @@ static const struct coresight_ops etm_cs
> .source_ops = &etm_source_ops,
> };
>
> -static int etm_cpu_callback(struct notifier_block *nfb, unsigned long action,
> - void *hcpu)
> +static int etm_online_cpu(unsigned int cpu)
> {
> - unsigned int cpu = (unsigned long)hcpu;
> -
> if (!etmdrvdata[cpu])
> - goto out;
> + return 0;
>
> - switch (action & (~CPU_TASKS_FROZEN)) {
> - case CPU_STARTING:
> - spin_lock(&etmdrvdata[cpu]->spinlock);
> - if (!etmdrvdata[cpu]->os_unlock) {
> - etm_os_unlock(etmdrvdata[cpu]);
> - etmdrvdata[cpu]->os_unlock = true;
> - }
> -
> - if (local_read(&etmdrvdata[cpu]->mode))
> - etm_enable_hw(etmdrvdata[cpu]);
> - spin_unlock(&etmdrvdata[cpu]->spinlock);
> - break;
> + if (etmdrvdata[cpu]->boot_enable && !etmdrvdata[cpu]->sticky_enable)
> + coresight_enable(etmdrvdata[cpu]->csdev);
> + return 0;
> +}
>
> - case CPU_ONLINE:
> - if (etmdrvdata[cpu]->boot_enable &&
> - !etmdrvdata[cpu]->sticky_enable)
> - coresight_enable(etmdrvdata[cpu]->csdev);
> - break;
> +static int etm_starting_cpu(unsigned int cpu)
> +{
> + if (!etmdrvdata[cpu])
> + return 0;
>
> - case CPU_DYING:
> - spin_lock(&etmdrvdata[cpu]->spinlock);
> - if (local_read(&etmdrvdata[cpu]->mode))
> - etm_disable_hw(etmdrvdata[cpu]);
> - spin_unlock(&etmdrvdata[cpu]->spinlock);
> - break;
> + spin_lock(&etmdrvdata[cpu]->spinlock);
> + if (!etmdrvdata[cpu]->os_unlock) {
> + etm_os_unlock(etmdrvdata[cpu]);
> + etmdrvdata[cpu]->os_unlock = true;
> }
> -out:
> - return NOTIFY_OK;
> +
> + if (local_read(&etmdrvdata[cpu]->mode))
> + etm_enable_hw(etmdrvdata[cpu]);
> + spin_unlock(&etmdrvdata[cpu]->spinlock);
> + return 0;
> }
>
> -static struct notifier_block etm_cpu_notifier = {
> - .notifier_call = etm_cpu_callback,
> -};
> +static int etm_dying_cpu(unsigned int cpu)
> +{
> + if (!etmdrvdata[cpu])
> + return 0;
> +
> + spin_lock(&etmdrvdata[cpu]->spinlock);
> + if (local_read(&etmdrvdata[cpu]->mode))
> + etm_disable_hw(etmdrvdata[cpu]);
> + spin_unlock(&etmdrvdata[cpu]->spinlock);
> + return 0;
> +}
>
> static bool etm_arch_supported(u8 arch)
> {
> @@ -750,6 +746,8 @@ static void etm_init_trace_id(struct etm
> drvdata->traceid = coresight_get_trace_id(drvdata->cpu);
> }
>
> +static enum cpuhp_state hp_online;
> +
Can we put this at the top of the file with the other global declaration?
> static int etm_probe(struct amba_device *adev, const struct amba_id *id)
> {
> int ret;
> @@ -806,9 +804,17 @@ static int etm_probe(struct amba_device
> etm_init_arch_data, drvdata, 1))
> dev_err(dev, "ETM arch init failed\n");
>
> - if (!etm_count++)
> - register_hotcpu_notifier(&etm_cpu_notifier);
> -
> + if (!etm_count++) {
> + cpuhp_setup_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING,
> + "AP_ARM_CORESIGHT_STARTING",
> + etm_starting_cpu, etm_dying_cpu);
> + ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
> + "AP_ARM_CORESIGHT_ONLINE",
> + etm_online_cpu, NULL);
> + if (ret < 0)
> + goto err_arch_supported;
> + hp_online = ret;
> + }
> put_online_cpus();
>
> if (etm_arch_supported(drvdata->arch) == false) {
> @@ -839,7 +845,6 @@ static int etm_probe(struct amba_device
>
> pm_runtime_put(&adev->dev);
> dev_info(dev, "%s initialized\n", (char *)id->data);
> -
> if (boot_enable) {
> coresight_enable(drvdata->csdev);
> drvdata->boot_enable = true;
> @@ -848,8 +853,11 @@ static int etm_probe(struct amba_device
> return 0;
>
> err_arch_supported:
> - if (--etm_count == 0)
> - unregister_hotcpu_notifier(&etm_cpu_notifier);
> + if (--etm_count == 0) {
> + cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT_STARTING);
> + if (hp_online)
> + cpuhp_remove_state_nocalls(hp_online);
> + }
> return ret;
> }
>
> --- a/include/linux/cpuhotplug.h
> +++ b/include/linux/cpuhotplug.h
> @@ -54,6 +54,7 @@ enum cpuhp_state {
> CPUHP_AP_KVM_ARM_VGIC_STARTING,
> CPUHP_AP_KVM_ARM_TIMER_STARTING,
> CPUHP_AP_ARM_XEN_STARTING,
> + CPUHP_AP_ARM_CORESIGHT_STARTING,
> CPUHP_AP_LEDTRIG_STARTING,
> CPUHP_AP_NOTIFY_STARTING,
> CPUHP_AP_ONLINE,
>
>
This looks good to me - thanks for contribution. With the above change,
Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [patch 55/66] hwtracing: coresight-etm4x: Convert to hotplug state machine
2016-07-11 12:29 ` [patch 55/66] hwtracing: coresight-etm4x: " Anna-Maria Gleixner
@ 2016-07-12 15:21 ` Mathieu Poirier
0 siblings, 0 replies; 10+ messages in thread
From: Mathieu Poirier @ 2016-07-12 15:21 UTC (permalink / raw)
To: linux-arm-kernel
On 11 July 2016 at 06:29, Anna-Maria Gleixner <anna-maria@linutronix.de> wrote:
> From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>
> This driver has an asymmetry of ONLINE code without any corresponding tear
> down code. Otherwise, this is a straightforward conversion.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: linux-arm-kernel at lists.infradead.org
> Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
> ---
> drivers/hwtracing/coresight/coresight-etm4x.c | 93 ++++++++++++++------------
> include/linux/cpuhotplug.h | 1
> 2 files changed, 53 insertions(+), 41 deletions(-)
>
> --- a/drivers/hwtracing/coresight/coresight-etm4x.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x.c
> @@ -673,53 +673,52 @@ void etm4_config_trace_mode(struct etmv4
> config->addr_acc[ETM_DEFAULT_ADDR_COMP + 1] = addr_acc;
> }
>
> -static int etm4_cpu_callback(struct notifier_block *nfb, unsigned long action,
> - void *hcpu)
> +static int etm4_online_cpu(unsigned int cpu)
> {
> - unsigned int cpu = (unsigned long)hcpu;
> + if (!etmdrvdata[cpu])
> + return 0;
> +
> + if (etmdrvdata[cpu]->boot_enable && !etmdrvdata[cpu]->sticky_enable)
> + coresight_enable(etmdrvdata[cpu]->csdev);
> + return 0;
> +}
> +
> +static int etm4_starting_cpu(unsigned int cpu)
> +{
> + if (!etmdrvdata[cpu])
> + return 0;
> +
> + spin_lock(&etmdrvdata[cpu]->spinlock);
> + if (!etmdrvdata[cpu]->os_unlock) {
> + etm4_os_unlock(etmdrvdata[cpu]);
> + etmdrvdata[cpu]->os_unlock = true;
> + }
>
> + if (local_read(&etmdrvdata[cpu]->mode))
> + etm4_enable_hw(etmdrvdata[cpu]);
> + spin_unlock(&etmdrvdata[cpu]->spinlock);
> + return 0;
> +}
> +
> +static int etm4_dying_cpu(unsigned int cpu)
> +{
> if (!etmdrvdata[cpu])
> - goto out;
> + return 0;
>
> - switch (action & (~CPU_TASKS_FROZEN)) {
> - case CPU_STARTING:
> - spin_lock(&etmdrvdata[cpu]->spinlock);
> - if (!etmdrvdata[cpu]->os_unlock) {
> - etm4_os_unlock(etmdrvdata[cpu]);
> - etmdrvdata[cpu]->os_unlock = true;
> - }
> -
> - if (local_read(&etmdrvdata[cpu]->mode))
> - etm4_enable_hw(etmdrvdata[cpu]);
> - spin_unlock(&etmdrvdata[cpu]->spinlock);
> - break;
> -
> - case CPU_ONLINE:
> - if (etmdrvdata[cpu]->boot_enable &&
> - !etmdrvdata[cpu]->sticky_enable)
> - coresight_enable(etmdrvdata[cpu]->csdev);
> - break;
> -
> - case CPU_DYING:
> - spin_lock(&etmdrvdata[cpu]->spinlock);
> - if (local_read(&etmdrvdata[cpu]->mode))
> - etm4_disable_hw(etmdrvdata[cpu]);
> - spin_unlock(&etmdrvdata[cpu]->spinlock);
> - break;
> - }
> -out:
> - return NOTIFY_OK;
> -}
> -
> -static struct notifier_block etm4_cpu_notifier = {
> - .notifier_call = etm4_cpu_callback,
> -};
> + spin_lock(&etmdrvdata[cpu]->spinlock);
> + if (local_read(&etmdrvdata[cpu]->mode))
> + etm4_disable_hw(etmdrvdata[cpu]);
> + spin_unlock(&etmdrvdata[cpu]->spinlock);
> + return 0;
> +}
>
> static void etm4_init_trace_id(struct etmv4_drvdata *drvdata)
> {
> drvdata->trcid = coresight_get_trace_id(drvdata->cpu);
> }
>
> +static enum cpuhp_state hp_online;
> +
Same comment as with ETMv3 - I'd like to see this at the top of the
file with the rest of the global declaration.
> static int etm4_probe(struct amba_device *adev, const struct amba_id *id)
> {
> int ret;
> @@ -767,8 +766,17 @@ static int etm4_probe(struct amba_device
> etm4_init_arch_data, drvdata, 1))
> dev_err(dev, "ETM arch init failed\n");
>
> - if (!etm4_count++)
> - register_hotcpu_notifier(&etm4_cpu_notifier);
> + if (!etm4_count++) {
> + cpuhp_setup_state_nocalls(CPUHP_AP_ARM_CORESIGHT4_STARTING,
> + "AP_ARM_CORESIGHT4_STARTING",
> + etm4_starting_cpu, etm4_dying_cpu);
> + ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
> + "AP_ARM_CORESIGHT4_ONLINE",
> + etm4_online_cpu, NULL);
> + if (ret < 0)
> + goto err_arch_supported;
> + hp_online = ret;
> + }
>
> put_online_cpus();
>
> @@ -809,8 +817,11 @@ static int etm4_probe(struct amba_device
> return 0;
>
> err_arch_supported:
> - if (--etm4_count == 0)
> - unregister_hotcpu_notifier(&etm4_cpu_notifier);
> + if (--etm4_count == 0) {
> + cpuhp_remove_state_nocalls(CPUHP_AP_ARM_CORESIGHT4_STARTING);
> + if (hp_online)
> + cpuhp_remove_state_nocalls(hp_online);
> + }
> return ret;
> }
>
> --- a/include/linux/cpuhotplug.h
> +++ b/include/linux/cpuhotplug.h
> @@ -55,6 +55,7 @@ enum cpuhp_state {
> CPUHP_AP_KVM_ARM_TIMER_STARTING,
> CPUHP_AP_ARM_XEN_STARTING,
> CPUHP_AP_ARM_CORESIGHT_STARTING,
> + CPUHP_AP_ARM_CORESIGHT4_STARTING,
> CPUHP_AP_LEDTRIG_STARTING,
> CPUHP_AP_NOTIFY_STARTING,
> CPUHP_AP_ONLINE,
>
>
With the above change,
Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-07-12 15:21 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20160711122450.923603742@linutronix.de>
2016-07-11 12:28 ` [patch 07/66] ARM: mvebu: Convert to hotplug state machine Anna-Maria Gleixner
2016-07-11 12:28 ` [patch 33/66] arm: Convert VFP hotplug notifiers to " Anna-Maria Gleixner
2016-07-11 12:28 ` [patch 38/66] clocksource/arm_global_timer: Convert to hotplug " Anna-Maria Gleixner
2016-07-11 12:28 ` [patch 51/66] arm: twd: " Anna-Maria Gleixner
2016-07-11 12:28 ` [patch 50/66] arm: l2c: " Anna-Maria Gleixner
2016-07-11 12:29 ` [patch 54/66] hwtracing: coresight-etm3x: " Anna-Maria Gleixner
2016-07-12 15:19 ` Mathieu Poirier
2016-07-11 12:29 ` [patch 55/66] hwtracing: coresight-etm4x: " Anna-Maria Gleixner
2016-07-12 15:21 ` Mathieu Poirier
2016-07-11 12:29 ` [patch 56/66] arm64: armv8 deprecated: " Anna-Maria Gleixner
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).