Commit 27c01a8c authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Ingo Molnar

arm64/armv8 deprecated: Convert to hotplug state machine

Install the callbacks via the state machine.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarAnna-Maria Gleixner <anna-maria@linutronix.de>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Jisheng Zhang <jszhang@marvell.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Shengjiu Wang <shengjiu.wang@freescale.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153337.311115906@linutronix.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 58eb457b
...@@ -121,7 +121,7 @@ static int run_all_cpu_set_hw_mode(struct insn_emulation *insn, bool enable) ...@@ -121,7 +121,7 @@ static int run_all_cpu_set_hw_mode(struct insn_emulation *insn, bool enable)
* 0 - If all the hooks ran successfully. * 0 - If all the hooks ran successfully.
* -EINVAL - At least one hook is not supported by the CPU. * -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; int rc = 0;
unsigned long flags; unsigned long flags;
...@@ -131,7 +131,7 @@ static int run_all_insn_set_hw_mode(unsigned long cpu) ...@@ -131,7 +131,7 @@ static int run_all_insn_set_hw_mode(unsigned long cpu)
list_for_each_entry(insn, &insn_emulation, node) { list_for_each_entry(insn, &insn_emulation, node) {
bool enable = (insn->current_mode == INSN_HW); bool enable = (insn->current_mode == INSN_HW);
if (insn->ops->set_hw_mode && insn->ops->set_hw_mode(enable)) { 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); cpu, insn->ops->name);
rc = -EINVAL; rc = -EINVAL;
} }
...@@ -617,20 +617,6 @@ static struct insn_emulation_ops setend_ops = { ...@@ -617,20 +617,6 @@ static struct insn_emulation_ops setend_ops = {
.set_hw_mode = setend_set_hw_mode, .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. * Invoked as late_initcall, since not needed before init spawned.
*/ */
...@@ -649,7 +635,9 @@ static int __init armv8_deprecated_init(void) ...@@ -649,7 +635,9 @@ static int __init armv8_deprecated_init(void)
pr_info("setend instruction emulation is not supported on the system"); 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); register_insn_emulation_sysctl(ctl_abi);
return 0; return 0;
......
...@@ -51,6 +51,7 @@ enum cpuhp_state { ...@@ -51,6 +51,7 @@ enum cpuhp_state {
CPUHP_AP_ARM_XEN_STARTING, CPUHP_AP_ARM_XEN_STARTING,
CPUHP_AP_ARM_CORESIGHT_STARTING, CPUHP_AP_ARM_CORESIGHT_STARTING,
CPUHP_AP_ARM_CORESIGHT4_STARTING, CPUHP_AP_ARM_CORESIGHT4_STARTING,
CPUHP_AP_ARM64_ISNDEP_STARTING,
CPUHP_AP_LEDTRIG_STARTING, CPUHP_AP_LEDTRIG_STARTING,
CPUHP_AP_NOTIFY_STARTING, CPUHP_AP_NOTIFY_STARTING,
CPUHP_AP_ONLINE, CPUHP_AP_ONLINE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment