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

[Xen-changelog] [linux-2.6.18-xen] linux/acpi: adjust extcntl code so that CONFIG_ACPI_PROCESSOR=m is possible again



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1216816650 -3600
# Node ID 72234a8ee99cb0f56c856f28ffbe2b10d2ea1ebc
# Parent  268d6984c8e2b3ecf02a609dc832253b042c64da
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@xxxxxxxxxx>
---
 arch/i386/kernel/acpi/processor_extcntl_xen.c |    8 ++--
 drivers/acpi/Kconfig                          |    1 
 drivers/acpi/processor_extcntl.c              |   50 +++++++-------------------
 include/acpi/processor.h                      |    5 +-
 4 files changed, 20 insertions(+), 44 deletions(-)

diff -r 268d6984c8e2 -r 72234a8ee99c 
arch/i386/kernel/acpi/processor_extcntl_xen.c
--- a/arch/i386/kernel/acpi/processor_extcntl_xen.c     Wed Jul 23 13:36:53 
2008 +0100
+++ b/arch/i386/kernel/acpi/processor_extcntl_xen.c     Wed Jul 23 13:37:30 
2008 +0100
@@ -221,7 +221,7 @@ static struct processor_extcntl_ops xen_
        .hotplug                = xen_hotplug_notifier,
 };
 
-static int __cpuinit xen_init_processor_extcntl(void)
+void arch_acpi_processor_init_extcntl(const struct processor_extcntl_ops **ops)
 {
        if (xen_processor_pmbits & XEN_PROCESSOR_PM_CX)
                xen_extcntl_ops.pm_ops[PM_TYPE_IDLE] = xen_cx_notifier;
@@ -230,6 +230,6 @@ static int __cpuinit xen_init_processor_
        if (xen_processor_pmbits & XEN_PROCESSOR_PM_TX)
                xen_extcntl_ops.pm_ops[PM_TYPE_THR] = xen_tx_notifier;
 
-       return processor_register_extcntl(&xen_extcntl_ops);
-}
-core_initcall(xen_init_processor_extcntl);
+       *ops = &xen_extcntl_ops;
+}
+EXPORT_SYMBOL(arch_acpi_processor_init_extcntl);
diff -r 268d6984c8e2 -r 72234a8ee99c drivers/acpi/Kconfig
--- a/drivers/acpi/Kconfig      Wed Jul 23 13:36:53 2008 +0100
+++ b/drivers/acpi/Kconfig      Wed Jul 23 13:37:30 2008 +0100
@@ -371,7 +371,6 @@ config PROCESSOR_EXTERNAL_CONTROL
 config PROCESSOR_EXTERNAL_CONTROL
        bool
        depends on X86 && XEN
-       select ACPI_PROCESSOR
        default y
 endif  # ACPI
 
diff -r 268d6984c8e2 -r 72234a8ee99c drivers/acpi/processor_extcntl.c
--- a/drivers/acpi/processor_extcntl.c  Wed Jul 23 13:36:53 2008 +0100
+++ b/drivers/acpi/processor_extcntl.c  Wed Jul 23 13:37:30 2008 +0100
@@ -36,7 +36,7 @@ static int processor_extcntl_get_perform
  * External processor control logic may register with its own set of
  * ops to get ACPI related notification. One example is like VMM.
  */
-struct processor_extcntl_ops *processor_extcntl_ops;
+const struct processor_extcntl_ops *processor_extcntl_ops;
 EXPORT_SYMBOL(processor_extcntl_ops);
 
 static int processor_notify_smm(void)
@@ -105,47 +105,13 @@ int processor_notify_external(struct acp
 }
 
 /*
- * External control logic can decide to grab full or part of physical
- * processor control bits. Take a VMM for example, physical processors
- * are owned by VMM and thus existence information like hotplug is
- * always required to be notified to VMM. Similar is processor idle
- * state which is also necessarily controlled by VMM. But for other
- * control bits like performance/throttle states, VMM may choose to
- * control or not upon its own policy.
- *
- * Such ownership is unlikely to be switched in the fly, and thus
- * not sure unregister interface is required or not. Being same reason,
- * lock is not forced now.
- */
-int processor_register_extcntl(struct processor_extcntl_ops *ops)
-{
-       if (!ops)
-               return -EINVAL;
-
-       if (processor_extcntl_ops &&
-               (processor_extcntl_ops != ops))
-               return -EBUSY;
-
-       processor_extcntl_ops = ops;
-       return 0;
-}
-
-int processor_unregister_extcntl(struct processor_extcntl_ops *ops)
-{
-       if (processor_extcntl_ops == ops)
-               processor_extcntl_ops = NULL;
-
-       return 0;
-}
-
-/*
  * This is called from ACPI processor init, and targeted to hold
  * some tricky housekeeping jobs to satisfy external control model.
  * For example, we may put dependency parse stub here for idle
  * and performance state. Those information may be not available
  * if splitting from dom0 control logic like cpufreq driver.
  */
-int processor_extcntl_init(struct acpi_processor *pr)
+int __cpuinit processor_extcntl_init(struct acpi_processor *pr)
 {
        /* parse cstate dependency information */
        if (processor_pm_external())
@@ -154,6 +120,18 @@ int processor_extcntl_init(struct acpi_p
        /* Initialize performance states */
        if (processor_pmperf_external())
                processor_extcntl_get_performance(pr);
+
+       /*
+        * External control logic can decide to grab full or part of physical
+        * processor control bits. Take a VMM for example, physical processors
+        * are owned by VMM and thus existence information like hotplug is
+        * always required to be notified to VMM. Similar is processor idle
+        * state which is also necessarily controlled by VMM. But for other
+        * control bits like performance/throttle states, VMM may choose to
+        * control or not upon its own policy.
+        */
+       if (!processor_extcntl_ops)
+               arch_acpi_processor_init_extcntl(&processor_extcntl_ops);
 
        return 0;
 }
diff -r 268d6984c8e2 -r 72234a8ee99c include/acpi/processor.h
--- a/include/acpi/processor.h  Wed Jul 23 13:36:53 2008 +0100
+++ b/include/acpi/processor.h  Wed Jul 23 13:37:30 2008 +0100
@@ -323,7 +323,7 @@ struct processor_extcntl_ops {
        /* Notify physical processor status to external control logic */
        int (*hotplug)(struct acpi_processor *pr, int event);
 };
-extern struct processor_extcntl_ops *processor_extcntl_ops;
+extern const struct processor_extcntl_ops *processor_extcntl_ops;
 
 static inline int processor_cntl_external(void)
 {
@@ -350,11 +350,10 @@ static inline int processor_pmthr_extern
 
 extern int processor_notify_external(struct acpi_processor *pr,
                        int event, int type);
-extern int processor_register_extcntl(struct processor_extcntl_ops *ops);
-extern int processor_unregister_extcntl(struct processor_extcntl_ops *ops);
 extern int processor_extcntl_init(struct acpi_processor *pr);
 extern int acpi_processor_get_performance_info(struct acpi_processor *pr);
 extern int acpi_processor_get_psd(struct acpi_processor *pr);
+void arch_acpi_processor_init_extcntl(const struct processor_extcntl_ops **);
 #else
 static inline int processor_cntl_external(void) {return 0;}
 static inline int processor_pm_external(void) {return 0;}

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


 


Rackspace

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