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

[PATCH] platform/cpufreq: add public defines for CPUFREQ_SHARED_TYPE_


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Wed, 6 Apr 2022 17:16:45 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=iIQTgOVt3wf93/U8SGKRpU2zbTVt6Bq9lixp/soUrC0=; b=gPU4hVuXG5IaASDCHigNh8Tr7K2EQI1aVbKKgS+pYJcagGlYiueS0PG2EPk7EdqIiW3env8+SkAC59RnzR/0v/AsRCE/4oVmMmXF4aMHDbogxuT73KPsZadxZRrA14ieG1pxXDkTmbSDvy2qm+cCc10JvAIKnJd346XhR1HnTxz8Iqyo5Cag7Him7JNAo4OQoKyMUGEedfzp6BgEAStmvxrTEn+CmtsJa7cK8DjFyI/1ni2txez2OB9feVCCIm6eZH4ZxGb/Ca6OTO9PTOL6qEctY6yKhaBkPIvoHDEVjTAc12vmSBSBnaNFDtfOkutCSVnZnzK2HnNED9QqwqSAZw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=npDGWDdM/ei2QOzVQyKeGnte6XyTaKw4fBFNlfkDEwL4ba+LRrgQMpogk1Ayc88NuV24HMH5AKhbSemhQ7/lYeAVX6CDN0hmKpRCQXnOw4Wl2iWKewJMi7fM9vN7uqf736KQDcG2kiY9PJ3mmH7JTifYHjq84lx3T1y4FC6HDkY4CtfybhFyZoA343NdIs9bUVddqvupXL+o+/GHr5UL4Mq7+JRL1Yo3lrB7SkSgWGLXFD/REi57gtLp+IVwbwLd++WnHtL1MszL5zMuiaw9qJ1Vin+KvbEGKf6RHQs+7zbBVwr5HzTrDbTDfp8B3K6vbBdW+QEvJjBJ0CBzL48Zrg==
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Wed, 06 Apr 2022 15:17:05 +0000
  • Ironport-data: A9a23:PSGRp6ny86D2n+aMyauiL0Po5gy+JkRdPkR7XQ2eYbSJt1+Wr1Gzt xIeD2iFPamOYTH9c9gjYYW/8kJUucDRn9Y1HAtlryFkESMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BCpC48T8kk/vgqoPUUIYoAAgoLeNfYHpn2EoLd9IR2NYy24DlW13V4 7senuWEULOb828sWo4rw/rrRCNH5JwebxtB4zTSzdgS1LPvvyF94KA3fMldHFOhKmVgJcaoR v6r8V2M1jixEyHBqD+Suu2TnkUiGtY+NOUV45Zcc/DKbhNq/kTe3kunXRa1hIg+ZzihxrhMJ NtxWZOYCj4FL7XNuL0ncBhIOhFjbbFfx6/cLi3q2SCT5xWun3rExvxvCAc9PJEC+/YxCmZLn RAaAGlTNFbZ3bvwme/lDLk37iggBJCD0Ic3oHZvwCufFf87aZvCX7/L9ZlT2zJYasVmQ6aHN 5FFMGQHgBLoPhJhIAsTVbgCgua13HauIxNYimzIuv9ii4TU5FMoi+W8WDbPQfSIWMFUk0Cwt m/AuWPjDXkyL8eDwDCI9natgO7nni7hXo8WUrqi+ZZCn1m71mEVThoMW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Wciq+gOlHZSOLFuIoO5lbZvs3+9La1wUh4TsOscYa hT5YDnlb1rmGqhHjzkVjIF+q3tYpwxdi32MHTq9PblkAS+p0oJvnfw9PZv4Evoy6hNO6Wsn9 60SpiAtIs+OvP+PpgNc9vof6OMex/wqFT3QSCvHWg=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The values set in the shared_type field of xen_processor_performance
have so far relied on Xen and Linux having the same
CPUFREQ_SHARED_TYPE_ defines, as those have never been part of the
public interface.

Formalize by adding the defines for the allowed values in the public
header, while renaming them to use the XEN_PERF_SHARED_TYPE_ prefix
for clarity.

Fixes: 2fa7bee0a0 ('Get ACPI Px from dom0 and choose Px controller')
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
I wonder if we want to keep the CPUFREQ_SHARED_TYPE_ defines for
internal usage (and define them based on XEN_PERF_SHARED_TYPE_) in
case we need to pick up changes from Linux.
---
 xen/arch/x86/acpi/cpufreq/cpufreq.c    |  2 +-
 xen/arch/x86/acpi/cpufreq/powernow.c   |  8 ++++----
 xen/drivers/cpufreq/cpufreq.c          | 10 +++++-----
 xen/drivers/cpufreq/cpufreq_ondemand.c |  2 +-
 xen/include/acpi/cpufreq/cpufreq.h     |  5 -----
 xen/include/public/platform.h          |  6 +++++-
 6 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c 
b/xen/arch/x86/acpi/cpufreq/cpufreq.c
index c27cbb2304..200c6ac851 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -426,7 +426,7 @@ static int cf_check acpi_cpufreq_target(
         return -ENODEV;
     }
 
-    if (policy->shared_type != CPUFREQ_SHARED_TYPE_ANY)
+    if (policy->shared_type != XEN_PERF_SHARED_TYPE_ANY)
         cmd.mask = &online_policy_cpus;
     else
         cmd.mask = cpumask_of(policy->cpu);
diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c 
b/xen/arch/x86/acpi/cpufreq/powernow.c
index d4c7dcd5d9..e03a079ecb 100644
--- a/xen/arch/x86/acpi/cpufreq/powernow.c
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c
@@ -109,7 +109,7 @@ static int cf_check powernow_cpufreq_target(
             return 0;
     }
 
