diff -r 2e8ad0c35792 xen/arch/x86/smpboot.c --- a/xen/arch/x86/smpboot.c Thu Sep 18 10:43:08 2008 +0100 +++ b/xen/arch/x86/smpboot.c Mon Sep 22 18:13:41 2008 +0800 @@ -1310,6 +1310,14 @@ return err; } +long cpu_down_helper(void *data) +{ + int cpu = (unsigned long)data; + + cpu_down(cpu); + return 0; +} + int cpu_up(unsigned int cpu) { int err = 0; diff -r 2e8ad0c35792 xen/arch/x86/sysctl.c --- a/xen/arch/x86/sysctl.c Thu Sep 18 10:43:08 2008 +0100 +++ b/xen/arch/x86/sysctl.c Mon Sep 22 18:13:41 2008 +0800 @@ -92,6 +92,25 @@ } break; + case XEN_SYSCTL_cpu_hotplug: + { + uint64_t ops = sysctl->u.cpu_hotplug.ops; + unsigned long cpu = sysctl->u.cpu_hotplug.cpu; + + switch ( ops ) + { + case CPU_HOTPLUG_ONLINE: + cpu_up(cpu); + break; + case CPU_HOTPLUG_OFFLINE: + continue_hypercall_on_cpu(0, cpu_down_helper, (void *)cpu); + break; + default: + ret = -EINVAL; + break; + } + } + break; default: ret = -ENOSYS; diff -r 2e8ad0c35792 xen/include/asm-x86/smp.h --- a/xen/include/asm-x86/smp.h Thu Sep 18 10:43:08 2008 +0100 +++ b/xen/include/asm-x86/smp.h Mon Sep 22 18:13:41 2008 +0800 @@ -56,6 +56,7 @@ #ifdef CONFIG_HOTPLUG_CPU #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) +extern long cpu_down_helper(void *data); extern int cpu_down(unsigned int cpu); extern int cpu_up(unsigned int cpu); extern void cpu_exit_clear(void); diff -r 2e8ad0c35792 xen/include/public/sysctl.h --- a/xen/include/public/sysctl.h Thu Sep 18 10:43:08 2008 +0100 +++ b/xen/include/public/sysctl.h Mon Sep 22 18:13:41 2008 +0800 @@ -262,6 +262,18 @@ typedef struct xen_sysctl_get_pmstat xen_sysctl_get_pmstat_t; DEFINE_XEN_GUEST_HANDLE(xen_sysctl_get_pmstat_t); +#define XEN_SYSCTL_cpu_hotplug 11 +struct xen_sysctl_cpu_hotplug { + /* IN variables */ + uint32_t cpu; /* Physical cpu. */ +#define CPU_HOTPLUG_ONLINE 0 +#define CPU_HOTPLUG_OFFLINE 1 + uint64_t ops; /* hotplug opscode */ +}; +typedef struct xen_sysctl_cpu_hotplug xen_sysctl_cpu_hotplug_t; +DEFINE_XEN_GUEST_HANDLE(xen_sysctl_cpu_hotplug_t); + + struct xen_sysctl { uint32_t cmd; uint32_t interface_version; /* XEN_SYSCTL_INTERFACE_VERSION */ @@ -276,6 +288,7 @@ struct xen_sysctl_getcpuinfo getcpuinfo; struct xen_sysctl_availheap availheap; struct xen_sysctl_get_pmstat get_pmstat; + struct xen_sysctl_cpu_hotplug cpu_hotplug; uint8_t pad[128]; } u; };