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

[XEN PATCH v1] x86/cpufreq: separate powernow/hwp cpufreq code



Build AMD Architectural P-state driver when CONFIG_AMD is on, and
Intel Hardware P-States driver when CONFIG_INTEL is on respectively,
allowing for a plaftorm-specific build.

Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@xxxxxxxx>
CC: Jason Andryuk <jason.andryuk@xxxxxxx>
---
 xen/arch/x86/acpi/cpufreq/Makefile  |  4 ++--
 xen/arch/x86/acpi/cpufreq/cpufreq.c |  2 +-
 xen/include/acpi/cpufreq/cpufreq.h  | 32 +++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/Makefile 
b/xen/arch/x86/acpi/cpufreq/Makefile
index db83aa6b14..527ff20f5a 100644
--- a/xen/arch/x86/acpi/cpufreq/Makefile
+++ b/xen/arch/x86/acpi/cpufreq/Makefile
@@ -1,3 +1,3 @@
 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 a341f2f020..a89f3ed03a 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -657,7 +657,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/include/acpi/cpufreq/cpufreq.h 
b/xen/include/acpi/cpufreq/cpufreq.h
index 443427153b..bc0c9a2b9f 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -252,6 +252,7 @@ void cpufreq_dbs_timer_resume(void);
 
 void intel_feature_detect(struct cpufreq_policy *policy);
 
+#ifdef CONFIG_INTEL
 int hwp_cmdline_parse(const char *s, const char *e);
 int hwp_register_driver(void);
 bool hwp_active(void);
@@ -260,4 +261,35 @@ int get_hwp_para(unsigned int cpu,
 int set_hwp_para(struct cpufreq_policy *policy,
                  struct xen_set_cppc_para *set_cppc);
 
+#else
+
+static inline int hwp_cmdline_parse(const char *s, const char *e)
+{
+    return -EINVAL;
+}
+
+static inline int hwp_register_driver(void)
+{
+    return -ENODEV;
+}
+
+static inline bool hwp_active(void)
+{
+    return false;
+}
+
+static inline int get_hwp_para(unsigned int cpu,
+                               struct xen_cppc_para *cppc_para)
+{
+    return -EINVAL;
+}
+
+static inline int set_hwp_para(struct cpufreq_policy *policy,
+                               struct xen_set_cppc_para *set_cppc)
+{
+    return -EINVAL;
+}
+
+#endif /* CONFIG_INTEL */
+
 #endif /* __XEN_CPUFREQ_PM_H__ */
-- 
2.25.1




 


Rackspace

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