-    if (policy->shared_type == CPUFREQ_SHARED_TYPE_HW &&
+    if (policy->shared_type == XEN_PERF_SHARED_TYPE_HW &&
         likely(policy->cpu == smp_processor_id())) {
         transition_pstate(&next_perf_state);
         cpufreq_statistic_update(policy->cpu, perf->state, next_perf_state);
@@ -119,7 +119,7 @@ static int cf_check powernow_cpufreq_target(
 
         cpumask_and(&online_policy_cpus, policy->cpus, &cpu_online_map);
 
-        if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
+        if (policy->shared_type == XEN_PERF_SHARED_TYPE_ALL ||
             unlikely(policy->cpu != smp_processor_id()))
             on_selected_cpus(&online_policy_cpus, transition_pstate,
                              &next_perf_state, 1);
@@ -220,8 +220,8 @@ static int cf_check powernow_cpufreq_cpu_init(struct 
cpufreq_policy *policy)
     info.perf = perf = data->acpi_data;
     policy->shared_type = perf->shared_type;
 
-    if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
-        policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
+    if (policy->shared_type == XEN_PERF_SHARED_TYPE_ALL ||
+        policy->shared_type == XEN_PERF_SHARED_TYPE_ANY) {
         cpumask_set_cpu(cpu, policy->cpus);
         if (cpumask_weight(policy->cpus) != 1) {
             printk(XENLOG_WARNING "Unsupported sharing type %d (%u CPUs)\n",
diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index a94520ee57..64ed8ab1d3 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -179,7 +179,7 @@ int cpufreq_add_cpu(unsigned int cpu)
     if (per_cpu(cpufreq_cpu_policy, cpu))
         return 0;
 
-    if (perf->shared_type == CPUFREQ_SHARED_TYPE_HW)
+    if (perf->shared_type == XEN_PERF_SHARED_TYPE_HW)
         hw_all = 1;
 
     dom = perf->domain_info.domain;
@@ -334,7 +334,7 @@ int cpufreq_del_cpu(unsigned int cpu)
     if (!per_cpu(cpufreq_cpu_policy, cpu))
         return 0;
 
-    if (perf->shared_type == CPUFREQ_SHARED_TYPE_HW)
+    if (perf->shared_type == XEN_PERF_SHARED_TYPE_HW)
         hw_all = 1;
 
     dom = perf->domain_info.domain;
@@ -504,9 +504,9 @@ int set_px_pminfo(uint32_t acpi_id, struct 
xen_processor_performance *dom0_px_in
     if ( dom0_px_info->flags & XEN_PX_PSD )
     {
         /* check domain coordination */
-        if (dom0_px_info->shared_type != CPUFREQ_SHARED_TYPE_ALL &&
-            dom0_px_info->shared_type != CPUFREQ_SHARED_TYPE_ANY &&
-            dom0_px_info->shared_type != CPUFREQ_SHARED_TYPE_HW)
+        if (dom0_px_info->shared_type != XEN_PERF_SHARED_TYPE_ALL &&
+            dom0_px_info->shared_type != XEN_PERF_SHARED_TYPE_ANY &&
+            dom0_px_info->shared_type != XEN_PERF_SHARED_TYPE_HW)
         {
             ret = -EINVAL;
             goto out;
diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c 
b/xen/drivers/cpufreq/cpufreq_ondemand.c
index fbcd14d6c3..ece90cb45c 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -195,7 +195,7 @@ static void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
     set_timer(&per_cpu(dbs_timer, dbs_info->cpu), 
NOW()+dbs_tuners_ins.sampling_rate);
 
     if ( processor_pminfo[dbs_info->cpu]->perf.shared_type
-            == CPUFREQ_SHARED_TYPE_HW )
+            == XEN_PERF_SHARED_TYPE_HW )
     {
         dbs_info->stoppable = 1;
     }
diff --git a/xen/include/acpi/cpufreq/cpufreq.h 
b/xen/include/acpi/cpufreq/cpufreq.h
index e5e58c6c30..6e4dcc99c5 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -78,11 +78,6 @@ DECLARE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_policy);
 extern int __cpufreq_set_policy(struct cpufreq_policy *data,
                                 struct cpufreq_policy *policy);
 
-#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */
-#define CPUFREQ_SHARED_TYPE_HW   (1) /* HW does needed coordination */
-#define CPUFREQ_SHARED_TYPE_ALL  (2) /* All dependent CPUs should set freq */
-#define CPUFREQ_SHARED_TYPE_ANY  (3) /* Freq can be set from any dependent 
CPU*/
-
 /******************** cpufreq transition notifiers *******************/
 
 struct cpufreq_freqs {
diff --git a/xen/include/public/platform.h b/xen/include/public/platform.h
index a4c0eb6224..0198d249ef 100644
--- a/xen/include/public/platform.h
+++ b/xen/include/public/platform.h
@@ -465,7 +465,11 @@ struct xen_processor_performance {
     uint32_t state_count;     /* total available performance states */
     XEN_GUEST_HANDLE(xen_processor_px_t) states;
     struct xen_psd_package domain_info;
-    uint32_t shared_type;     /* coordination type of this processor */
+    /* Coordination type of this processor */
+#define XEN_PERF_SHARED_TYPE_HW   1 /* HW does needed coordination */
+#define XEN_PERF_SHARED_TYPE_ALL  2 /* All dependent CPUs should set freq */
+#define XEN_PERF_SHARED_TYPE_ANY  3 /* Freq can be set from any dependent CPU 
*/
+    uint32_t shared_type;
 };
 typedef struct xen_processor_performance xen_processor_performance_t;
 DEFINE_XEN_GUEST_HANDLE(xen_processor_performance_t);
-- 
2.35.1




 


Rackspace

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