|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] [linux-2.6.18-xen] Notify CPU frequency changes to Xen.
# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1190294232 -3600
# Node ID 2a8f7f0a8726a7d4f513a0bf044e65765c2be34c
# Parent 8a407c41dfb0cc03b66366b45eacd48c3e7bda4c
Notify CPU frequency changes to Xen.
Signed-off-by: Mark Langsdorf <mark.langsdorf@xxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
arch/i386/kernel/time-xen.c | 40 +++++++++++++++++++++++++++++++++++++++
include/xen/interface/platform.h | 11 ++++++++++
2 files changed, 51 insertions(+)
diff -r 8a407c41dfb0 -r 2a8f7f0a8726 arch/i386/kernel/time-xen.c
--- a/arch/i386/kernel/time-xen.c Thu Sep 20 14:16:30 2007 +0100
+++ b/arch/i386/kernel/time-xen.c Thu Sep 20 14:17:12 2007 +0100
@@ -50,6 +50,7 @@
#include <linux/percpu.h>
#include <linux/kernel_stat.h>
#include <linux/posix-timers.h>
+#include <linux/cpufreq.h>
#include <asm/io.h>
#include <asm/smp.h>
@@ -1118,6 +1119,45 @@ void local_teardown_timer(unsigned int c
BUG_ON(cpu == 0);
unbind_from_irqhandler(per_cpu(timer_irq, cpu), NULL);
}
+#endif
+
+#if CONFIG_CPU_FREQ
+static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
+ void *data)
+{
+ struct cpufreq_freqs *freq = data;
+ struct xen_platform_op op;
+
+ if (cpu_has(&cpu_data[freq->cpu], X86_FEATURE_CONSTANT_TSC))
+ return 0;
+
+ if (val == CPUFREQ_PRECHANGE)
+ return 0;
+
+ op.cmd = XENPF_change_freq;
+ op.u.change_freq.flags = 0;
+ op.u.change_freq.cpu = freq->cpu;
+ op.u.change_freq.freq = (u64)freq->new * 1000;
+ HYPERVISOR_platform_op(&op);
+
+ return 0;
+}
+
+static struct notifier_block time_cpufreq_notifier_block = {
+ .notifier_call = time_cpufreq_notifier
+};
+
+static int __init cpufreq_time_setup(void)
+{
+ if (!cpufreq_register_notifier(&time_cpufreq_notifier_block,
+ CPUFREQ_TRANSITION_NOTIFIER)) {
+ printk(KERN_ERR "failed to set up cpufreq notifier\n");
+ return -ENODEV;
+ }
+ return 0;
+}
+
+core_initcall(cpufreq_time_setup);
#endif
/*
diff -r 8a407c41dfb0 -r 2a8f7f0a8726 include/xen/interface/platform.h
--- a/include/xen/interface/platform.h Thu Sep 20 14:16:30 2007 +0100
+++ b/include/xen/interface/platform.h Thu Sep 20 14:17:12 2007 +0100
@@ -164,6 +164,16 @@ typedef struct xenpf_enter_acpi_sleep xe
typedef struct xenpf_enter_acpi_sleep xenpf_enter_acpi_sleep_t;
DEFINE_XEN_GUEST_HANDLE(xenpf_enter_acpi_sleep_t);
+#define XENPF_change_freq 52
+struct xenpf_change_freq {
+ /* IN variables */
+ uint32_t flags; /* Must be zero. */
+ uint32_t cpu; /* Physical cpu. */
+ uint64_t freq; /* New frequency (Hz). */
+};
+typedef struct xenpf_change_freq xenpf_change_freq_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_change_freq_t);
+
struct xen_platform_op {
uint32_t cmd;
uint32_t interface_version; /* XENPF_INTERFACE_VERSION */
@@ -176,6 +186,7 @@ struct xen_platform_op {
struct xenpf_platform_quirk platform_quirk;
struct xenpf_firmware_info firmware_info;
struct xenpf_enter_acpi_sleep enter_acpi_sleep;
+ struct xenpf_change_freq change_freq;
uint8_t pad[128];
} u;
};
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] [linux-2.6.18-xen] Notify CPU frequency changes to Xen.,
Xen patchbot-linux-2.6.18-xen <=
|
|
|
|
|