From patchwork Tue Aug 25 15:00:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 52692 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id 99D5A22E8F for ; Tue, 25 Aug 2015 15:13:13 +0000 (UTC) Received: by wijp15 with SMTP id p15sf7065255wij.3 for ; Tue, 25 Aug 2015 08:13:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=mEFAiMTYlahNZAAfuYX/Il3qMRJJ5w1mrJHny8crxAU=; b=jWfDE4iPRGk4nmiEYYNQC4F6JD4FTMDscJWb9T6GYz3bAfpvuigNRfzrXptjH4HgBP PV8QwndtV1UQfqBljuNC+i2MIXstj0PJy4UKh/zZpkGwVdrY2VBpXmk3/ff7ZPpszOSW QGMPcr6cSGpy00Gx0vqIdBFbR4kCBCI8ZGqq7khYiH9b8JBvTcX1NniTENRA+gInR/e8 K5wP2gPBO1Eg2TSOgKqKOpbLGBu9ITCilpNkVIlIFUE0FwlRtbc2oNKm/8lI2xdYaKua p/3Cwp8BKZOtPL+mwYQySUHzYiVCZJ6NXG4NnPXx7NDc6qtLV9X+jqYNQMWA9GvcNkoS bujg== X-Gm-Message-State: ALoCoQkACq3r9efjbT0lSnzVZ7JC+QAMLGn11F7mBn4WIMmdKXSDzI1mYPcaZg8Cr1qoH79tYIm0 X-Received: by 10.180.8.74 with SMTP id p10mr1035830wia.3.1440515592788; Tue, 25 Aug 2015 08:13:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.36 with SMTP id v4ls177208laj.109.gmail; Tue, 25 Aug 2015 08:13:12 -0700 (PDT) X-Received: by 10.152.6.231 with SMTP id e7mr26322003laa.78.1440515592604; Tue, 25 Aug 2015 08:13:12 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id ph9si16241532lbb.120.2015.08.25.08.13.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Aug 2015 08:13:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbcbn3 with SMTP id bn3so101517896lbc.2 for ; Tue, 25 Aug 2015 08:13:12 -0700 (PDT) X-Received: by 10.112.63.138 with SMTP id g10mr11237467lbs.106.1440515592436; Tue, 25 Aug 2015 08:13:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.162.200 with SMTP id yc8csp3246522lbb; Tue, 25 Aug 2015 08:13:11 -0700 (PDT) X-Received: by 10.13.249.196 with SMTP id j187mr37721690ywf.173.1440515590213; Tue, 25 Aug 2015 08:13:10 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g71si21298695qge.44.2015.08.25.08.13.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 25 Aug 2015 08:13:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:60792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUFuP-0005b3-8s for patch@linaro.org; Tue, 25 Aug 2015 11:13:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUFiB-0001mR-JY for qemu-devel@nongnu.org; Tue, 25 Aug 2015 11:00:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUFi7-0001WH-Bt for qemu-devel@nongnu.org; Tue, 25 Aug 2015 11:00:31 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34989) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUFi7-0001NR-4W for qemu-devel@nongnu.org; Tue, 25 Aug 2015 11:00:27 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZUFhx-0004Ki-Hq for qemu-devel@nongnu.org; Tue, 25 Aug 2015 16:00:17 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 25 Aug 2015 16:00:10 +0100 Message-Id: <1440514816-16562-15-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1440514816-16562-1-git-send-email-peter.maydell@linaro.org> References: <1440514816-16562-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 14/20] 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Wei Huang 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 Message-id: 1439485767-20259-3-git-send-email-wei@redhat.com [PMM: Added missing braces on if ()] Signed-off-by: Peter Maydell --- default-configs/arm-softmmu.mak | 1 + hw/arm/virt.c | 26 ++++++++++++++++++++++++++ qemu-options.hx | 2 +- 3 files changed, 28 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 d5a8417..bbd061b 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -50,6 +50,7 @@ #include "hw/arm/fdt.h" #include "hw/intc/arm_gic_common.h" #include "kvm_arm.h" +#include "hw/smbios/smbios.h" /* Number of external interrupt lines to configure the GIC with */ #define NUM_IRQS 256 @@ -788,12 +789,37 @@ 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