[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] cpuidle: export max_cstate access via libxc
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1238494766 -3600 # Node ID fa8dc6e43ec8d2870ce12d627c22359e7e47e04e # Parent 0f53202cb1320659134bbf3d2b06882b06f3ad65 cpuidle: export max_cstate access via libxc Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx> --- tools/libxc/xc_pm.c | 33 +++++++++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 3 +++ xen/drivers/acpi/pmstat.c | 13 +++++++++++++ xen/include/public/sysctl.h | 6 ++++++ 4 files changed, 55 insertions(+) diff -r 0f53202cb132 -r fa8dc6e43ec8 tools/libxc/xc_pm.c --- a/tools/libxc/xc_pm.c Tue Mar 31 11:17:51 2009 +0100 +++ b/tools/libxc/xc_pm.c Tue Mar 31 11:19:26 2009 +0100 @@ -362,3 +362,36 @@ int xc_set_sched_opt_smt(int xc_handle, return rc; } +int xc_get_cpuidle_max_cstate(int xc_handle, uint32_t *value) +{ + int rc; + DECLARE_SYSCTL; + + if ( xc_handle < 0 || !value ) + return -EINVAL; + + sysctl.cmd = XEN_SYSCTL_pm_op; + sysctl.u.pm_op.cmd = XEN_SYSCTL_pm_op_get_max_cstate; + sysctl.u.pm_op.cpuid = 0; + sysctl.u.pm_op.get_max_cstate = 0; + rc = do_sysctl(xc_handle, &sysctl); + *value = sysctl.u.pm_op.get_max_cstate; + + return rc; +} + +int xc_set_cpuidle_max_cstate(int xc_handle, uint32_t value) +{ + DECLARE_SYSCTL; + + if ( xc_handle < 0 ) + return -EINVAL; + + sysctl.cmd = XEN_SYSCTL_pm_op; + sysctl.u.pm_op.cmd = XEN_SYSCTL_pm_op_set_max_cstate; + sysctl.u.pm_op.cpuid = 0; + sysctl.u.pm_op.set_max_cstate = value; + + return do_sysctl(xc_handle, &sysctl); +} + diff -r 0f53202cb132 -r fa8dc6e43ec8 tools/libxc/xenctrl.h --- a/tools/libxc/xenctrl.h Tue Mar 31 11:17:51 2009 +0100 +++ b/tools/libxc/xenctrl.h Tue Mar 31 11:19:26 2009 +0100 @@ -1262,4 +1262,7 @@ int xc_get_cputopo(int xc_handle, struct int xc_set_sched_opt_smt(int xc_handle, uint32_t value); +int xc_get_cpuidle_max_cstate(int xc_handle, uint32_t *value); +int xc_set_cpuidle_max_cstate(int xc_handle, uint32_t value); + #endif /* XENCTRL_H */ diff -r 0f53202cb132 -r fa8dc6e43ec8 xen/drivers/acpi/pmstat.c --- a/xen/drivers/acpi/pmstat.c Tue Mar 31 11:17:51 2009 +0100 +++ b/xen/drivers/acpi/pmstat.c Tue Mar 31 11:19:26 2009 +0100 @@ -37,6 +37,7 @@ #include <asm/processor.h> #include <xen/percpu.h> #include <xen/domain.h> +#include <xen/acpi.h> #include <public/sysctl.h> #include <acpi/cpufreq/cpufreq.h> @@ -527,6 +528,18 @@ int do_pm_op(struct xen_sysctl_pm_op *op break; } + case XEN_SYSCTL_pm_op_get_max_cstate: + { + op->get_max_cstate = max_cstate; + break; + } + + case XEN_SYSCTL_pm_op_set_max_cstate: + { + max_cstate = op->set_max_cstate; + break; + } + default: printk("not defined sub-hypercall @ do_pm_op\n"); ret = -ENOSYS; diff -r 0f53202cb132 -r fa8dc6e43ec8 xen/include/public/sysctl.h --- a/xen/include/public/sysctl.h Tue Mar 31 11:17:51 2009 +0100 +++ b/xen/include/public/sysctl.h Tue Mar 31 11:19:26 2009 +0100 @@ -382,6 +382,10 @@ struct xen_sysctl_pm_op { /* set/reset scheduler power saving option */ #define XEN_SYSCTL_pm_op_set_sched_opt_smt 0x21 + /* cpuidle max_cstate access command */ + #define XEN_SYSCTL_pm_op_get_max_cstate 0x22 + #define XEN_SYSCTL_pm_op_set_max_cstate 0x23 + uint32_t cmd; uint32_t cpuid; union { @@ -391,6 +395,8 @@ struct xen_sysctl_pm_op { uint64_t get_avgfreq; struct xen_get_cputopo get_topo; uint32_t set_sched_opt_smt; + uint32_t get_max_cstate; + uint32_t set_max_cstate; }; }; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |