From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lqupj-0008QY-UQ for qemu-devel@nongnu.org; Mon, 06 Apr 2009 15:50:16 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lqupe-0008OA-DR for qemu-devel@nongnu.org; Mon, 06 Apr 2009 15:50:15 -0400 Received: from [199.232.76.173] (port=44455 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lqupe-0008O5-1z for qemu-devel@nongnu.org; Mon, 06 Apr 2009 15:50:10 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:36128) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lqupd-0003Vn-Gj for qemu-devel@nongnu.org; Mon, 06 Apr 2009 15:50:09 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e31.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id n36Jkvsd029370 for ; Mon, 6 Apr 2009 13:46:57 -0600 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n36Jo5gV206640 for ; Mon, 6 Apr 2009 13:50:05 -0600 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n36Jo5M4008553 for ; Mon, 6 Apr 2009 13:50:05 -0600 Message-ID: <49DA5CEA.7040209@us.ibm.com> Date: Mon, 06 Apr 2009 14:50:02 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1237835133.7276.1107.camel@lappy> <1237835465.15558.4.camel@lappy> In-Reply-To: <1237835465.15558.4.camel@lappy> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 1/2] qemu: Allow SMBIOS entries to be loaded and provided to the VM BIOS Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex Williamson Cc: qemu-devel , kvm Alex Williamson wrote: > Create a new -smbios options that takes binary SMBIOS entries > to provide to the VM BIOS. The binary can be easily generated > using something like: > > dmidecode -t 1 -u | grep $'^\t\t[^"]' | xargs -n1 | \ > perl -lne 'printf "%c", hex($_)' > smbios_type_1.bin > > For some inventory tools, this makes the VM report the system > information for the host. One entry per binary file, multiple > files can be chained together as: > > -smbios file1,file2,... > > or specified independently: > > -smbios file1 -smbios file2 > > Signed-off-by: Alex Williamson > Hi Alex, I know we have to support blobs because of OEM specific smbios entries, but there are a number of common ones that it would probably be good to specify in a less user-unfriendly way. What do you think? Anyway, comments below. > diff --git a/hw/acpi.c b/hw/acpi.c > index 52f50a0..0bd93bf 100644 > --- a/hw/acpi.c > +++ b/hw/acpi.c > @@ -915,3 +915,69 @@ out: > } > return -1; > } > + > +char *smbios_entries; > +size_t smbios_entries_len; > I think an accessor would be better than making these variables global. > +int smbios_entry_add(const char *t) > +{ > acpi.c is hardware emulation, I'd rather see the command line parsing done somewhere else (like vl.c). > + struct stat s; > + char file[1024], *p, *f, *n; > + int fd, r; > + size_t len, off; > + > + f = (char *)t; > + do { > + n = strchr(f, ','); > + if (n) { > + strncpy(file, f, (n - f)); > + file[n - f] = '\0'; > + f = n + 1; > + } else { > + strcpy(file, f); > + f += strlen(file); > + } > I'm happy to just require multiple -smbios options. I dislike overloading with ','s even though we do it a lot in QEMU. > + fd = open(file, O_RDONLY); > + if (fd < 0) > + return -1; > + > + if (fstat(fd, &s) < 0) { > + close(fd); > + return -1; > + } > May want to look at load_image/get_image_size. -- Regards, Anthony Liguori