WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 1/2] cpuidle: export max_cstate access via libxc

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 1/2] cpuidle: export max_cstate access via libxc
From: "Wei, Gang" <gang.wei@xxxxxxxxx>
Date: Tue, 24 Mar 2009 17:50:53 +0800
Accept-language: en-US
Acceptlanguage: en-US
Delivery-date: Tue, 24 Mar 2009 02:51:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcmsZgWG6tW//dudSsCn/2fZVQf+Jg==
Thread-topic: [PATCH 1/2] cpuidle: export max_cstate access via libxc
cpuidle: export max_cstate access via libxc

signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>

diff -r 0477f9061c8a tools/libxc/xc_pm.c
--- a/tools/libxc/xc_pm.c       Fri Mar 20 17:42:46 2009 +0000
+++ b/tools/libxc/xc_pm.c       Tue Mar 24 16:16:04 2009 +0800
@@ -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 0477f9061c8a tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Fri Mar 20 17:42:46 2009 +0000
+++ b/tools/libxc/xenctrl.h     Tue Mar 24 16:16:04 2009 +0800
@@ -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 0477f9061c8a xen/drivers/acpi/pmstat.c
--- a/xen/drivers/acpi/pmstat.c Fri Mar 20 17:42:46 2009 +0000
+++ b/xen/drivers/acpi/pmstat.c Tue Mar 24 16:16:04 2009 +0800
@@ -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 0477f9061c8a xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h       Fri Mar 20 17:42:46 2009 +0000
+++ b/xen/include/public/sysctl.h       Tue Mar 24 16:16:04 2009 +0800
@@ -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;
     };
 };
 

Attachment: libxc-export-max_cstate.patch
Description: libxc-export-max_cstate.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 1/2] cpuidle: export max_cstate access via libxc, Wei, Gang <=