Commit 39f87561 authored by Michael Ellerman's avatar Michael Ellerman
Browse files

powerpc/smp: Move ppc_md.cpu_die() to smp_ops.cpu_offline_self()



We have smp_ops->cpu_die() and ppc_md.cpu_die(). One of them offlines
the current CPU and one offlines another CPU, can you guess which is
which? Also one is in smp_ops and one is in ppc_md?

So rename ppc_md.cpu_die(), to cpu_offline_self(), because that's what
it does. And move it into smp_ops where it belongs.

Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200819015634.1974478-3-mpe@ellerman.id.au
parent bf3c1464
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -65,7 +65,6 @@ struct machdep_calls {
	void __noreturn	(*restart)(char *cmd);
	void __noreturn (*halt)(void);
	void		(*panic)(char *str);
	void		(*cpu_die)(void);

	long		(*time_init)(void); /* Optional, may be NULL */

+3 −0
Original line number Diff line number Diff line
@@ -50,6 +50,9 @@ struct smp_ops_t {
	int   (*cpu_disable)(void);
	void  (*cpu_die)(unsigned int nr);
	int   (*cpu_bootable)(unsigned int nr);
#ifdef CONFIG_HOTPLUG_CPU
	void  (*cpu_offline_self)(void);
#endif
};

extern int smp_send_nmi_ipi(int cpu, void (*fn)(struct pt_regs *), u64 delay_us);
+2 −2
Original line number Diff line number Diff line
@@ -1499,8 +1499,8 @@ void arch_cpu_idle_dead(void)
	 */
	this_cpu_disable_ftrace();

	if (ppc_md.cpu_die)
		ppc_md.cpu_die();
	if (smp_ops->cpu_offline_self)
		smp_ops->cpu_offline_self();

	/* If we return, we re-enter start_secondary */
	start_secondary_resume();
+3 −1
Original line number Diff line number Diff line
@@ -1160,6 +1160,7 @@ static int __init topology_init(void)
	for_each_possible_cpu(cpu) {
		struct cpu *c = &per_cpu(cpu_devices, cpu);

#ifdef CONFIG_HOTPLUG_CPU
		/*
		 * For now, we just see if the system supports making
		 * the RTAS calls for CPU hotplug.  But, there may be a
@@ -1167,8 +1168,9 @@ static int __init topology_init(void)
		 * CPU.  For instance, the boot cpu might never be valid
		 * for hotplugging.
		 */
		if (ppc_md.cpu_die)
		if (smp_ops->cpu_offline_self)
			c->hotpluggable = 1;
#endif

		if (cpu_online(cpu) || c->hotpluggable) {
			register_cpu(c, cpu);
+2 −2
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ static void mpc85xx_take_timebase(void)
	local_irq_restore(flags);
}

static void smp_85xx_mach_cpu_die(void)
static void smp_85xx_cpu_offline_self(void)
{
	unsigned int cpu = smp_processor_id();

@@ -506,7 +506,7 @@ void __init mpc85xx_smp_init(void)
	if (qoriq_pm_ops) {
		smp_85xx_ops.give_timebase = mpc85xx_give_timebase;
		smp_85xx_ops.take_timebase = mpc85xx_take_timebase;
		ppc_md.cpu_die = smp_85xx_mach_cpu_die;
		smp_85xx_ops.cpu_offline_self = smp_85xx_cpu_offline_self;
		smp_85xx_ops.cpu_die = qoriq_cpu_kill;
	}
#endif
Loading