From: armbru@redhat.com
To: qemu-devel@nongnu.org
Cc: ehabkost@redhat.com, mst@redhat.com, aliguori@amazon.com,
pbonzini@redhat.com, lersek@redhat.com, afaerber@suse.de
Subject: [Qemu-devel] [PATCH v3 2/2] smbios: Set system manufacturer, product & version by default
Date: Wed, 30 Oct 2013 13:56:40 +0100 [thread overview]
Message-ID: <1383137800-2990-3-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1383137800-2990-1-git-send-email-armbru@redhat.com>
From: Markus Armbruster <armbru@redhat.com>
Currently, we get SeaBIOS defaults: manufacturer Bochs, product Bochs,
no version. Best SeaBIOS can do, but we can provide better defaults:
manufacturer QEMU, product & version taken from QEMUMachine desc and
name.
Take care to do this only for new machine types, of course.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/i386/pc_piix.c | 9 +++++++++
hw/i386/pc_q35.c | 7 +++++++
hw/i386/smbios.c | 14 ++++++++++++++
include/hw/i386/smbios.h | 2 ++
4 files changed, 32 insertions(+)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index c6042c7..417ad33 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -28,6 +28,7 @@
#include "hw/loader.h"
#include "hw/i386/pc.h"
#include "hw/i386/apic.h"
+#include "hw/i386/smbios.h"
#include "hw/pci/pci.h"
#include "hw/pci/pci_ids.h"
#include "hw/usb.h"
@@ -59,6 +60,7 @@ static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
static bool has_pvpanic;
static bool has_pci_info = true;
+static bool smbios_type1_defaults = true;
/* PC hardware initialisation */
static void pc_init1(QEMUMachineInitArgs *args,
@@ -124,6 +126,10 @@ static void pc_init1(QEMUMachineInitArgs *args,
guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
guest_info->has_pci_info = has_pci_info;
guest_info->isapc_ram_fw = !pci_enabled;
+ if (smbios_type1_defaults) {
+ smbios_set_type1_defaults("QEMU", args->machine->desc,
+ args->machine->name);
+ }
/* allocate ram and load rom/bios */
if (!xen_enabled()) {
@@ -240,6 +246,7 @@ static void pc_compat_1_6(QEMUMachineInitArgs *args)
{
has_pci_info = false;
rom_file_in_ram = false;
+ smbios_type1_defaults = false;
}
static void pc_compat_1_5(QEMUMachineInitArgs *args)
@@ -304,6 +311,7 @@ static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
{
has_pci_info = false;
+ smbios_type1_defaults = false;
disable_kvm_pv_eoi();
enable_compat_apic_id_mode();
pc_init1(args, 1, 0);
@@ -312,6 +320,7 @@ static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
static void pc_init_isa(QEMUMachineInitArgs *args)
{
has_pci_info = false;
+ smbios_type1_defaults = false;
if (!args->cpu_model) {
args->cpu_model = "486";
}
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index ca84e1c..9e3213f 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -39,6 +39,7 @@
#include "hw/pci-host/q35.h"
#include "exec/address-spaces.h"
#include "hw/i386/ich9.h"
+#include "hw/i386/smbios.h"
#include "hw/ide/pci.h"
#include "hw/ide/ahci.h"
#include "hw/usb.h"
@@ -49,6 +50,7 @@
static bool has_pvpanic;
static bool has_pci_info = true;
+static bool smbios_type1_defaults = true;
/* PC hardware initialisation */
static void pc_q35_init(QEMUMachineInitArgs *args)
@@ -111,6 +113,10 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
guest_info->has_pci_info = has_pci_info;
guest_info->isapc_ram_fw = false;
+ if (smbios_type1_defaults) {
+ smbios_set_type1_defaults("QEMU", args->machine->desc,
+ args->machine->name);
+ }
/* allocate ram and load rom/bios */
if (!xen_enabled()) {
@@ -224,6 +230,7 @@ static void pc_compat_1_6(QEMUMachineInitArgs *args)
{
has_pci_info = false;
rom_file_in_ram = false;
+ smbios_type1_defaults = false;
}
static void pc_compat_1_5(QEMUMachineInitArgs *args)
diff --git a/hw/i386/smbios.c b/hw/i386/smbios.c
index d3f1ee6..e8f41ad 100644
--- a/hw/i386/smbios.c
+++ b/hw/i386/smbios.c
@@ -256,6 +256,20 @@ static void smbios_build_type_1_fields(void)
}
}
+void smbios_set_type1_defaults(const char *manufacturer,
+ const char *product, const char *version)
+{
+ if (!type1.manufacturer) {
+ type1.manufacturer = manufacturer;
+ }
+ if (!type1.product) {
+ type1.product = product;
+ }
+ if (!type1.version) {
+ type1.version = version;
+ }
+}
+
uint8_t *smbios_get_table(size_t *length)
{
if (!smbios_immutable) {
diff --git a/include/hw/i386/smbios.h b/include/hw/i386/smbios.h
index b08ec71..18fb970 100644
--- a/include/hw/i386/smbios.h
+++ b/include/hw/i386/smbios.h
@@ -16,6 +16,8 @@
#include "qemu/option.h"
void smbios_entry_add(QemuOpts *opts);
+void smbios_set_type1_defaults(const char *manufacturer,
+ const char *product, const char *version);
uint8_t *smbios_get_table(size_t *length);
/*
--
1.8.1.4
next prev parent reply other threads:[~2013-10-30 12:56 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-30 12:56 [Qemu-devel] [PATCH v3 0/2] smbios nicer defaults for DMI type 1 (System) armbru
2013-10-30 12:56 ` [Qemu-devel] [PATCH v3 1/2] hw: Pass QEMUMachine to its init() method armbru
2013-10-30 13:13 ` Eduardo Habkost
2013-10-30 13:38 ` Andreas Färber
2013-10-31 6:17 ` Michael S. Tsirkin
2013-10-30 12:56 ` armbru [this message]
2013-10-30 13:19 ` [Qemu-devel] [PATCH v3 2/2] smbios: Set system manufacturer, product & version by default Eduardo Habkost
2013-10-30 14:18 ` Michael S. Tsirkin
2013-10-30 14:29 ` Eduardo Habkost
2013-10-30 14:48 ` Michael S. Tsirkin
2013-10-30 15:18 ` Markus Armbruster
2013-10-30 19:17 ` Michael S. Tsirkin
2013-10-30 20:22 ` Markus Armbruster
2013-10-30 23:01 ` Michael S. Tsirkin
2013-10-31 5:30 ` Markus Armbruster
2013-10-31 9:00 ` Eduardo Habkost
2013-10-30 14:48 ` Markus Armbruster
2013-10-30 19:12 ` Michael S. Tsirkin
2013-10-31 5:54 ` Markus Armbruster
2013-10-31 6:17 ` Michael S. Tsirkin
2013-10-30 14:20 ` [Qemu-devel] [PATCH v3 0/2] smbios nicer defaults for DMI type 1 (System) Michael S. Tsirkin
2013-10-31 5:51 ` [Qemu-devel] [PATCH v3 3/2] smbios: Decouple system product from QEMUMachine Markus Armbruster
2013-10-31 6:16 ` Michael S. Tsirkin
2013-10-31 8:20 ` Eduardo Habkost
2013-11-04 13:40 ` [Qemu-devel] [PATCH v3 0/2] smbios nicer defaults for DMI type 1 (System) Michael S. Tsirkin
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=1383137800-2990-3-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=afaerber@suse.de \
--cc=aliguori@amazon.com \
--cc=ehabkost@redhat.com \
--cc=lersek@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).