From: anthony.perard@citrix.com
To: QEMU-devel <qemu-devel@nongnu.org>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
Xen Devel <xen-devel@lists.xensource.com>
Subject: [Qemu-devel] [PATCH V2 2/3] xen: Add xc_domain_add_to_physmap to xen_interface.
Date: Fri, 14 Jan 2011 18:10:12 +0000 [thread overview]
Message-ID: <1295028613-28237-3-git-send-email-anthony.perard@citrix.com> (raw)
In-Reply-To: <1295028613-28237-1-git-send-email-anthony.perard@citrix.com>
From: Anthony PERARD <anthony.perard@citrix.com>
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@citrix.com>
---
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
next prev parent reply other threads:[~2011-01-14 18:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-14 18:10 [Qemu-devel] [PATCH V2 0/3] Xen VGA dirtybit support anthony.perard
2011-01-14 18:10 ` [Qemu-devel] [PATCH V2 1/3] Introduce log_start/log_stop in CPUPhysMemoryClient anthony.perard
2011-01-17 15:54 ` [Qemu-devel] " Jan Kiszka
2011-01-17 18:25 ` Anthony PERARD
2011-01-18 12:25 ` anthony.perard
2011-01-18 18:20 ` Jan Kiszka
2011-01-14 18:10 ` anthony.perard [this message]
2011-01-14 18:10 ` [Qemu-devel] [PATCH V2 3/3] xen: Introduce VGA sync dirty bitmap support anthony.perard
2011-01-17 15:09 ` [Qemu-devel] Re: [Xen-devel] " Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1295028613-28237-3-git-send-email-anthony.perard@citrix.com \
--to=anthony.perard@citrix.com \
--cc=qemu-devel@nongnu.org \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).