]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
WIP xendevicemodel.h
authorIan Campbell <ian.campbell@citrix.com>
Thu, 17 Dec 2015 12:04:45 +0000 (12:04 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 10 Feb 2016 17:09:55 +0000 (17:09 +0000)
This is just the header docs as a starting point for discussion for
some further interfaces.

Implementation notes:

xendevicemodel_create_vram_region:
   - xen-hvm.c:xen_add_to_physmap, only used for vram (explicit check).
        - XENMEM_add_to_physmap + XEN_DOMCTL_pin_mem_cacheattr
        - Is first XENMEM_populate_physmap'd in
          xen-hvm.c:xen_ram_alloc. Some refactoring required.
   - XEN_DOMCTL_pin_mem_cacheattr needs to become a stable API
   - Using XEN_DOMCTL_MEM_CACHEATTR_WB.
   - xc_domain_pin_memory_cacheattr can likely be removed from libxc

xendevicemodel_destroy_vram_region:
   - xen-hvm.c:xen_remove_from_physmap, implicit check via presence of
     physmap, which is only for vram (see xen_add_to_physmap)
        - XENMEM_add_to_physmap
        - Don't need to undo pin_mem_cacheattr?

tools/libs/devicemodel/include/xendevicemodel.h

index d410a3aafdd3ff5b2266b1746acd8b62efe74e37..e21c8d9aca2ac2bb6fc92e522e63f6fa312ebc2b 100644 (file)
@@ -325,6 +325,61 @@ int xendevicemodel_destroy_ioreq_server(xendevicemodel_handle *dm,
 int xendevicemodel_populate_ram(xendevicemodel_handle *dm,
                                 xen_pfn_t start_gpfn, size_t nr_pages);
 
+#if 0
+/*
+ * Populate a region of video RAM starting at vram_start_gpfn by
+ * taking nr_pages of backing memory from backing_start_pgfn onwards.
+ *
+ * The guest physical memory region at backing_start_gpfn must
+ * currently be populated with regular memory (such as that from
+ * xendevicemodel_populate_ram) and will become unmapped as a result
+ * of this call.
+ *
+ * The memory region will be given appropriate cache properties for
+ * video RAM.
+ *
+ * On success *r_vram will be set to an opaque cookie.
+ */
+struct xendevicemodel_vram;
+int xendevicemodel_create_vram_region(xendevicemodel_handle *dm,
+                                      xen_pfn_t vram_start_gpfn,
+                                      xen_pfn_t backing_start_gpfn,
+                                      size_t nr_pages,
+                                      struct xendevicemodel_vram **r_vram);
+
+/*
+ * Undoes (perhaps partially) the effects of a previous
+ * xendevicemodel_populate_vram. Memory which was previously moved
+ * from backing_start_gpfn to vram_start_gpfn will be returned to its
+ * original location.
+ *
+ * The address space at vram_start_gpfn will become unmapped and the
+ * memory at backing_start_gpfn will have cache properties suitable
+ * for standard RAM.
+ *
+ * probably undo the cacheattr, done on populate, which current QEMU
+ * code does not do.
+ *
+ * XXX perhaps have the handle cache a single instance of populate
+ * vram and have this function undo it with no additional arguments
+ * (and have populate EBUSY o/w).
+ */
+int xendevicemodel_destroy_vram(xendevicemodel_handle *dm,
+                                struct xendevicemodel_vram *vram,
+                                xen_pfn_t vram_start_gpfn,
+                                xen_pfn_t backing_start_gpfn,
+                                size_t nr_pages);
+
+/* XXX only one at a time (globally, not even per vram), must be a
+ * sub-region of vram */
+/*
+ * Useful to have a start, stop, sync calls, with a single hyercall buffer? */
+int xendevicemodel_vram_dirtybitmap(xendevicemodel_handle *dm,
+                                    struct xendevicemodel_vram *vram,
+                                    start, length);
+
+#endif
+
 #endif
 /*
  * Local variables: