2009-08-01 11:53:46 +02:00
|
|
|
Index: xen-3.4.1-testing/xen/arch/x86/platform_hypercall.c
|
2009-05-04 18:38:09 +02:00
|
|
|
===================================================================
|
2009-08-01 11:53:46 +02:00
|
|
|
--- xen-3.4.1-testing.orig/xen/arch/x86/platform_hypercall.c
|
|
|
|
+++ xen-3.4.1-testing/xen/arch/x86/platform_hypercall.c
|
2008-10-26 01:33:59 +02:00
|
|
|
@@ -21,7 +21,7 @@
|
|
|
|
#include <xen/acpi.h>
|
|
|
|
#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>
|
|
|
|
#include "cpu/mtrr/mtrr.h"
|
2009-05-04 18:38:09 +02:00
|
|
|
@@ -56,6 +56,7 @@ static long cpu_frequency_change_helper(
|
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) )
|
2009-06-12 20:43:24 +02:00
|
|
|
@@ -385,6 +386,20 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
|
2008-10-26 01:33:59 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
+
|
|
|
|
+ case XENPF_get_cpu_freq:
|
|
|
|
+ if ( op->u.get_cpu_freq.vcpu >= MAX_VIRT_CPUS ||
|
|
|
|
+ !(v = current->domain->vcpu[op->u.get_cpu_freq.vcpu]) )
|
|
|
|
+ {
|
|
|
|
+ ret = -EINVAL;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
2009-05-04 18:38:09 +02:00
|
|
|
+ op->u.get_cpu_freq.freq = cpufreq_cpu_policy[v->processor] ?
|
|
|
|
+ cpufreq_cpu_policy[v->processor]->cur : 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;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ret = -ENOSYS;
|
2009-08-01 11:53:46 +02:00
|
|
|
Index: xen-3.4.1-testing/xen/arch/x86/x86_64/platform_hypercall.c
|
2009-05-04 18:38:09 +02:00
|
|
|
===================================================================
|
2009-08-01 11:53:46 +02:00
|
|
|
--- xen-3.4.1-testing.orig/xen/arch/x86/x86_64/platform_hypercall.c
|
|
|
|
+++ xen-3.4.1-testing/xen/arch/x86/x86_64/platform_hypercall.c
|
2009-05-04 18:38:09 +02:00
|
|
|
@@ -23,6 +23,8 @@ DEFINE_XEN_GUEST_HANDLE(compat_platform_
|
2008-10-26 01:33:59 +02:00
|
|
|
#define xen_processor_power_t compat_processor_power_t
|
|
|
|
#define set_cx_pminfo compat_set_cx_pminfo
|
|
|
|
|
|
|
|
+#define xenpf_get_cpu_freq compat_pf_get_cpu_freq
|
|
|
|
+
|
|
|
|
#define xenpf_enter_acpi_sleep compat_pf_enter_acpi_sleep
|
|
|
|
|
|
|
|
#define COMPAT
|
2009-08-01 11:53:46 +02:00
|
|
|
Index: xen-3.4.1-testing/xen/include/public/platform.h
|
2009-05-04 18:38:09 +02:00
|
|
|
===================================================================
|
2009-08-01 11:53:46 +02:00
|
|
|
--- xen-3.4.1-testing.orig/xen/include/public/platform.h
|
|
|
|
+++ xen-3.4.1-testing/xen/include/public/platform.h
|
2008-10-26 01:33:59 +02:00
|
|
|
@@ -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;
|
|
|
|
};
|