2011-09-15 23:43:21 +02:00
|
|
|
Index: xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c
|
|
|
|
===================================================================
|
|
|
|
--- xen-4.1.2-testing.orig/xen/arch/x86/platform_hypercall.c
|
|
|
|
+++ xen-4.1.2-testing/xen/arch/x86/platform_hypercall.c
|
2011-07-01 21:31:25 +02:00
|
|
|
@@ -23,7 +23,7 @@
|
2011-03-21 17:47:37 +01:00
|
|
|
#include <xen/cpu.h>
|
2008-10-26 01:33:59 +02:00
|
|
|
#include <asm/current.h>
|
|
|
|
#include <public/platform.h>
|
|
|
|
-#include <acpi/cpufreq/processor_perf.h>
|
|
|
|
+#include <acpi/cpufreq/cpufreq.h>
|
|
|
|
#include <asm/edd.h>
|
|
|
|
#include <asm/mtrr.h>
|
2011-03-21 17:47:37 +01:00
|
|
|
#include <asm/io_apic.h>
|
2011-07-01 21:31:25 +02:00
|
|
|
@@ -63,6 +63,7 @@ long cpu_down_helper(void *data);
|
2008-10-26 01:33:59 +02:00
|
|
|
ret_t do_platform_op(XEN_GUEST_HANDLE(xen_platform_op_t) u_xenpf_op)
|
|
|
|
{
|
|
|
|
ret_t ret = 0;
|
|
|
|
+ struct vcpu *v;
|
|
|
|
struct xen_platform_op curop, *op = &curop;
|
|
|
|
|
|
|
|
if ( !IS_PRIV(current->domain) )
|
2011-08-26 18:49:33 +02:00
|
|
|
@@ -522,6 +523,24 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
|
2010-01-16 01:12:54 +01:00
|
|
|
op->u.mem_add.epfn,
|
|
|
|
op->u.mem_add.pxm);
|
2008-10-26 01:33:59 +02:00
|
|
|
break;
|
|
|
|
+
|
|
|
|
+ case XENPF_get_cpu_freq:
|
2010-01-16 01:12:54 +01:00
|
|
|
+ if ( op->u.get_cpu_freq.vcpu >= current->domain->max_vcpus ||
|
2008-10-26 01:33:59 +02:00
|
|
|
+ !(v = current->domain->vcpu[op->u.get_cpu_freq.vcpu]) )
|
|
|
|
+ {
|
|
|
|
+ ret = -EINVAL;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
2011-03-21 17:47:37 +01:00
|
|
|
+ op->u.get_cpu_freq.freq = per_cpu(cpufreq_cpu_policy, v->processor)
|
2010-01-16 01:12:54 +01:00
|
|
|
+ ? cpufreq_driver->get
|
|
|
|
+ ? cpufreq_driver->get(v->processor)
|
2011-03-21 17:47:37 +01:00
|
|
|
+ : per_cpu(cpufreq_cpu_policy, v->processor)->cur
|
2010-01-16 01:12:54 +01:00
|
|
|
+ : 0;
|
2008-10-26 01:33:59 +02:00
|
|
|
+ if ( copy_field_to_guest(u_xenpf_op, op, u.get_cpu_freq.freq) )
|
|
|
|
+ ret = -EFAULT;
|
|
|
|
+ break;
|
2010-01-16 01:12:54 +01:00
|
|
|
+
|
2008-10-26 01:33:59 +02:00
|
|
|
default:
|
|
|
|
ret = -ENOSYS;
|
2010-01-16 01:12:54 +01:00
|
|
|
break;
|
2011-09-15 23:43:21 +02:00
|
|
|
Index: xen-4.1.2-testing/xen/include/public/platform.h
|
|
|
|
===================================================================
|
|
|
|
--- xen-4.1.2-testing.orig/xen/include/public/platform.h
|
|
|
|
+++ xen-4.1.2-testing/xen/include/public/platform.h
|
2011-08-26 18:49:33 +02:00
|
|
|
@@ -451,6 +451,14 @@ struct xenpf_mem_hotadd
|
2010-01-16 01:12:54 +01:00
|
|
|
uint32_t flags;
|
|
|
|
};
|
2008-10-26 01:33:59 +02:00
|
|
|
|
|
|
|
+#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 */
|
2011-08-26 18:49:33 +02:00
|
|
|
@@ -471,6 +479,7 @@ struct xen_platform_op {
|
2010-01-16 01:12:54 +01:00
|
|
|
struct xenpf_cpu_ol cpu_ol;
|
|
|
|
struct xenpf_cpu_hotadd cpu_add;
|
|
|
|
struct xenpf_mem_hotadd mem_add;
|
2008-10-26 01:33:59 +02:00
|
|
|
+ struct xenpf_get_cpu_freq get_cpu_freq;
|
|
|
|
uint8_t pad[128];
|
|
|
|
} u;
|
|
|
|
};
|