[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/cpufreq: separate powernow/hwp/acpi cpufreq code
commit f96d008fb006751385a2c381d4ad0b9526a89a1e Author: Sergiy Kibrik <Sergiy_Kibrik@xxxxxxxx> AuthorDate: Thu Aug 1 09:41:03 2024 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Aug 1 09:41:03 2024 +0200 x86/cpufreq: separate powernow/hwp/acpi cpufreq code Build AMD Architectural P-state driver when CONFIG_AMD is on, and Intel Hardware P-States driver together with ACPI Processor P-States driver when CONFIG_INTEL is on respectively, allowing for a platform-specific build. Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@xxxxxxxx> Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/acpi/cpufreq/Makefile | 6 +++--- xen/arch/x86/acpi/cpufreq/cpufreq.c | 8 +++++--- xen/drivers/acpi/pmstat.c | 5 +++-- xen/drivers/cpufreq/cpufreq.c | 3 ++- xen/include/acpi/cpufreq/cpufreq.h | 5 +++++ 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/acpi/cpufreq/Makefile b/xen/arch/x86/acpi/cpufreq/Makefile index 44d4c0b497..e7dbe434a8 100644 --- a/xen/arch/x86/acpi/cpufreq/Makefile +++ b/xen/arch/x86/acpi/cpufreq/Makefile @@ -1,4 +1,4 @@ -obj-y += acpi.o +obj-$(CONFIG_INTEL) += acpi.o obj-y += cpufreq.o -obj-y += hwp.o -obj-y += powernow.o +obj-$(CONFIG_INTEL) += hwp.o +obj-$(CONFIG_AMD) += powernow.o diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c index 6244d29496..61e98b67bd 100644 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c @@ -138,10 +138,12 @@ static int __init cf_check cpufreq_driver_init(void) switch ( cpufreq_xen_opts[i] ) { case CPUFREQ_xen: - ret = acpi_cpufreq_register(); + ret = IS_ENABLED(CONFIG_INTEL) ? + acpi_cpufreq_register() : -ENODEV; break; case CPUFREQ_hwp: - ret = hwp_register_driver(); + ret = IS_ENABLED(CONFIG_INTEL) ? + hwp_register_driver() : -ENODEV; break; case CPUFREQ_none: ret = 0; @@ -155,7 +157,7 @@ static int __init cf_check cpufreq_driver_init(void) case X86_VENDOR_AMD: case X86_VENDOR_HYGON: - ret = powernow_register_driver(); + ret = IS_ENABLED(CONFIG_AMD) ? powernow_register_driver() : -ENODEV; break; } } diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c index 998d2e3c65..df309e27b4 100644 --- a/xen/drivers/acpi/pmstat.c +++ b/xen/drivers/acpi/pmstat.c @@ -254,8 +254,9 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op) else strlcpy(op->u.get_para.scaling_driver, "Unknown", CPUFREQ_NAME_LEN); - if ( !strncmp(op->u.get_para.scaling_driver, XEN_HWP_DRIVER_NAME, - CPUFREQ_NAME_LEN) ) + if ( IS_ENABLED(CONFIG_INTEL) && + !strncmp(op->u.get_para.scaling_driver, XEN_HWP_DRIVER_NAME, + CPUFREQ_NAME_LEN) ) ret = get_hwp_para(policy->cpu, &op->u.get_para.u.cppc_para); else { diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c index 8659ad3aee..4a103c6de9 100644 --- a/xen/drivers/cpufreq/cpufreq.c +++ b/xen/drivers/cpufreq/cpufreq.c @@ -120,7 +120,8 @@ static int __init cf_check setup_cpufreq_option(const char *str) if ( arg[0] && arg[1] ) ret = cpufreq_cmdline_parse(arg + 1, end); } - else if ( choice < 0 && !cmdline_strcmp(str, "hwp") ) + else if ( IS_ENABLED(CONFIG_INTEL) && choice < 0 && + !cmdline_strcmp(str, "hwp") ) { xen_processor_pmbits |= XEN_PROCESSOR_PM_PX; cpufreq_controller = FREQCTL_xen; diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h index ec7e139000..b6cff825ce 100644 --- a/xen/include/acpi/cpufreq/cpufreq.h +++ b/xen/include/acpi/cpufreq/cpufreq.h @@ -254,7 +254,12 @@ void intel_feature_detect(struct cpufreq_policy *policy); int hwp_cmdline_parse(const char *s, const char *e); int hwp_register_driver(void); +#ifdef CONFIG_INTEL bool hwp_active(void); +#else +static inline bool hwp_active(void) { return false; } +#endif + int get_hwp_para(unsigned int cpu, struct xen_cppc_para *cppc_para); int set_hwp_para(struct cpufreq_policy *policy, -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |