[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 07/11] xen/platform_op: Wrap around XENPF_set_processor_pminfo


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jiqian Chen <Jiqian.Chen@xxxxxxx>
  • Date: Fri, 25 Jul 2025 14:15:26 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GWo4Gp0/CkdsYjzkposWPAs5K0N2Gq89c2dtM3RO0HA=; b=RVPEs9o7ffuVc+t6BQlL+tkusncNfpTYWr4uv5UUOZ1YAi7TK2+F0Dpdc+HYFc9u4C9Gl0uLJWwNfyw+qkXet4r+1wlULfjdC4Jhq63t/mugLzLP4qaw+t114Y5XqjXXxr4vS4D8lEnqv8Sl9E4iWbL//GpCjUPdfPJ7pSvR18/Og+MYon5AF4Nrh4x+/Yhayu0A51B7FE7HhZcAcvi6MjDucb11YwumdflMpdDufyw+Hbxg0P/bEwkbvvWADD+FakEq+0PpNYAKJf4zoL16wWfw4zW+yZ1E8/NbGeT36zGXyFmAcPwt0WziB3dQj9y65jIK5NQ7mo17WGVwgrgocg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qUPb8Qnt/iKXF7dXuWRpWZyzMJAKe57s1CwU92KG6v7BCfeWfJAOkC163J1XToGro4ONJQ1WpztsezWz20LT5aajBotABH6f6taXf4gCgzBHbcV0HV2oUmzfwf6pgl0xM62sihaCecUQdFrEZwPM9LcmD1W5pfi9KMzh5PdaNvNE/zvv4Qgkx1tGyYz6r8XXCB7iWnaVwUBixKy1TsoG+KPb5XShfYmM24JIg70A6z+X7aR9KsAggrMtynfaqU96tEvWrsJ+/tNk2uKIvURnpP3sr4f9+9vk5X0D1dEUcxnflCTBUOw/GyMBIB4eJJp5HEgJx2Fr5hb8ALpkLNecnA==
  • Cc: Huang Rui <ray.huang@xxxxxxx>, Jiqian Chen <Jiqian.Chen@xxxxxxx>, "Jan Beulich" <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 25 Jul 2025 06:16:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxx>
---
cc: Jan Beulich <jbeulich@xxxxxxxx>
cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
cc: "Roger Pau Monné" <roger.pau@xxxxxxxxxx>
---
 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 = &current_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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.