提交 32e3b9ec 编写于 作者: X Xiangyou Xie 提交者: Zheng Zengkai

ARM: cpuidle: Add support for cpuidle-haltpoll driver for ARM

hulk inclusion
category: feature
bugzilla: 47727
CVE: NA

------------------------------

Add support for cpuidle-haltpoll driver for ARM.
Allow arm to use the couidle-haltpoll driver.
Signed-off-by: NXiangyou Xie <xiexiangyou@huawei.com>
Signed-off-by: NPeng Liang <liangpeng10@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 59863798
...@@ -345,6 +345,9 @@ config KASAN_SHADOW_OFFSET ...@@ -345,6 +345,9 @@ config KASAN_SHADOW_OFFSET
default 0xeffffff900000000 if ARM64_VA_BITS_36 && KASAN_SW_TAGS default 0xeffffff900000000 if ARM64_VA_BITS_36 && KASAN_SW_TAGS
default 0xffffffffffffffff default 0xffffffffffffffff
config ARCH_HAS_CPU_RELAX
def_bool y
source "arch/arm64/Kconfig.platforms" source "arch/arm64/Kconfig.platforms"
menu "Kernel Features" menu "Kernel Features"
......
...@@ -128,6 +128,10 @@ void noinstr arch_cpu_idle(void) ...@@ -128,6 +128,10 @@ void noinstr arch_cpu_idle(void)
raw_local_irq_enable(); raw_local_irq_enable();
} }
#if defined(CONFIG_HALTPOLL_CPUIDLE_MODULE)
EXPORT_SYMBOL(arch_cpu_idle);
#endif
#ifdef CONFIG_HOTPLUG_CPU #ifdef CONFIG_HOTPLUG_CPU
void arch_cpu_idle_dead(void) void arch_cpu_idle_dead(void)
{ {
......
...@@ -35,7 +35,7 @@ config CPU_IDLE_GOV_TEO ...@@ -35,7 +35,7 @@ config CPU_IDLE_GOV_TEO
config CPU_IDLE_GOV_HALTPOLL config CPU_IDLE_GOV_HALTPOLL
bool "Haltpoll governor (for virtualized systems)" bool "Haltpoll governor (for virtualized systems)"
depends on KVM_GUEST depends on KVM_GUEST || ARM64
help help
This governor implements haltpoll idle state selection, to be This governor implements haltpoll idle state selection, to be
used in conjunction with the haltpoll cpuidle driver, allowing used in conjunction with the haltpoll cpuidle driver, allowing
...@@ -64,7 +64,7 @@ endmenu ...@@ -64,7 +64,7 @@ endmenu
config HALTPOLL_CPUIDLE config HALTPOLL_CPUIDLE
tristate "Halt poll cpuidle driver" tristate "Halt poll cpuidle driver"
depends on X86 && KVM_GUEST depends on (X86 && KVM_GUEST) || ARM64
default y default y
help help
This option enables halt poll cpuidle driver, which allows to poll This option enables halt poll cpuidle driver, which allows to poll
......
...@@ -96,7 +96,7 @@ static void haltpoll_uninit(void) ...@@ -96,7 +96,7 @@ static void haltpoll_uninit(void)
static bool haltpoll_want(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) static int __init haltpoll_init(void)
...@@ -112,7 +112,7 @@ static int __init haltpoll_init(void) ...@@ -112,7 +112,7 @@ static int __init haltpoll_init(void)
cpuidle_poll_state_init(drv); cpuidle_poll_state_init(drv);
if (!kvm_para_available() || !haltpoll_want()) if (!force && (!kvm_para_available() || !haltpoll_want()))
return -ENODEV; return -ENODEV;
ret = cpuidle_register_driver(drv); ret = cpuidle_register_driver(drv);
......
...@@ -39,6 +39,10 @@ module_param(guest_halt_poll_grow_start, uint, 0644); ...@@ -39,6 +39,10 @@ module_param(guest_halt_poll_grow_start, uint, 0644);
static bool guest_halt_poll_allow_shrink __read_mostly = true; static bool guest_halt_poll_allow_shrink __read_mostly = true;
module_param(guest_halt_poll_allow_shrink, bool, 0644); 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 * haltpoll_select - selects the next idle state to enter
* @drv: cpuidle driver containing state data * @drv: cpuidle driver containing state data
...@@ -140,7 +144,7 @@ static struct cpuidle_governor haltpoll_governor = { ...@@ -140,7 +144,7 @@ static struct cpuidle_governor haltpoll_governor = {
static int __init init_haltpoll(void) static int __init init_haltpoll(void)
{ {
if (kvm_para_available()) if (kvm_para_available() || enable)
return cpuidle_register_governor(&haltpoll_governor); return cpuidle_register_governor(&haltpoll_governor);
return 0; return 0;
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/sched/clock.h> #include <linux/sched/clock.h>
#include <linux/sched/idle.h> #include <linux/sched/idle.h>
#ifdef CONFIG_ARM64
#include <linux/cpu.h>
#endif
#define POLL_IDLE_RELAX_COUNT 200 #define POLL_IDLE_RELAX_COUNT 200
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册