From bebef79bdce35694d088141ae508c70643a19a4e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 30 Aug 2024 13:02:51 +0200 Subject: [PATCH] Revert "MIPS: Loongson64: reset: Prioritise firmware service" This reverts commit 77011a1d7a1a973d1657d06b658ce20f94172827 which is commit 4e7ca0b57f3bc09ba3e4ab86bf6b7c35134bfd04 upstream. Turns out to break the 5.15.y build, it should not have been backported that far. Reported-by: Guenter Roeck Cc: Jiaxun Yang Cc: Thomas Bogendoerfer Link: https://lore.kernel.org/r/135ef4fd-4fc9-40b4-b188-8e64946f47c4@roeck-us.net Signed-off-by: Greg Kroah-Hartman --- arch/mips/loongson64/reset.c | 38 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/arch/mips/loongson64/reset.c b/arch/mips/loongson64/reset.c index 2a8e4cd72605..e420800043b0 100644 --- a/arch/mips/loongson64/reset.c +++ b/arch/mips/loongson64/reset.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -22,21 +21,36 @@ #include #include -static int firmware_restart(struct sys_off_data *unusedd) +static void loongson_restart(char *command) { void (*fw_restart)(void) = (void *)loongson_sysconf.restart_addr; fw_restart(); - return NOTIFY_DONE; + while (1) { + if (cpu_wait) + cpu_wait(); + } } -static int firmware_poweroff(struct sys_off_data *unused) +static void loongson_poweroff(void) { void (*fw_poweroff)(void) = (void *)loongson_sysconf.poweroff_addr; fw_poweroff(); - return NOTIFY_DONE; + while (1) { + if (cpu_wait) + cpu_wait(); + } +} + +static void loongson_halt(void) +{ + pr_notice("\n\n** You can safely turn off the power now **\n\n"); + while (1) { + if (cpu_wait) + cpu_wait(); + } } #ifdef CONFIG_KEXEC @@ -140,17 +154,9 @@ static void loongson_crash_shutdown(struct pt_regs *regs) static int __init mips_reboot_setup(void) { - if (loongson_sysconf.restart_addr) { - register_sys_off_handler(SYS_OFF_MODE_RESTART, - SYS_OFF_PRIO_FIRMWARE, - firmware_restart, NULL); - } - - if (loongson_sysconf.poweroff_addr) { - register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, - SYS_OFF_PRIO_FIRMWARE, - firmware_poweroff, NULL); - } + _machine_restart = loongson_restart; + _machine_halt = loongson_halt; + pm_power_off = loongson_poweroff; #ifdef CONFIG_KEXEC kexec_argv = kmalloc(KEXEC_ARGV_SIZE, GFP_KERNEL);