2015-01-14 21:58:52 +01:00
|
|
|
Index: xen-4.5.0-testing/xen/arch/x86/platform_hypercall.c
|
2014-01-02 20:09:07 +01:00
|
|
|
===================================================================
|
2015-01-14 21:58:52 +01:00
|
|
|
--- xen-4.5.0-testing.orig/xen/arch/x86/platform_hypercall.c
|
|
|
|
+++ xen-4.5.0-testing/xen/arch/x86/platform_hypercall.c
|
2012-09-17 17:49:23 +02:00
|
|
|
@@ -25,7 +25,7 @@
|
|
|
|
#include <xen/irq.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>
|
2015-01-14 21:58:52 +01:00
|
|
|
@@ -760,6 +760,41 @@ ret_t do_platform_op(XEN_GUEST_HANDLE_PA
|
2012-09-17 17:49:23 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-10-26 01:33:59 +02:00
|
|
|
+ case XENPF_get_cpu_freq:
|
2012-01-05 20:41:54 +01:00
|
|
|
+ case XENPF_get_cpu_freq_min:
|
|
|
|
+ case XENPF_get_cpu_freq_max:
|
|
|
|
+ {
|
|
|
|
+ struct vcpu *v;
|
|
|
|
+ const struct cpufreq_policy *policy;
|
|
|
|
+
|
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;
|
|
|
|
+ }
|
|
|
|
+
|
2012-01-05 20:41:54 +01:00
|
|
|
+ policy = per_cpu(cpufreq_cpu_policy, v->processor);
|
|
|
|
+ switch ( op->cmd & -!!policy )
|
|
|
|
+ {
|
|
|
|
+ case XENPF_get_cpu_freq:
|
|
|
|
+ op->u.get_cpu_freq.freq = policy->cur;
|
|
|
|
+ break;
|
|
|
|
+ case XENPF_get_cpu_freq_min:
|
|
|
|
+ op->u.get_cpu_freq.freq = policy->min;
|
|
|
|
+ break;
|
|
|
|
+ case XENPF_get_cpu_freq_max:
|
|
|
|
+ op->u.get_cpu_freq.freq = policy->max;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ op->u.get_cpu_freq.freq = 0;
|
|
|
|
+ break;
|
|
|
|
+ }
|
2013-07-17 04:04:59 +02:00
|
|
|
+ if ( __copy_field_to_guest(u_xenpf_op, op, u.get_cpu_freq.freq) )
|
2008-10-26 01:33:59 +02:00
|
|
|
+ ret = -EFAULT;
|
2012-01-05 20:41:54 +01:00
|
|
|
+ }
|
|
|
|
+ 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;
|
2015-01-14 21:58:52 +01:00
|
|
|
Index: xen-4.5.0-testing/xen/include/public/platform.h
|
2014-01-02 20:09:07 +01:00
|
|
|
===================================================================
|
2015-01-14 21:58:52 +01:00
|
|
|
--- xen-4.5.0-testing.orig/xen/include/public/platform.h
|
|
|
|
+++ xen-4.5.0-testing/xen/include/public/platform.h
|
2013-06-01 23:11:56 +02:00
|
|
|
@@ -527,6 +527,16 @@ struct xenpf_core_parking {
|
2012-09-17 17:49:23 +02:00
|
|
|
typedef struct xenpf_core_parking xenpf_core_parking_t;
|
|
|
|
DEFINE_XEN_GUEST_HANDLE(xenpf_core_parking_t);
|
2008-10-26 01:33:59 +02:00
|
|
|
|
|
|
|
+#define XENPF_get_cpu_freq ('N' << 24)
|
2012-01-05 20:41:54 +01:00
|
|
|
+#define XENPF_get_cpu_freq_min (XENPF_get_cpu_freq + 1)
|
|
|
|
+#define XENPF_get_cpu_freq_max (XENPF_get_cpu_freq_min + 1)
|
2008-10-26 01:33:59 +02:00
|
|
|
+struct xenpf_get_cpu_freq {
|
|
|
|
+ /* IN variables */
|
|
|
|
+ uint32_t vcpu;
|
|
|
|
+ /* OUT variables */
|
|
|
|
+ uint32_t freq; /* in kHz */
|
|
|
|
+};
|
|
|
|
+
|
2012-09-17 17:49:23 +02:00
|
|
|
/*
|
2015-01-14 21:58:52 +01:00
|
|
|
* Access generic platform resources(e.g., accessing MSR, port I/O, etc)
|
|
|
|
* in unified way. Batch resource operations in one call are supported and
|
|
|
|
@@ -587,6 +597,7 @@ struct xen_platform_op {
|
2010-01-16 01:12:54 +01:00
|
|
|
struct xenpf_mem_hotadd mem_add;
|
2012-09-17 17:49:23 +02:00
|
|
|
struct xenpf_core_parking core_parking;
|
2015-01-14 21:58:52 +01:00
|
|
|
struct xenpf_resource_op resource_op;
|
2008-10-26 01:33:59 +02:00
|
|
|
+ struct xenpf_get_cpu_freq get_cpu_freq;
|
|
|
|
uint8_t pad[128];
|
|
|
|
} u;
|
|
|
|
};
|