WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [IA64] introduce DOM0VP_get_memmap hyperc

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [IA64] introduce DOM0VP_get_memmap hypercall.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 10 Oct 2008 20:00:46 -0700
Delivery-date: Fri, 10 Oct 2008 20:02:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
# Date 1223005795 -32400
# Node ID 89ef37e0f4b8e5fe861eb46dae5bf5724d03d343
# Parent  ba543f51c6f1821f91263c0bd98e176f11ff8838
[IA64] introduce DOM0VP_get_memmap hypercall.

introduce new dom0vp hypercall, DOM0VP_get_memmap,
to get memmap of a given domain without race.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
 xen/arch/ia64/xen/dom0_ops.c   |    6 +++++
 xen/arch/ia64/xen/mm.c         |   49 +++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-ia64/mm.h      |    2 +
 xen/include/public/arch-ia64.h |    5 ++++
 4 files changed, 62 insertions(+)

diff -r ba543f51c6f1 -r 89ef37e0f4b8 xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c      Fri Oct 03 12:49:04 2008 +0900
+++ b/xen/arch/ia64/xen/dom0_ops.c      Fri Oct 03 12:49:55 2008 +0900
@@ -597,6 +597,12 @@ do_dom0vp_op(unsigned long cmd,
     case IA64_DOM0VP_unexpose_foreign_p2m:
         ret = dom0vp_unexpose_foreign_p2m(d, arg0, arg1);
         break;
+    case IA64_DOM0VP_get_memmap: {
+        XEN_GUEST_HANDLE(char) hnd;
+        set_xen_guest_handle(hnd, (char*)arg1);
+        ret = dom0vp_get_memmap((domid_t)arg0, hnd);
+        break;
+    }
     default:
         ret = -1;
                printk("unknown dom0_vp_op 0x%lx\n", cmd);
diff -r ba543f51c6f1 -r 89ef37e0f4b8 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Fri Oct 03 12:49:04 2008 +0900
+++ b/xen/arch/ia64/xen/mm.c    Fri Oct 03 12:49:55 2008 +0900
@@ -2467,6 +2467,55 @@ __dom0vp_add_memdesc(struct domain *targ
         free_domheap_pages(page, order);
     return ret;
 }
+
+unsigned long
+dom0vp_get_memmap(domid_t domid, XEN_GUEST_HANDLE(char) buffer)
+{
+    unsigned long ret = 0;
+    struct domain *targ_d;
+
+    struct page_info *page = NULL;
+    unsigned long order;
+
+    struct xen_ia64_memmap_info *memmap_info;
+    unsigned long num_pages;
+    
+    ret = rcu_lock_target_domain_by_id(domid, &targ_d);
+    if (ret != 0)
+        return ret;
+
+    memmap_lock(targ_d);
+
+    ret = memmap_copy_from(targ_d, &page, &order);
+    if (ret != 0)
+        goto unlock_out;
+
+    memmap_info = page_to_virt(page);
+    num_pages = targ_d->shared_info->arch.memmap_info_num_pages;
+    if ((num_pages << PAGE_SHIFT) - sizeof(*memmap_info) <
+        memmap_info->efi_memmap_size) {
+        ret = -EFAULT;
+        goto unlock_out;
+    }
+    memmap_unlock(targ_d);
+    rcu_unlock_domain(targ_d);
+    
+    if (copy_to_guest(buffer, (char*)memmap_info, sizeof(*memmap_info)) ||
+        copy_to_guest_offset(buffer, sizeof(*memmap_info),
+                             (char*)memmap_info->memdesc,
+                             memmap_info->efi_memmap_size))
+        ret = -EFAULT;
+
+ out:
+    if (page != NULL)
+        free_domheap_pages(page, order);
+    return ret;
+
+ unlock_out:
+    memmap_unlock(targ_d);
+    rcu_unlock_domain(targ_d);
+    goto out;
+}
 #endif
 
 // grant table host mapping
diff -r ba543f51c6f1 -r 89ef37e0f4b8 xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Fri Oct 03 12:49:04 2008 +0900
+++ b/xen/include/asm-ia64/mm.h Fri Oct 03 12:49:55 2008 +0900
@@ -448,6 +448,7 @@ extern void foreign_p2m_destroy(struct d
 extern void foreign_p2m_destroy(struct domain* d);
 extern unsigned long dom0vp_expose_foreign_p2m(struct domain* dest_dom, 
unsigned long dest_gpfn, domid_t domid, XEN_GUEST_HANDLE(char) buffer, unsigned 
long flags);
 extern unsigned long dom0vp_unexpose_foreign_p2m(struct domain* dest_dom, 
unsigned long dest_gpfn, domid_t domid);
+extern unsigned long dom0vp_get_memmap(domid_t domid, XEN_GUEST_HANDLE(char) 
buffer);
 #else
 #define expose_p2m_init()       do { } while (0)
 #define dom0vp_expose_p2m(d, conv_start_gpfn, assign_start_gpfn, expose_size, 
granule_pfn)     (-ENOSYS)
@@ -456,6 +457,7 @@ extern unsigned long dom0vp_unexpose_for
 #define dom0vp_expose_foreign_p2m(dest_dom, dest_gpfn, domid, buffer, flags)   
(-ENOSYS)
 #define dom0vp_unexpose_foreign_p2m(dest_dom, dest_gpfn, domid)        
(-ENOSYS)
 #define __dom0vp_add_memdesc(d, memmap_info, memdesc)  (-ENOSYS)
+#define dom0vp_get_memmap(domid, buffer)               (-ENOSYS)
 #endif
 
 extern volatile unsigned long *mpt_table;
diff -r ba543f51c6f1 -r 89ef37e0f4b8 xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h    Fri Oct 03 12:49:04 2008 +0900
+++ b/xen/include/public/arch-ia64.h    Fri Oct 03 12:49:55 2008 +0900
@@ -453,6 +453,11 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_conte
 /* unexpose the foreign domain's p2m table into privileged domain */
 #define IA64_DOM0VP_unexpose_foreign_p2m        13
 
+/* get memmap_info and memmap. It is possible to map the page directly
+   by foreign page mapping, but there is a race between writer.
+   This hypercall avoids such race. */
+#define IA64_DOM0VP_get_memmap          14
+
 // flags for page assignement to pseudo physical address space
 #define _ASSIGN_readonly                0
 #define ASSIGN_readonly                 (1UL << _ASSIGN_readonly)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [IA64] introduce DOM0VP_get_memmap hypercall., Xen patchbot-unstable <=