Skip to content

Commit e937dd5

Browse files
committed
arm64: debug: convert OS lock CPU hotplug notifier to new infrastructure
The arm64 debug monitor initialisation code uses a CPU hotplug notifier to clear the OS lock when CPUs come online. This patch converts the code to the new hotplug mechanism. Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent d7a83d1 commit e937dd5

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

arch/arm64/kernel/debug-monitors.c

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -132,36 +132,18 @@ NOKPROBE_SYMBOL(disable_debug_monitors);
132132
/*
133133
* OS lock clearing.
134134
*/
135-
static void clear_os_lock(void *unused)
135+
static int clear_os_lock(unsigned int cpu)
136136
{
137137
asm volatile("msr oslar_el1, %0" : : "r" (0));
138+
isb();
139+
return 0;
138140
}
139141

140-
static int os_lock_notify(struct notifier_block *self,
141-
unsigned long action, void *data)
142-
{
143-
if ((action & ~CPU_TASKS_FROZEN) == CPU_ONLINE)
144-
clear_os_lock(NULL);
145-
return NOTIFY_OK;
146-
}
147-
148-
static struct notifier_block os_lock_nb = {
149-
.notifier_call = os_lock_notify,
150-
};
151-
152142
static int debug_monitors_init(void)
153143
{
154-
cpu_notifier_register_begin();
155-
156-
/* Clear the OS lock. */
157-
on_each_cpu(clear_os_lock, NULL, 1);
158-
isb();
159-
160-
/* Register hotplug handler. */
161-
__register_cpu_notifier(&os_lock_nb);
162-
163-
cpu_notifier_register_done();
164-
return 0;
144+
return cpuhp_setup_state(CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING,
145+
"CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING",
146+
clear_os_lock, NULL);
165147
}
166148
postcore_initcall(debug_monitors_init);
167149

include/linux/cpuhotplug.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ enum cpuhp_state {
4545
CPUHP_AP_PERF_METAG_STARTING,
4646
CPUHP_AP_MIPS_OP_LOONGSON3_STARTING,
4747
CPUHP_AP_ARM_VFP_STARTING,
48+
CPUHP_AP_ARM64_DEBUG_MONITORS_STARTING,
4849
CPUHP_AP_PERF_ARM_HW_BREAKPOINT_STARTING,
4950
CPUHP_AP_PERF_ARM_STARTING,
5051
CPUHP_AP_ARM_L2X0_STARTING,

0 commit comments

Comments
 (0)