[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] vm_event: Add a new opcode to get VM_EVENT_INTERFACE_VERSION
commit d48e1836074cec0d2b7dd11f7ffce716bdf7cbcb Author: Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx> AuthorDate: Thu Feb 14 16:18:11 2019 +0200 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Tue Mar 12 12:57:13 2019 +0000 vm_event: Add a new opcode to get VM_EVENT_INTERFACE_VERSION Currently, the VM_EVENT_INTERFACE_VERSION is determined at runtime, by inspecting the corresponding field in a vm_event_request. This helper opcode will query the hypervisor supported version before the vm_event related structures and layout are set-up. Signed-off-by: Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> Acked-by: Tamas K Lengyel <tamas@xxxxxxxxxxxxx> --- tools/libxc/include/xenctrl.h | 5 +++++ tools/libxc/xc_vm_event.c | 18 +++++++++++++++++- xen/common/domctl.c | 1 + xen/common/vm_event.c | 11 ++++++++++- xen/include/public/domctl.h | 9 ++++++++- 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 31cdda76c6..a3628e56bb 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -2003,6 +2003,11 @@ int xc_set_mem_access_multi(xc_interface *xch, uint32_t domain_id, int xc_get_mem_access(xc_interface *xch, uint32_t domain_id, uint64_t pfn, xenmem_access_t *access); +/* + * Returns the VM_EVENT_INTERFACE version. + */ +int xc_vm_event_get_version(xc_interface *xch); + /*** * Monitor control operations. * diff --git a/tools/libxc/xc_vm_event.c b/tools/libxc/xc_vm_event.c index 8674607895..a97c615b18 100644 --- a/tools/libxc/xc_vm_event.c +++ b/tools/libxc/xc_vm_event.c @@ -35,7 +35,7 @@ int xc_vm_event_control(xc_interface *xch, uint32_t domain_id, unsigned int op, rc = do_domctl(xch, &domctl); if ( !rc && port ) - *port = domctl.u.vm_event_op.port; + *port = domctl.u.vm_event_op.u.enable.port; return rc; } @@ -156,6 +156,22 @@ void *xc_vm_event_enable(xc_interface *xch, uint32_t domain_id, int param, return ring_page; } +int xc_vm_event_get_version(xc_interface *xch) +{ + DECLARE_DOMCTL; + int rc; + + domctl.cmd = XEN_DOMCTL_vm_event_op; + domctl.domain = DOMID_INVALID; + domctl.u.vm_event_op.op = XEN_VM_EVENT_GET_VERSION; + domctl.u.vm_event_op.mode = XEN_DOMCTL_VM_EVENT_OP_MONITOR; + + rc = do_domctl(xch, &domctl); + if ( !rc ) + rc = domctl.u.vm_event_op.u.version; + return rc; +} + /* * Local variables: * mode: C diff --git a/xen/common/domctl.c b/xen/common/domctl.c index d08b6274e2..bade9a63b1 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -392,6 +392,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) switch ( op->cmd ) { case XEN_DOMCTL_test_assign_device: + case XEN_DOMCTL_vm_event_op: if ( op->domain == DOMID_INVALID ) { case XEN_DOMCTL_createdomain: diff --git a/xen/common/vm_event.c b/xen/common/vm_event.c index 26cfa2c605..19c983c035 100644 --- a/xen/common/vm_event.c +++ b/xen/common/vm_event.c @@ -88,7 +88,7 @@ static int vm_event_enable( if ( rc < 0 ) goto err; - (*ved)->xen_port = vec->port = rc; + (*ved)->xen_port = vec->u.enable.port = rc; /* Prepare ring buffer */ FRONT_RING_INIT(&(*ved)->front_ring, @@ -592,6 +592,15 @@ int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec, { int rc; + if ( vec->op == XEN_VM_EVENT_GET_VERSION ) + { + vec->u.version = VM_EVENT_INTERFACE_VERSION; + return 0; + } + + if ( unlikely(d == NULL) ) + return -ESRCH; + rc = xsm_vm_event_control(XSM_PRIV, d, vec->mode, vec->op); if ( rc ) return rc; diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index 7e1cf21075..19486d5e32 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -781,6 +781,7 @@ struct xen_domctl_gdbsx_domstatus { #define XEN_VM_EVENT_ENABLE 0 #define XEN_VM_EVENT_DISABLE 1 #define XEN_VM_EVENT_RESUME 2 +#define XEN_VM_EVENT_GET_VERSION 3 /* * Domain memory paging @@ -843,7 +844,13 @@ struct xen_domctl_vm_event_op { uint32_t op; /* XEN_VM_EVENT_* */ uint32_t mode; /* XEN_DOMCTL_VM_EVENT_OP_* */ - uint32_t port; /* OUT: event channel for ring */ + union { + struct { + uint32_t port; /* OUT: event channel for ring */ + } enable; + + uint32_t version; + } u; }; /* -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |