kernel-xen/xen-cpufreq-report

57 lines
2.1 KiB
Text

From: jbeulich@novell.com
Subject: make /proc/cpuinfo track CPU speed
Patch-mainline: obsolete
--- sle11sp1-2010-03-22.orig/arch/x86/kernel/acpi/processor_extcntl_xen.c 2010-03-22 12:00:53.000000000 +0100
+++ sle11sp1-2010-03-22/arch/x86/kernel/acpi/processor_extcntl_xen.c 2010-03-22 12:57:38.000000000 +0100
@@ -206,3 +206,14 @@ void arch_acpi_processor_init_extcntl(co
*ops = &xen_extcntl_ops;
}
EXPORT_SYMBOL(arch_acpi_processor_init_extcntl);
+
+unsigned int cpufreq_quick_get(unsigned int cpu)
+{
+ xen_platform_op_t op = {
+ .cmd = XENPF_get_cpu_freq,
+ .interface_version = XENPF_INTERFACE_VERSION,
+ .u.get_cpu_freq.vcpu = cpu
+ };
+
+ return HYPERVISOR_platform_op(&op) == 0 ? op.u.get_cpu_freq.freq : 0;
+}
--- sle11sp1-2010-03-22.orig/include/linux/cpufreq.h 2010-03-22 12:07:53.000000000 +0100
+++ sle11sp1-2010-03-22/include/linux/cpufreq.h 2009-11-06 11:09:27.000000000 +0100
@@ -302,7 +302,7 @@ static inline unsigned int cpufreq_get(u
#endif
/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */
-#ifdef CONFIG_CPU_FREQ
+#if defined(CONFIG_CPU_FREQ) || defined(CONFIG_PROCESSOR_EXTERNAL_CONTROL)
unsigned int cpufreq_quick_get(unsigned int cpu);
#else
static inline unsigned int cpufreq_quick_get(unsigned int cpu)
--- sle11sp1-2010-03-22.orig/include/xen/interface/platform.h 2010-01-04 11:56:34.000000000 +0100
+++ sle11sp1-2010-03-22/include/xen/interface/platform.h 2010-01-04 13:31:04.000000000 +0100
@@ -355,6 +355,14 @@ struct xenpf_mem_hotadd
uint32_t flags;
};
+#define XENPF_get_cpu_freq ('N' << 24)
+struct xenpf_get_cpu_freq {
+ /* IN variables */
+ uint32_t vcpu;
+ /* OUT variables */
+ uint32_t freq; /* in kHz */
+};
+
struct xen_platform_op {
uint32_t cmd;
uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -374,6 +382,7 @@ struct xen_platform_op {
struct xenpf_cpu_ol cpu_ol;
struct xenpf_cpu_hotadd cpu_add;
struct xenpf_mem_hotadd mem_add;
+ struct xenpf_get_cpu_freq get_cpu_freq;
uint8_t pad[128];
} u;
};