Wrap around the call stack functions of XENPF_set_processor_pminfo:
set_px_pminfo
print_PCT
print_PSS
print_PSD
print_PPC
check_psd_pminfo
cpufreq_limit_change
cpufreq_cpu_init
set_cx_pminfo
copy_from_compat_state
set_cx
check_cx
acpi_processor_ffh_cstate_probe
acpi_processor_power_init_bm_check
acpi_set_pdc_bits
arch_acpi_set_pdc_bits
get_mwait_ecx
And file xen/arch/x86/x86_64/cpufreq.c and xen/arch/x86/x86_64/cpu_idle.c
only have compat_set_px_pminfo and compat_set_cx_pminfo related functions,
also wrap them.
Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
---
cc: Jan Beulich <jbeulich@suse.com>
cc: Andrew Cooper <andrew.cooper3@citrix.com>
cc: "Roger Pau Monné" <roger.pau@citrix.com>
---
xen/arch/x86/acpi/cpu_idle.c | 6 ++++++
xen/arch/x86/acpi/cpufreq/cpufreq.c | 2 ++
xen/arch/x86/acpi/lib.c | 2 ++
xen/arch/x86/x86_64/Makefile | 5 +++--
xen/drivers/cpufreq/cpufreq.c | 4 ++++
5 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index d60a07bfd56b..37b3272473f3 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -986,6 +986,7 @@ int cpuidle_init_cpu(unsigned int cpu)
return 0;
}
+#ifdef CONFIG_PLATFORM_OP
static int acpi_processor_ffh_cstate_probe(xen_processor_cx_t *cx)
{
struct cpuinfo_x86 *c = ¤t_cpu_data;
@@ -1168,10 +1169,12 @@ static int check_cx(struct acpi_processor_power *power, xen_processor_cx_t *cx)
return 0;
}
+#endif /* CONFIG_PLATFORM_OP */
static unsigned int latency_factor = 2;
integer_param("idle_latency_factor", latency_factor);
+#ifdef CONFIG_PLATFORM_OP
static void set_cx(
struct acpi_processor_power *acpi_power,
xen_processor_cx_t *xen_cx)
@@ -1230,6 +1233,7 @@ static void set_cx(
if ( cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 )
acpi_power->safe_state = cx;
}
+#endif /* CONFIG_PLATFORM_OP */
int get_cpu_id(u32 acpi_id)
{
@@ -1302,6 +1306,7 @@ static void print_cx_pminfo(uint32_t cpu, struct xen_processor_power *power)
#define print_cx_pminfo(c, p)
#endif
+#ifdef CONFIG_PLATFORM_OP
long set_cx_pminfo(uint32_t acpi_id, struct xen_processor_power *power)
{
XEN_GUEST_HANDLE(xen_processor_cx_t) states;
@@ -1389,6 +1394,7 @@ long set_cx_pminfo(uint32_t acpi_id, struct xen_processor_power *power)
return 0;
}
+#endif /* CONFIG_PLATFORM_OP */
static void amd_cpuidle_init(struct acpi_processor_power *power)
{
diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c
index 45f301f354ac..333b57f3e015 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -179,6 +179,7 @@ static int __init cf_check cpufreq_driver_late_init(void)
}
__initcall(cpufreq_driver_late_init);
+#ifdef CONFIG_PLATFORM_OP
int cpufreq_cpu_init(unsigned int cpu)
{
/* Currently we only handle Intel, AMD and Hygon processor */
@@ -188,3 +189,4 @@ int cpufreq_cpu_init(unsigned int cpu)
return -EOPNOTSUPP;
}
+#endif /* CONFIG_PLATFORM_OP */
diff --git a/xen/arch/x86/acpi/lib.c b/xen/arch/x86/acpi/lib.c
index 51cb082ca02a..06afc7f3f71a 100644
--- a/xen/arch/x86/acpi/lib.c
+++ b/xen/arch/x86/acpi/lib.c
@@ -101,6 +101,7 @@ unsigned int acpi_get_processor_id(unsigned int cpu)
return INVALID_ACPIID;
}
+#ifdef CONFIG_PLATFORM_OP
static void cf_check get_mwait_ecx(void *info)
{
*(u32 *)info = cpuid_ecx(CPUID_MWAIT_LEAF);
@@ -147,3 +148,4 @@ int arch_acpi_set_pdc_bits(u32 acpi_id, u32 *pdc, u32 mask)
return 0;
}
+#endif /* CONFIG_PLATFORM_OP */
diff --git a/xen/arch/x86/x86_64/Makefile b/xen/arch/x86/x86_64/Makefile
index 472b2bab523d..8778d49870a9 100644
--- a/xen/arch/x86/x86_64/Makefile
+++ b/xen/arch/x86/x86_64/Makefile
@@ -9,6 +9,7 @@ obj-y += mmconf-fam10h.o
obj-y += mmconfig_64.o
obj-y += mmconfig-shared.o
obj-$(CONFIG_COMPAT) += domain.o
-obj-$(CONFIG_COMPAT) += cpu_idle.o
-obj-$(CONFIG_COMPAT) += cpufreq.o
+ifeq ($(CONFIG_COMPAT)$(CONFIG_PLATFORM_OP),yy)
+obj-y += cpu_idle.o cpufreq.o
+endif
obj-bin-$(CONFIG_KEXEC) += kexec_reloc.o
diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index efba1414188a..396a3a9fd092 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -168,6 +168,7 @@ int __init cpufreq_register_governor(struct cpufreq_governor *governor)
return 0;
}
+#ifdef CONFIG_PLATFORM_OP
int cpufreq_limit_change(unsigned int cpu)
{
struct processor_performance *perf;
@@ -190,6 +191,7 @@ int cpufreq_limit_change(unsigned int cpu)
return __cpufreq_set_policy(data, &policy);
}
+#endif /* CONFIG_PLATFORM_OP */
static int get_psd_info(unsigned int cpu, unsigned int *shared_type,
const struct xen_psd_package **domain_info)
@@ -460,6 +462,7 @@ int cpufreq_del_cpu(unsigned int cpu)
return 0;
}
+#ifdef CONFIG_PLATFORM_OP
static void print_PCT(struct xen_pct_register *ptr)
{
printk("\t_PCT: descriptor=%d, length=%d, space_id=%d, "
@@ -661,6 +664,7 @@ int acpi_set_pdc_bits(unsigned int acpi_id, XEN_GUEST_HANDLE(uint32) pdc)
return ret;
}
+#endif /* CONFIG_PLATFORM_OP */
static void cpufreq_cmdline_common_para(struct cpufreq_policy *new_policy)
{
--
2.34.1