Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / xen / xen-stub.c
blob3be4e74660b5707ab0ce1e0551200983238809f6
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * xen-stub.c - stub drivers to reserve space for Xen
5 * Copyright (C) 2012 Intel Corporation
6 * Author: Liu Jinsong <jinsong.liu@intel.com>
7 * Author: Jiang Yunhong <yunhong.jiang@intel.com>
9 * Copyright (C) 2012 Oracle Inc
10 * Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/export.h>
16 #include <linux/types.h>
17 #include <linux/acpi.h>
18 #include <xen/acpi.h>
20 #ifdef CONFIG_ACPI
22 /*--------------------------------------------
23 stub driver for Xen memory hotplug
24 --------------------------------------------*/
26 static const struct acpi_device_id memory_device_ids[] = {
27 {ACPI_MEMORY_DEVICE_HID, 0},
28 {"", 0},
31 static struct acpi_driver xen_stub_memory_device_driver = {
32 /* same name as native memory driver to block native loaded */
33 .name = "acpi_memhotplug",
34 .class = ACPI_MEMORY_DEVICE_CLASS,
35 .ids = memory_device_ids,
38 int xen_stub_memory_device_init(void)
40 if (!xen_initial_domain())
41 return -ENODEV;
43 /* just reserve space for Xen, block native driver loaded */
44 return acpi_bus_register_driver(&xen_stub_memory_device_driver);
46 EXPORT_SYMBOL_GPL(xen_stub_memory_device_init);
47 subsys_initcall(xen_stub_memory_device_init);
49 void xen_stub_memory_device_exit(void)
51 acpi_bus_unregister_driver(&xen_stub_memory_device_driver);
53 EXPORT_SYMBOL_GPL(xen_stub_memory_device_exit);
56 /*--------------------------------------------
57 stub driver for Xen cpu hotplug
58 --------------------------------------------*/
60 static const struct acpi_device_id processor_device_ids[] = {
61 {ACPI_PROCESSOR_OBJECT_HID, 0},
62 {ACPI_PROCESSOR_DEVICE_HID, 0},
63 {"", 0},
66 static struct acpi_driver xen_stub_processor_driver = {
67 /* same name as native processor driver to block native loaded */
68 .name = "processor",
69 .class = ACPI_PROCESSOR_CLASS,
70 .ids = processor_device_ids,
73 int xen_stub_processor_init(void)
75 if (!xen_initial_domain())
76 return -ENODEV;
78 /* just reserve space for Xen, block native driver loaded */
79 return acpi_bus_register_driver(&xen_stub_processor_driver);
81 EXPORT_SYMBOL_GPL(xen_stub_processor_init);
82 subsys_initcall(xen_stub_processor_init);
84 void xen_stub_processor_exit(void)
86 acpi_bus_unregister_driver(&xen_stub_processor_driver);
88 EXPORT_SYMBOL_GPL(xen_stub_processor_exit);
90 #endif