qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Anthony Liguori <aliguori@amazon.com>,
	Gabriel Somlo <somlo@cmu.edu>, Michael Tokarev <mjt@tls.msk.ru>,
	"Gabriel L. Somlo" <gsomlo@gmail.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PULL 03/10] SMBIOS: Update Type 0 struct generator for machines >= 2.1
Date: Thu, 5 Jun 2014 20:17:14 +0300	[thread overview]
Message-ID: <1401986505-12359-4-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1401986505-12359-1-git-send-email-mst@redhat.com>

From: "Gabriel L. Somlo" <gsomlo@gmail.com>

Update how type 0 (bios info) structures are generated, as follows:

  - convert bios_characteristics field to uin64_t (instead of
    uint8_t[8]), as described in the current smbios spec (v2.8)

  - enable "virtual machine" bit in bios_characteristics_extension_bits

  - add command line option to enable "uefi supported" bit in
    bios_characteristics_extension_bits

These updates should make this optional structure more useful when
used with edk2/ovmf. Only pc machines >= 2.1 are affected, and only
when a type 0 structure is explicitly specified on the command line.

Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 include/hw/i386/smbios.h |  2 +-
 hw/i386/smbios.c         | 18 +++++++++++-------
 qemu-options.hx          |  4 ++--
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/include/hw/i386/smbios.h b/include/hw/i386/smbios.h
index 6d854b7..5583f60 100644
--- a/include/hw/i386/smbios.h
+++ b/include/hw/i386/smbios.h
@@ -64,7 +64,7 @@ struct smbios_type_0 {
     uint16_t bios_starting_address_segment;
     uint8_t bios_release_date_str;
     uint8_t bios_rom_size;
-    uint8_t bios_characteristics[8];
+    uint64_t bios_characteristics;
     uint8_t bios_characteristics_extension_bytes[2];
     uint8_t system_bios_major_release;
     uint8_t system_bios_minor_release;
diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c
index aeb94bc..1793821 100644
--- a/hw/i386/smbios.c
+++ b/hw/i386/smbios.c
@@ -67,7 +67,7 @@ static DECLARE_BITMAP(have_fields_bitmap, SMBIOS_MAX_TYPE+1);
 
 static struct {
     const char *vendor, *version, *date;
-    bool have_major_minor;
+    bool have_major_minor, uefi;
     uint8_t major, minor;
 } type0;
 
@@ -134,6 +134,10 @@ static const QemuOptDesc qemu_smbios_type0_opts[] = {
         .name = "release",
         .type = QEMU_OPT_STRING,
         .help = "revision number",
+    },{
+        .name = "uefi",
+        .type = QEMU_OPT_BOOL,
+        .help = "uefi support",
     },
     { /* end of list */ }
 };
@@ -497,13 +501,12 @@ static void smbios_build_type_0_table(void)
 
     t->bios_rom_size = 0; /* hardcoded in SeaBIOS with FIXME comment */
 
-    /* BIOS characteristics not supported */
-    memset(t->bios_characteristics, 0, 8);
-    t->bios_characteristics[0] = 0x08;
-
-    /* Enable targeted content distribution (needed for SVVP, per SeaBIOS) */
+    t->bios_characteristics = cpu_to_le64(0x08); /* Not supported */
     t->bios_characteristics_extension_bytes[0] = 0;
-    t->bios_characteristics_extension_bytes[1] = 4;
+    t->bios_characteristics_extension_bytes[1] = 0x14; /* TCD/SVVP | VM */
+    if (type0.uefi) {
+        t->bios_characteristics_extension_bytes[1] |= 0x08; /* |= UEFI */
+    }
 
     if (type0.have_major_minor) {
         t->system_bios_major_release = type0.major;
@@ -979,6 +982,7 @@ void smbios_entry_add(QemuOpts *opts)
             save_opt(&type0.vendor, opts, "vendor");
             save_opt(&type0.version, opts, "version");
             save_opt(&type0.date, opts, "date");
+            type0.uefi = qemu_opt_get_bool(opts, "uefi", false);
 
             val = qemu_opt_get(opts, "release");
             if (val) {
diff --git a/qemu-options.hx b/qemu-options.hx
index 781af14..15779e7 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1335,7 +1335,7 @@ ETEXI
 DEF("smbios", HAS_ARG, QEMU_OPTION_smbios,
     "-smbios file=binary\n"
     "                load SMBIOS entry from binary file\n"
-    "-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d]\n"
+    "-smbios type=0[,vendor=str][,version=str][,date=str][,release=%d.%d][,uefi=on|off]\n"
     "                specify SMBIOS type 0 fields\n"
     "-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]\n"
     "              [,uuid=uuid][,sku=str][,family=str]\n"
@@ -1345,7 +1345,7 @@ STEXI
 @findex -smbios
 Load SMBIOS entry from binary file.
 
-@item -smbios type=0[,vendor=@var{str}][,version=@var{str}][,date=@var{str}][,release=@var{%d.%d}]
+@item -smbios type=0[,vendor=@var{str}][,version=@var{str}][,date=@var{str}][,release=@var{%d.%d}][,uefi=on|off]
 Specify SMBIOS type 0 fields
 
 @item -smbios type=1[,manufacturer=@var{str}][,product=@var{str}] [,version=@var{str}][,serial=@var{str}][,uuid=@var{uuid}][,sku=@var{str}] [,family=@var{str}]
-- 
MST

  parent reply	other threads:[~2014-06-05 17:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-05 17:17 [Qemu-devel] [PULL 00/10] pc,pci,virtio,qdev fixes, tests Michael S. Tsirkin
2014-06-05 17:17 ` [Qemu-devel] [PULL 01/10] serial-pci: Set prog interface field of pci config to 16550 compatible Michael S. Tsirkin
2014-06-05 17:17 ` [Qemu-devel] [PULL 02/10] SMBIOS: Fix endian-ness when populating multi-byte fields Michael S. Tsirkin
2014-06-05 17:17 ` Michael S. Tsirkin [this message]
2014-06-05 17:17 ` [Qemu-devel] [PULL 04/10] SMBIOS: Fix type 17 field sizes Michael S. Tsirkin
2014-06-05 17:17 ` [Qemu-devel] [PULL 05/10] pcie_host: Turn pcie_host_init() into an instance_init Michael S. Tsirkin
2014-06-05 17:17 ` [Qemu-devel] [PULL 06/10] virtio-balloon: return empty data when no stats are available Michael S. Tsirkin
2014-06-05 17:17 ` [Qemu-devel] [PULL 07/10] tests: rename acpi-test to bios-tables-test Michael S. Tsirkin
2014-06-05 17:17 ` [Qemu-devel] [PULL 08/10] tests: add smbios testing Michael S. Tsirkin
2014-06-05 17:17 ` [Qemu-devel] [PULL 09/10] qdev: Display warning about unused -global Michael S. Tsirkin
2014-06-05 17:17 ` [Qemu-devel] [PULL 10/10] qdev: Add test of qdev_prop_check_global Michael S. Tsirkin
2014-06-09 12:19   ` Peter Maydell
2014-06-09 13:10     ` Michael S. Tsirkin
2014-06-09 22:53       ` Eduardo Habkost
2014-06-05 21:40 ` [Qemu-devel] [PULL 00/10] pc,pci,virtio,qdev fixes, tests Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401986505-12359-4-git-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=gsomlo@gmail.com \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=somlo@cmu.edu \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).