HVM SMBIOS v2 2/5
PATCH 1/1 HVM SMBIOS v2 2/5
This patch modifies HVM domain builder code in libxenguest to
(1) take the domU's UUID as an argument
(2) fill in the new fields in hvm_info_table needed for SMBIOS
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 <[email protected]>
tools/libxc/xc_hvm_build.c +38 -13
@@ -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 */
tools/libxc/xenguest.h +4 -2
@@ -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 */
tools/libxc/xg_private.c +2 -1
@@ -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; }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel