ia64/linux-2.6.18-xen.hg

changeset 668:92a5f8917514

x86, xen, pm: Add ppc dynamic change handle

When ppc dynamic change event happened, get new ppc value
and then notify power management logic of Xen hypervisor
through hypercall.

Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Sep 12 10:37:02 2008 +0100 (2008-09-12)
parents e1e8cc97331d
children de4d39818577
files arch/i386/kernel/acpi/processor_extcntl_xen.c include/xen/interface/platform.h
line diff
     1.1 --- a/arch/i386/kernel/acpi/processor_extcntl_xen.c	Fri Sep 12 07:24:53 2008 +0100
     1.2 +++ b/arch/i386/kernel/acpi/processor_extcntl_xen.c	Fri Sep 12 10:37:02 2008 +0100
     1.3 @@ -141,7 +141,7 @@ static void convert_psd_pack(struct xen_
     1.4  
     1.5  static int xen_px_notifier(struct acpi_processor *pr, int action)
     1.6  {
     1.7 -	int ret;
     1.8 +	int ret = -EINVAL;
     1.9  	xen_platform_op_t op = {
    1.10  		.cmd			= XENPF_set_processor_pminfo,
    1.11  		.interface_version	= XENPF_INTERFACE_VERSION,
    1.12 @@ -153,48 +153,64 @@ static int xen_px_notifier(struct acpi_p
    1.13  	struct acpi_processor_performance *px;
    1.14  	struct acpi_psd_package *pdomain;
    1.15  
    1.16 -	/* leave dynamic ppc handle in the future */
    1.17 -	if (action == PROCESSOR_PM_CHANGE)
    1.18 -		return 0;
    1.19 +	if (!pr)
    1.20 +		return -EINVAL;
    1.21  
    1.22  	perf = &op.u.set_pminfo.perf;
    1.23  	px = pr->performance;
    1.24  
    1.25 -	perf->flags = XEN_PX_PPC | 
    1.26 -		      XEN_PX_PCT | 
    1.27 -		      XEN_PX_PSS | 
    1.28 -		      XEN_PX_PSD;
    1.29 -
    1.30 -	/* ppc */
    1.31 -	perf->ppc = pr->performance_platform_limit;
    1.32 -
    1.33 -	/* pct */
    1.34 -	convert_pct_reg(&perf->control_register, &px->control_register);
    1.35 -	convert_pct_reg(&perf->status_register, &px->status_register);
    1.36 +	switch(action) {
    1.37 +	case PROCESSOR_PM_CHANGE:
    1.38 +		/* ppc dynamic handle */
    1.39 +		perf->flags = XEN_PX_PPC;
    1.40 +		perf->platform_limit = pr->performance_platform_limit;
    1.41  
    1.42 -	/* pss */
    1.43 -	perf->state_count = px->state_count;
    1.44 -	states = kzalloc(px->state_count*sizeof(xen_processor_px_t),GFP_KERNEL);
    1.45 -	if (!states)
    1.46 -		return -ENOMEM;
    1.47 -	convert_pss_states(states, px->states, px->state_count);
    1.48 -	set_xen_guest_handle(perf->states, states);
    1.49 +		ret = HYPERVISOR_platform_op(&op);
    1.50 +		break;
    1.51  
    1.52 -	/* psd */
    1.53 -	pdomain = &px->domain_info;
    1.54 -	convert_psd_pack(&perf->domain_info, pdomain);
    1.55 -	if (perf->domain_info.num_processors) {
    1.56 -		if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL)
    1.57 -			perf->shared_type = CPUFREQ_SHARED_TYPE_ALL;
    1.58 -		else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY)
    1.59 -			perf->shared_type = CPUFREQ_SHARED_TYPE_ANY;
    1.60 -		else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL)
    1.61 -			perf->shared_type = CPUFREQ_SHARED_TYPE_HW;
    1.62 -	} else
    1.63 -		perf->shared_type = CPUFREQ_SHARED_TYPE_NONE;
    1.64 +	case PROCESSOR_PM_INIT:
    1.65 +		/* px normal init */
    1.66 +		perf->flags = XEN_PX_PPC | 
    1.67 +			      XEN_PX_PCT | 
    1.68 +			      XEN_PX_PSS | 
    1.69 +			      XEN_PX_PSD;
    1.70  
    1.71 -	ret = HYPERVISOR_platform_op(&op);
    1.72 -	kfree(states);
    1.73 +		/* ppc */
    1.74 +		perf->platform_limit = pr->performance_platform_limit;
    1.75 +
    1.76 +		/* pct */
    1.77 +		convert_pct_reg(&perf->control_register, &px->control_register);
    1.78 +		convert_pct_reg(&perf->status_register, &px->status_register);
    1.79 +
    1.80 +		/* pss */
    1.81 +		perf->state_count = px->state_count;
    1.82 +		states = kzalloc(px->state_count*sizeof(xen_processor_px_t),GFP_KERNEL);
    1.83 +		if (!states)
    1.84 +			return -ENOMEM;
    1.85 +		convert_pss_states(states, px->states, px->state_count);
    1.86 +		set_xen_guest_handle(perf->states, states);
    1.87 +
    1.88 +		/* psd */
    1.89 +		pdomain = &px->domain_info;
    1.90 +		convert_psd_pack(&perf->domain_info, pdomain);
    1.91 +		if (perf->domain_info.num_processors) {
    1.92 +			if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL)
    1.93 +				perf->shared_type = CPUFREQ_SHARED_TYPE_ALL;
    1.94 +			else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY)
    1.95 +				perf->shared_type = CPUFREQ_SHARED_TYPE_ANY;
    1.96 +			else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL)
    1.97 +				perf->shared_type = CPUFREQ_SHARED_TYPE_HW;
    1.98 +		} else
    1.99 +			perf->shared_type = CPUFREQ_SHARED_TYPE_NONE;
   1.100 +
   1.101 +		ret = HYPERVISOR_platform_op(&op);
   1.102 +		kfree(states);
   1.103 +		break;
   1.104 +
   1.105 +	default:
   1.106 +		break;
   1.107 +	}
   1.108 +
   1.109  	return ret;
   1.110  }
   1.111  
     2.1 --- a/include/xen/interface/platform.h	Fri Sep 12 07:24:53 2008 +0100
     2.2 +++ b/include/xen/interface/platform.h	Fri Sep 12 10:37:02 2008 +0100
     2.3 @@ -289,7 +289,7 @@ struct xen_psd_package {
     2.4  
     2.5  struct xen_processor_performance {
     2.6      uint32_t flags;     /* flag for Px sub info type */
     2.7 -    uint32_t ppc;       /* Platform limitation on freq usage */
     2.8 +    uint32_t platform_limit;  /* Platform limitation on freq usage */
     2.9      struct xen_pct_register control_register;
    2.10      struct xen_pct_register status_register;
    2.11      uint32_t state_count;     /* total available performance states */