diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 0363fb21ced1223309c7a7c1f6a6c0d2b67af846..a20e81177d1b65369d1907d873b030c92397595d 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -345,6 +345,9 @@ config KASAN_SHADOW_OFFSET default 0xeffffff900000000 if ARM64_VA_BITS_36 && KASAN_SW_TAGS default 0xffffffffffffffff +config ARCH_HAS_CPU_RELAX + def_bool y + source "arch/arm64/Kconfig.platforms" menu "Kernel Features" diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 73e3b324c51ed0b5f79ab85a52879d94a3913988..7fa97c7004a8a6b6c528128047c900eb94a89cf1 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -128,6 +128,10 @@ void noinstr arch_cpu_idle(void) raw_local_irq_enable(); } +#if defined(CONFIG_HALTPOLL_CPUIDLE_MODULE) +EXPORT_SYMBOL(arch_cpu_idle); +#endif + #ifdef CONFIG_HOTPLUG_CPU void arch_cpu_idle_dead(void) { diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig index c0aeedd66f022ae7f92492d220a14685707338fc..7b6ba7fa574aa1cf5ee6e7fa3e698ecd14ff85cd 100644 --- a/drivers/cpuidle/Kconfig +++ b/drivers/cpuidle/Kconfig @@ -35,7 +35,7 @@ config CPU_IDLE_GOV_TEO config CPU_IDLE_GOV_HALTPOLL bool "Haltpoll governor (for virtualized systems)" - depends on KVM_GUEST + depends on KVM_GUEST || ARM64 help This governor implements haltpoll idle state selection, to be used in conjunction with the haltpoll cpuidle driver, allowing @@ -64,7 +64,7 @@ endmenu config HALTPOLL_CPUIDLE tristate "Halt poll cpuidle driver" - depends on X86 && KVM_GUEST + depends on (X86 && KVM_GUEST) || ARM64 default y help This option enables halt poll cpuidle driver, which allows to poll diff --git a/drivers/cpuidle/cpuidle-haltpoll.c b/drivers/cpuidle/cpuidle-haltpoll.c index f4761285258266c80ecca48e2797e257fd52da3e..e22f7867609bcdd921f5686b16b33029825f3bd9 100644 --- a/drivers/cpuidle/cpuidle-haltpoll.c +++ b/drivers/cpuidle/cpuidle-haltpoll.c @@ -96,7 +96,7 @@ static void haltpoll_uninit(void) static bool haltpoll_want(void) { - return kvm_para_has_hint(KVM_HINTS_REALTIME) || force; + return kvm_para_has_hint(KVM_HINTS_REALTIME); } static int __init haltpoll_init(void) @@ -112,7 +112,7 @@ static int __init haltpoll_init(void) cpuidle_poll_state_init(drv); - if (!kvm_para_available() || !haltpoll_want()) + if (!force && (!kvm_para_available() || !haltpoll_want())) return -ENODEV; ret = cpuidle_register_driver(drv); diff --git a/drivers/cpuidle/governors/haltpoll.c b/drivers/cpuidle/governors/haltpoll.c index cb2a96eafc02750acc5e7e66fa53cea18a50523a..4e814683509eb33900df3a69d1b374b2f55ce161 100644 --- a/drivers/cpuidle/governors/haltpoll.c +++ b/drivers/cpuidle/governors/haltpoll.c @@ -39,6 +39,10 @@ module_param(guest_halt_poll_grow_start, uint, 0644); static bool guest_halt_poll_allow_shrink __read_mostly = true; module_param(guest_halt_poll_allow_shrink, bool, 0644); +static bool enable __read_mostly; +module_param(enable, bool, 0444); +MODULE_PARM_DESC(enable, "Load unconditionally"); + /** * haltpoll_select - selects the next idle state to enter * @drv: cpuidle driver containing state data @@ -140,7 +144,7 @@ static struct cpuidle_governor haltpoll_governor = { static int __init init_haltpoll(void) { - if (kvm_para_available()) + if (kvm_para_available() || enable) return cpuidle_register_governor(&haltpoll_governor); return 0; diff --git a/drivers/cpuidle/poll_state.c b/drivers/cpuidle/poll_state.c index f7e83613ae94abf925003feff989e21b4f1127a8..a0dea6323771e1eeb144dd11455d57310b28bd08 100644 --- a/drivers/cpuidle/poll_state.c +++ b/drivers/cpuidle/poll_state.c @@ -7,6 +7,9 @@ #include #include #include +#ifdef CONFIG_ARM64 +#include +#endif #define POLL_IDLE_RELAX_COUNT 200