Thus far mem_access and mem_sharing memops had been able to signal
to Xen to start pulling responses off the corresponding rings. In this patch
we retire these memops and add them to the option to the vm_event_op domctl.
The vm_event_op domctl suboptions are the same for each ring thus we
consolidate them into XEN_VM_EVENT_ENABLE/DISABLE/RESUME.
As part of this patch in libxc we also rename the mem_access_enable/disable
functions to monitor_enable/disable and move them into xc_monitor.c.
Signed-off-by: Tamas K Lengyel tamas.leng...@zentific.com
Acked-by: Wei Liu wei.l...@citrix.com
---
v6: Style fixes
---
tools/libxc/include/xenctrl.h | 22 +++---
tools/libxc/xc_mem_access.c | 25 -
tools/libxc/xc_mem_paging.c | 12 ++--
tools/libxc/xc_memshr.c | 15 ++-
tools/libxc/xc_monitor.c| 22 ++
tools/libxc/xc_vm_event.c | 6 +++---
tools/tests/xen-access/xen-access.c | 10 +-
xen/arch/x86/mm/mem_sharing.c | 12
xen/common/mem_access.c | 9 -
xen/common/vm_event.c | 33 +++--
xen/include/public/domctl.h | 32 +++-
xen/include/public/memory.h | 20 +---
12 files changed, 108 insertions(+), 110 deletions(-)
diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 4d9c610..45651c8 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -2270,6 +2270,7 @@ int xc_tmem_restore_extra(xc_interface *xch, int dom, int
fd);
*/
int xc_mem_paging_enable(xc_interface *xch, domid_t domain_id, uint32_t *port);
int xc_mem_paging_disable(xc_interface *xch, domid_t domain_id);
+int xc_mem_paging_resume(xc_interface *xch, domid_t domain_id);
int xc_mem_paging_nominate(xc_interface *xch, domid_t domain_id,
unsigned long gfn);
int xc_mem_paging_evict(xc_interface *xch, domid_t domain_id, unsigned long
gfn);
@@ -2283,17 +2284,6 @@ int xc_mem_paging_load(xc_interface *xch, domid_t
domain_id,
*/
/*
- * Enables mem_access and returns the mapped ring page.
- * Will return NULL on error.
- * Caller has to unmap this page when done.
- */
-void *xc_mem_access_enable(xc_interface *xch, domid_t domain_id, uint32_t
*port);
-void *xc_mem_access_enable_introspection(xc_interface *xch, domid_t domain_id,
- uint32_t *port);
-int xc_mem_access_disable(xc_interface *xch, domid_t domain_id);
-int xc_mem_access_resume(xc_interface *xch, domid_t domain_id);
-
-/*
* Set a range of memory to a specific access.
* Allowed types are XENMEM_access_default, XENMEM_access_n, any combination of
* XENMEM_access_ + (rwx), and XENMEM_access_rx2rw
@@ -2321,7 +2311,17 @@ int xc_mem_access_disable_emulate(xc_interface *xch,
domid_t domain_id);
/***
* Monitor control operations.
+ *
+ * Enables the VM event monitor ring and returns the mapped ring page.
+ * This ring is used to deliver mem_access events, as well a set of additional
+ * events that can be enabled with the xc_monitor_* functions.
+ *
+ * Will return NULL on error.
+ * Caller has to unmap this page when done.
*/
+void *xc_monitor_enable(xc_interface *xch, domid_t domain_id, uint32_t *port);
+int xc_monitor_disable(xc_interface *xch, domid_t domain_id);
+int xc_monitor_resume(xc_interface *xch, domid_t domain_id);
int xc_monitor_mov_to_cr0(xc_interface *xch, domid_t domain_id, bool enable,
bool sync, bool onchangeonly);
int xc_monitor_mov_to_cr3(xc_interface *xch, domid_t domain_id, bool enable,
diff --git a/tools/libxc/xc_mem_access.c b/tools/libxc/xc_mem_access.c
index f27bc44..5cfa611 100644
--- a/tools/libxc/xc_mem_access.c
+++ b/tools/libxc/xc_mem_access.c
@@ -24,31 +24,6 @@
#include xc_private.h
#include xen/memory.h
-void *xc_mem_access_enable(xc_interface *xch, domid_t domain_id, uint32_t
*port)
-{
-return xc_vm_event_enable(xch, domain_id, HVM_PARAM_MONITOR_RING_PFN,
- port);
-}
-
-int xc_mem_access_disable(xc_interface *xch, domid_t domain_id)
-{
-return xc_vm_event_control(xch, domain_id,
- XEN_VM_EVENT_MONITOR_DISABLE,
- XEN_DOMCTL_VM_EVENT_OP_MONITOR,
- NULL);
-}
-
-int xc_mem_access_resume(xc_interface *xch, domid_t domain_id)
-{
-xen_mem_access_op_t mao =
-{
-.op= XENMEM_access_op_resume,
-.domid = domain_id
-};
-
-return do_memory_op(xch, XENMEM_access_op, mao, sizeof(mao));
-}
-
int xc_set_mem_access(xc_interface *xch,
domid_t domain_id,
xenmem_access_t access,
diff --git a/tools/libxc/xc_mem_paging.c b/tools/libxc/xc_mem_paging.c
index 9c311d9..4aa48d6 100644
--- a/tools/libxc/xc_mem_paging.c
+++