From patchwork Tue Apr 7 19:51:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 458765 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 879C2140213 for ; Wed, 8 Apr 2015 05:52:40 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=VvCXn2m4; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost ([::1]:48557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfZY6-0002sg-LH for incoming@patchwork.ozlabs.org; Tue, 07 Apr 2015 15:52:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60659) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfZXT-0001cT-3n for qemu-devel@nongnu.org; Tue, 07 Apr 2015 15:52:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YfZXS-0002Fx-22 for qemu-devel@nongnu.org; Tue, 07 Apr 2015 15:51:59 -0400 Received: from mail-ob0-x22b.google.com ([2607:f8b0:4003:c01::22b]:35759) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfZXR-0002Fj-S2 for qemu-devel@nongnu.org; Tue, 07 Apr 2015 15:51:57 -0400 Received: by obbfy7 with SMTP id fy7so106889851obb.2 for ; Tue, 07 Apr 2015 12:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=wgqisjyUUYH210w++TEUqmuJP9JHgFqLN8UuA6Ix4n8=; b=VvCXn2m4NWqdKYi7OE/+e6gRG7BBRO/Obv0REykaA4arLvsqHtekdhcj3A1/Q1xiYS nF3zXaJ3JubjhtXCGh6QcWM8k8pcB5YcuSBnNskHR3ecRnDZ06G5YcGWoKsh1RxnUJsv UldsUxFM+t9w/eMUH2PWHWS9plAyFBKlNsBZ7T/EHuR5e4vdtrcj/FTg+sA3T/6QTO/Y AVj+gvuZN52AtPwV9rQiurUbBNM0+5q+Hl7mac1wxLQ325xEm+SsvdApemfDNlcUIAow H1BjynJxhw9H53KKjL7+BnAmebFSY2Ex9NTSZ4meqoFROz1iOd9Oi8dKhDHdKUCRELVR kUow== X-Received: by 10.60.149.166 with SMTP id ub6mr27406832oeb.41.1428436317431; Tue, 07 Apr 2015 12:51:57 -0700 (PDT) Received: from t430.minyard.home (pool-173-57-158-30.dllstx.fios.verizon.net. [173.57.158.30]) by mx.google.com with ESMTPSA id nt2sm6805407obb.23.2015.04.07.12.51.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Apr 2015 12:51:54 -0700 (PDT) Received: from t430.minyard.home (t430.minyard.home [127.0.0.1]) by t430.minyard.home (8.14.7/8.14.7) with ESMTP id t37JpqEB024690; Tue, 7 Apr 2015 14:51:52 -0500 Received: (from cminyard@localhost) by t430.minyard.home (8.14.7/8.14.7/Submit) id t37JpqWO024689; Tue, 7 Apr 2015 14:51:52 -0500 From: minyard@acm.org To: qemu-devel@nongnu.org Date: Tue, 7 Apr 2015 14:51:40 -0500 Message-Id: <1428436304-24044-12-git-send-email-minyard@acm.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1428436304-24044-1-git-send-email-minyard@acm.org> References: <1428436304-24044-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::22b Cc: Corey Minyard Subject: [Qemu-devel] [PATCH 11/15] pc: Postpone SMBIOS table installation to post machine init 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 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 | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index a8e6be1..efe3c2f 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -680,8 +680,6 @@ static unsigned int pc_apic_id_limit(unsigned int max_cpus) static FWCfgState *bochs_bios_init(void) { FWCfgState *fw_cfg; - uint8_t *smbios_tables, *smbios_anchor; - size_t smbios_tables_len, smbios_anchor_len; uint64_t *numa_fw_cfg; int i, j; unsigned int apic_id_limit = pc_apic_id_limit(max_cpus); @@ -707,21 +705,6 @@ static FWCfgState *bochs_bios_init(void) acpi_tables, acpi_tables_len); fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override()); - smbios_tables = smbios_get_table_legacy(&smbios_tables_len); - if (smbios_tables) { - fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, - smbios_tables, smbios_tables_len); - } - - smbios_get_tables(&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); - } - 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, @@ -1119,7 +1102,25 @@ void pc_guest_info_machine_done(Notifier *notifier, void *data) PcGuestInfoState *guest_info_state = container_of(notifier, PcGuestInfoState, machine_done); + uint8_t *smbios_tables, *smbios_anchor; + size_t smbios_tables_len, smbios_anchor_len; + FWCfgState *fw_cfg = guest_info_state->info.fw_cfg; + acpi_setup(&guest_info_state->info); + + smbios_tables = smbios_get_table_legacy(&smbios_tables_len); + if (smbios_tables) { + fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, + smbios_tables, smbios_tables_len); + } + smbios_get_tables(&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); + } } PcGuestInfo *pc_guest_info_init(ram_addr_t below_4g_mem_size,