From patchwork Tue Oct 8 10:52:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 11179379 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E0FF139A for ; Tue, 8 Oct 2019 10:57:59 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2E09F20673 for ; Tue, 8 Oct 2019 10:57:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E09F20673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHnBm-0006Q2-As for patchwork-qemu-devel@patchwork.kernel.org; Tue, 08 Oct 2019 06:57:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46602) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHn7P-0001sL-AR for qemu-devel@nongnu.org; Tue, 08 Oct 2019 06:53:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHn7N-0003kz-Nj for qemu-devel@nongnu.org; Tue, 08 Oct 2019 06:53:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49714) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iHn7N-0003kI-Hx for qemu-devel@nongnu.org; Tue, 08 Oct 2019 06:53:25 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C89E5300CA4B; Tue, 8 Oct 2019 10:53:24 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-109.rdu2.redhat.com [10.10.120.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id 062DA5D9C9; Tue, 8 Oct 2019 10:53:22 +0000 (UTC) From: Laszlo Ersek To: qemu devel list Subject: [PATCH 1/4] fw_cfg: bump file slots to 40 Date: Tue, 8 Oct 2019 12:52:56 +0200 Message-Id: <20191008105259.5378-2-lersek@redhat.com> In-Reply-To: <20191008105259.5378-1-lersek@redhat.com> References: <20191008105259.5378-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 08 Oct 2019 10:53:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Gerd Hoffmann , Paolo Bonzini , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" I count approximately 30 additions of named fw_cfg files, with fw_cfg_add_file() / fw_cfg_add_file_callback() / fw_cfg_modify_file(). On top of those, vgaroms/* and genroms/* files are added with invocations of rom_add_vga() and rom_add_option(). While it's pretty unlikely that a QEMU cmdline causes all of those named files to be added simultaneously, it now seems prudent to bump FW_CFG_FILE_SLOTS_DFLT from 32 to a higher value. Increment it by 8. Cc: Eduardo Habkost Cc: Gerd Hoffmann Cc: Igor Mammedov Cc: Marcel Apfelbaum Cc: Paolo Bonzini Cc: Philippe Mathieu-Daudé Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1515 Signed-off-by: Laszlo Ersek --- hw/core/machine.c | 2 ++ hw/nvram/fw_cfg.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 1689ad3bf8af..fefc9e1f0dd0 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -29,6 +29,8 @@ GlobalProperty hw_compat_4_1[] = { { "virtio-pci", "x-pcie-flr-init", "off" }, + { "fw_cfg_mem", "x-file-slots", "0x20" }, + { "fw_cfg_io", "x-file-slots", "0x20" }, }; const size_t hw_compat_4_1_len = G_N_ELEMENTS(hw_compat_4_1); diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 7dc3ac378ee0..cd785fad93b1 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -40,7 +40,7 @@ #include "qemu/cutils.h" #include "qapi/error.h" -#define FW_CFG_FILE_SLOTS_DFLT 0x20 +#define FW_CFG_FILE_SLOTS_DFLT 0x28 /* FW_CFG_VERSION bits */ #define FW_CFG_VERSION 0x01 From patchwork Tue Oct 8 10:52:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 11179369 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8FB89139A for ; Tue, 8 Oct 2019 10:55:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 701D220673 for ; Tue, 8 Oct 2019 10:55:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 701D220673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53619 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHn9I-0003YU-Pc for patchwork-qemu-devel@patchwork.kernel.org; Tue, 08 Oct 2019 06:55:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46627) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHn7T-0001tD-PF for qemu-devel@nongnu.org; Tue, 08 Oct 2019 06:53:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHn7P-0003nt-J3 for qemu-devel@nongnu.org; Tue, 08 Oct 2019 06:53:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48220) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iHn7P-0003m6-Au for qemu-devel@nongnu.org; Tue, 08 Oct 2019 06:53:27 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 90F2D30BEBE6; Tue, 8 Oct 2019 10:53:26 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-109.rdu2.redhat.com [10.10.120.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2FC4B5D9C9; Tue, 8 Oct 2019 10:53:24 +0000 (UTC) From: Laszlo Ersek To: qemu devel list Subject: [PATCH 2/4] target/i386: remove useless enable_compat_apic_id_mode() prototype Date: Tue, 8 Oct 2019 12:52:57 +0200 Message-Id: <20191008105259.5378-3-lersek@redhat.com> In-Reply-To: <20191008105259.5378-1-lersek@redhat.com> References: <20191008105259.5378-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 08 Oct 2019 10:53:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Richard Henderson , Eduardo Habkost , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The enable_compat_apic_id_mode() function definition was removed earlier; there are no callers left. Remove the function declaration too. Cc: Eduardo Habkost Cc: Igor Mammedov Cc: Paolo Bonzini Cc: Richard Henderson Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1515 Signed-off-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daudé --- target/i386/cpu.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index eaa5395aa539..c9ab1a367939 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2126,8 +2126,6 @@ void x86_cpu_set_default_version(X86CPUVersion version); /* Return name of 32-bit register, from a R_* constant */ const char *get_register_name_32(unsigned int reg); -void enable_compat_apic_id_mode(void); - #define APIC_DEFAULT_ADDRESS 0xfee00000 #define APIC_SPACE_SIZE 0x100000 From patchwork Tue Oct 8 10:52:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 11179373 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CBB6D1709 for ; Tue, 8 Oct 2019 10:55:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AADF420673 for ; Tue, 8 Oct 2019 10:55:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AADF420673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHn9P-0003o1-VX for patchwork-qemu-devel@patchwork.kernel.org; Tue, 08 Oct 2019 06:55:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46640) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHn7X-0001tc-2N for qemu-devel@nongnu.org; Tue, 08 Oct 2019 06:53:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHn7V-0003pp-KH for qemu-devel@nongnu.org; Tue, 08 Oct 2019 06:53:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48252) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iHn7U-0003pO-7O for qemu-devel@nongnu.org; Tue, 08 Oct 2019 06:53:32 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 77EB430860A5; Tue, 8 Oct 2019 10:53:31 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-109.rdu2.redhat.com [10.10.120.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB10D5D9C9; Tue, 8 Oct 2019 10:53:26 +0000 (UTC) From: Laszlo Ersek To: qemu devel list Subject: [PATCH 3/4] hw/i386: add facility to expose CPU topology over fw-cfg Date: Tue, 8 Oct 2019 12:52:58 +0200 Message-Id: <20191008105259.5378-4-lersek@redhat.com> In-Reply-To: <20191008105259.5378-1-lersek@redhat.com> References: <20191008105259.5378-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 08 Oct 2019 10:53:31 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" FW_CFG_MAX_CPUS exposes the (exclusive) maximum APIC ID to guest firmware, due to historical reasons. That value is not useful to edk2, however. For supporting VCPU hotplug, edk2 needs: - the boot CPU count (already exposed in FW_CFG_NB_CPUS), - and the maximum foreseen CPU count (tracked in "MachineState.smp.max_cpus", but not currently exposed). Add a new fw-cfg file to expose "max_cpus". While at it, expose the rest of the topology too (die / core / thread counts), because I expect that the VCPU hotplug feature for OVMF will ultimately need those too, and the data size is not large. This is slightly complicated by the fact that the die count is specific to PCMachineState, but fw_cfg_arch_create() intends to be PC-independent (see commit 149c50cabcc4). For now, the feature is temporarily disabled. Cc: "Michael S. Tsirkin" Cc: Eduardo Habkost Cc: Igor Mammedov Cc: Marcel Apfelbaum Cc: Paolo Bonzini Cc: Philippe Mathieu-Daudé Cc: Richard Henderson Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1515 Signed-off-by: Laszlo Ersek Reviewed-by: Philippe Mathieu-Daudé --- hw/i386/fw_cfg.h | 30 +++++++++++++++++++++++++++++- hw/i386/fw_cfg.c | 26 ++++++++++++++++++++++++-- hw/i386/pc.c | 4 ++-- 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/hw/i386/fw_cfg.h b/hw/i386/fw_cfg.h index e0856a376996..d742435b9793 100644 --- a/hw/i386/fw_cfg.h +++ b/hw/i386/fw_cfg.h @@ -18,9 +18,37 @@ #define FW_CFG_E820_TABLE (FW_CFG_ARCH_LOCAL + 3) #define FW_CFG_HPET (FW_CFG_ARCH_LOCAL + 4) +/** + * FWCfgX86Topology: expose the X86 CPU topology to guest firmware over fw-cfg. + * + * All fields have little-endian encoding. + * + * @dies: Number of dies per package (aka socket). Set it to 1 unless the + * concrete MachineState subclass defines it differently. + * @cores: Corresponds to @CpuTopology.@cores. + * @threads: Corresponds to @CpuTopology.@threads. + * @max_cpus: Corresponds to @CpuTopology.@max_cpus. + * + * Firmware can derive the package (aka socket) count with the following + * formula: + * + * DIV_ROUND_UP(@max_cpus, @dies * @cores * @threads) + * + * Firmware can derive APIC ID field widths and offsets per the standard + * calculations in "include/hw/i386/topology.h". + */ +typedef struct FWCfgX86Topology { + uint32_t dies; + uint32_t cores; + uint32_t threads; + uint32_t max_cpus; +} QEMU_PACKED FWCfgX86Topology; + FWCfgState *fw_cfg_arch_create(MachineState *ms, uint16_t boot_cpus, - uint16_t apic_id_limit); + uint16_t apic_id_limit, + unsigned smp_dies, + bool expose_topology); void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg); void fw_cfg_build_feature_control(MachineState *ms, FWCfgState *fw_cfg); diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index 39b6bc60520c..33d09875014f 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -85,9 +85,26 @@ void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg) } } +static void fw_cfg_expose_topology(FWCfgState *fw_cfg, + unsigned dies, + unsigned cores, + unsigned threads, + unsigned max_cpus) +{ + FWCfgX86Topology *topo = g_new(FWCfgX86Topology, 1); + + topo->dies = cpu_to_le32(dies); + topo->cores = cpu_to_le32(cores); + topo->threads = cpu_to_le32(threads); + topo->max_cpus = cpu_to_le32(max_cpus); + fw_cfg_add_file(fw_cfg, "etc/x86-smp-topology", topo, sizeof *topo); +} + FWCfgState *fw_cfg_arch_create(MachineState *ms, - uint16_t boot_cpus, - uint16_t apic_id_limit) + uint16_t boot_cpus, + uint16_t apic_id_limit, + unsigned smp_dies, + bool expose_topology) { FWCfgState *fw_cfg; uint64_t *numa_fw_cfg; @@ -143,6 +160,11 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms, (1 + apic_id_limit + nb_numa_nodes) * sizeof(*numa_fw_cfg)); + if (expose_topology) { + fw_cfg_expose_topology(fw_cfg, smp_dies, ms->smp.cores, + ms->smp.threads, ms->smp.max_cpus); + } + return fw_cfg; } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index bcda50efcc23..bb72b12edad2 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1738,8 +1738,8 @@ void pc_memory_init(PCMachineState *pcms, option_rom_mr, 1); - fw_cfg = fw_cfg_arch_create(machine, - pcms->boot_cpus, pcms->apic_id_limit); + fw_cfg = fw_cfg_arch_create(machine, pcms->boot_cpus, pcms->apic_id_limit, + pcms->smp_dies, false); rom_set_fw(fw_cfg); From patchwork Tue Oct 8 10:52:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 11179375 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F638139A for ; Tue, 8 Oct 2019 10:55:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 80AA620673 for ; Tue, 8 Oct 2019 10:55:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80AA620673 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHn9R-0003qC-LL for patchwork-qemu-devel@patchwork.kernel.org; Tue, 08 Oct 2019 06:55:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46659) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iHn7b-0001uT-D0 for qemu-devel@nongnu.org; Tue, 08 Oct 2019 06:53:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iHn7Z-0003ro-MJ for qemu-devel@nongnu.org; Tue, 08 Oct 2019 06:53:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56338) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iHn7Z-0003rE-ER for qemu-devel@nongnu.org; Tue, 08 Oct 2019 06:53:37 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7AD703175281; Tue, 8 Oct 2019 10:53:36 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-109.rdu2.redhat.com [10.10.120.109]) by smtp.corp.redhat.com (Postfix) with ESMTP id 789375D9C9; Tue, 8 Oct 2019 10:53:34 +0000 (UTC) From: Laszlo Ersek To: qemu devel list Subject: [PATCH 4/4] hw/i386/pc: expose CPU topology over fw-cfg Date: Tue, 8 Oct 2019 12:52:59 +0200 Message-Id: <20191008105259.5378-5-lersek@redhat.com> In-Reply-To: <20191008105259.5378-1-lersek@redhat.com> References: <20191008105259.5378-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 08 Oct 2019 10:53:36 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , Paolo Bonzini , Igor Mammedov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Enable the small feature added in the last patch on 4.2+ PC machine types. Cc: "Michael S. Tsirkin" Cc: Eduardo Habkost Cc: Igor Mammedov Cc: Marcel Apfelbaum Cc: Paolo Bonzini Cc: Philippe Mathieu-Daudé Cc: Richard Henderson Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1515 Signed-off-by: Laszlo Ersek --- include/hw/i386/pc.h | 3 +++ hw/i386/pc.c | 3 ++- hw/i386/pc_piix.c | 2 ++ hw/i386/pc_q35.c | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 6df4f4b6fbe7..96af441453bc 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -144,6 +144,9 @@ typedef struct PCMachineClass { /* Enables contiguous-apic-ID mode */ bool compat_apic_id_mode; + + /* expose x86 CPU topology over fw_cfg */ + bool fwcfg_topology; } PCMachineClass; #define TYPE_PC_MACHINE "generic-pc-machine" diff --git a/hw/i386/pc.c b/hw/i386/pc.c index bb72b12edad2..12b13ba0e1c5 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1739,7 +1739,7 @@ void pc_memory_init(PCMachineState *pcms, 1); fw_cfg = fw_cfg_arch_create(machine, pcms->boot_cpus, pcms->apic_id_limit, - pcms->smp_dies, false); + pcms->smp_dies, pcmc->fwcfg_topology); rom_set_fw(fw_cfg); @@ -2798,6 +2798,7 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) pcmc->save_tsc_khz = true; pcmc->linuxboot_dma_enabled = true; pcmc->pvh_enabled = true; + pcmc->fwcfg_topology = true; assert(!mc->get_hotplug_handler); mc->get_hotplug_handler = pc_get_hotplug_handler; mc->hotplug_allowed = pc_hotplug_allowed; diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 6824b72124de..7fb87452889b 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -445,9 +445,11 @@ DEFINE_I440FX_MACHINE(v4_2, "pc-i440fx-4.2", NULL, static void pc_i440fx_4_1_machine_options(MachineClass *m) { + PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_i440fx_4_2_machine_options(m); m->alias = NULL; m->is_default = 0; + pcmc->fwcfg_topology = false; compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len); compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len); } diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 8fad20f3146a..3ec45659da02 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -377,8 +377,10 @@ DEFINE_Q35_MACHINE(v4_2, "pc-q35-4.2", NULL, static void pc_q35_4_1_machine_options(MachineClass *m) { + PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_q35_4_2_machine_options(m); m->alias = NULL; + pcmc->fwcfg_topology = false; compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len); compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len); }