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-devel

[Xen-devel] [RFC] [PATCH] HVM SMBIOS support 1/6

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [RFC] [PATCH] HVM SMBIOS support 1/6
From: "Andrew D. Ball" <aball@xxxxxxxxxx>
Date: Fri, 07 Jul 2006 15:36:49 -0400
Delivery-date: Fri, 07 Jul 2006 12:37:19 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
[HVM] [XEND] Add option for enabling SMBIOS for HVM domU's.  Also pass the
xenstore UUID of HVM domU's all the way down to xc_hvm_build().  The UUID
is needed to fill out SMBIOS tables.

Signed-off-by: Andrew D. Ball <aball@xxxxxxxxxx>

diff -r f91cc71173c5 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Thu Jun 22 20:37:33 2006
+++ b/tools/python/xen/lowlevel/xc/xc.c Fri Jul  7 13:49:52 2006
@@ -371,18 +371,38 @@
     int pae  = 0;
     int acpi = 0;
     int apic = 0;
+    int smbios = 0;
+    PyObject *uuid_obj = NULL;
+    uint8_t uuid[16];
     unsigned long store_mfn = 0;
+    int i;
+    PyObject *tmp = NULL;
 
     static char *kwd_list[] = { "dom", "store_evtchn",
-                               "memsize", "image", "vcpus", "pae", "acpi", 
"apic",
+                               "memsize", "image", "vcpus", "pae", "acpi",
+                                "apic", "smbios", "uuid",
                                NULL };
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiiii", kwd_list,
+
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiisiiiiiO", kwd_list,
                                       &dom, &store_evtchn, &memsize,
-                                      &image, &vcpus, &pae, &acpi, &apic) )
-        return NULL;
+                                      &image, &vcpus, &pae, &acpi, &apic,
+                                      &smbios, &uuid_obj) )
+
+        return NULL;
+
+    /* convert the UUID array from Python to C if possible */
+    if (!PySequence_Check(uuid_obj) || PySequence_Length(uuid_obj) != 16)
+        return NULL;
+    for (i = 0; i < 16; i++) {
+        tmp = PySequence_GetItem(uuid_obj, i);
+        if (!PyInt_Check(tmp))
+            return NULL;
+        uuid[i] = (uint8_t) PyInt_AsLong(tmp);
+    }
 
     if ( xc_hvm_build(self->xc_handle, dom, memsize, image,
-                     vcpus, pae, acpi, apic, store_evtchn, &store_mfn) != 0 )
+                     vcpus, pae, acpi, apic, smbios, uuid, store_evtchn,
+                      &store_mfn) != 0 )
         return PyErr_SetFromErrno(xc_error);
 
     return Py_BuildValue("{s:i}", "store_mfn", store_mfn);
@@ -1043,6 +1063,8 @@
       " dom     [int]:      Identifier of domain to build into.\n"
       " image   [str]:      Name of HVM loader image file.\n"
       " vcpus   [int, 1]:   Number of Virtual CPUS in domain.\n\n"
+      " smbios  [int, 1]:   Enable SMBIOS if nonzero.\n\n"
+      " uuid    [int[16]]:  UUID of the domain.\n\n"
       "Returns: [int] 0 on success; -1 on error.\n" },
 
     { "bvtsched_global_set",
diff -r f91cc71173c5 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Thu Jun 22 20:37:33 2006
+++ b/tools/python/xen/xend/image.py    Fri Jul  7 13:49:52 2006
@@ -221,9 +221,21 @@
 
         self.acpi = int(sxp.child_value(imageConfig, 'acpi', 0))
         self.apic = int(sxp.child_value(imageConfig, 'apic', 0))
+        self.smbios = int(sxp.child_value(imageConfig, 'smbios', 0))
 
     def buildDomain(self):
         store_evtchn = self.vm.getStorePort()
+
+        # convert the DCE formatted UUID string to an array
+        # of 16 integers
+        uuid_str = self.vm.info['uuid']
+        uuid_str = uuid_str.replace('-','')
+
+        uuid_arr = []
+
+        byte_num = 0
+        for i in range(0,32,2):
+            uuid_arr.append(int(uuid_str[i:i+2], 16))
 
         log.debug("dom            = %d", self.vm.getDomid())
         log.debug("image          = %s", self.kernel)
@@ -233,6 +245,8 @@
         log.debug("pae            = %d", self.pae)
         log.debug("acpi           = %d", self.acpi)
         log.debug("apic           = %d", self.apic)
+        log.debug("smbios         = %d", self.smbios)
+        log.debug("uuid           = %s", uuid_arr)
 
         self.register_shutdown_watch()
 
@@ -243,7 +257,9 @@
                             vcpus          = self.vm.getVCpuCount(),
                             pae            = self.pae,
                             acpi           = self.acpi,
-                            apic           = self.apic)
+                            apic           = self.apic,
+                            smbios         = self.smbios,
+                            uuid           = uuid_arr)
 
     # Return a list of cmd line args to the device models based on the
     # xm config file
diff -r f91cc71173c5 tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Thu Jun 22 20:37:33 2006
+++ b/tools/python/xen/xm/create.py     Fri Jul  7 13:49:52 2006
@@ -173,6 +173,9 @@
 gopts.var('apic', val='APIC',
           fn=set_int, default=0,
           use="Disable or enable APIC of HVM domain.")
+gopts.var('smbios', val='SMBIOS',
+          fn=set_int, default=1,
+          use="Disable or enable SMBIOS tables of an HVM domain.")
 
 gopts.var('vcpus', val='VCPUS',
           fn=set_int, default=1,
@@ -431,6 +434,9 @@
           addresses for virtual network interfaces.  This must be a unique 
           value across the entire cluster.""")
 
+gopts.var('smbios', val='SMBIOS',
+          fn=set_int, default=0,
+          use="Disable or enable SMBIOS for an HVM domain.")
 
 def err(msg):
     """Print an error to stderr and exit.
@@ -622,7 +628,7 @@
     args = [ 'device_model', 'pae', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
              'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'audio',
              'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'acpi', 'apic',
-             'xauthority', 'usb', 'usbdevice' ]
+             'xauthority', 'smbios', 'uuid' ]
     for a in args:
         if (vals.__dict__[a]):
             config_image.append([a, vals.__dict__[a]])

Attachment: smbios_1_xend.patch
Description: Text Data

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