ia64/xen-unstable

changeset 18151:ab1d7db3facb

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@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jul 24 14:16:47 2008 +0100 (2008-07-24)
parents 379dd201c36c
children 07a44e0d2c52
files xen/arch/x86/platform_hypercall.c
line diff
     1.1 --- a/xen/arch/x86/platform_hypercall.c	Thu Jul 24 14:14:27 2008 +0100
     1.2 +++ b/xen/arch/x86/platform_hypercall.c	Thu Jul 24 14:16:47 2008 +0100
     1.3 @@ -355,6 +355,11 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
     1.4              struct processor_pminfo *pmpt;
     1.5              struct processor_performance *pxpt;
     1.6  
     1.7 +            if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_PX) )
     1.8 +            {
     1.9 +                ret = -ENOSYS;
    1.10 +                break;
    1.11 +            }
    1.12              if ( cpuid < 0 )
    1.13              {
    1.14                  ret = -EINVAL;
    1.15 @@ -373,6 +378,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
    1.16                  memcpy ((void *)&pxpt->status_register,
    1.17                      (void *)&xenpxpt->status_register,
    1.18                      sizeof(struct xen_pct_register));
    1.19 +                pxpt->init |= XEN_PX_PCT;
    1.20              }
    1.21              if ( xenpxpt->flags & XEN_PX_PSS ) 
    1.22              {
    1.23 @@ -390,6 +396,7 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
    1.24                      break;
    1.25                  }
    1.26                  pxpt->state_count = xenpxpt->state_count;
    1.27 +                pxpt->init |= XEN_PX_PSS;
    1.28              }
    1.29              if ( xenpxpt->flags & XEN_PX_PSD )
    1.30              {
    1.31 @@ -397,14 +404,18 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
    1.32                  memcpy ((void *)&pxpt->domain_info,
    1.33                      (void *)&xenpxpt->domain_info,
    1.34                      sizeof(struct xen_psd_package));
    1.35 +                pxpt->init |= XEN_PX_PSD;
    1.36              }
    1.37              if ( xenpxpt->flags & XEN_PX_PPC )
    1.38 +            {
    1.39                  pxpt->ppc = xenpxpt->ppc;
    1.40 +                pxpt->init |= XEN_PX_PPC;
    1.41 +            }
    1.42  
    1.43 -            if ( xenpxpt->flags == ( XEN_PX_PCT | XEN_PX_PSS | 
    1.44 -                XEN_PX_PSD | XEN_PX_PPC ) )
    1.45 +            if ( pxpt->init == ( XEN_PX_PCT | XEN_PX_PSS |
    1.46 +                                 XEN_PX_PSD | XEN_PX_PPC ) )
    1.47              {
    1.48 -                pxpt->init =1;
    1.49 +                pxpt->init |= 0x80000000;
    1.50                  cpu_count++;
    1.51              }
    1.52              if ( cpu_count == num_online_cpus() )
    1.53 @@ -418,10 +429,20 @@ ret_t do_platform_op(XEN_GUEST_HANDLE(xe
    1.54          }
    1.55   
    1.56          case XEN_PM_CX:
    1.57 +            if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_CX) )
    1.58 +            {
    1.59 +                ret = -ENOSYS;
    1.60 +                break;
    1.61 +            }
    1.62              ret = set_cx_pminfo(op->u.set_pminfo.id, &op->u.set_pminfo.power);
    1.63              break;
    1.64  
    1.65          case XEN_PM_TX:
    1.66 +            if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_TX) )
    1.67 +            {
    1.68 +                ret = -ENOSYS;
    1.69 +                break;
    1.70 +            }
    1.71              ret = -EINVAL;
    1.72              break;
    1.73