mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
cpuidle: export max_cstate access via libxc
Signed-off-by: Wei Gang <gang.wei@intel.com>
This commit is contained in:
1 parent
6fe255bdc2
commit
fd598342a0
4 files changed
+55
No files matched your search
@@ -362,3 +362,36 @@ int xc_set_sched_opt_smt(int xc_handle, uint32_t value)
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1262,4 +1262,7 @@ int xc_get_cputopo(int xc_handle, struct xc_get_cputopo *info);
|
||||
|
||||
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 */
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||