All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] [PATCH] HVM SMBIOS support 1/6
@ 2006-07-07 19:36 Andrew D. Ball
  2006-07-10 14:49 ` Keir Fraser
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew D. Ball @ 2006-07-07 19:36 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 5563 bytes --]

[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@us.ibm.com>

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 #2: smbios_1_xend.patch --]
[-- Type: text/x-patch, Size: 5562 bytes --]

[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@us.ibm.com>

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 #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] [PATCH] HVM SMBIOS support 1/6
  2006-07-07 19:36 [RFC] [PATCH] HVM SMBIOS support 1/6 Andrew D. Ball
@ 2006-07-10 14:49 ` Keir Fraser
  2006-07-10 15:11   ` Andrew D. Ball
  2006-07-11 18:12   ` Andrew D. Ball
  0 siblings, 2 replies; 7+ messages in thread
From: Keir Fraser @ 2006-07-10 14:49 UTC (permalink / raw)
  To: Andrew D. Ball; +Cc: xen-devel


On 7 Jul 2006, at 20:36, Andrew D. Ball wrote:

> [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@us.ibm.com>

Does it need to be optional? I don't think most BIOSes let you disable 
the SMBIOS tables?

  -- Keir

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] [PATCH] HVM SMBIOS support 1/6
  2006-07-10 14:49 ` Keir Fraser
@ 2006-07-10 15:11   ` Andrew D. Ball
  2006-07-11 18:12   ` Andrew D. Ball
  1 sibling, 0 replies; 7+ messages in thread
From: Andrew D. Ball @ 2006-07-10 15:11 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

On Mon, 2006-07-10 at 15:49 +0100, Keir Fraser wrote:
> On 7 Jul 2006, at 20:36, Andrew D. Ball wrote:
> 
> > [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@us.ibm.com>
> 
> Does it need to be optional? I don't think most BIOSes let you disable 
> the SMBIOS tables?
> 

Good point.  It's fine with me to always generate the SMBIOS tables.

Andrew

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] [PATCH] HVM SMBIOS support 1/6
  2006-07-10 14:49 ` Keir Fraser
  2006-07-10 15:11   ` Andrew D. Ball
@ 2006-07-11 18:12   ` Andrew D. Ball
  2006-07-11 18:34     ` Keir Fraser
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew D. Ball @ 2006-07-11 18:12 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

Do you see any other things to work on for the SMBIOS patches?  Making
SMBIOS not optional cuts down on a bit of the code, so I'm working on
that and getting the code to run on the latest changeset today.

Thanks for your help!
Andrew

On Mon, 2006-07-10 at 15:49 +0100, Keir Fraser wrote:
> On 7 Jul 2006, at 20:36, Andrew D. Ball wrote:
> 
> > [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@us.ibm.com>
> 
> Does it need to be optional? I don't think most BIOSes let you disable 
> the SMBIOS tables?
> 
>   -- Keir
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] [PATCH] HVM SMBIOS support 1/6
  2006-07-11 18:12   ` Andrew D. Ball
@ 2006-07-11 18:34     ` Keir Fraser
  2006-07-11 19:01       ` Keir Fraser
  2006-07-11 19:27       ` Andrew D. Ball
  0 siblings, 2 replies; 7+ messages in thread
From: Keir Fraser @ 2006-07-11 18:34 UTC (permalink / raw)
  To: Andrew D. Ball; +Cc: xen-devel


On 11 Jul 2006, at 19:12, Andrew D. Ball wrote:

> Do you see any other things to work on for the SMBIOS patches?  Making
> SMBIOS not optional cuts down on a bit of the code, so I'm working on
> that and getting the code to run on the latest changeset today.

I think they're basically okay. I find it a bit weird that hvmloader 
puts SMBIOS tables in a fixed place and then rombios copies them -- not 
sure why that's needed but I suppose you're only copying what is done 
for ACPI tables. Couldn't hvmloader write all BIOS tables to a safe 
location and be done with them, or is the problem that 0xf0000 upwards 
is not available at the time hvmloader runs? Also, is the e820 
reservation entry actually valid: 0x9f000-0xA0000 is reserved, but 
rombios copies the tables out of that area, right? Does rombios also 
update the e820 table?

  -- Keir

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] [PATCH] HVM SMBIOS support 1/6
  2006-07-11 18:34     ` Keir Fraser
