From: jbeulich@novell.com
Subject: make /proc/cpuinfo track CPU speed
Patch-mainline: obsolete

--- head-2009-07-13.orig/arch/x86/kernel/acpi/processor_extcntl_xen.c	2009-07-13 14:25:35.000000000 +0200
+++ head-2009-07-13/arch/x86/kernel/acpi/processor_extcntl_xen.c	2009-07-13 15:19:10.000000000 +0200
@@ -204,3 +204,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;
+}
--- head-2009-07-13.orig/include/linux/cpufreq.h	2009-07-13 14:29:22.000000000 +0200
+++ head-2009-07-13/include/linux/cpufreq.h	2009-07-13 15:19:10.000000000 +0200
@@ -285,7 +285,7 @@ int cpufreq_update_policy(unsigned int c
 unsigned int cpufreq_get(unsigned int cpu);
 
 /* 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)
--- head-2009-07-13.orig/include/xen/interface/platform.h	2009-06-23 09:28:21.000000000 +0200
+++ head-2009-07-13/include/xen/interface/platform.h	2009-07-13 15:19:10.000000000 +0200
@@ -312,6 +312,16 @@ struct xenpf_set_processor_pminfo {
 typedef struct xenpf_set_processor_pminfo xenpf_set_processor_pminfo_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_set_processor_pminfo_t);
 
+#define XENPF_get_cpu_freq        ('N' << 24)
+struct xenpf_get_cpu_freq {
+    /* IN variables */
+    uint32_t vcpu;
+    /* OUT variables */
+    uint32_t freq; /* in kHz */
+};
+typedef struct xenpf_get_cpu_freq xenpf_get_cpu_freq_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_get_cpu_freq_t);
+
 struct xen_platform_op {
     uint32_t cmd;
     uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -327,6 +337,7 @@ struct xen_platform_op {
         struct xenpf_change_freq       change_freq;
         struct xenpf_getidletime       getidletime;
         struct xenpf_set_processor_pminfo set_pminfo;
+        struct xenpf_get_cpu_freq      get_cpu_freq;
         uint8_t                        pad[128];
     } u;
 };
