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

[Xen-devel] [PATCH] HVM SMBIOS v2 2/5



[HVM] Add support for SMBIOS to HVM domain builder: make room for the tables
in the e820 map and write data needed for the SMBIOS tables to the
hvm_info_table struct.

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

diff -r a1c2cede77c7 tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Mon Jul 10 14:01:49 2006
+++ b/tools/libxc/xc_hvm_build.c        Wed Jul 12 11:48:10 2006
@@ -60,12 +60,12 @@

     /* XXX: Doesn't work for > 4GB yet */
     e820entry[nr_map].addr = 0x0;
-    e820entry[nr_map].size = 0x9F800;
+    e820entry[nr_map].size = 0x9F000;
     e820entry[nr_map].type = E820_RAM;
     nr_map++;

-    e820entry[nr_map].addr = 0x9F800;
-    e820entry[nr_map].size = 0x800;
+    e820entry[nr_map].addr = 0x9F000;
+    e820entry[nr_map].size = 0x1000;
     e820entry[nr_map].type = E820_RESERVED;
     nr_map++;

@@ -135,12 +135,15 @@
  * Use E820 reserved memory 0x9F800 to pass HVM info to hvmloader
  * hvmloader will use this info to set BIOS accordingly
  */
-static int set_hvm_info(int xc_handle, uint32_t dom,
+static int set_hvm_info(int xc_handle, uint32_t dom, uint64_t memsize,
                         xen_pfn_t *pfn_list, unsigned int vcpus,
- unsigned int pae, unsigned int acpi, unsigned int apic) + unsigned int pae, unsigned int acpi, unsigned int apic,
+                        uint8_t *uuid)
 {
     char *va_map;
     struct hvm_info_table *va_hvm;
+    uint32_t xen_version;
+    char xen_extra_version[XEN_EXTRAVERSION_LEN];

     va_map = xc_map_foreign_range(xc_handle, dom, PAGE_SIZE,
                                   PROT_READ | PROT_WRITE,
@@ -158,6 +161,22 @@
     va_hvm->apic_enabled = apic;
     va_hvm->pae_enabled  = pae;
     va_hvm->nr_vcpus     = vcpus;
+    va_hvm->memsize      = memsize;
+    memcpy(va_hvm->uuid, uuid, 16);
+
+    xen_version = xc_version(xc_handle, XENVER_version, NULL);
+    va_hvm->xen_major_version = (uint16_t) (xen_version >> 16);
+    va_hvm->xen_minor_version = (uint16_t) xen_version;
+
+    if (xc_version(xc_handle, XENVER_extraversion, &xen_extra_version)) {
+        PERROR("Could not get Xen extra version for HVM info table!");
+        return -1;
+    }
+
+    snprintf(va_hvm->xen_version, sizeof(va_hvm->xen_version),
+ "%hd.%hd%s", va_hvm->xen_major_version, va_hvm->xen_minor_version,
+             xen_extra_version);
+    va_hvm->xen_version[sizeof(va_hvm->xen_version)-1] = '\0';

     set_hvm_info_checksum(va_hvm);

@@ -177,7 +196,8 @@
                        unsigned int acpi,
                        unsigned int apic,
                        unsigned int store_evtchn,
-                       unsigned long *store_mfn)
+                       unsigned long *store_mfn,
+                       uint8_t *uuid)
 {
     xen_pfn_t *page_array = NULL;
     unsigned long count, i;
@@ -250,7 +270,8 @@
             goto error_out;
     }

-    if ( set_hvm_info(xc_handle, dom, page_array, vcpus, pae, acpi, apic) )
+    if ( set_hvm_info(xc_handle, dom, memsize, page_array, vcpus, pae, acpi,
+                      apic, uuid) )
     {
         ERROR("Couldn't set hvm info for HVM guest.\n");
         goto error_out;
@@ -347,7 +368,8 @@
                                  unsigned int acpi,
                                  unsigned int apic,
                                  unsigned int store_evtchn,
-                                 unsigned long *store_mfn)
+                                 unsigned long *store_mfn,
+                                 uint8_t *uuid)
 {
     dom0_op_t launch_op, op;
     int rc, i;
@@ -400,7 +422,8 @@
     ctxt->flags = VGCF_HVM_GUEST;
     if ( setup_guest(xc_handle, domid, memsize, image, image_size, nr_pages,
                      ctxt, op.u.getdomaininfo.shared_info_frame,
-                     vcpus, pae, acpi, apic, store_evtchn, store_mfn) < 0)
+                     vcpus, pae, acpi, apic, store_evtchn, store_mfn,
+                     uuid) < 0)
     {
         ERROR("Error constructing guest OS");
         goto error_out;
@@ -593,7 +616,8 @@
                  unsigned int acpi,
                  unsigned int apic,
                  unsigned int store_evtchn,
-                 unsigned long *store_mfn)
+                 unsigned long *store_mfn,
+                 uint8_t *uuid)
 {
     char *image;
     int  sts;
@@ -606,7 +630,7 @@
     sts = xc_hvm_build_internal(xc_handle, domid, memsize,
                                 image, image_size,
                                 vcpus, pae, acpi, apic,
-                                store_evtchn, store_mfn);
+                                store_evtchn, store_mfn, uuid);

     free(image);

@@ -629,7 +653,8 @@
                      unsigned int acpi,
                      unsigned int apic,
                      unsigned int store_evtchn,
-                     unsigned long *store_mfn)
+                     unsigned long *store_mfn,
+                     uint8_t *uuid)
 {
     int           sts;
     unsigned long img_len;
@@ -653,7 +678,7 @@
     sts = xc_hvm_build_internal(xc_handle, domid, memsize,
                                 img, img_len,
                                 vcpus, pae, acpi, apic,
-                                store_evtchn, store_mfn);
+                                store_evtchn, store_mfn, uuid);

     /* xc_inflate_buffer may return the original buffer pointer (for
        for already inflated buffers), so exercise some care in freeing */
diff -r a1c2cede77c7 tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h    Mon Jul 10 14:01:49 2006
+++ b/tools/libxc/xenguest.h    Wed Jul 12 11:48:10 2006
@@ -111,7 +111,8 @@
                  unsigned int acpi,
                  unsigned int apic,
                  unsigned int store_evtchn,
-                 unsigned long *store_mfn);
+                 unsigned long *store_mfn,
+                 uint8_t *uuid);

 int xc_hvm_build_mem(int xc_handle,
                      uint32_t domid,
@@ -123,6 +124,7 @@
                      unsigned int acpi,
                      unsigned int apic,
                      unsigned int store_evtchn,
-                     unsigned long *store_mfn);
+                     unsigned long *store_mfn,
+                     uint8_t *uuid);

 #endif /* XENGUEST_H */
diff -r a1c2cede77c7 tools/libxc/xg_private.c
--- a/tools/libxc/xg_private.c  Mon Jul 10 14:01:49 2006
+++ b/tools/libxc/xg_private.c  Wed Jul 12 11:48:10 2006
@@ -156,7 +156,8 @@
     unsigned int acpi,
     unsigned int apic,
     unsigned int store_evtchn,
-    unsigned long *store_mfn)
+    unsigned long *store_mfn,
+    uint8_t *uuid)
 {
     return -ENOSYS;
 }

Attachment: smbios_2-libxenguest.patch
Description: Text Data

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

 


Rackspace

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