ia64/linux-2.6.18-xen.hg

changeset 531:3c564f80f2ef

Notify ACPI processor events to external logic, including C/P/T and hotplug, etc.

Signed-off-by: Tian Kevin <kevin.tian@intel.com>
Signed-off-by: Wei Gang <gang.wei@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu May 01 10:52:31 2008 +0100 (2008-05-01)
parents 3da869d5095b
children e97855b90cc2
files arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c drivers/acpi/processor_core.c drivers/acpi/processor_idle.c drivers/acpi/processor_perflib.c
line diff
     1.1 --- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	Thu May 01 10:52:06 2008 +0100
     1.2 +++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	Thu May 01 10:52:31 2008 +0100
     1.3 @@ -568,6 +568,15 @@ acpi_cpufreq_init (void)
     1.4  {
     1.5  	dprintk("acpi_cpufreq_init\n");
     1.6  
     1.7 +	/*
     1.8 +	 * This effectively blocks in-kernel cpufreq driver to interfere
     1.9 +	 * external control logic
    1.10 +	 */
    1.11 +	if (processor_pmperf_external()) {
    1.12 +		printk("CPUFREQ is controllerd externally...exit then!\n");
    1.13 +		return -1;
    1.14 +	}
    1.15 +
    1.16  	acpi_cpufreq_early_init_acpi();
    1.17  
    1.18  	return cpufreq_register_driver(&acpi_cpufreq_driver);
     2.1 --- a/drivers/acpi/processor_core.c	Thu May 01 10:52:06 2008 +0100
     2.2 +++ b/drivers/acpi/processor_core.c	Thu May 01 10:52:31 2008 +0100
     2.3 @@ -564,6 +564,10 @@ static int acpi_processor_start(struct a
     2.4  
     2.5  	acpi_processor_power_init(pr, device);
     2.6  
     2.7 +#ifdef CONFIG_PROCESSOR_EXTERNAL_CONTROL
     2.8 +	processor_extcntl_init(pr);
     2.9 +#endif
    2.10 +
    2.11  	if (pr->flags.throttling) {
    2.12  		printk(KERN_INFO PREFIX "%s [%s] (supports",
    2.13  		       acpi_device_name(device), acpi_device_bid(device));
    2.14 @@ -710,6 +714,10 @@ int acpi_processor_device_add(acpi_handl
    2.15  	if (!pr)
    2.16  		return -ENODEV;
    2.17  
    2.18 +	if (processor_cntl_external())
    2.19 +		processor_notify_external(pr,
    2.20 +			PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD);
    2.21 +
    2.22  	if ((pr->id >= 0) && (pr->id < NR_CPUS)) {
    2.23  		kobject_uevent(&(*device)->kobj, KOBJ_ONLINE);
    2.24  	}
    2.25 @@ -748,6 +756,10 @@ acpi_processor_hotplug_notify(acpi_handl
    2.26  			break;
    2.27  		}
    2.28  
    2.29 +		if (processor_cntl_external())
    2.30 +			processor_notify_external(pr,
    2.31 +					PROCESSOR_HOTPLUG, HOTPLUG_TYPE_ADD);
    2.32 +
    2.33  		if (pr->id >= 0 && (pr->id < NR_CPUS)) {
    2.34  			kobject_uevent(&device->kobj, KOBJ_OFFLINE);
    2.35  			break;
    2.36 @@ -779,6 +791,11 @@ acpi_processor_hotplug_notify(acpi_handl
    2.37  
    2.38  		if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
    2.39  			kobject_uevent(&device->kobj, KOBJ_OFFLINE);
    2.40 +
    2.41 +		if (processor_cntl_external())
    2.42 +			processor_notify_external(pr, PROCESSOR_HOTPLUG,
    2.43 +							HOTPLUG_TYPE_REMOVE);
    2.44 +
    2.45  		break;
    2.46  	default:
    2.47  		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
     3.1 --- a/drivers/acpi/processor_idle.c	Thu May 01 10:52:06 2008 +0100
     3.2 +++ b/drivers/acpi/processor_idle.c	Thu May 01 10:52:31 2008 +0100
     3.3 @@ -985,12 +985,16 @@ int acpi_processor_cst_has_changed(struc
     3.4  		return -ENODEV;
     3.5  
     3.6  	/* Fall back to the default idle loop */
     3.7 -	pm_idle = pm_idle_save;
     3.8 +	if (!processor_pm_external())
     3.9 +		pm_idle = pm_idle_save;
    3.10  	synchronize_sched();	/* Relies on interrupts forcing exit from idle. */
    3.11  
    3.12  	pr->flags.power = 0;
    3.13  	result = acpi_processor_get_power_info(pr);
    3.14 -	if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
    3.15 +	if (processor_pm_external())
    3.16 +		processor_notify_external(pr,
    3.17 +			PROCESSOR_PM_CHANGE, PM_TYPE_IDLE);
    3.18 +	else if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
    3.19  		pm_idle = acpi_processor_idle;
    3.20  
    3.21  	return result;
    3.22 @@ -1122,7 +1126,7 @@ int acpi_processor_power_init(struct acp
    3.23  				       pr->power.states[i].type);
    3.24  		printk(")\n");
    3.25  
    3.26 -		if (pr->id == 0) {
    3.27 +		if (!processor_pm_external() && (pr->id == 0)) {
    3.28  			pm_idle_save = pm_idle;
    3.29  			pm_idle = acpi_processor_idle;
    3.30  		}
    3.31 @@ -1141,6 +1145,9 @@ int acpi_processor_power_init(struct acp
    3.32  
    3.33  	pr->flags.power_setup_done = 1;
    3.34  
    3.35 +	if (processor_pm_external())
    3.36 +		processor_notify_external(pr,
    3.37 +			PROCESSOR_PM_INIT, PM_TYPE_IDLE);
    3.38  	return 0;
    3.39  }
    3.40  
     4.1 --- a/drivers/acpi/processor_perflib.c	Thu May 01 10:52:06 2008 +0100
     4.2 +++ b/drivers/acpi/processor_perflib.c	Thu May 01 10:52:31 2008 +0100
     4.3 @@ -136,8 +136,11 @@ int acpi_processor_ppc_has_changed(struc
     4.4  	int ret = acpi_processor_get_platform_limit(pr);
     4.5  	if (ret < 0)
     4.6  		return (ret);
     4.7 +	else if (!processor_pmperf_external())
     4.8 +		return cpufreq_update_policy(pr->id);
     4.9  	else
    4.10 -		return cpufreq_update_policy(pr->id);
    4.11 +		return processor_notify_external(pr,
    4.12 +				PROCESSOR_PM_CHANGE, PM_TYPE_PERF);
    4.13  }
    4.14  
    4.15  void acpi_processor_ppc_init(void)