From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
This function will be used to support sync dirty bitmap.
This come with a check against every Xen release, and special
implementation for Xen version that doesn't have this specific call.
This function will not be usable with Xen 3.3 because the behavior is
different.
Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
configure | 29 ++++++++++++++++++++++++++++-
hw/xen_interfaces.c | 31 +++++++++++++++++++++++++++++++
hw/xen_interfaces.h | 5 +++++
hw/xen_redirect.h | 1 +
4 files changed, 65 insertions(+), 1 deletions(-)
diff --git a/configure b/configure
index f3c524e..642d344 100755
--- a/configure
+++ b/configure
@@ -1154,6 +1154,7 @@ int main(void) {
xs_daemon_open();
xc_interface_open(0, 0, 0);
xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
+ xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
xc_gnttab_open(xc);
return 0;
}
@@ -1173,10 +1174,14 @@ EOF
# error HVM_MAX_VCPUS not defined
#endif
int main(void) {
+ struct xen_add_to_physmap xatp = {
+ .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
+ };
xs_daemon_open();
xc_interface_open();
xc_gnttab_open();
xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
+ xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
return 0;
}
EOF
@@ -1185,7 +1190,29 @@ EOF
xen_ctrl_version=400
xen=yes
- # Xen 3.3.0, 3.4.0
+ # Xen 3.4.0
+ elif (
+ cat > $TMPC <<EOF
+#include <xenctrl.h>
+#include <xs.h>
+int main(void) {
+ struct xen_add_to_physmap xatp = {
+ .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
+ };
+ xs_daemon_open();
+ xc_interface_open();
+ xc_gnttab_open();
+ xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
+ xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
+ return 0;
+}
+EOF
+ compile_prog "" "$xen_libs"
+ ) ; then
+ xen_ctrl_version=340
+ xen=yes
+
+ # Xen 3.3.0
elif (
cat > $TMPC <<EOF
#include <xenctrl.h>
diff --git a/hw/xen_interfaces.c b/hw/xen_interfaces.c
index 129e8b2..4d9862b 100644
--- a/hw/xen_interfaces.c
+++ b/hw/xen_interfaces.c
@@ -124,6 +124,20 @@ static void *map_foreign_batch(int xc_handle, uint32_t
dom, int prot,
return xc_map_foreign_batch(xc_handle, dom, prot, (xen_pfn_t*)arr, num);
}
+static int domain_add_to_physmap(qemu_xc_interface xc_handle, uint32_t domid,
+ unsigned int space, unsigned long idx,
+ xen_pfn_t gpfn)
+{
+ struct xen_add_to_physmap xatp = {
+ .domid = domid,
+ .space = space,
+ .idx = idx,
+ .gpfn = gpfn,
+ };
+
+ return xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp);
+}
+
struct XenIfOps xc_xen = {
.interface_open = interface_open,
.interface_close = xc_interface_close,
@@ -131,6 +145,7 @@ struct XenIfOps xc_xen = {
.map_foreign_pages = xc_map_foreign_pages,
.map_foreign_bulk = map_foreign_batch,
.domain_populate_physmap_exact = xc_domain_memory_populate_physmap,
+ .domain_add_to_physmap = domain_add_to_physmap,
};
# elif CONFIG_XEN_CTRL_INTERFACE_VERSION < 410
@@ -141,6 +156,20 @@ static qemu_xc_interface interface_open(xentoollog_logger
*logger,
return xc_interface_open();
}
+static int domain_add_to_physmap(qemu_xc_interface xc_handle, uint32_t domid,
+ unsigned int space, unsigned long idx,
+ xen_pfn_t gpfn)
+{
+ struct xen_add_to_physmap xatp = {
+ .domid = domid,
+ .space = space,
+ .idx = idx,
+ .gpfn = gpfn,
+ };
+
+ return xc_memory_op(xc_handle, XENMEM_add_to_physmap, &xatp);
+}
+
struct XenIfOps xc_xen = {
.interface_open = interface_open,
.interface_close = xc_interface_close,
@@ -148,6 +177,7 @@ struct XenIfOps xc_xen = {
.map_foreign_pages = xc_map_foreign_pages,
.map_foreign_bulk = xc_map_foreign_bulk,
.domain_populate_physmap_exact = xc_domain_memory_populate_physmap,
+ .domain_add_to_physmap = domain_add_to_physmap,
};
# else /* CONFIG_XEN_CTRL_INTERFACE_VERSION >= 410 */
@@ -158,6 +188,7 @@ struct XenIfOps xc_xen = {
.map_foreign_pages = xc_map_foreign_pages,
.map_foreign_bulk = xc_map_foreign_bulk,
.domain_populate_physmap_exact = xc_domain_populate_physmap_exact,
+ .domain_add_to_physmap = xc_domain_add_to_physmap,
};
# endif
diff --git a/hw/xen_interfaces.h b/hw/xen_interfaces.h
index 0f698dc..be38345 100644
--- a/hw/xen_interfaces.h
+++ b/hw/xen_interfaces.h
@@ -108,6 +108,11 @@ struct XenIfOps {
unsigned int extent_order,
unsigned int mem_flags,
xen_pfn_t *extent_start);
+ int (*domain_add_to_physmap)(qemu_xc_interface xc_handle,
+ uint32_t domid,
+ unsigned int space,
+ unsigned long idx,
+ xen_pfn_t gpfn);
};
extern struct XenIfOps xc;
diff --git a/hw/xen_redirect.h b/hw/xen_redirect.h
index 7cd6492..1b7c603 100644
--- a/hw/xen_redirect.h
+++ b/hw/xen_redirect.h
@@ -30,6 +30,7 @@
#define xc_map_foreign_bulk xc.map_foreign_bulk
#define xc_domain_populate_physmap_exact \
xc.domain_populate_physmap_exact
+#define xc_domain_add_to_physmap xc.domain_add_to_physmap
/* xenstore interface */
#define xs_daemon_open xs.daemon_open
--
1.7.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|