aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/sysctl.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-09-22 16:07:04 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-09-22 16:07:04 +0100
commit49571f74cbb03e101dc5d2bf96c46f2c23630f13 (patch)
tree9cec4d3f7e05bcffa55997aa051f7fa877d72821 /xen/arch/x86/sysctl.c
parent8d71a294c15ab64df95b48246d63b5060635f394 (diff)
downloadxen-49571f74cbb03e101dc5d2bf96c46f2c23630f13.tar.gz
xen-49571f74cbb03e101dc5d2bf96c46f2c23630f13.tar.bz2
xen-49571f74cbb03e101dc5d2bf96c46f2c23630f13.zip
x86: Add sysctl for cpu online/offline
Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Diffstat (limited to 'xen/arch/x86/sysctl.c')
-rw-r--r--xen/arch/x86/sysctl.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index 2fc125d4b9..dbb54ede09 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -29,6 +29,12 @@
#define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
+static long cpu_down_helper(void *data)
+{
+ int cpu = (unsigned long)data;
+ return cpu_down(cpu);
+}
+
long arch_do_sysctl(
struct xen_sysctl *sysctl, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
{
@@ -92,6 +98,25 @@ long arch_do_sysctl(
}
break;
+ case XEN_SYSCTL_cpu_hotplug:
+ {
+ unsigned int cpu = sysctl->u.cpu_hotplug.cpu;
+
+ switch ( sysctl->u.cpu_hotplug.op )
+ {
+ case XEN_SYSCTL_CPU_HOTPLUG_ONLINE:
+ ret = cpu_up(cpu);
+ break;
+ case XEN_SYSCTL_CPU_HOTPLUG_OFFLINE:
+ ret = continue_hypercall_on_cpu(
+ 0, cpu_down_helper, (void *)(unsigned long)cpu);
+ break;
+ default:
+ ret = -EINVAL;
+ break;
+ }
+ }
+ break;
default:
ret = -ENOSYS;