2012-09-21 16:45:08 +02:00
|
|
|
--- a/xen/arch/x86/platform_hypercall.c
|
|
|
|
+++ b/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>
|
2012-09-17 17:49:23 +02:00
|
|
|
@@ -639,6 +639,41 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
+ }
|
2008-10-26 01:33:59 +02:00
|
|
|
+ if ( copy_field_to_guest(u_xenpf_op, op, u.get_cpu_freq.freq) )
|
|
|
|
+ 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;
|
2012-09-21 16:45:08 +02:00
|
|
|
--- a/xen/include/public/platform.h
|
|
|
|
+++ b/xen/include/public/platform.h
|
2012-09-17 17:49:23 +02:00
|
|
|
@@ -504,6 +504,16 @@ struct xenpf_core_parking {
|
|
|
|
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
|
|
|
/*
|
|
|
|
* ` enum neg_errnoval
|
|
|
|
* ` HYPERVISOR_platform_op(const struct xen_platform_op*);
|
|
|
|
@@ -530,6 +540,7 @@ struct xen_platform_op {
|
2010-01-16 01:12:54 +01:00
|
|
|
struct xenpf_cpu_hotadd cpu_add;
|
|
|
|
struct xenpf_mem_hotadd mem_add;
|
2012-09-17 17:49:23 +02:00
|
|
|
struct xenpf_core_parking core_parking;
|
2008-10-26 01:33:59 +02:00
|
|
|
+ struct xenpf_get_cpu_freq get_cpu_freq;
|
|
|
|
uint8_t pad[128];
|
|
|
|
} u;
|
|
|
|
};
|