aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_misc.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-05-02 15:08:27 +0100
committerKeir Fraser <keir.fraser@citrix.com>2008-05-02 15:08:27 +0100
commit4fe64c6d1b6c1e81901ed9fc3e4498fb578b6d91 (patch)
tree4ea3659b511b1c865a14d1c4f63aa7cf9c40df85 /tools/libxc/xc_misc.c
parent3238785d35b0cef87d619a1bdaa12dcd7032cf14 (diff)
downloadxen-4fe64c6d1b6c1e81901ed9fc3e4498fb578b6d91.tar.gz
xen-4fe64c6d1b6c1e81901ed9fc3e4498fb578b6d91.tar.bz2
xen-4fe64c6d1b6c1e81901ed9fc3e4498fb578b6d91.zip
shadow: track video RAM dirty bits
This adds a new HVM op that enables tracking dirty bits of a range of video RAM. The idea is to optimize just for the most common case (only one guest mapping, with sometimes some temporary other mappings), which permits to keep the overhead on shadow as low as possible. Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_misc.c')
-rw-r--r--tools/libxc/xc_misc.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
index c79e14a563..c68461a496 100644
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -236,6 +236,37 @@ int xc_hvm_set_pci_link_route(
return rc;
}
+int xc_hvm_track_dirty_vram(
+ int xc_handle, domid_t dom,
+ uint64_t first_pfn, uint64_t nr,
+ unsigned long *dirty_bitmap)
+{
+ DECLARE_HYPERCALL;
+ struct xen_hvm_track_dirty_vram arg;
+ int rc;
+
+ hypercall.op = __HYPERVISOR_hvm_op;
+ hypercall.arg[0] = HVMOP_track_dirty_vram;
+ hypercall.arg[1] = (unsigned long)&arg;
+
+ arg.domid = dom;
+ arg.first_pfn = first_pfn;
+ arg.nr = nr;
+ set_xen_guest_handle(arg.dirty_bitmap, (uint8_t *)dirty_bitmap);
+
+ if ( (rc = lock_pages(&arg, sizeof(arg))) != 0 )
+ {
+ PERROR("Could not lock memory");
+ return rc;
+ }
+
+ rc = do_xen_hypercall(xc_handle, &hypercall);
+
+ unlock_pages(&arg, sizeof(arg));
+
+ return rc;
+}
+
void *xc_map_foreign_pages(int xc_handle, uint32_t dom, int prot,
const xen_pfn_t *arr, int num)
{