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] Initialize the xenstore MFN for VMX domains

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Initialize the xenstore MFN for VMX domains
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 31 Aug 2005 08:30:18 +0000
Delivery-date: Wed, 31 Aug 2005 08:31:44 +0000
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 adsharma@xxxxxxxxxxxxxxxxxxxx
# Node ID 02121365cfff9cfa8e57cc37a560df5305360b58
# Parent  990288245c0051b38cde67776191f260c4742111
Initialize the xenstore MFN for VMX domains

Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>

diff -r 990288245c00 -r 02121365cfff tools/libxc/linux_boot_params.h
--- a/tools/libxc/linux_boot_params.h   Tue Aug  9 19:20:28 2005
+++ b/tools/libxc/linux_boot_params.h   Tue Aug  9 22:21:18 2005
@@ -17,6 +17,7 @@
 #define E820_NVS        4
 #define E820_IO         16
 #define E820_SHARED     17
+#define E820_XENSTORE   18
 
         u32 caching_attr;    /* used by hypervisor */
 #define MEMMAP_UC      0
diff -r 990288245c00 -r 02121365cfff tools/libxc/xc.h
--- a/tools/libxc/xc.h  Tue Aug  9 19:20:28 2005
+++ b/tools/libxc/xc.h  Tue Aug  9 22:21:18 2005
@@ -306,7 +306,10 @@
                  const char *ramdisk_name,
                  const char *cmdline,
                  unsigned int control_evtchn,
-                 unsigned long flags);
+                 unsigned long flags,
+                 unsigned int vcpus,
+                 unsigned int store_evtchn,
+                 unsigned long *store_mfn);
 
 int xc_bvtsched_global_set(int xc_handle,
                            unsigned long ctx_allow);
diff -r 990288245c00 -r 02121365cfff tools/libxc/xc_vmx_build.c
--- a/tools/libxc/xc_vmx_build.c        Tue Aug  9 19:20:28 2005
+++ b/tools/libxc/xc_vmx_build.c        Tue Aug  9 22:21:18 2005
@@ -37,58 +37,70 @@
     int nr_map = 0;
 
     /* XXX: Doesn't work for > 4GB yet */
-    mem_mapp->map[0].addr = 0x0;
-    mem_mapp->map[0].size = 0x9F800;
-    mem_mapp->map[0].type = E820_RAM;
-    mem_mapp->map[0].caching_attr = MEMMAP_WB;
+    mem_mapp->map[nr_map].addr = 0x0;
+    mem_mapp->map[nr_map].size = 0x9F800;
+    mem_mapp->map[nr_map].type = E820_RAM;
+    mem_mapp->map[nr_map].caching_attr = MEMMAP_WB;
     nr_map++;
 
-    mem_mapp->map[1].addr = 0x9F800;
-    mem_mapp->map[1].size = 0x800;
-    mem_mapp->map[1].type = E820_RESERVED;
-    mem_mapp->map[1].caching_attr = MEMMAP_UC;
+    mem_mapp->map[nr_map].addr = 0x9F800;
+    mem_mapp->map[nr_map].size = 0x800;
+    mem_mapp->map[nr_map].type = E820_RESERVED;
+    mem_mapp->map[nr_map].caching_attr = MEMMAP_UC;
     nr_map++;
 
-    mem_mapp->map[2].addr = 0xA0000;
-    mem_mapp->map[2].size = 0x20000;
-    mem_mapp->map[2].type = E820_IO;
-    mem_mapp->map[2].caching_attr = MEMMAP_UC;
+    mem_mapp->map[nr_map].addr = 0xA0000;
+    mem_mapp->map[nr_map].size = 0x20000;
+    mem_mapp->map[nr_map].type = E820_IO;
+    mem_mapp->map[nr_map].caching_attr = MEMMAP_UC;
     nr_map++;
 
-    mem_mapp->map[3].addr = 0xF0000;
-    mem_mapp->map[3].size = 0x10000;
-    mem_mapp->map[3].type = E820_RESERVED;
-    mem_mapp->map[3].caching_attr = MEMMAP_UC;
+    mem_mapp->map[nr_map].addr = 0xF0000;
+    mem_mapp->map[nr_map].size = 0x10000;
+    mem_mapp->map[nr_map].type = E820_RESERVED;
+    mem_mapp->map[nr_map].caching_attr = MEMMAP_UC;
     nr_map++;
 
-    mem_mapp->map[4].addr = 0x100000;
-    mem_mapp->map[4].size = mem_size - 0x100000 - PAGE_SIZE;
-    mem_mapp->map[4].type = E820_RAM;
-    mem_mapp->map[4].caching_attr = MEMMAP_WB;
+#define STATIC_PAGES    2       /* for ioreq_t and store_mfn */
+    /* Most of the ram goes here */
+    mem_mapp->map[nr_map].addr = 0x100000;
+    mem_mapp->map[nr_map].size = mem_size - 0x100000 - STATIC_PAGES*PAGE_SIZE;
+    mem_mapp->map[nr_map].type = E820_RAM;
+    mem_mapp->map[nr_map].caching_attr = MEMMAP_WB;
     nr_map++;
 
-    mem_mapp->map[5].addr = mem_size - PAGE_SIZE;
-    mem_mapp->map[5].size = PAGE_SIZE;
-    mem_mapp->map[5].type = E820_SHARED;
-    mem_mapp->map[5].caching_attr = MEMMAP_WB;
+    /* Statically allocated special pages */
+
+    /* Shared ioreq_t page */
+    mem_mapp->map[nr_map].addr = mem_size - PAGE_SIZE;
+    mem_mapp->map[nr_map].size = PAGE_SIZE;
+    mem_mapp->map[nr_map].type = E820_SHARED;
+    mem_mapp->map[nr_map].caching_attr = MEMMAP_WB;
     nr_map++;
 
-    mem_mapp->map[6].addr = mem_size;
-    mem_mapp->map[6].size = 0x3 * PAGE_SIZE;
-    mem_mapp->map[6].type = E820_NVS;
-    mem_mapp->map[6].caching_attr = MEMMAP_UC;
+    /* For xenstore */
+    mem_mapp->map[nr_map].addr = mem_size - 2*PAGE_SIZE;
+    mem_mapp->map[nr_map].size = PAGE_SIZE;
+    mem_mapp->map[nr_map].type = E820_XENSTORE;
+    mem_mapp->map[nr_map].caching_attr = MEMMAP_WB;
     nr_map++;
 
-    mem_mapp->map[7].addr = mem_size + 0x3 * PAGE_SIZE;
-    mem_mapp->map[7].size = 0xA * PAGE_SIZE;
-    mem_mapp->map[7].type = E820_ACPI;
-    mem_mapp->map[7].caching_attr = MEMMAP_WB;
+    mem_mapp->map[nr_map].addr = mem_size;
+    mem_mapp->map[nr_map].size = 0x3 * PAGE_SIZE;
+    mem_mapp->map[nr_map].type = E820_NVS;
+    mem_mapp->map[nr_map].caching_attr = MEMMAP_UC;
     nr_map++;
 
-    mem_mapp->map[8].addr = 0xFEC00000;
-    mem_mapp->map[8].size = 0x1400000;
-    mem_mapp->map[8].type = E820_IO;
-    mem_mapp->map[8].caching_attr = MEMMAP_UC;
+    mem_mapp->map[nr_map].addr = mem_size + 0x3 * PAGE_SIZE;
+    mem_mapp->map[nr_map].size = 0xA * PAGE_SIZE;
+    mem_mapp->map[nr_map].type = E820_ACPI;
+    mem_mapp->map[nr_map].caching_attr = MEMMAP_WB;
+    nr_map++;
+
+    mem_mapp->map[nr_map].addr = 0xFEC00000;
+    mem_mapp->map[nr_map].size = 0x1400000;
+    mem_mapp->map[nr_map].type = E820_IO;
+    mem_mapp->map[nr_map].caching_attr = MEMMAP_UC;
     nr_map++;
 
     mem_mapp->nr_map = nr_map;
@@ -212,7 +224,11 @@
                          unsigned long shared_info_frame,
                          unsigned int control_evtchn,
                          unsigned long flags,
-                         struct mem_map * mem_mapp)
+                         unsigned int vcpus,
+                         unsigned int store_evtchn,
+                         unsigned long *store_mfn,
+                         struct mem_map *mem_mapp
+                         )
 {
     l1_pgentry_t *vl1tab=NULL, *vl1e=NULL;
     l2_pgentry_t *vl2tab=NULL, *vl2e=NULL;
@@ -510,7 +526,10 @@
     boot_paramsp->drive_info.dummy[14] = 32;
 
     /* memsize is in megabytes */
+    /* If you need to create a special e820map, comment this line
+       and use mem-map.sxp */
     build_e820map(mem_mapp, memsize << 20);
+    *store_mfn = page_array[(v_end-2) >> PAGE_SHIFT];
 #if defined (__i386__)
     if (zap_mmio_ranges(xc_handle, dom, l2tab, mem_mapp) == -1)
 #else
@@ -637,7 +656,10 @@
                    const char *ramdisk_name,
                    const char *cmdline,
                    unsigned int control_evtchn,
-                   unsigned long flags)
+                   unsigned long flags,
+                   unsigned int vcpus,
+                   unsigned int store_evtchn,
+                   unsigned long *store_mfn)
 {
     dom0_op_t launch_op, op;
     int initrd_fd = -1;
@@ -712,7 +734,8 @@
                        initrd_gfd, initrd_size, nr_pages, 
                        ctxt, cmdline,
                        op.u.getdomaininfo.shared_info_frame,
-                       control_evtchn, flags, mem_mapp) < 0 )
+                       control_evtchn, flags, vcpus, store_evtchn, store_mfn,
+                       mem_mapp) < 0 )
     {
         ERROR("Error constructing guest OS");
         goto error_out;
diff -r 990288245c00 -r 02121365cfff tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Tue Aug  9 19:20:28 2005
+++ b/tools/python/xen/lowlevel/xc/xc.c Tue Aug  9 22:21:18 2005
@@ -297,22 +297,23 @@
     u32   dom;
     char *image, *ramdisk = NULL, *cmdline = "";
     PyObject *memmap;
-    int   control_evtchn, flags = 0;
+    int   control_evtchn, store_evtchn;
+    int flags = 0, vcpus = 1;
     int numItems, i;
     int memsize;
     struct mem_map mem_map;
-
-    static char *kwd_list[] = { "dom", "control_evtchn",
-                                "memsize",
-                                "image", "memmap",
+    unsigned long store_mfn = 0;
+
+    static char *kwd_list[] = { "dom", "control_evtchn", "store_evtchn",
+                                "memsize", "image", "memmap",
                                "ramdisk", "cmdline", "flags",
-                                NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisO!|ssi", kwd_list, 
-                                      &dom, &control_evtchn, 
+                               "vcpus", NULL };
+
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiisO!|ssii", kwd_list, 
+                                      &dom, &control_evtchn, &store_evtchn,
                                       &memsize,
                                       &image, &PyList_Type, &memmap,
-                                     &ramdisk, &cmdline, &flags) )
+                                     &ramdisk, &cmdline, &flags, &vcpus) )
         return NULL;
 
     memset(&mem_map, 0, sizeof(mem_map));
@@ -321,7 +322,6 @@
     /* get the number of lines passed to us */
     numItems = PyList_Size(memmap) - 1;        /* removing the line 
                                           containing "memmap" */
-    printf ("numItems: %d\n", numItems);
     mem_map.nr_map = numItems;
    
     /* should raise an error here. */
@@ -365,11 +365,11 @@
     }
 
     if ( xc_vmx_build(xc->xc_handle, dom, memsize, image, &mem_map,
-                        ramdisk, cmdline, control_evtchn, flags) != 0 )
-        return PyErr_SetFromErrno(xc_error);
-    
-    Py_INCREF(zero);
-    return zero;
+                        ramdisk, cmdline, control_evtchn, flags,
+                        vcpus, store_evtchn, &store_mfn) != 0 )
+        return PyErr_SetFromErrno(xc_error);
+    
+    return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
 }
 
 static PyObject *pyxc_bvtsched_global_set(PyObject *self,
diff -r 990288245c00 -r 02121365cfff tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Tue Aug  9 19:20:28 2005
+++ b/tools/python/xen/xend/image.py    Tue Aug  9 22:21:18 2005
@@ -274,14 +274,24 @@
         # Create an event channel
         self.device_channel = channel.eventChannel(0, self.vm.getDomain())
         log.info("VMX device model port: %d", self.device_channel.port2)
-        return xc.vmx_build(dom            = self.vm.getDomain(),
+        if self.vm.store_channel:
+            store_evtchn = self.vm.store_channel.port2
+        else:
+            store_evtchn = 0
+        ret = xc.vmx_build(dom            = self.vm.getDomain(),
                             image          = self.kernel,
                             control_evtchn = self.device_channel.port2,
+                            store_evtchn   = store_evtchn,
                             memsize        = self.vm.memory,
                             memmap         = self.memmap_value,
                             cmdline        = self.cmdline,
                             ramdisk        = self.ramdisk,
-                            flags          = self.flags)
+                            flags          = self.flags,
+                            vcpus          = self.vm.vcpus)
+        if isinstance(ret, dict):
+            self.vm.store_mfn = ret.get('store_mfn')
+            return 0
+        return ret
 
     def parseMemmap(self):
         self.memmap = sxp.child_value(self.vm.config, "memmap")
@@ -396,7 +406,9 @@
         self.pid = 0
 
     def getDomainMemory(self, mem_mb):
-        return (mem_mb * 1024) + self.getPageTableSize(mem_mb)
+        # for ioreq_t and xenstore
+        static_pages = 2
+        return (mem_mb * 1024) + self.getPageTableSize(mem_mb) + 4 * 
static_pages
             
     def getPageTableSize(self, mem_mb):
         """Return the size of memory needed for 1:1 page tables for physical

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

<Prev in Thread] Current Thread [Next in Thread>