From patchwork Fri Sep 4 15:05:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 53116 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 2124522E23 for ; Fri, 4 Sep 2015 15:18:13 +0000 (UTC) Received: by wicuu12 with SMTP id uu12sf7447481wic.2 for ; Fri, 04 Sep 2015 08:18: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=ecspBlNSLCrN0UvvAgBjBX3542WWGkMpotpRvgvzwy8=; b=KLf6FZeapWsPQXzWCJavtEdt69i2AonQD02yk6uz0EMbuPllgOEsLZ/grssMloHHvh +Scz/RMzg2aMihh1qZGpdlxAWFQESlwB8yAo5IdQ7h+gQN/POm52+6opsrniOReWrGTf fl+vmP8pwFD1EgoZpLJKvyjIioEFQ8GGxlVIytZJ023pG52IjmtTQVM1sAi2XMo5RYbh Bu7THeHCJACnnSx5fQTPxpdEQoURle6bUVJ+6WDyxLncNYmdtVVc+DHpCUZsJl1R+2bH IbyWGwCLaNf/X/2Htct6oXe5XBE5it7hVUNxI4AduJH8lggbB+Ay0IgnE5jj7RuDZSXO ArBA== X-Gm-Message-State: ALoCoQnIpmwe1HRD/nIOcExubbNDJ2vW9d2GljRUH8J+Fh21l4wHIsUyDXTT4W/N/VnsD++iWUhg X-Received: by 10.180.79.66 with SMTP id h2mr1234637wix.3.1441379892403; Fri, 04 Sep 2015 08:18:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.4.43 with SMTP id cb11ls6051lad.65.gmail; Fri, 04 Sep 2015 08:18:12 -0700 (PDT) X-Received: by 10.152.21.130 with SMTP id v2mr4209457lae.48.1441379892083; Fri, 04 Sep 2015 08:18:12 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id pk4si2588154lbb.17.2015.09.04.08.18.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Sep 2015 08:18:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lanb10 with SMTP id b10so15507622lan.3 for ; Fri, 04 Sep 2015 08:18:12 -0700 (PDT) X-Received: by 10.152.22.133 with SMTP id d5mr4182741laf.112.1441379891867; Fri, 04 Sep 2015 08:18:11 -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.164.42 with SMTP id yn10csp2052598lbb; Fri, 4 Sep 2015 08:18:10 -0700 (PDT) X-Received: by 10.140.16.74 with SMTP id 68mr5932201qga.7.1441379890642; Fri, 04 Sep 2015 08:18:10 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id p28si3103042qkh.92.2015.09.04.08.18.10 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 04 Sep 2015 08:18: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]:60642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXskj-00053u-Oz for patch@linaro.org; Fri, 04 Sep 2015 11:18:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXsZD-00009J-R6 for qemu-devel@nongnu.org; Fri, 04 Sep 2015 11:06:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXsZ7-0000py-H3 for qemu-devel@nongnu.org; Fri, 04 Sep 2015 11:06:15 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:35023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXsZ7-0000iE-AJ for qemu-devel@nongnu.org; Fri, 04 Sep 2015 11:06:09 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZXsYu-0006FM-LV for qemu-devel@nongnu.org; Fri, 04 Sep 2015 16:05:56 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 4 Sep 2015 16:05:41 +0100 Message-Id: <1441379156-23939-13-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1441379156-23939-1-git-send-email-peter.maydell@linaro.org> References: <1441379156-23939-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 12/27] 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.215.50 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: 1440615870-9518-3-git-send-email-wei@redhat.com [PMM: Added missing braces around an if().] Reviewed-by: Peter Maydell 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