From dcb93b96cec723783a81e8cac7df62feaf964792 Mon Sep 17 00:00:00 2001 From: Liu Jinsong Date: Thu, 24 Jan 2013 20:16:59 +0800 Subject: xen/stub: driver for memory hotplug This patch create a file (xen-stub.c) for Xen stub drivers. Xen stub drivers are used to reserve space for Xen drivers, i.e. memory hotplug and cpu hotplug, and to block native drivers loaded, so that real Xen drivers can be modular and loaded on demand. This patch is specific for Xen memory hotplug (other Xen logic can add stub drivers on their own). The xen stub driver will occupied earlier via subsys_initcall (than native memory hotplug driver via module_init and so blocking native). Later real Xen memory hotplug logic will unregister the stub driver and register itself to take effect on demand. Signed-off-by: Liu Jinsong Signed-off-by: Konrad Rzeszutek Wilk --- include/xen/acpi.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/xen/acpi.h') diff --git a/include/xen/acpi.h b/include/xen/acpi.h index 48a9c0171b65..ce7e5264b320 100644 --- a/include/xen/acpi.h +++ b/include/xen/acpi.h @@ -40,6 +40,13 @@ #include #include +#define ACPI_MEMORY_DEVICE_CLASS "memory" +#define ACPI_MEMORY_DEVICE_HID "PNP0C80" +#define ACPI_MEMORY_DEVICE_NAME "Hotplug Mem Device" + +int xen_stub_memory_device_init(void); +void xen_stub_memory_device_exit(void); + int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 pm1a_cnt, u32 pm1b_cnd); -- cgit v1.2.3 From b22ff77b82598ff131d215627533e09e4a472220 Mon Sep 17 00:00:00 2001 From: Liu Jinsong Date: Thu, 24 Jan 2013 22:12:30 +0800 Subject: xen/stub: driver for CPU hotplug 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 Signed-off-by: Konrad Rzeszutek Wilk --- include/xen/acpi.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/xen/acpi.h') diff --git a/include/xen/acpi.h b/include/xen/acpi.h index ce7e5264b320..2b3103b33725 100644 --- a/include/xen/acpi.h +++ b/include/xen/acpi.h @@ -47,6 +47,13 @@ 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); -- cgit v1.2.3 From 40a58637a4fa10a2faea71f0f30ff0b3d74c6e00 Mon Sep 17 00:00:00 2001 From: Liu Jinsong Date: Fri, 25 Jan 2013 15:42:31 +0800 Subject: xen/acpi: Move xen_acpi_get_pxm to Xen's acpi.h So that it could be reused by Xen CPU hotplug logic. Signed-off-by: Liu, Jinsong Signed-off-by: Konrad Rzeszutek Wilk --- include/xen/acpi.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/xen/acpi.h') diff --git a/include/xen/acpi.h b/include/xen/acpi.h index 2b3103b33725..dc69c91605b8 100644 --- a/include/xen/acpi.h +++ b/include/xen/acpi.h @@ -69,4 +69,22 @@ static inline void xen_acpi_sleep_register(void) } #endif +static inline int xen_acpi_get_pxm(acpi_handle h) +{ + unsigned long long pxm; + acpi_status status; + acpi_handle handle; + acpi_handle phandle = h; + + do { + handle = phandle; + status = acpi_evaluate_integer(handle, "_PXM", NULL, &pxm); + if (ACPI_SUCCESS(status)) + return pxm; + status = acpi_get_parent(handle, &phandle); + } while (ACPI_SUCCESS(status)); + + return -ENXIO; +} + #endif /* _XEN_ACPI_H */ -- cgit v1.2.3 From 39adc483d378f79711f291539f20e3797337892d Mon Sep 17 00:00:00 2001 From: Liu Jinsong Date: Fri, 25 Jan 2013 15:43:34 +0800 Subject: xen/acpi: ACPI cpu hotplug This patch implement real Xen ACPI cpu hotplug driver as module. When loaded, it replaces Xen stub driver. For booting existed cpus, the driver enumerates them. For hotadded cpus, which added at runtime and notify OS via device or container event, the driver is invoked to add them, parsing cpu information, hypercalling to Xen hypervisor to add them, and finally setting up new /sys interface for them. Signed-off-by: Liu Jinsong Signed-off-by: Konrad Rzeszutek Wilk --- include/xen/acpi.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/xen/acpi.h') diff --git a/include/xen/acpi.h b/include/xen/acpi.h index dc69c91605b8..c962d5f5b38b 100644 --- a/include/xen/acpi.h +++ b/include/xen/acpi.h @@ -54,6 +54,9 @@ void xen_stub_memory_device_exit(void); int xen_stub_processor_init(void); void xen_stub_processor_exit(void); +void xen_pcpu_hotplug_sync(void); +int xen_pcpu_id(uint32_t acpi_id); + int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 pm1a_cnt, u32 pm1b_cnd); -- cgit v1.2.3 From 268a207563f933ff8e3d876866c324b4247f234e Mon Sep 17 00:00:00 2001 From: Liu Jinsong Date: Thu, 14 Feb 2013 15:46:26 +0800 Subject: xen/acpi: move xen_acpi_get_pxm under CONFIG_XEN_DOM0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid compile issue and it's meanigfull only under CONFIG_XEN_DOM0. In file included from linux/arch/x86/xen/enlighten.c:47:0: linux/include/xen/acpi.h:75:76: error: unknown type name ‘acpi_handle’ make[3]: *** [arch/x86/xen/enlighten.o] Error 1 Signed-off-by: Liu Jinsong [v1: Fixed spelling mistakes] Signed-off-by: Konrad Rzeszutek Wilk --- include/xen/acpi.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'include/xen/acpi.h') diff --git a/include/xen/acpi.h b/include/xen/acpi.h index c962d5f5b38b..68d73d09b770 100644 --- a/include/xen/acpi.h +++ b/include/xen/acpi.h @@ -57,21 +57,6 @@ void xen_stub_processor_exit(void); void xen_pcpu_hotplug_sync(void); int xen_pcpu_id(uint32_t acpi_id); -int xen_acpi_notify_hypervisor_state(u8 sleep_state, - u32 pm1a_cnt, u32 pm1b_cnd); - -static inline void xen_acpi_sleep_register(void) -{ - if (xen_initial_domain()) - acpi_os_set_prepare_sleep( - &xen_acpi_notify_hypervisor_state); -} -#else -static inline void xen_acpi_sleep_register(void) -{ -} -#endif - static inline int xen_acpi_get_pxm(acpi_handle h) { unsigned long long pxm; @@ -90,4 +75,19 @@ static inline int xen_acpi_get_pxm(acpi_handle h) return -ENXIO; } +int xen_acpi_notify_hypervisor_state(u8 sleep_state, + u32 pm1a_cnt, u32 pm1b_cnd); + +static inline void xen_acpi_sleep_register(void) +{ + if (xen_initial_domain()) + acpi_os_set_prepare_sleep( + &xen_acpi_notify_hypervisor_state); +} +#else +static inline void xen_acpi_sleep_register(void) +{ +} +#endif + #endif /* _XEN_ACPI_H */ -- cgit v1.2.3