@ 2006-07-11 19:01       ` Keir Fraser
  2006-07-11 19:27       ` Andrew D. Ball
  1 sibling, 0 replies; 7+ messages in thread
From: Keir Fraser @ 2006-07-11 19:01 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel, Andrew D. Ball


On 11 Jul 2006, at 19:34, Keir Fraser wrote:

> Couldn't hvmloader write all BIOS tables to a safe location and be 
> done with them, or is the problem that 0xf0000 upwards is not 
> available at the time hvmloader runs? Also, is the e820 reservation 
> entry actually valid: 0x9f000-0xA0000 is reserved, but rombios copies 
> the tables out of that area, right? Does rombios also update the e820 
> table?

Actually don't worry about this. Some cleanups to the e820 stuff can be 
done later in a separate patch (e.g., getting rid of the xen-specific 
e820 types). The current e820 map is fine for now though, and I think 
the BIOS table copying and so on probably does make sense.

  -- Keir

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC] [PATCH] HVM SMBIOS support 1/6
  2006-07-11 18:34     ` Keir Fraser
  2006-07-11 19:01       ` Keir Fraser
@ 2006-07-11 19:27       ` Andrew D. Ball
  1 sibling, 0 replies; 7+ messages in thread
From: Andrew D. Ball @ 2006-07-11 19:27 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xen-devel

On Tue, 2006-07-11 at 19:34 +0100, Keir Fraser wrote:
> On 11 Jul 2006, at 19:12, Andrew D. Ball wrote:
> 
> > Do you see any other things to work on for the SMBIOS patches?  Making
> > SMBIOS not optional cuts down on a bit of the code, so I'm working on
> > that and getting the code to run on the latest changeset today.
> 
> I think they're basically okay. I find it a bit weird that hvmloader 
> puts SMBIOS tables in a fixed place and then rombios copies them -- not 
> sure why that's needed but I suppose you're only copying what is done 
> for ACPI tables. Couldn't hvmloader write all BIOS tables to a safe 
> location and be done with them, or is the problem that 0xf0000 upwards 
> is not available at the time hvmloader runs? 

More or less.  0xf0000-0xfffff is reserved for the ROMBIOS, but I need a
31-bit entry point somewhere on a 16-byte boundary there.  It's only the
31-bit entry point that gets copied.

> Also, is the e820 
> reservation entry actually valid: 0x9f000-0xA0000 is reserved, but 
> rombios copies the tables out of that area, right? Does rombios also 
> update the e820 table?

I'm a little confused about this myself.  Whenever I change the e820 map
in libxenguest, it seems to work, but I see two other places that might
change it

(1) copy_e820_table in rombios.c -- looks like this doesn't do anything
if 0x91e8 is 0, which is probably the case.
(2) some code in vmxassist's setup.c -- looks like this has a copy of
the same e820map defined in xc_hvm_build.c and only changes it if TEST
is defined.

Thanks for your help!
Andrew

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-07-11 19:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-07 19:36 [RFC] [PATCH] HVM SMBIOS support 1/6 Andrew D. Ball
2006-07-10 14:49 ` Keir Fraser
2006-07-10 15:11   ` Andrew D. Ball
2006-07-11 18:12   ` Andrew D. Ball
2006-07-11 18:34     ` Keir Fraser
2006-07-11 19:01       ` Keir Fraser
2006-07-11 19:27       ` Andrew D. Ball

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.