diff options
author | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-08-25 18:39:10 +0100 |
---|---|---|
committer | kfraser@localhost.localdomain <kfraser@localhost.localdomain> | 2006-08-25 18:39:10 +0100 |
commit | 1df421476a141955f4f04b7ad0fbaf73e57c8358 (patch) | |
tree | 6500dea6303559d54abd1b0ff49db083c463d0d8 /tools/libxc/xc_tbuf.c | |
parent | e76cb15dcecf1b78ecb1365ea0f955a97c5d2dd1 (diff) | |
download | xen-1df421476a141955f4f04b7ad0fbaf73e57c8358.tar.gz xen-1df421476a141955f4f04b7ad0fbaf73e57c8358.tar.bz2 xen-1df421476a141955f4f04b7ad0fbaf73e57c8358.zip |
Replace dom0_ops hypercall with three new hypercalls:
1. platform_op -- used by dom0 kernel to perform actions on the
hardware platform (e.g., MTRR access, microcode update, platform
quirks, ...)
2. domctl -- used by management tools to control a specified domain
3. sysctl -- used by management tools for system-wide actions
Benefits include more sensible factoring of actions to
hypercalls. Also allows tool compatibility to be tracked separately
from the dom0 kernel. The assumption is that it will be easier to
replace libxenctrl, libxenguest and Xen as a matched set if the
dom0 kernel does not need to be replaced too (e.g., because that
would require vendor revalidation).
From here on we hope to maintain dom0 kernel compatibility. This
promise is not extended to tool compatibility beyond the existing
guarantee that compatibility will not be broken within a three-level
stable release [3.0.2, 3.0.3, etc.].
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/libxc/xc_tbuf.c')
-rw-r--r-- | tools/libxc/xc_tbuf.c | 88 |
1 files changed, 51 insertions, 37 deletions
diff --git a/tools/libxc/xc_tbuf.c b/tools/libxc/xc_tbuf.c index 3160da1942..13614f0f8a 100644 --- a/tools/libxc/xc_tbuf.c +++ b/tools/libxc/xc_tbuf.c @@ -18,49 +18,49 @@ static int tbuf_enable(int xc_handle, int enable) { - DECLARE_DOM0_OP; + DECLARE_SYSCTL; - op.cmd = DOM0_TBUFCONTROL; - op.interface_version = DOM0_INTERFACE_VERSION; + sysctl.cmd = XEN_SYSCTL_tbuf_op; + sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION; if (enable) - op.u.tbufcontrol.op = DOM0_TBUF_ENABLE; + sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_enable; else - op.u.tbufcontrol.op = DOM0_TBUF_DISABLE; + sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_disable; - return xc_dom0_op(xc_handle, &op); + return xc_sysctl(xc_handle, &sysctl); } int xc_tbuf_set_size(int xc_handle, unsigned long size) { - DECLARE_DOM0_OP; + DECLARE_SYSCTL; - op.cmd = DOM0_TBUFCONTROL; - op.interface_version = DOM0_INTERFACE_VERSION; - op.u.tbufcontrol.op = DOM0_TBUF_SET_SIZE; - op.u.tbufcontrol.size = size; + sysctl.cmd = XEN_SYSCTL_tbuf_op; + sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION; + sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_set_size; + sysctl.u.tbuf_op.size = size; - return xc_dom0_op(xc_handle, &op); + return xc_sysctl(xc_handle, &sysctl); } int xc_tbuf_get_size(int xc_handle, unsigned long *size) { int rc; - DECLARE_DOM0_OP; + DECLARE_SYSCTL; - op.cmd = DOM0_TBUFCONTROL; - op.interface_version = DOM0_INTERFACE_VERSION; - op.u.tbufcontrol.op = DOM0_TBUF_GET_INFO; + sysctl.cmd = XEN_SYSCTL_tbuf_op; + sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION; + sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_get_info; - rc = xc_dom0_op(xc_handle, &op); + rc = xc_sysctl(xc_handle, &sysctl); if (rc == 0) - *size = op.u.tbufcontrol.size; + *size = sysctl.u.tbuf_op.size; return rc; } int xc_tbuf_enable(int xc_handle, size_t cnt, unsigned long *mfn, unsigned long *size) { - DECLARE_DOM0_OP; + DECLARE_SYSCTL; int rc; /* @@ -73,15 +73,15 @@ int xc_tbuf_enable(int xc_handle, size_t cnt, unsigned long *mfn, if ( tbuf_enable(xc_handle, 1) != 0 ) return -1; - op.cmd = DOM0_TBUFCONTROL; - op.interface_version = DOM0_INTERFACE_VERSION; - op.u.tbufcontrol.op = DOM0_TBUF_GET_INFO; + sysctl.cmd = XEN_SYSCTL_tbuf_op; + sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION; + sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_get_info; - rc = xc_dom0_op(xc_handle, &op); + rc = xc_sysctl(xc_handle, &sysctl); if ( rc == 0 ) { - *size = op.u.tbufcontrol.size; - *mfn = op.u.tbufcontrol.buffer_mfn; + *size = sysctl.u.tbuf_op.size; + *mfn = sysctl.u.tbuf_op.buffer_mfn; } return 0; @@ -94,25 +94,39 @@ int xc_tbuf_disable(int xc_handle) int xc_tbuf_set_cpu_mask(int xc_handle, uint32_t mask) { - DECLARE_DOM0_OP; + DECLARE_SYSCTL; + int ret = -1; - op.cmd = DOM0_TBUFCONTROL; - op.interface_version = DOM0_INTERFACE_VERSION; - op.u.tbufcontrol.op = DOM0_TBUF_SET_CPU_MASK; - op.u.tbufcontrol.cpu_mask = mask; + sysctl.cmd = XEN_SYSCTL_tbuf_op; + sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION; + sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_set_cpu_mask; - return do_dom0_op(xc_handle, &op); + set_xen_guest_handle(sysctl.u.tbuf_op.cpu_mask.bitmap, (uint8_t *)&mask); + sysctl.u.tbuf_op.cpu_mask.nr_cpus = sizeof(mask) * 8; + + if ( mlock(&mask, sizeof(mask)) != 0 ) + { + PERROR("Could not lock memory for Xen hypercall"); + goto out; + } + + ret = do_sysctl(xc_handle, &sysctl); + + safe_munlock(&mask, sizeof(mask)); + + out: + return ret; } int xc_tbuf_set_evt_mask(int xc_handle, uint32_t mask) { - DECLARE_DOM0_OP; + DECLARE_SYSCTL; - op.cmd = DOM0_TBUFCONTROL; - op.interface_version = DOM0_INTERFACE_VERSION; - op.u.tbufcontrol.op = DOM0_TBUF_SET_EVT_MASK; - op.u.tbufcontrol.evt_mask = mask; + sysctl.cmd = XEN_SYSCTL_tbuf_op; + sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION; + sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_set_evt_mask; + sysctl.u.tbuf_op.evt_mask = mask; - return do_dom0_op(xc_handle, &op); + return do_sysctl(xc_handle, &sysctl); } |