Skip to content

Commit 27c01a8

Browse files
Sebastian Andrzej SiewiorIngo Molnar
authored andcommitted
arm64/armv8 deprecated: Convert to hotplug state machine
Install the callbacks via the state machine. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Anna-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.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 58eb457 commit 27c01a8

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

arch/arm64/kernel/armv8_deprecated.c

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static int run_all_cpu_set_hw_mode(struct insn_emulation *insn, bool enable)
121121
* 0 - If all the hooks ran successfully.
122122
* -EINVAL - At least one hook is not supported by the CPU.
123123
*/
124-
static int run_all_insn_set_hw_mode(unsigned long cpu)
124+
static int run_all_insn_set_hw_mode(unsigned int cpu)
125125
{
126126
int rc = 0;
127127
unsigned long flags;
@@ -131,7 +131,7 @@ static int run_all_insn_set_hw_mode(unsigned long cpu)
131131
list_for_each_entry(insn, &insn_emulation, node) {
132132
bool enable = (insn->current_mode == INSN_HW);
133133
if (insn->ops->set_hw_mode && insn->ops->set_hw_mode(enable)) {
134-
pr_warn("CPU[%ld] cannot support the emulation of %s",
134+
pr_warn("CPU[%u] cannot support the emulation of %s",
135135
cpu, insn->ops->name);
136136
rc = -EINVAL;
137137
}
@@ -617,20 +617,6 @@ static struct insn_emulation_ops setend_ops = {
617617
.set_hw_mode = setend_set_hw_mode,
618618
};
619619

620-
static int insn_cpu_hotplug_notify(struct notifier_block *b,
621-
unsigned long action, void *hcpu)
622-
{
623-
int rc = 0;
624-
if ((action & ~CPU_TASKS_FROZEN) == CPU_STARTING)
625-
rc = run_all_insn_set_hw_mode((unsigned long)hcpu);
626-
627-
return notifier_from_errno(rc);
628-
}
629-
630-
static struct notifier_block insn_cpu_hotplug_notifier = {
631-
.notifier_call = insn_cpu_hotplug_notify,
632-
};
633-
634620
/*
635621
* Invoked as late_initcall, since not needed before init spawned.
636622
*/
@@ -649,7 +635,9 @@ static int __init armv8_deprecated_init(void)
649635
pr_info("setend instruction emulation is not supported on the system");
650636
}
651637

652-
register_cpu_notifier(&insn_cpu_hotplug_notifier);
638+
cpuhp_setup_state_nocalls(CPUHP_AP_ARM64_ISNDEP_STARTING,
639+
"AP_ARM64_ISNDEP_STARTING",
640+
run_all_insn_set_hw_mode, NULL);
653641
register_insn_emulation_sysctl(ctl_abi);
654642

655643
return 0;

include/linux/cpuhotplug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ enum cpuhp_state {
5151
CPUHP_AP_ARM_XEN_STARTING,
5252
CPUHP_AP_ARM_CORESIGHT_STARTING,
5353
CPUHP_AP_ARM_CORESIGHT4_STARTING,
54+
CPUHP_AP_ARM64_ISNDEP_STARTING,
5455
CPUHP_AP_LEDTRIG_STARTING,
5556
CPUHP_AP_NOTIFY_STARTING,
5657
CPUHP_AP_ONLINE,

0 commit comments

Comments
 (0)