ia64/xen-unstable
changeset 18534:df6f9fe48f11
libxc: Wrapper functions for cpu online/offline
Signed-off-by: Shan Haitao <haitao.shan@intel.com>
Signed-off-by: Shan Haitao <haitao.shan@intel.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Mon Sep 22 16:10:25 2008 +0100 (2008-09-22) |
parents | 0c8d2e44126d |
children | fd3f54eb23e1 |
files | tools/libxc/Makefile tools/libxc/xc_cpu_hotplug.c tools/libxc/xenctrl.h |
line diff
1.1 --- a/tools/libxc/Makefile Mon Sep 22 16:07:04 2008 +0100 1.2 +++ b/tools/libxc/Makefile Mon Sep 22 16:10:25 2008 +0100 1.3 @@ -19,6 +19,7 @@ CTRL_SRCS-y += xc_sedf.c 1.4 CTRL_SRCS-y += xc_csched.c 1.5 CTRL_SRCS-y += xc_tbuf.c 1.6 CTRL_SRCS-y += xc_pm.c 1.7 +CTRL_SRCS-y += xc_cpu_hotplug.c 1.8 CTRL_SRCS-y += xc_resume.c 1.9 CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c 1.10 CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/tools/libxc/xc_cpu_hotplug.c Mon Sep 22 16:10:25 2008 +0100 2.3 @@ -0,0 +1,53 @@ 2.4 +/****************************************************************************** 2.5 + * xc_cpu_hotplug.c - Libxc API for Xen Physical CPU hotplug Management 2.6 + * 2.7 + * Copyright (c) 2008, Shan Haitao <haitao.shan@intel.com> 2.8 + * 2.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy 2.10 + * of this software and associated documentation files (the "Software"), to 2.11 + * deal in the Software without restriction, including without limitation the 2.12 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 2.13 + * sell copies of the Software, and to permit persons to whom the Software is 2.14 + * furnished to do so, subject to the following conditions: 2.15 + * 2.16 + * The above copyright notice and this permission notice shall be included in 2.17 + * all copies or substantial portions of the Software. 2.18 + * 2.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 2.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 2.24 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 2.25 + * DEALINGS IN THE SOFTWARE. 2.26 + * 2.27 + */ 2.28 + 2.29 +#include "xc_private.h" 2.30 + 2.31 +int xc_cpu_online(int xc_handle, int cpu) 2.32 +{ 2.33 + DECLARE_SYSCTL; 2.34 + int ret; 2.35 + 2.36 + sysctl.cmd = XEN_SYSCTL_cpu_hotplug; 2.37 + sysctl.u.cpu_hotplug.cpu = cpu; 2.38 + sysctl.u.cpu_hotplug.op = XEN_SYSCTL_CPU_HOTPLUG_ONLINE; 2.39 + ret = xc_sysctl(xc_handle, &sysctl); 2.40 + 2.41 + return ret; 2.42 +} 2.43 + 2.44 +int xc_cpu_offline(int xc_handle, int cpu) 2.45 +{ 2.46 + DECLARE_SYSCTL; 2.47 + int ret; 2.48 + 2.49 + sysctl.cmd = XEN_SYSCTL_cpu_hotplug; 2.50 + sysctl.u.cpu_hotplug.cpu = cpu; 2.51 + sysctl.u.cpu_hotplug.op = XEN_SYSCTL_CPU_HOTPLUG_OFFLINE; 2.52 + ret = xc_sysctl(xc_handle, &sysctl); 2.53 + 2.54 + return ret; 2.55 +} 2.56 +
3.1 --- a/tools/libxc/xenctrl.h Mon Sep 22 16:07:04 2008 +0100 3.2 +++ b/tools/libxc/xenctrl.h Mon Sep 22 16:10:25 2008 +0100 3.3 @@ -1156,4 +1156,6 @@ int xc_pm_get_max_cx(int xc_handle, int 3.4 int xc_pm_get_cxstat(int xc_handle, int cpuid, struct xc_cx_stat *cxpt); 3.5 int xc_pm_reset_cxstat(int xc_handle, int cpuid); 3.6 3.7 +int xc_cpu_online(int xc_handle, int cpu); 3.8 +int xc_cpu_offline(int xc_handle, int cpu); 3.9 #endif /* XENCTRL_H */