From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> 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 <linux@xxxxxxxxxxxx> Cc: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx> Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/135ef4fd-4fc9-40b4-b188-8e64946f47c4@xxxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/mips/loongson64/reset.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) --- a/arch/mips/loongson64/reset.c +++ b/arch/mips/loongson64/reset.c @@ -11,7 +11,6 @@ #include <linux/init.h> #include <linux/kexec.h> #include <linux/pm.h> -#include <linux/reboot.h> #include <linux/slab.h> #include <asm/bootinfo.h> @@ -22,21 +21,36 @@ #include <loongson.h> #include <boot_param.h> -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(stru 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); Patches currently in stable-queue which might be from gregkh@xxxxxxxxxxxxxxxxxxx are queue-5.15/drm-amdgpu-using-uninitialized-value-size-when-calling-amdgpu_vce_cs_reloc.patch queue-5.15/nfsd-remove-nfsd_stats-make-th_cnt-a-global-counter.patch queue-5.15/nfsd-move-reply-cache-initialization-into-nfsd-startup.patch queue-5.15/hwmon-ltc2992-fix-memory-leak-in-ltc2992_parse_dt.patch queue-5.15/sunrpc-remove-pg_stats-from-svc_program.patch queue-5.15/xhci-fix-panther-point-null-pointer-deref-at-full-speed-re-enumeration.patch queue-5.15/fs-ntfs3-add-prefix-to-bitmap_size-and-use-bits_to_u64.patch queue-5.15/scsi-core-fix-the-return-value-of-scsi_logical_block_count.patch queue-5.15/input-mt-limit-max-slots.patch queue-5.15/tools-move-alignment-related-macros-to-new-linux-align.h.patch queue-5.15/bitmap-introduce-generic-optimized-bitmap_size.patch queue-5.15/usb-gadget-fsl-increase-size-of-name-buffer-for-endp.patch queue-5.15/s390-dasd-fix-error-recovery-leading-to-data-corruption-on-ese-devices.patch queue-5.15/fuse-initialize-beyond-eof-page-contents-before-setting-uptodate.patch queue-5.15/nfsd-rename-nfsd_reply_cache_alloc.patch queue-5.15/usb-dwc3-core-skip-setting-event-buffers-for-host-on.patch queue-5.15/staging-ks7010-disable-bh-on-tx_dev_lock.patch queue-5.15/nfsd-make-all-of-the-nfsd-stats-per-network-namespace.patch queue-5.15/nfsd-move-init-of-percpu-reply_cache_stats-counters-back-to-nfsd_init_net.patch queue-5.15/selinux-fix-potential-counting-error-in-avc_add_xperms_decision.patch queue-5.15/vfs-don-t-evict-inode-under-the-inode-lru-traversing-context.patch queue-5.15/nfsd-replace-nfsd_prune_bucket.patch queue-5.15/fix-bitmap-corruption-on-close_range-with-close_range_unshare.patch queue-5.15/dm-resume-don-t-return-einval-when-signalled.patch queue-5.15/pinctrl-single-fix-potential-null-dereference-in-pcs_get_function.patch queue-5.15/pinctrl-rockchip-correct-rk3328-iomux-width-flag-for-gpio2-b-pins.patch queue-5.15/kvm-arm64-make-icc_-sgi-_el1-undef-in-the-absence-of-a-vgicv3.patch queue-5.15/drm-amdgpu-jpeg2-properly-set-atomics-vmid-field.patch queue-5.15/btrfs-tree-checker-add-dev-extent-item-checks.patch queue-5.15/revert-mips-loongson64-reset-prioritise-firmware-service.patch queue-5.15/alsa-usb-audio-add-delay-quirk-for-vivo-usb-c-xe710-headset.patch queue-5.15/bluetooth-mgmt-add-error-handling-to-pair_device.patch queue-5.15/gtp-pull-network-headers-in-gtp_dev_xmit.patch queue-5.15/mm-numa-no-task_numa_fault-call-if-pte-is-changed.patch queue-5.15/media-solo6x10-replace-max-a-min-b-c-by-clamp-b-a-c.patch queue-5.15/block-use-unsigned-long-for-blk_validate_block_size.patch queue-5.15/nfsd-stop-setting-pg_stats-for-unused-stats.patch queue-5.15/net-mana-fix-race-of-mana_hwc_post_rx_wqe-and-new-hwc-response.patch queue-5.15/mm-numa-no-task_numa_fault-call-if-pmd-is-changed.patch queue-5.15/sunrpc-don-t-change-sv_stats-if-it-doesn-t-exist.patch queue-5.15/memcg_write_event_control-fix-a-user-triggerable-oops.patch queue-5.15/char-xillybus-don-t-destroy-workqueue-from-work-item-running-on-it.patch queue-5.15/btrfs-run-delayed-iputs-when-flushing-delalloc.patch queue-5.15/nfsd-make-svc_stat-per-network-namespace-instead-of-global.patch queue-5.15/revert-drm-amd-display-validate-hw_points_num-before-using-it.patch queue-5.15/nfsd-fix-frame-size-warning-in-svc_export_parse.patch queue-5.15/char-xillybus-check-usb-endpoints-when-probing-device.patch queue-5.15/hid-wacom-defer-calculation-of-resolution-until-resolution_code-is-known.patch queue-5.15/nfsd-rename-nfsd_net_-to-nfsd_stats_.patch queue-5.15/arm64-acpi-numa-initialize-all-values-of-acpi_early_node_map-to-numa_no_node.patch queue-5.15/mips-loongson64-set-timer-mode-in-cpu-probe.patch queue-5.15/alsa-timer-relax-start-tick-time-check-for-slave-timer-elements.patch queue-5.15/nfsd-refactor-nfsd_reply_cache_free_locked.patch queue-5.15/alsa-usb-audio-support-yamaha-p-125-quirk-entry.patch queue-5.15/cxgb4-add-forgotten-u64-ivlan-cast-before-shift.patch queue-5.15/sunrpc-use-the-struct-net-as-the-svc-proc-private.patch queue-5.15/wifi-mwifiex-duplicate-static-structs-used-in-driver-instances.patch queue-5.15/hid-microsoft-add-rumble-support-to-latest-xbox-controllers.patch queue-5.15/bluetooth-hci_ldisc-check-hci_uart_proto_ready-flag-in-hciuartgetproto.patch queue-5.15/btrfs-rename-bitmap_set_bits-btrfs_bitmap_set_bits.patch queue-5.15/sunrpc-pass-in-the-sv_stats-struct-through-svc_create_pooled.patch queue-5.15/mmc-dw_mmc-allow-biu-and-ciu-clocks-to-defer.patch queue-5.15/mptcp-sched-check-both-backup-in-retrans.patch queue-5.15/s390-cio-rename-bitmap_size-idset_bitmap_size.patch queue-5.15/drm-amdgpu-actually-check-flags-for-all-context-ops.patch queue-5.15/dm-persistent-data-fix-memory-allocation-failure.patch queue-5.15/thunderbolt-mark-xdomain-as-unplugged-when-router-is-removed.patch queue-5.15/nfsd-rewrite-synopsis-of-nfsd_percpu_counters_init.patch queue-5.15/nfsd-expose-proc-net-sunrpc-nfsd-in-net-namespaces.patch queue-5.15/drm-amdkfd-don-t-allow-mapping-the-mmio-hdp-page-with-large-pages.patch queue-5.15/nfsd-refactor-the-duplicate-reply-cache-shrinker.patch queue-5.15/char-xillybus-refine-workqueue-handling.patch