[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2/6] libxc: xc_domain_memory_mapping, handle cacheability



Add an additional parameter to xc_domain_memory_mapping to pass
cacheability information. The same parameter values are the same for the
XEN_DOMCTL_memory_mapping hypercall (0 is device memory, 1 is normal
memory). Pass CACHEABILITY_DEVMEM by default -- no changes in behavior.

Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx>
CC: ian.jackson@xxxxxxxxxxxxx
CC: wei.liu2@xxxxxxxxxx
---
 tools/libxc/include/xenctrl.h | 3 ++-
 tools/libxc/xc_domain.c       | 6 ++++--
 tools/libxl/libxl_create.c    | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 97ae965..3b89b05 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1719,7 +1719,8 @@ int xc_domain_memory_mapping(xc_interface *xch,
                              unsigned long first_gfn,
                              unsigned long first_mfn,
                              unsigned long nr_mfns,
-                             uint32_t add_mapping);
+                             uint32_t add_mapping,
+                             uint32_t cache_policy);
 
 int xc_domain_ioport_mapping(xc_interface *xch,
                              uint32_t domid,
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index 05d771f..f22d176 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -2048,7 +2048,8 @@ int xc_domain_memory_mapping(
     unsigned long first_gfn,
     unsigned long first_mfn,
     unsigned long nr_mfns,
-    uint32_t add_mapping)
+    uint32_t add_mapping,
+    uint32_t cache_policy)
 {
     DECLARE_DOMCTL;
     xc_dominfo_t info;
@@ -2070,6 +2071,7 @@ int xc_domain_memory_mapping(
     domctl.cmd = XEN_DOMCTL_memory_mapping;
     domctl.domain = domid;
     domctl.u.memory_mapping.add_mapping = add_mapping;
+    domctl.u.memory_mapping.cache_policy = cache_policy;
     max_batch_sz = nr_mfns;
     do
     {
@@ -2106,7 +2108,7 @@ int xc_domain_memory_mapping(
      */
     if ( ret && add_mapping != DPCI_REMOVE_MAPPING )
         xc_domain_memory_mapping(xch, domid, first_gfn, first_mfn, nr_mfns,
-                                 DPCI_REMOVE_MAPPING);
+                                 DPCI_REMOVE_MAPPING, CACHEABILITY_DEVMEM);
 
     /* We might get E2BIG so many times that we never advance. */
     if ( !done && !ret )
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index fa57334..9a9b953 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -1348,7 +1348,7 @@ static void domcreate_launch_dm(libxl__egc *egc, 
libxl__multidev *multidev,
         }
         ret = xc_domain_memory_mapping(CTX->xch, domid,
                                        io->gfn, io->start,
-                                       io->number, 1);
+                                       io->number, 1, CACHEABILITY_DEVMEM);
         if (ret < 0) {
             LOGED(ERROR, domid,
                   "failed to map to domain iomem range %"PRIx64"-%"PRIx64
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.