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@bitdefender.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
This commit is contained in:
Petre Pircalabu authored and Wei Liu committed 2019-03-12 12:57:13 +00:00
1 parent 91c3e3dc91
commit d48e183607
5 files changed
+41 -3

No files matched your search

+5
View File
@@ -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.
*
+17 -1
View File
@@ -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
+1
View File
@@ -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:
+10 -1
View File
@@ -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;
+8 -1
View File
@@ -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;
};
/*
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.