[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2] vm_event: Add a new opcode to get VM_EVENT_INTERFACE_VERSION
On Thu, Feb 14, 2019 at 7:18 AM Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx> wrote: > > 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: Tamas K Lengyel <tamas@xxxxxxxxxxxxx> > > --- > Changes from v1: > - Return -ESRCH instead of -EINVAL if DOMID_INVALID if given as > parameter to XEN_DOMCTL_vm_event_op and op is not > XEN_VM_EVENT_GET_VERSION. Also the log message was removed. > - Replace XEN_VM_EVENT_GET_INTERFACE_VERSION with > XEN_VM_EVENT_GET_VERSION. > - Replace the "get_interface_version" wrapper struct with a single > "version" field. > - Rename the libxc wrapper to xc_vm_event_get_version. > --- > 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 31cdda7..a3628e5 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 8674607..a97c615 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 d08b627..bade9a6 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 26cfa2c..19c983c 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 7e1cf21..19486d5 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; > }; > > /* > -- > 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |