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

[Xen-ia64-devel] [PATCH 7/7] add IA64_dom0VP_add_memdesc hypercall



[IA64] add IA64_dom0VP_add_memdesc hypercall.

This hypercall is necessary for pv_ops balloon driver which
uses Linux memory hot plug in order to tell the region
which will be populated.

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r d40dfdd3bfdb xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c      Mon Sep 29 21:18:21 2008 +0900
+++ b/xen/arch/ia64/xen/dom0_ops.c      Mon Sep 29 21:19:36 2008 +0900
@@ -607,6 +607,12 @@
     case IA64_DOM0VP_unexpose_foreign_p2m:
         ret = dom0vp_unexpose_foreign_p2m(d, arg0, arg1);
         break;
+    case IA64_DOM0VP_add_memdesc: {
+        XEN_GUEST_HANDLE(char) hnd;
+        set_xen_guest_handle(hnd, (char*)arg1);
+        ret = dom0vp_add_memdesc(d, (domid_t)arg0, hnd);
+        break;
+    }
     default:
         ret = -1;
                printk("unknown dom0_vp_op 0x%lx\n", cmd);
diff -r d40dfdd3bfdb xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Mon Sep 29 21:18:21 2008 +0900
+++ b/xen/arch/ia64/xen/mm.c    Mon Sep 29 21:19:36 2008 +0900
@@ -2461,6 +2461,42 @@
     free_domheap_pages(page, order);
     return ret;
 }
+
+unsigned long
+dom0vp_add_memdesc(struct domain *d,
+                   domid_t targ_domid, XEN_GUEST_HANDLE(char) buffer)
+{
+    unsigned long ret = 0;
+    struct domain *targ_d;
+    struct xen_ia64_memmap_info u_memmap_info;
+    char *u_memmap;
+
+    ret = memmap_info_copy_from_guest(&u_memmap_info, &u_memmap, buffer);
+    if (ret != 0)
+        return ret;
+
+    if (targ_domid == DOMID_SELF)
+        targ_d = rcu_lock_current_domain();
+    else {
+        targ_d = rcu_lock_domain_by_id(targ_domid);
+        if (targ_d == NULL) {
+            ret = -ENOENT;
+            goto out;
+        }
+        if (!IS_PRIV_FOR(current->domain, targ_d)) {
+            ret = -EPERM;
+            goto out_unlock;
+        }
+    }
+
+    ret = __dom0vp_add_memdesc(targ_d, &u_memmap_info, u_memmap);
+
+ out_unlock:
+    rcu_unlock_domain(targ_d);
+ out:
+    xfree(u_memmap);
+    return ret;
+}
 #endif
 
 // grant table host mapping
diff -r d40dfdd3bfdb xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Mon Sep 29 21:18:21 2008 +0900
+++ b/xen/include/asm-ia64/mm.h Mon Sep 29 21:19:36 2008 +0900
@@ -448,6 +448,7 @@
 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);
+unsigned long dom0vp_add_memdesc(struct domain *d, domid_t targ_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 @@
 #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_add_memdesc(d, targ_domid, buffer)      (-ENOSYS)
 #endif
 
 extern volatile unsigned long *mpt_table;
diff -r d40dfdd3bfdb xen/include/public/arch-ia64.h
--- a/xen/include/public/arch-ia64.h    Mon Sep 29 21:18:21 2008 +0900
+++ b/xen/include/public/arch-ia64.h    Mon Sep 29 21:19:36 2008 +0900
@@ -464,6 +464,9 @@
 /* unexpose the foreign domain's p2m table into privileged domain */
 #define IA64_DOM0VP_unexpose_foreign_p2m        13
 
+/* Add a new memory descriptor to memmap_info for memory hot plug */
+#define IA64_DOM0VP_add_memdesc         14
+
 // flags for page assignement to pseudo physical address space
 #define _ASSIGN_readonly                0
 #define ASSIGN_readonly                 (1UL << _ASSIGN_readonly)

Attachment: memmap-info-hypercall.patch
Description: Text Data

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

 


Rackspace

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