ia64/linux-2.6.18-xen.hg

changeset 620:72234a8ee99c

linux/acpi: adjust extcntl code so that CONFIG_ACPI_PROCESSOR=m is possible again

This is done by inverting the calling direction for registering the
extcntl_ops structure, similar to arch_acpi_processor_init_pdc().

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jul 23 13:37:30 2008 +0100 (2008-07-23)
parents 268d6984c8e2
children f4b11ef0c6eb
files arch/i386/kernel/acpi/processor_extcntl_xen.c drivers/acpi/Kconfig drivers/acpi/processor_extcntl.c include/acpi/processor.h
line diff
     1.1 --- a/arch/i386/kernel/acpi/processor_extcntl_xen.c	Wed Jul 23 13:36:53 2008 +0100
     1.2 +++ b/arch/i386/kernel/acpi/processor_extcntl_xen.c	Wed Jul 23 13:37:30 2008 +0100
     1.3 @@ -221,7 +221,7 @@ static struct processor_extcntl_ops xen_
     1.4  	.hotplug		= xen_hotplug_notifier,
     1.5  };
     1.6  
     1.7 -static int __cpuinit xen_init_processor_extcntl(void)
     1.8 +void arch_acpi_processor_init_extcntl(const struct processor_extcntl_ops **ops)
     1.9  {
    1.10  	if (xen_processor_pmbits & XEN_PROCESSOR_PM_CX)
    1.11  		xen_extcntl_ops.pm_ops[PM_TYPE_IDLE] = xen_cx_notifier;
    1.12 @@ -230,6 +230,6 @@ static int __cpuinit xen_init_processor_
    1.13  	if (xen_processor_pmbits & XEN_PROCESSOR_PM_TX)
    1.14  		xen_extcntl_ops.pm_ops[PM_TYPE_THR] = xen_tx_notifier;
    1.15  
    1.16 -	return processor_register_extcntl(&xen_extcntl_ops);
    1.17 +	*ops = &xen_extcntl_ops;
    1.18  }
    1.19 -core_initcall(xen_init_processor_extcntl);
    1.20 +EXPORT_SYMBOL(arch_acpi_processor_init_extcntl);
     2.1 --- a/drivers/acpi/Kconfig	Wed Jul 23 13:36:53 2008 +0100
     2.2 +++ b/drivers/acpi/Kconfig	Wed Jul 23 13:37:30 2008 +0100
     2.3 @@ -371,7 +371,6 @@ config ACPI_PV_SLEEP
     2.4  config PROCESSOR_EXTERNAL_CONTROL
     2.5  	bool
     2.6  	depends on X86 && XEN
     2.7 -	select ACPI_PROCESSOR
     2.8  	default y
     2.9  endif	# ACPI
    2.10  
     3.1 --- a/drivers/acpi/processor_extcntl.c	Wed Jul 23 13:36:53 2008 +0100
     3.2 +++ b/drivers/acpi/processor_extcntl.c	Wed Jul 23 13:37:30 2008 +0100
     3.3 @@ -36,7 +36,7 @@ static int processor_extcntl_get_perform
     3.4   * External processor control logic may register with its own set of
     3.5   * ops to get ACPI related notification. One example is like VMM.
     3.6   */
     3.7 -struct processor_extcntl_ops *processor_extcntl_ops;
     3.8 +const struct processor_extcntl_ops *processor_extcntl_ops;
     3.9  EXPORT_SYMBOL(processor_extcntl_ops);
    3.10  
    3.11  static int processor_notify_smm(void)
    3.12 @@ -105,47 +105,13 @@ int processor_notify_external(struct acp
    3.13  }
    3.14  
    3.15  /*
    3.16 - * External control logic can decide to grab full or part of physical
    3.17 - * processor control bits. Take a VMM for example, physical processors
    3.18 - * are owned by VMM and thus existence information like hotplug is
    3.19 - * always required to be notified to VMM. Similar is processor idle
    3.20 - * state which is also necessarily controlled by VMM. But for other
    3.21 - * control bits like performance/throttle states, VMM may choose to
    3.22 - * control or not upon its own policy.
    3.23 - *
    3.24 - * Such ownership is unlikely to be switched in the fly, and thus
    3.25 - * not sure unregister interface is required or not. Being same reason,
    3.26 - * lock is not forced now.
    3.27 - */
    3.28 -int processor_register_extcntl(struct processor_extcntl_ops *ops)
    3.29 -{
    3.30 -	if (!ops)
    3.31 -		return -EINVAL;
    3.32 -
    3.33 -	if (processor_extcntl_ops &&
    3.34 -		(processor_extcntl_ops != ops))
    3.35 -		return -EBUSY;
    3.36 -
    3.37 -	processor_extcntl_ops = ops;
    3.38 -	return 0;
    3.39 -}
    3.40 -
    3.41 -int processor_unregister_extcntl(struct processor_extcntl_ops *ops)
    3.42 -{
    3.43 -	if (processor_extcntl_ops == ops)
    3.44 -		processor_extcntl_ops = NULL;
    3.45 -
    3.46 -	return 0;
    3.47 -}
    3.48 -
    3.49 -/*
    3.50   * This is called from ACPI processor init, and targeted to hold
    3.51   * some tricky housekeeping jobs to satisfy external control model.
    3.52   * For example, we may put dependency parse stub here for idle
    3.53   * and performance state. Those information may be not available
    3.54   * if splitting from dom0 control logic like cpufreq driver.
    3.55   */
    3.56 -int processor_extcntl_init(struct acpi_processor *pr)
    3.57 +int __cpuinit processor_extcntl_init(struct acpi_processor *pr)
    3.58  {
    3.59  	/* parse cstate dependency information */
    3.60  	if (processor_pm_external())
    3.61 @@ -155,6 +121,18 @@ int processor_extcntl_init(struct acpi_p
    3.62  	if (processor_pmperf_external())
    3.63  		processor_extcntl_get_performance(pr);
    3.64  
    3.65 +	/*
    3.66 +	 * External control logic can decide to grab full or part of physical
    3.67 +	 * processor control bits. Take a VMM for example, physical processors
    3.68 +	 * are owned by VMM and thus existence information like hotplug is
    3.69 +	 * always required to be notified to VMM. Similar is processor idle
    3.70 +	 * state which is also necessarily controlled by VMM. But for other
    3.71 +	 * control bits like performance/throttle states, VMM may choose to
    3.72 +	 * control or not upon its own policy.
    3.73 +	 */
    3.74 +	if (!processor_extcntl_ops)
    3.75 +		arch_acpi_processor_init_extcntl(&processor_extcntl_ops);
    3.76 +
    3.77  	return 0;
    3.78  }
    3.79  
     4.1 --- a/include/acpi/processor.h	Wed Jul 23 13:36:53 2008 +0100
     4.2 +++ b/include/acpi/processor.h	Wed Jul 23 13:37:30 2008 +0100
     4.3 @@ -323,7 +323,7 @@ struct processor_extcntl_ops {
     4.4  	/* Notify physical processor status to external control logic */
     4.5  	int (*hotplug)(struct acpi_processor *pr, int event);
     4.6  };
     4.7 -extern struct processor_extcntl_ops *processor_extcntl_ops;
     4.8 +extern const struct processor_extcntl_ops *processor_extcntl_ops;
     4.9  
    4.10  static inline int processor_cntl_external(void)
    4.11  {
    4.12 @@ -350,11 +350,10 @@ static inline int processor_pmthr_extern
    4.13  
    4.14  extern int processor_notify_external(struct acpi_processor *pr,
    4.15  			int event, int type);
    4.16 -extern int processor_register_extcntl(struct processor_extcntl_ops *ops);
    4.17 -extern int processor_unregister_extcntl(struct processor_extcntl_ops *ops);
    4.18  extern int processor_extcntl_init(struct acpi_processor *pr);
    4.19  extern int acpi_processor_get_performance_info(struct acpi_processor *pr);
    4.20  extern int acpi_processor_get_psd(struct acpi_processor *pr);
    4.21 +void arch_acpi_processor_init_extcntl(const struct processor_extcntl_ops **);
    4.22  #else
    4.23  static inline int processor_cntl_external(void) {return 0;}
    4.24  static inline int processor_pm_external(void) {return 0;}