Commit c8d2bcc4 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Peter Zijlstra
Browse files

MIPS: SMP_CPS: Switch to hotplug core state synchronization



Switch to the CPU hotplug core state tracking and synchronization
mechanim. This unfortunately requires to add dead reporting to the non CPS
platforms as CPS is the only user, but it allows an overall consolidation
of this functionality.

No functional change intended.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: default avatarMichael Kelley <mikelley@microsoft.com>
Tested-by: default avatarOleksandr Natalenko <oleksandr@natalenko.name>
Tested-by: Helge Deller <deller@gmx.de> # parisc
Tested-by: Guilherme G. Piccoli <gpiccoli@igalia.com> # Steam Deck
Link: https://lore.kernel.org/r/20230512205256.803238859@linutronix.de
parent 7202e979
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2285,6 +2285,7 @@ config MIPS_CPS
	select MIPS_CM
	select MIPS_CPS_PM if HOTPLUG_CPU
	select SMP
	select HOTPLUG_CORE_SYNC_DEAD if HOTPLUG_CPU
	select SYNC_R4K if (CEVT_R4K || CSRC_R4K)
	select SYS_SUPPORTS_HOTPLUG_CPU
	select SYS_SUPPORTS_SCHED_SMT if CPU_MIPSR6
+1 −0
Original line number Diff line number Diff line
@@ -345,6 +345,7 @@ void play_dead(void)
	int cpu = cpu_number_map(cvmx_get_core_num());

	idle_task_exit();
	cpuhp_ap_report_dead();
	octeon_processor_boot = 0xff;
	per_cpu(cpu_state, cpu) = CPU_DEAD;

+1 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ struct plat_smp_ops {
#ifdef CONFIG_HOTPLUG_CPU
	int (*cpu_disable)(void);
	void (*cpu_die)(unsigned int cpu);
	void (*cleanup_dead_cpu)(unsigned cpu);
#endif
#ifdef CONFIG_KEXEC
	void (*kexec_nonboot_cpu)(void);
+1 −0
Original line number Diff line number Diff line
@@ -392,6 +392,7 @@ static void bmips_cpu_die(unsigned int cpu)
void __ref play_dead(void)
{
	idle_task_exit();
	cpuhp_ap_report_dead();

	/* flush data cache */
	_dma_cache_wback_inv(0, ~0);
+5 −9
Original line number Diff line number Diff line
@@ -503,8 +503,7 @@ void play_dead(void)
		}
	}

	/* This CPU has chosen its way out */
	(void)cpu_report_death();
	cpuhp_ap_report_dead();

	cps_shutdown_this_cpu(cpu_death);

@@ -527,7 +526,9 @@ static void wait_for_sibling_halt(void *ptr_cpu)
	} while (!(halted & TCHALT_H));
}

static void cps_cpu_die(unsigned int cpu)
static void cps_cpu_die(unsigned int cpu) { }

static void cps_cleanup_dead_cpu(unsigned cpu)
{
	unsigned core = cpu_core(&cpu_data[cpu]);
	unsigned int vpe_id = cpu_vpe_id(&cpu_data[cpu]);
@@ -535,12 +536,6 @@ static void cps_cpu_die(unsigned int cpu)
	unsigned stat;
	int err;

	/* Wait for the cpu to choose its way out */
	if (!cpu_wait_death(cpu, 5)) {
		pr_err("CPU%u: didn't offline\n", cpu);
		return;
	}

	/*
	 * Now wait for the CPU to actually offline. Without doing this that
	 * offlining may race with one or more of:
@@ -624,6 +619,7 @@ static const struct plat_smp_ops cps_smp_ops = {
#ifdef CONFIG_HOTPLUG_CPU
	.cpu_disable		= cps_cpu_disable,
	.cpu_die		= cps_cpu_die,
	.cleanup_dead_cpu	= cps_cleanup_dead_cpu,
#endif
#ifdef CONFIG_KEXEC
	.kexec_nonboot_cpu	= cps_kexec_nonboot_cpu,
Loading