From patchwork Thu Aug 13 17:09:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Huang X-Patchwork-Id: 507123 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8348D1401AF for ; Fri, 14 Aug 2015 03:11:34 +1000 (AEST) Received: from localhost ([::1]:43542 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPw2O-0001CG-EY for incoming@patchwork.ozlabs.org; Thu, 13 Aug 2015 13:11:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPw0i-00070J-1T for qemu-devel@nongnu.org; Thu, 13 Aug 2015 13:09:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPw0d-00047Y-Ao for qemu-devel@nongnu.org; Thu, 13 Aug 2015 13:09:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPw0d-00047Q-4E for qemu-devel@nongnu.org; Thu, 13 Aug 2015 13:09:43 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id C944891DCE; Thu, 13 Aug 2015 17:09:42 +0000 (UTC) Received: from apm-mustang-ev3-05.lab.eng.rdu.redhat.com (apm-mustang-ev3-05.lab.eng.rdu.redhat.com [10.12.0.116]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7DH9cmh009456; Thu, 13 Aug 2015 13:09:41 -0400 From: Wei Huang To: qemu-devel@nongnu.org Date: Thu, 13 Aug 2015 13:09:27 -0400 Message-Id: <1439485767-20259-3-git-send-email-wei@redhat.com> In-Reply-To: <1439485767-20259-1-git-send-email-wei@redhat.com> References: <1439485767-20259-1-git-send-email-wei@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: wei@redhat.com, peter.maydell@linaro.org, drjones@redhat.com, ard.biesheuvel@linaro.org, ehabkost@redhat.com, ivan.khoronzhuk@linaro.org, mst@redhat.com, somlo@cmu.edu, zhaoshenglong@huawei.com, leif.lindholm@linaro.org, roy.franz@linaro.org, pbonzini@redhat.com, imammedo@redhat.com, lersek@redhat.com, jdelvare@suse.de, rth@twiddle.net Subject: [Qemu-devel] [ARM SMBIOS V4 PATCH 2/2] smbios: implement smbios support for mach-virt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch generates smbios tables for ARM mach-virt. Also add CONFIG_SMBIOS=y for ARM default config. Acked-by: Gabriel Somlo Tested-by: Gabriel Somlo Reviewed-by: Laszlo Ersek Reviewed-by: Shannon Zhao Tested-by: Leif Lindholm Signed-off-by: Wei Huang --- default-configs/arm-softmmu.mak | 1 + hw/arm/virt.c | 25 +++++++++++++++++++++++++ qemu-options.hx | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.mak index 74f1db3..99b41e9 100644 --- a/default-configs/arm-softmmu.mak +++ b/default-configs/arm-softmmu.mak @@ -102,3 +102,4 @@ CONFIG_XIO3130=y CONFIG_IOH3420=y CONFIG_I82801B11=y CONFIG_ACPI=y +CONFIG_SMBIOS=y diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 4846892..b7c1822 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -48,6 +48,7 @@ #include "hw/arm/sysbus-fdt.h" #include "hw/platform-bus.h" #include "hw/arm/fdt.h" +#include "hw/smbios/smbios.h" /* Number of external interrupt lines to configure the GIC with */ #define NUM_IRQS 256 @@ -780,12 +781,36 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size) return board->fdt; } +static void virt_build_smbios(VirtGuestInfo *guest_info) +{ + FWCfgState *fw_cfg = guest_info->fw_cfg; + uint8_t *smbios_tables, *smbios_anchor; + size_t smbios_tables_len, smbios_anchor_len; + + if (!fw_cfg) + return; + + smbios_set_defaults("QEMU", "QEMU Virtual Machine", + "1.0", false, true, SMBIOS_ENTRY_POINT_30); + + smbios_get_tables(NULL, 0, &smbios_tables, &smbios_tables_len, + &smbios_anchor, &smbios_anchor_len); + + if (smbios_anchor) { + fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-tables", + smbios_tables, smbios_tables_len); + fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor", + smbios_anchor, smbios_anchor_len); + } +} + static void virt_guest_info_machine_done(Notifier *notifier, void *data) { VirtGuestInfoState *guest_info_state = container_of(notifier, VirtGuestInfoState, machine_done); virt_acpi_setup(&guest_info_state->info); + virt_build_smbios(&guest_info_state->info); } static void machvirt_init(MachineState *machine) diff --git a/qemu-options.hx b/qemu-options.hx index 77f5853..efce775 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1412,7 +1412,7 @@ DEF("smbios", HAS_ARG, QEMU_OPTION_smbios, "-smbios type=17[,loc_pfx=str][,bank=str][,manufacturer=str][,serial=str]\n" " [,asset=str][,part=str][,speed=%d]\n" " specify SMBIOS type 17 fields\n", - QEMU_ARCH_I386) + QEMU_ARCH_I386 | QEMU_ARCH_ARM) STEXI @item -smbios file=@var{binary} @findex -smbios