From patchwork Thu May 19 15:23:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 9127871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C8DCC60453 for ; Thu, 19 May 2016 15:45:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC7A2281C2 for ; Thu, 19 May 2016 15:45:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B12BC281D1; Thu, 19 May 2016 15:45:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 82E45281C2 for ; Thu, 19 May 2016 15:45:53 +0000 (UTC) Received: from localhost ([::1]:51056 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Q92-0000ve-Kr for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 May 2016 11:45:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Po7-0007Be-TY for qemu-devel@nongnu.org; Thu, 19 May 2016 11:24:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3Po1-0001B2-SS for qemu-devel@nongnu.org; Thu, 19 May 2016 11:24:15 -0400 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:36679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Po1-0001Ax-Nw for qemu-devel@nongnu.org; Thu, 19 May 2016 11:24:09 -0400 Received: by mail-oi0-x244.google.com with SMTP id g16so3563944oib.3 for ; Thu, 19 May 2016 08:24:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=frcDSYIVB3YKEOmRVCH8ew2TTpaxXHX3r5VRaJNqBY8=; b=u1YpZbR27oZ1ik+At/xKNeq4lEXRn5TadFTBXSK1+/Y7VzFNYO6skGEnX/qhJcUJu4 Nh+gRXir9fpaoDAyTIw4l7XSfYFhz50CAoBHJqUFNm12kuLsI97oHONme0ILUjLUyF9Q n6FG1YWW5NJHjljroOxSQ++Ia6ZiruIMmuLryU7ipaaACqRsQvHHvvvkXMgWJTYpN88m o2rVsRiHd9or9lFbH3//pTUY7RcQWuqzIGP+Y8owqxlgBgOU+mY4FSTZa746n5Q5ot3m rmUDjCAeLZR7oNAMZQgOIyIJeVgwPeCZsH2Kz4bCMyZ0iqz8Wsf57LvDVY4Gl7rA+eL7 1YOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=frcDSYIVB3YKEOmRVCH8ew2TTpaxXHX3r5VRaJNqBY8=; b=JYBcXa25XB/H6QVu7nelLgEmgfKmRQojQ3nx7N152GsfV0xZg9xS35Qyold3lyXbkO c6/nlTyd6FdrigAWaOl9Ad4u/k7GtiUaNpPoeCnvdAYR+E6VfE+OH0JPHMAbflUDXdMo UGXMeV6Uf5MuHDe+ExzbSDPg/orxeLNcCEHxLizeuAZrAxZJoHUeCgdqIzBRKiVZ/Lqr ZZl9+KJF7FDxexu0YhMuvnBHp6a2ocjyhDtqzrdb1YIg0Ifuta9B0oo6Mp4pVmXCE+Bd /tpXAJulbotA61OadxSoVI+phIQFAI9yqF9DTnIRvMgNos09MI9yHbpWCfgS/BozKuCS kd6A== X-Gm-Message-State: AOPr4FWXXNkAdofdeB9/BKVyiGT9xQaT3BItxythu0XdEKtQdS8jx6yiJA1czIKym5zkzg== X-Received: by 10.202.93.133 with SMTP id r127mr7750822oib.100.1463671449324; Thu, 19 May 2016 08:24:09 -0700 (PDT) Received: from serve.minyard.net ([108.19.215.157]) by smtp.gmail.com with ESMTPSA id t92sm3964444otb.30.2016.05.19.08.24.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 08:24:06 -0700 (PDT) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id BF7D6199F; Thu, 19 May 2016 10:24:05 -0500 (CDT) Received: by t430.minyard.net (Postfix, from userid 1000) id 553D2300538; Thu, 19 May 2016 10:24:04 -0500 (CDT) From: minyard@acm.org To: Igor Mammedov , "Michael S . Tsirkin" , Paolo Bonzini , qemu-devel@nongnu.org, minyard@acm.org, cminyard@mvista.com Date: Thu, 19 May 2016 10:23:58 -0500 Message-Id: <1463671442-15631-3-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1463671442-15631-1-git-send-email-minyard@acm.org> References: <1463671442-15631-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::244 Subject: [Qemu-devel] [PATCH v5 2/6] pc: Postpone SMBIOS table installation to post machine init X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Corey Minyard This is the same place that the ACPI SSDT table gets added, so that devices can add themselves to the SMBIOS table. Signed-off-by: Corey Minyard --- hw/i386/pc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 99437e0..5e78ef4 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -764,8 +764,6 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, PCMachineState *pcms) acpi_tables, acpi_tables_len); fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override()); - pc_build_smbios(fw_cfg); - fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE, &e820_reserve, sizeof(e820_reserve)); fw_cfg_add_file(fw_cfg, "etc/e820", e820_table, @@ -1161,6 +1159,7 @@ void pc_machine_done(Notifier *notifier, void *data) { PCMachineState *pcms = container_of(notifier, PCMachineState, machine_done); + FWCfgState *fw_cfg = pcms->fw_cfg; PCIBus *bus = pcms->bus; if (bus) { @@ -1172,15 +1171,17 @@ void pc_machine_done(Notifier *notifier, void *data) extra_hosts++; } } - if (extra_hosts && pcms->fw_cfg) { + if (extra_hosts && fw_cfg) { uint64_t *val = g_malloc(sizeof(*val)); *val = cpu_to_le64(extra_hosts); - fw_cfg_add_file(pcms->fw_cfg, - "etc/extra-pci-roots", val, sizeof(*val)); + fw_cfg_add_file(fw_cfg, "etc/extra-pci-roots", val, sizeof(*val)); } } acpi_setup(); + if (fw_cfg) { + pc_build_smbios(fw_cfg); + } } void pc_guest_info_init(PCMachineState *pcms)