diff --git a/arch/sw_64/include/asm/idle.h b/arch/sw_64/include/asm/idle.h new file mode 100644 index 0000000000000000000000000000000000000000..7e88af18ba39f20f891703ef424dca3af02de7f9 --- /dev/null +++ b/arch/sw_64/include/asm/idle.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_SW64_IDLE_H +#define _ASM_SW64_IDLE_H + +extern void arch_cpu_idle(void); + +#endif /* _ASM_SW64_IDLE_H */ diff --git a/arch/sw_64/kernel/Makefile b/arch/sw_64/kernel/Makefile index 850f6dfddd1fe6a761458c86dfb57f228829ee5e..3cfd7b5fdb6be57a048e077dd6290d760b19525f 100644 --- a/arch/sw_64/kernel/Makefile +++ b/arch/sw_64/kernel/Makefile @@ -17,7 +17,7 @@ obj-y := entry.o fpu.o traps.o process.o sys_sw64.o irq.o \ irq_sw64.o signal.o setup.o ptrace.o time.o \ systbls.o dup_print.o tc.o timer.o \ insn.o early_init.o topology.o cacheinfo.o \ - vdso.o vdso/ hmcall.o stacktrace.o + vdso.o vdso/ hmcall.o stacktrace.o idle.o obj-$(CONFIG_ACPI) += acpi.o obj-$(CONFIG_SMP) += smp.o diff --git a/arch/sw_64/kernel/idle.c b/arch/sw_64/kernel/idle.c new file mode 100644 index 0000000000000000000000000000000000000000..729af77a228460a9095a0590c6bc7b07bf15981e --- /dev/null +++ b/arch/sw_64/kernel/idle.c @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * sw64 idle loop support. + * + */ +#include +#include +#include +#include + +#ifdef CONFIG_HOTPLUG_CPU +void arch_cpu_idle_dead(void) +{ + play_dead(); +} +#endif + +void cpu_idle(void) +{ + int i; + + local_irq_enable(); + cpu_relax(); + + if (is_in_guest()) + hcall(HCALL_HALT, 0, 0, 0); + else { + for (i = 0; i < 16; i++) + asm("nop"); + asm("halt"); + } +} + +void arch_cpu_idle(void) +{ + cpu_idle(); +} diff --git a/arch/sw_64/kernel/process.c b/arch/sw_64/kernel/process.c index e1689d25f77d25300164ae39a6f4d039eae77069..3c5b6f032c8bd5b8cb92aeda28bfe5b5cdf1a7b6 100644 --- a/arch/sw_64/kernel/process.c +++ b/arch/sw_64/kernel/process.c @@ -26,29 +26,6 @@ struct halt_info { char *restart_cmd; }; -#ifdef CONFIG_HOTPLUG_CPU -void arch_cpu_idle_dead(void) -{ - play_dead(); -} -#endif - -void arch_cpu_idle(void) -{ - int i; - - local_irq_enable(); - cpu_relax(); - - if (is_in_guest()) - hcall(HCALL_HALT, 0, 0, 0); - else { - for (i = 0; i < 16; i++) - asm("nop"); - asm("halt"); - } -} - static void common_shutdown_1(void *generic_ptr) { struct halt_info *how = (struct halt_info *)generic_ptr;