[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/4] tools/libxc: Alow getting and setting the max sub C-State
Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx> --- tools/libxc/xc_pm.c | 33 +++++++++++++++++++++++++++++++++ tools/libxc/xenctrl.h | 3 +++ xen/drivers/acpi/pmstat.c | 12 ++++++++++++ xen/include/public/sysctl.h | 6 ++++++ xen/include/xen/acpi.h | 20 ++++++++++++++++++++ 5 files changed, 74 insertions(+) diff --git a/tools/libxc/xc_pm.c b/tools/libxc/xc_pm.c index e4e0fb9..ef72f02 100644 --- a/tools/libxc/xc_pm.c +++ b/tools/libxc/xc_pm.c @@ -419,6 +419,39 @@ int xc_set_cpuidle_max_cstate(xc_interface *xch, uint32_t value) return do_sysctl(xch, &sysctl); } +int xc_get_cpuidle_max_substate(xc_interface *xch, uint32_t *value) +{ + int rc; + DECLARE_SYSCTL; + + if ( !xch || !value ) + return -EINVAL; + + sysctl.cmd = XEN_SYSCTL_pm_op; + sysctl.u.pm_op.cmd = XEN_SYSCTL_pm_op_get_max_substate; + sysctl.u.pm_op.cpuid = 0; + sysctl.u.pm_op.u.get_max_substate = 0; + rc = do_sysctl(xch, &sysctl); + *value = sysctl.u.pm_op.u.get_max_substate; + + return rc; +} + +int xc_set_cpuidle_max_substate(xc_interface *xch, uint32_t value) +{ + DECLARE_SYSCTL; + + if ( !xch ) + return -EINVAL; + + sysctl.cmd = XEN_SYSCTL_pm_op; + sysctl.u.pm_op.cmd = XEN_SYSCTL_pm_op_set_max_substate; + sysctl.u.pm_op.cpuid = 0; + sysctl.u.pm_op.u.set_max_substate = value; + + return do_sysctl(xch, &sysctl); +} + int xc_enable_turbo(xc_interface *xch, int cpuid) { DECLARE_SYSCTL; diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 02129f7..d518812 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -1992,6 +1992,9 @@ int xc_get_vcpu_migration_delay(xc_interface *xch, uint32_t *value); int xc_get_cpuidle_max_cstate(xc_interface *xch, uint32_t *value); int xc_set_cpuidle_max_cstate(xc_interface *xch, uint32_t value); +int xc_get_cpuidle_max_substate(xc_interface *xch, uint32_t *value); +int xc_set_cpuidle_max_substate(xc_interface *xch, uint32_t value); + int xc_enable_turbo(xc_interface *xch, int cpuid); int xc_disable_turbo(xc_interface *xch, int cpuid); /** diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c index daac2da..44598aa 100644 --- a/xen/drivers/acpi/pmstat.c +++ b/xen/drivers/acpi/pmstat.c @@ -475,6 +475,18 @@ int do_pm_op(struct xen_sysctl_pm_op *op) break; } + case XEN_SYSCTL_pm_op_get_max_substate: + { + op->u.get_max_substate = acpi_get_substate_limit(); + break; + } + + case XEN_SYSCTL_pm_op_set_max_substate: + { + acpi_set_substate_limit(op->u.set_max_substate); + break; + } + case XEN_SYSCTL_pm_op_enable_turbo: { ret = cpufreq_update_turbo(op->cpuid, CPUFREQ_TURBO_ENABLED); diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h index 3588698..1bb3767 100644 --- a/xen/include/public/sysctl.h +++ b/xen/include/public/sysctl.h @@ -366,6 +366,10 @@ struct xen_sysctl_pm_op { #define XEN_SYSCTL_pm_op_enable_turbo 0x26 #define XEN_SYSCTL_pm_op_disable_turbo 0x27 + /* cpuidle max_substate access command */ + #define XEN_SYSCTL_pm_op_get_max_substate 0x28 + #define XEN_SYSCTL_pm_op_set_max_substate 0x29 + uint32_t cmd; uint32_t cpuid; union { @@ -376,6 +380,8 @@ struct xen_sysctl_pm_op { uint32_t set_sched_opt_smt; uint32_t get_max_cstate; uint32_t set_max_cstate; + uint32_t get_max_substate; + uint32_t set_max_substate; uint32_t get_vcpu_migration_delay; uint32_t set_vcpu_migration_delay; } u; diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h index b49c4fc..52e9074 100644 --- a/xen/include/xen/acpi.h +++ b/xen/include/xen/acpi.h @@ -141,10 +141,30 @@ static inline void acpi_set_cstate_limit(unsigned int new_limit) return; } +/* + * Set the highest legal sub C-state. Only applies to the highest legal C-state + * max_cstate = 1, max_substate = 0 ==> C0, C1 okay, but not C1E + * max_cstate = 1, max_substate = 1 ==> C0, C1 and C1E okay, but not C2 + * max_cstate = 2, max_substate = 0 ==> C0, C1, C1E, C2 okay, but not C3 + * max_cstate = 2, max_substate = 1 ==> C0, C1, C1E, C2 okay, but not C3 + */ + extern unsigned int max_substate; + +static inline unsigned int acpi_get_substate_limit(void) +{ + return max_substate; +} +static inline void acpi_set_substate_limit(unsigned int new_limit) +{ + max_substate = new_limit; + return; +} #else static inline unsigned int acpi_get_cstate_limit(void) { return 0; } static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; } +static inline unsigned int acpi_get_substate_limit(void) { return 0; } +static inline void acpi_set_substate_limit(unsigned int new_limit) { return; } #endif #ifdef XEN_GUEST_HANDLE_PARAM -- 1.9.3 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |