aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/cpuidle.h
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-09-10 11:18:36 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-09-10 11:18:36 +0100
commit246127c0bc91ef95db7cfee2ba5c72965ff01d1b (patch)
tree2fa1dd836d6305778b1aa4ee8091b6767c8208a5 /xen/include/xen/cpuidle.h
parent9851c8e77e8da55e5bef15e52048669480e38f1d (diff)
downloadxen-246127c0bc91ef95db7cfee2ba5c72965ff01d1b.tar.gz
xen-246127c0bc91ef95db7cfee2ba5c72965ff01d1b.tar.bz2
xen-246127c0bc91ef95db7cfee2ba5c72965ff01d1b.zip
CPUIDLE: Port Linux menu governor to replace the initial ladder governor
The ladder governor has long pro/demotion delay shortcome while applying to tickless mode, because it needs to count usage. Menu governor chooses the next state simply via break-event prediction including the factors of next timer event & last residency time etc, so it would have faster response speed. Signed-off-by: Gang Wei <gang.wei@intel.com>
Diffstat (limited to 'xen/include/xen/cpuidle.h')
-rw-r--r--xen/include/xen/cpuidle.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/xen/include/xen/cpuidle.h b/xen/include/xen/cpuidle.h
new file mode 100644
index 0000000000..32d71d15f3
--- /dev/null
+++ b/xen/include/xen/cpuidle.h
@@ -0,0 +1,82 @@
+/*
+ * cpuidle.h - xen idle state module derived from Linux
+ *
+ * (C) 2007 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
+ * Shaohua Li <shaohua.li@intel.com>
+ * Adam Belay <abelay@novell.com>
+ * Copyright (C) 2008 Intel Corporation
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+#ifndef _XEN_CPUIDLE_H
+#define _XEN_CPUIDLE_H
+
+#define ACPI_PROCESSOR_MAX_POWER 8
+#define CPUIDLE_NAME_LEN 16
+
+struct acpi_processor_cx
+{
+ u8 valid;
+ u8 type;
+ u32 address;
+ u8 space_id;
+ u32 latency;
+ u32 latency_ticks;
+ u32 power;
+ u32 usage;
+ u64 time;
+ u32 target_residency;
+};
+
+struct acpi_processor_flags
+{
+ u8 bm_control:1;
+ u8 bm_check:1;
+ u8 has_cst:1;
+ u8 power_setup_done:1;
+ u8 bm_rld_set:1;
+};
+
+struct acpi_processor_power
+{
+ unsigned int cpu;
+ struct acpi_processor_flags flags;
+ struct acpi_processor_cx *last_state;
+ struct acpi_processor_cx *safe_state;
+ u32 last_residency;
+ void *gdata; /* governor specific data */
+ u32 count;
+ struct acpi_processor_cx states[ACPI_PROCESSOR_MAX_POWER];
+};
+
+struct cpuidle_governor
+{
+ char name[CPUIDLE_NAME_LEN];
+ unsigned int rating;
+
+ int (*enable) (struct acpi_processor_power *dev);
+ void (*disable) (struct acpi_processor_power *dev);
+
+ int (*select) (struct acpi_processor_power *dev);
+ void (*reflect) (struct acpi_processor_power *dev);
+};
+
+extern struct cpuidle_governor *cpuidle_current_governor;
+
+#endif /* _XEN_CPUIDLE_H */