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

Re: [Xen-devel] [PATCH 3/4] x86: Add map_domain_pages_global



Hi,

On 09/13/2018 04:01 PM, Petre Pircalabu wrote:
Create a single mapping for multiple domain pages.

Signed-off-by: Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx>
---
  tools/libxc/xc_vm_event.c     |  2 +-
  xen/arch/x86/domain_page.c    | 22 ++++++++++++++++++++++
  xen/include/xen/domain_page.h |  9 +++++++++
  3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/tools/libxc/xc_vm_event.c b/tools/libxc/xc_vm_event.c
index dd34cec..de37ca5 100644
--- a/tools/libxc/xc_vm_event.c
+++ b/tools/libxc/xc_vm_event.c
@@ -74,7 +74,7 @@ static int xc_vm_event_domctl(int type, unsigned int *param)
      {
      case XEN_VM_EVENT_TYPE_PAGING:
          *param = XEN_DOMCTL_VM_EVENT_OP_PAGING;
-       break;
+        break;
case XEN_VM_EVENT_TYPE_MONITOR:
          *param = XEN_DOMCTL_VM_EVENT_OP_MONITOR;
diff --git a/xen/arch/x86/domain_page.c b/xen/arch/x86/domain_page.c
index 4a07cfb..0d23e52 100644
--- a/xen/arch/x86/domain_page.c
+++ b/xen/arch/x86/domain_page.c
@@ -317,6 +317,28 @@ void *map_domain_page_global(mfn_t mfn)
      return vmap(&mfn, 1);
  }
+void *map_domain_pages_global(const mfn_t *mfn, unsigned int nr)
+{
+    ASSERT(!in_irq() &&
+           ((system_state >= SYS_STATE_boot &&
+             system_state < SYS_STATE_active) ||
+            local_irq_is_enabled()));
+
+    return vmap(mfn, nr);
+}
+
+void *__map_domain_pages_global(const struct page_info *pg, unsigned int nr)
+{
+    mfn_t mfn[nr];
+    int i;
+    struct page_info *cur_pg = (struct page_info *)&pg[0];
+
+    for (i = 0; i < nr; i++)
+        mfn[i] = page_to_mfn(cur_pg++);
+
+    return map_domain_pages_global(mfn, nr);
+}
+
  void unmap_domain_page_global(const void *ptr)
  {
      unsigned long va = (unsigned long)ptr;
diff --git a/xen/include/xen/domain_page.h b/xen/include/xen/domain_page.h
index 32669a3..76422f9 100644
--- a/xen/include/xen/domain_page.h
+++ b/xen/include/xen/domain_page.h
@@ -42,6 +42,7 @@ mfn_t domain_page_map_to_mfn(const void *va);
   * mappings can also be unmapped from any context.
   */
  void *map_domain_page_global(mfn_t mfn);
+void *map_domain_pages_global(const mfn_t *mfn, unsigned int nr);
  void unmap_domain_page_global(const void *va);
#define __map_domain_page(pg) map_domain_page(page_to_mfn(pg))
@@ -51,6 +52,8 @@ static inline void *__map_domain_page_global(const struct 
page_info *pg)
      return map_domain_page_global(page_to_mfn(pg));
  }
+void *__map_domain_pages_global(const struct page_info *pg, unsigned int nr);

This would require an implementation for Arm, assuming this is going ahead.

+
  #else /* !CONFIG_DOMAIN_PAGE */
#define map_domain_page(mfn) __mfn_to_virt(mfn_x(mfn))
@@ -68,6 +71,12 @@ static inline void *__map_domain_page_global(const struct 
page_info *pg)
      return page_to_virt(pg);
  }
+static inline void *__map_domain_pages_global(const struct page_info *pg,
+                                              unsigned int nr)
+{
+    return __map_domain_page_global(pg);
+}
+
  static inline void unmap_domain_page_global(const void *va) {};
#endif /* !CONFIG_DOMAIN_PAGE */


Cheers,

--
Julien Grall

_______________________________________________
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®.