[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] x86: XENPF_set_processor_pminfo handler adjustments



Only handle information passed up from dom0 when actually controlling
the respective functionality. Only count up CPUs once for each CPU.
Allow dom0 to provide information incrementally.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2008-07-21/xen/arch/x86/platform_hypercall.c
===================================================================
--- 2008-07-21.orig/xen/arch/x86/platform_hypercall.c   2008-07-18 
16:19:34.000000000 +0200
+++ 2008-07-21/xen/arch/x86/platform_hypercall.c        2008-07-23 
14:08:42.000000000 +0200
@@ -355,6 +355,11 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
             struct processor_pminfo *pmpt;
             struct processor_performance *pxpt;
 
+            if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_PX) )
+            {
+                ret = -ENOSYS;
+                break;
+            }
             if ( cpuid < 0 )
             {
                 ret = -EINVAL;
@@ -373,6 +378,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
                 memcpy ((void *)&pxpt->status_register,
                     (void *)&xenpxpt->status_register,
                     sizeof(struct xen_pct_register));
+                pxpt->init |= XEN_PX_PCT;
             }
             if ( xenpxpt->flags & XEN_PX_PSS ) 
             {
@@ -390,6 +396,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
                     break;
                 }
                 pxpt->state_count = xenpxpt->state_count;
+                pxpt->init |= XEN_PX_PSS;
             }
             if ( xenpxpt->flags & XEN_PX_PSD )
             {
@@ -397,14 +404,18 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
                 memcpy ((void *)&pxpt->domain_info,
                     (void *)&xenpxpt->domain_info,
                     sizeof(struct xen_psd_package));
+                pxpt->init |= XEN_PX_PSD;
             }
             if ( xenpxpt->flags & XEN_PX_PPC )
+            {
                 pxpt->ppc = xenpxpt->ppc;
+                pxpt->init |= XEN_PX_PPC;
+            }
 
-            if ( xenpxpt->flags == ( XEN_PX_PCT | XEN_PX_PSS | 
-                XEN_PX_PSD | XEN_PX_PPC ) )
+            if ( pxpt->init == ( XEN_PX_PCT | XEN_PX_PSS |
+                                 XEN_PX_PSD | XEN_PX_PPC ) )
             {
-                pxpt->init =1;
+                pxpt->init |= 0x80000000;
                 cpu_count++;
             }
             if ( cpu_count == num_online_cpus() )
@@ -418,10 +429,20 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
         }
  
         case XEN_PM_CX:
+            if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_CX) )
+            {
+                ret = -ENOSYS;
+                break;
+            }
             ret = set_cx_pminfo(op->u.set_pminfo.id, &op->u.set_pminfo.power);
             break;
 
         case XEN_PM_TX:
+            if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_TX) )
+            {
+                ret = -ENOSYS;
+                break;
+            }
             ret = -EINVAL;
             break;
 




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.