[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v4 01/15] cpufreq: Allow restricting to internal governors only
For hwp, the standard governors are not usable, and only the internal one is applicable. Add the cpufreq_governor_internal boolean to indicate when an internal governor, like hwp, will be used. This is set during presmp_initcall, so that it can suppress governor registration during initcall. Add an internal flag to struct cpufreq_governor to indicate such governors. This way, the unusable governors are not registered, so the internal one is the only one returned to userspace. This means incompatible governors won't be advertised to userspace. Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx> --- v4: Rework to use an internal flag Removed Jan's Ack since the approach is different. v3: Switch to initdata Add Jan Acked-by Commit message s/they/the/ typo Don't register hwp-internal when running non-hwp - Marek v2: Switch to "-internal" Add blank line in header --- xen/drivers/cpufreq/cpufreq.c | 7 +++++++ xen/include/acpi/cpufreq/cpufreq.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c index 2321c7dd07..cccf9a64c8 100644 --- a/xen/drivers/cpufreq/cpufreq.c +++ b/xen/drivers/cpufreq/cpufreq.c @@ -56,6 +56,7 @@ struct cpufreq_dom { }; static LIST_HEAD_READ_MOSTLY(cpufreq_dom_list_head); +bool __initdata cpufreq_governor_internal; struct cpufreq_governor *__read_mostly cpufreq_opt_governor; LIST_HEAD_READ_MOSTLY(cpufreq_governor_list); @@ -121,6 +122,12 @@ int __init cpufreq_register_governor(struct cpufreq_governor *governor) if (!governor) return -EINVAL; + if (cpufreq_governor_internal && !governor->internal) + return -EINVAL; + + if (!cpufreq_governor_internal && governor->internal) + return -EINVAL; + if (__find_governor(governor->name) != NULL) return -EEXIST; diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h index 35dcf21e8f..1c0872506a 100644 --- a/xen/include/acpi/cpufreq/cpufreq.h +++ b/xen/include/acpi/cpufreq/cpufreq.h @@ -106,6 +106,7 @@ struct cpufreq_governor { unsigned int event); bool_t (*handle_option)(const char *name, const char *value); struct list_head governor_list; + bool internal; }; extern struct cpufreq_governor *cpufreq_opt_governor; @@ -114,6 +115,8 @@ extern struct cpufreq_governor cpufreq_gov_userspace; extern struct cpufreq_governor cpufreq_gov_performance; extern struct cpufreq_governor cpufreq_gov_powersave; +extern bool cpufreq_governor_internal; + extern struct list_head cpufreq_governor_list; extern int cpufreq_register_governor(struct cpufreq_governor *governor); -- 2.40.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |