]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xen/stub: driver for CPU hotplug
authorLiu Jinsong <jinsong.liu@intel.com>
Thu, 24 Jan 2013 14:12:30 +0000 (22:12 +0800)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Sat, 26 Jan 2013 00:34:08 +0000 (19:34 -0500)
Add Xen stub driver for CPU hotplug, early occupy to block native,
will be replaced later by real Xen processor driver module.

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/xen/xen-stub.c
include/xen/acpi.h

index 811152f67137edd16de911d24e8a63d42ae99c32..d85e411cbf8924ceaf8e3947ab961e1c5ea68744 100644 (file)
 #include <acpi/acpi_drivers.h>
 #include <xen/acpi.h>
 
+#ifdef CONFIG_ACPI
+
 /*--------------------------------------------
        stub driver for Xen memory hotplug
 --------------------------------------------*/
 
-#ifdef CONFIG_ACPI
-
 static const struct acpi_device_id memory_device_ids[] = {
        {ACPI_MEMORY_DEVICE_HID, 0},
        {"", 0},
@@ -63,4 +63,39 @@ void xen_stub_memory_device_exit(void)
 }
 EXPORT_SYMBOL_GPL(xen_stub_memory_device_exit);
 
+
+/*--------------------------------------------
+       stub driver for Xen cpu hotplug
+--------------------------------------------*/
+
+static const struct acpi_device_id processor_device_ids[] = {
+       {ACPI_PROCESSOR_OBJECT_HID, 0},
+       {ACPI_PROCESSOR_DEVICE_HID, 0},
+       {"", 0},
+};
+
+static struct acpi_driver xen_stub_processor_driver = {
+       /* same name as native processor driver to block native loaded */
+       .name = "processor",
+       .class = ACPI_PROCESSOR_CLASS,
+       .ids = processor_device_ids,
+};
+
+int xen_stub_processor_init(void)
+{
+       if (!xen_initial_domain())
+               return -ENODEV;
+
+       /* just reserve space for Xen, block native driver loaded */
+       return acpi_bus_register_driver(&xen_stub_processor_driver);
+}
+EXPORT_SYMBOL_GPL(xen_stub_processor_init);
+subsys_initcall(xen_stub_processor_init);
+
+void xen_stub_processor_exit(void)
+{
+       acpi_bus_unregister_driver(&xen_stub_processor_driver);
+}
+EXPORT_SYMBOL_GPL(xen_stub_processor_exit);
+
 #endif
index ce7e5264b320dccec01e09f1e0bb9a05bb49458e..2b3103b33725abb87f061bb41712f840fe4d4fe5 100644 (file)
 int xen_stub_memory_device_init(void);
 void xen_stub_memory_device_exit(void);
 
+#define ACPI_PROCESSOR_CLASS            "processor"
+#define ACPI_PROCESSOR_DEVICE_HID       "ACPI0007"
+#define ACPI_PROCESSOR_DEVICE_NAME      "Processor"
+
+int xen_stub_processor_init(void);
+void xen_stub_processor_exit(void);
+
 int xen_acpi_notify_hypervisor_state(u8 sleep_state,
                                     u32 pm1a_cnt, u32 pm1b_cnd);