[PATCH v3 04/15] xen/cpufreq: move XEN_PROCESSOR_PM_xxx to internal header

Penny Zheng posted 15 patches 11 months, 1 week ago
There is a newer version of this series
[PATCH v3 04/15] xen/cpufreq: move XEN_PROCESSOR_PM_xxx to internal header
Posted by Penny Zheng 11 months, 1 week ago
XEN_PROCESSOR_PM_xxx are used to set xen_processor_pmbits only, which is
a Xen-internal variable only. Although PV Dom0 passed these bits in si->flags,
they haven't been used anywhere.
So this commit moves XEN_PROCESSOR_PM_xxx back to internal header
"acpi/cpufreq/processor_perf.h"

Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
v2 -> v3:
- new commit
---
 xen/arch/x86/pv/dom0_build.c              | 1 -
 xen/arch/x86/setup.c                      | 1 +
 xen/common/domain.c                       | 1 +
 xen/include/acpi/cpufreq/processor_perf.h | 5 +++++
 xen/include/public/platform.h             | 5 -----
 xen/include/public/xen.h                  | 1 -
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 96e28c7b6a..a62948b0e8 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -886,7 +886,6 @@ static int __init dom0_construct(struct boot_info *bi, struct domain *d)
         si->flags    = SIF_PRIVILEGED | SIF_INITDOMAIN;
     if ( !vinitrd_start && initrd_len )
         si->flags   |= SIF_MOD_START_PFN;
-    si->flags       |= MASK_INSR(xen_processor_pmbits, SIF_PM_MASK);
     si->pt_base      = vpt_start;
     si->nr_pt_frames = nr_pt_pages;
     si->mfn_list     = vphysmap_start;
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8ebe5a9443..5101b381fe 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -62,6 +62,7 @@
 #include <asm/prot-key.h>
 #include <asm/pv/domain.h>
 #include <asm/trampoline.h>
+#include <acpi/cpufreq/cpufreq.h>
 
 /* opt_nosmp: If true, secondary processors are ignored. */
 static bool __initdata opt_nosmp;
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 0c4cc77111..05cfa1d885 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -43,6 +43,7 @@
 #include <xsm/xsm.h>
 #include <xen/trace.h>
 #include <asm/setup.h>
+#include <acpi/cpufreq/cpufreq.h>
 
 #ifdef CONFIG_X86
 #include <asm/guest.h>
diff --git a/xen/include/acpi/cpufreq/processor_perf.h b/xen/include/acpi/cpufreq/processor_perf.h
index 12b6e6b826..33edf112a0 100644
--- a/xen/include/acpi/cpufreq/processor_perf.h
+++ b/xen/include/acpi/cpufreq/processor_perf.h
@@ -5,6 +5,11 @@
 #include <public/sysctl.h>
 #include <xen/acpi.h>
 
+/* ability bits */
+#define XEN_PROCESSOR_PM_CX 1
+#define XEN_PROCESSOR_PM_PX 2
+#define XEN_PROCESSOR_PM_TX 4
+
 #define XEN_CPPC_INIT 0x40000000U
 #define XEN_PX_INIT   0x80000000U
 
diff --git a/xen/include/public/platform.h b/xen/include/public/platform.h
index 07f4b72014..24cc5812ed 100644
--- a/xen/include/public/platform.h
+++ b/xen/include/public/platform.h
@@ -353,11 +353,6 @@ DEFINE_XEN_GUEST_HANDLE(xenpf_getidletime_t);
 
 #define XENPF_set_processor_pminfo      54
 
-/* ability bits */
-#define XEN_PROCESSOR_PM_CX	1
-#define XEN_PROCESSOR_PM_PX	2
-#define XEN_PROCESSOR_PM_TX	4
-
 /* cmd type */
 #define XEN_PM_CX   0
 #define XEN_PM_PX   1
diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h
index e051f989a5..941d288ec1 100644
--- a/xen/include/public/xen.h
+++ b/xen/include/public/xen.h
@@ -877,7 +877,6 @@ typedef struct start_info start_info_t;
 #define SIF_MOD_START_PFN (1<<3)  /* Is mod_start a PFN? */
 #define SIF_VIRT_P2M_4TOOLS (1<<4) /* Do Xen tools understand a virt. mapped */
                                    /* P->M making the 3 level tree obsolete? */
-#define SIF_PM_MASK       (0xFF<<8) /* reserve 1 byte for xen-pm options */
 
 /*
  * A multiboot module is a package containing modules very similar to a
-- 
2.34.1
Re: [PATCH v3 04/15] xen/cpufreq: move XEN_PROCESSOR_PM_xxx to internal header
Posted by Jan Beulich 10 months, 3 weeks ago
On 06.03.2025 09:39, Penny Zheng wrote:
> XEN_PROCESSOR_PM_xxx are used to set xen_processor_pmbits only, which is
> a Xen-internal variable only. Although PV Dom0 passed these bits in si->flags,
> they haven't been used anywhere.

Please be careful with "not used anywhere". See e.g.
https://xenbits.xen.org/gitweb/?p=legacy/linux-2.6.18-xen.git;a=blob;f=arch/i386/kernel/acpi/processor_extcntl_xen.c;h=eb6a53e9572c137da505a7d4970b1a5b7e1c522d;hb=HEAD#l193

> So this commit moves XEN_PROCESSOR_PM_xxx back to internal header
> "acpi/cpufreq/processor_perf.h"

Essentially you're again altering the stable public ABI in a way that's not
acceptable.

Jan
RE: [PATCH v3 04/15] xen/cpufreq: move XEN_PROCESSOR_PM_xxx to internal header
Posted by Penny, Zheng 10 months, 2 weeks ago
[Public]

Hi

> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Monday, March 24, 2025 11:12 PM
> To: Penny, Zheng <penny.zheng@amd.com>
> Cc: Huang, Ray <Ray.Huang@amd.com>; Andrew Cooper
> <andrew.cooper3@citrix.com>; Roger Pau Monné <roger.pau@citrix.com>;
> Anthony PERARD <anthony.perard@vates.tech>; Orzel, Michal
> <Michal.Orzel@amd.com>; Julien Grall <julien@xen.org>; Stefano Stabellini
> <sstabellini@kernel.org>; xen-devel@lists.xenproject.org
> Subject: Re: [PATCH v3 04/15] xen/cpufreq: move XEN_PROCESSOR_PM_xxx
> to internal header
>
> On 06.03.2025 09:39, Penny Zheng wrote:
> > XEN_PROCESSOR_PM_xxx are used to set xen_processor_pmbits only, which
> > is a Xen-internal variable only. Although PV Dom0 passed these bits in
> > si->flags, they haven't been used anywhere.
>
> Please be careful with "not used anywhere". See e.g.
> https://xenbits.xen.org/gitweb/?p=legacy/linux-2.6.18-
> xen.git;a=blob;f=arch/i386/kernel/acpi/processor_extcntl_xen.c;h=eb6a53e9572c13
> 7da505a7d4970b1a5b7e1c522d;hb=HEAD#l193
>
> > So this commit moves XEN_PROCESSOR_PM_xxx back to internal header
> > "acpi/cpufreq/processor_perf.h"
>
> Essentially you're again altering the stable public ABI in a way that's not acceptable.
>

Understood...
I misunderstood the previous comment again...
I'll only move  the new XEN_PROCESSOR_PM_CPPC into the internal header

> Jan