From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560439364; cv=none; d=zoho.com; s=zohoarc; b=bfzvklLHYfAlZFwlIrflTQXY8CE5+Rjrp1gM+ycIOJhNGsFBTooOIz3jlRK0XjW4C9naLEe4K9NF3RPxCyVCx9ZZHIvLECJjzmiieHJC0t8kGm/czILn9SNZZzgtVqLXRzLDm71tiMFEjaYz00/QAoA1NYcL0fTraO6vYi0Gwak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560439364; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=PxAY1EVBuz8vUbrkr3OC5iAKFXhLiiGgXC8HShSjYp4=; b=nnjxDFh2AALNpk7mg1hvsxK+UQu2eqImUuQnBQ81xNKyKALTNNKtDMg1sV4QMFZ592Xd9KvjqoUPvFRamE5lwHTVpLOXp8XuweBnJ2+5ilEhgkuday3brgUfjcxMCTpNkKJ/g6RSnAOV/p0UXqukiZbijDRcfuS8ZFllOVJ+jiI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560439364038198.76520202689846; Thu, 13 Jun 2019 08:22:44 -0700 (PDT) Received: from localhost ([::1]:40848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbRYp-0005l2-1W for importer@patchew.org; Thu, 13 Jun 2019 11:22:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42525) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQph-0001Z9-N2 for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQpf-0001YG-WA for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37932) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQpf-0000fM-KQ for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:03 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B37CC30BBE97; Thu, 13 Jun 2019 14:35:07 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 52FA31001B3A; Thu, 13 Jun 2019 14:35:01 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:27 +0200 Message-Id: <20190613143446.23937-2-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 13 Jun 2019 14:35:16 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 01/20] hw/i386/pc: Use unsigned type to index arrays 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Li Qiang , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Reviewed-by: Li Qiang Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 5 +++-- include/hw/i386/pc.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 2c5446b095..bb3c74f4ca 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -874,7 +874,7 @@ static void handle_a20_line_change(void *opaque, int ir= q, int level) =20 int e820_add_entry(uint64_t address, uint64_t length, uint32_t type) { - int index =3D le32_to_cpu(e820_reserve.count); + unsigned int index =3D le32_to_cpu(e820_reserve.count); struct e820_entry *entry; =20 if (type !=3D E820_RAM) { @@ -906,7 +906,8 @@ int e820_get_num_entries(void) return e820_entries; } =20 -bool e820_get_entry(int idx, uint32_t type, uint64_t *address, uint64_t *l= ength) +bool e820_get_entry(unsigned int idx, uint32_t type, + uint64_t *address, uint64_t *length) { if (idx < e820_entries && e820_table[idx].type =3D=3D cpu_to_le32(type= )) { *address =3D le64_to_cpu(e820_table[idx].address); diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index a7d0b87166..3b3a0d6e59 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -291,7 +291,7 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, =20 int e820_add_entry(uint64_t, uint64_t, uint32_t); int e820_get_num_entries(void); -bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); +bool e820_get_entry(unsigned int, uint32_t, uint64_t *, uint64_t *); =20 extern GlobalProperty pc_compat_4_0_1[]; extern const size_t pc_compat_4_0_1_len; --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560441228; cv=none; d=zoho.com; s=zohoarc; b=D0rHv0dLn7AxUWj4x5bz8hHMt8gi3oty33Fhank+r7HwKQr1Ai/Am0j3SWIcTZ9Ja8en/KmsTQT7rqUDRpfCF//M1+4QOerYvABUaDkQMzQUAfavq8C8z9bWfoF3eeOo/jMn4gX/1d+2iA2XNcvbnclq+oAiWU8KYAT6akHiFys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560441228; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Qwa0rdHdhX3tNKERFYAkOmllLLU1DCX9lI5lFo9zUMo=; b=L/jHOkRLbNz50P9Pd17m7YqGZ23r7JCqoISTyv5DIpAL3I48bPUA7jn9ZMNF4qFG9S7Vxo+LIEY5l+Qpjl6wwjOoa7pc4bcPukllOQdDO5Y1Evbh7BX2elPuiXwiCIJBJ8AC4d4t8LVXh+pHYJRHDqKjk2xpe2Iy4JNlgGTSWk0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560441228414979.2551256173003; Thu, 13 Jun 2019 08:53:48 -0700 (PDT) Received: from localhost ([::1]:41146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbS2r-00067L-C9 for importer@patchew.org; Thu, 13 Jun 2019 11:53:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42577) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQpi-0001b5-QM for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQpg-0001ZV-NX for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38792) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQpg-00013Z-5h for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:04 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E678C30C31AA; Thu, 13 Jun 2019 14:35:24 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A8DD1001DC0; Thu, 13 Jun 2019 14:35:07 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:28 +0200 Message-Id: <20190613143446.23937-3-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 13 Jun 2019 14:35:31 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 02/20] hw/i386/pc: Use size_t type to hold/return a size of array 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Li Qiang , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Reviewed-by: Li Qiang Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 4 ++-- include/hw/i386/pc.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index bb3c74f4ca..ff0f6bbbb3 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -105,7 +105,7 @@ struct e820_table { =20 static struct e820_table e820_reserve; static struct e820_entry *e820_table; -static unsigned e820_entries; +static size_t e820_entries; struct hpet_fw_config hpet_cfg =3D {.count =3D UINT8_MAX}; =20 /* Physical Address of PVH entry point read from kernel ELF NOTE */ @@ -901,7 +901,7 @@ int e820_add_entry(uint64_t address, uint64_t length, u= int32_t type) return e820_entries; } =20 -int e820_get_num_entries(void) +size_t e820_get_num_entries(void) { return e820_entries; } diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 3b3a0d6e59..fc29893624 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -290,7 +290,7 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, #define E820_UNUSABLE 5 =20 int e820_add_entry(uint64_t, uint64_t, uint32_t); -int e820_get_num_entries(void); +size_t e820_get_num_entries(void); bool e820_get_entry(unsigned int, uint32_t, uint64_t *, uint64_t *); =20 extern GlobalProperty pc_compat_4_0_1[]; --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560439593; cv=none; d=zoho.com; s=zohoarc; b=mrricBFWUfAgYCQdqcVn6bwwjQY6AlKry0b5W5RGs/IerIyvVGnlzs1RBV4Dp1WH5OmOW9PYu3CuhUNoQFrmc+Sb7tY4SopPUqY2dc+oUWiX1RMyC1knonCGOXrUQ75/GRtkrKX3bKDTiEcTkhNxfYFS0vmIx6nSmMTg74LjbiU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560439593; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3Ao0mX3Ij1gVVde10C8a300EfS2Ar/6wUyGeYf2DgYY=; b=MnlA2uiSd2Gyc+cNdgr0SehhQ/HxPZKFVk/IyqjrG133SJW7LrL7ugYUL6/dCt4/itDo5FBFTyNV43ZNFsNld4dskvpiEQTWSX8R8eMAPc42bCcntHbOJn5+SdByYpECmupjLY5uaMmHtRuTI62RSuGMyXyxypjdiiRfq+Yr19k= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560439593067216.79682358122136; Thu, 13 Jun 2019 08:26:33 -0700 (PDT) Received: from localhost ([::1]:40882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbRcU-00029K-0d for importer@patchew.org; Thu, 13 Jun 2019 11:26:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42717) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQpl-0001f9-DW for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQpi-0001c7-7J for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59504) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQph-00017F-Rf for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:06 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ED86D85545; Thu, 13 Jun 2019 14:35:31 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 673F61001B2B; Thu, 13 Jun 2019 14:35:25 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:29 +0200 Message-Id: <20190613143446.23937-4-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 13 Jun 2019 14:35:37 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 03/20] hw/i386/pc: Let e820_add_entry() return a ssize_t type 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Li Qiang , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" e820_add_entry() returns an array size on success, or a negative value on error. Reviewed-by: Li Qiang Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 2 +- include/hw/i386/pc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index ff0f6bbbb3..5a7cffbb1a 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -872,7 +872,7 @@ static void handle_a20_line_change(void *opaque, int ir= q, int level) x86_cpu_set_a20(cpu, level); } =20 -int e820_add_entry(uint64_t address, uint64_t length, uint32_t type) +ssize_t e820_add_entry(uint64_t address, uint64_t length, uint32_t type) { unsigned int index =3D le32_to_cpu(e820_reserve.count); struct e820_entry *entry; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index fc29893624..c56116e6f6 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -289,7 +289,7 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, #define E820_NVS 4 #define E820_UNUSABLE 5 =20 -int e820_add_entry(uint64_t, uint64_t, uint32_t); +ssize_t e820_add_entry(uint64_t, uint64_t, uint32_t); size_t e820_get_num_entries(void); bool e820_get_entry(unsigned int, uint32_t, uint64_t *, uint64_t *); =20 --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560441400; cv=none; d=zoho.com; s=zohoarc; b=YCaREC/pWrg2Q1aVcVKGHOytJp//ZWIbZCxHCAsyUaijV/RWwBevcnNm0PWjJnDzRPgmp4ceoJkt2+3WXSvm0bZOWlKVoehYdjemuZfmuqldbd8tVCT6bdfuYF3u3h4bP9I+7mUQToXP+rGGilFzpMTHoE9roylT4mHTLDbIOjo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560441400; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=KKIKgA6Oh207wc2cEaotYYl18clreTqjjliG9bj4Igs=; b=cUS9dNUWkMFVtCP/h0RuEXzhAQnLRVtnr5a+ZrXm8okDIgvMZaopdDpbFH4sOWZXAN59B7L4MLIHuwT2YcgnRviozbUWaWjBABAsp1x8bslrcPsWyrN7ggSTdwc2VhZxUcD90sZvy68CaHqd4Ew9evsh6ibfNZyWkgP/GPMgt7g= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560441400357368.76715611314535; Thu, 13 Jun 2019 08:56:40 -0700 (PDT) Received: from localhost ([::1]:41196 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbS5Y-0001PU-Cl for importer@patchew.org; Thu, 13 Jun 2019 11:56:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42621) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQpj-0001cd-Gl for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQpg-0001YQ-3d for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38184) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQpf-00017y-L0 for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:03 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA27030BC599; Thu, 13 Jun 2019 14:35:37 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A4F51001B16; Thu, 13 Jun 2019 14:35:32 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:30 +0200 Message-Id: <20190613143446.23937-5-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 13 Jun 2019 14:35:37 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 04/20] hw/i386/pc: Add the E820Type enum type 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This ensure we won't use an incorrect value. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- v2: Do not cast the enum (Li) --- hw/i386/pc.c | 4 ++-- include/hw/i386/pc.h | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 5a7cffbb1a..86ba554439 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -872,7 +872,7 @@ static void handle_a20_line_change(void *opaque, int ir= q, int level) x86_cpu_set_a20(cpu, level); } =20 -ssize_t e820_add_entry(uint64_t address, uint64_t length, uint32_t type) +ssize_t e820_add_entry(uint64_t address, uint64_t length, E820Type type) { unsigned int index =3D le32_to_cpu(e820_reserve.count); struct e820_entry *entry; @@ -906,7 +906,7 @@ size_t e820_get_num_entries(void) return e820_entries; } =20 -bool e820_get_entry(unsigned int idx, uint32_t type, +bool e820_get_entry(unsigned int idx, E820Type type, uint64_t *address, uint64_t *length) { if (idx < e820_entries && e820_table[idx].type =3D=3D cpu_to_le32(type= )) { diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index c56116e6f6..7c07185dd5 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -282,12 +282,16 @@ void pc_system_firmware_init(PCMachineState *pcms, Me= moryRegion *rom_memory); void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, const CPUArchIdList *apic_ids, GArray *entry); =20 -/* e820 types */ -#define E820_RAM 1 -#define E820_RESERVED 2 -#define E820_ACPI 3 -#define E820_NVS 4 -#define E820_UNUSABLE 5 +/** + * E820Type: Type of the e820 address range. + */ +typedef enum { + E820_RAM =3D 1, + E820_RESERVED =3D 2, + E820_ACPI =3D 3, + E820_NVS =3D 4, + E820_UNUSABLE =3D 5 +} E820Type; =20 ssize_t e820_add_entry(uint64_t, uint64_t, uint32_t); size_t e820_get_num_entries(void); --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560439162; cv=none; d=zoho.com; s=zohoarc; b=XKiYHD1cZuoBEciPKRhfXUHyY/eOFjcNgMHlpk0/SuDr0WDziDkpdcEPWBtZ5La924tZsmylMtWYftdEMiWW4QYKPsfnGx+RT5xDcUCrcXM/B1uL4o1m5xkgcrpIliWvytn3IbQlP1h5+zilXOCZs87JRsn09jEw9wAXWcgENXU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560439162; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=yjqrpOTOd0mpcAWb28AbteVaFyPGEFTLGBVJqsRCkA8=; b=HBumlgFwRybtTO1VAE4VRH6Z6EMrnW4WQes5aREoaDqPJc31PKlrSC4ygx7KwuBmyl/loDUiuPn+HHFi7ote1MFtKcYp/YiEeBmNWx1Nl5nHG3E8FkCulMuNtzFepNfOk4mTb3cbNrbjVHplCCsunuMXXizsmVUJa9ixRx8buxs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560439162960692.8133291532037; Thu, 13 Jun 2019 08:19:22 -0700 (PDT) Received: from localhost ([::1]:40812 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbRVU-0001kp-UC for importer@patchew.org; Thu, 13 Jun 2019 11:19:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42430) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQpf-0001UI-6c for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQpc-0001VK-W6 for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37526) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQpZ-0001Kl-2Z for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:35:59 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6765030860BF; Thu, 13 Jun 2019 14:35:44 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 277E71001B0F; Thu, 13 Jun 2019 14:35:37 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:31 +0200 Message-Id: <20190613143446.23937-6-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 13 Jun 2019 14:35:49 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 05/20] hw/i386/pc: Add documentation to the e820_*() functions 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/i386/pc.h | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 7c07185dd5..fc66b61ff8 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -293,9 +293,42 @@ typedef enum { E820_UNUSABLE =3D 5 } E820Type; =20 -ssize_t e820_add_entry(uint64_t, uint64_t, uint32_t); +/** + * e820_add_entry: Add an #e820_entry to the @e820_table. + * + * Returns the number of entries of the e820_table on success, + * or a negative errno otherwise. + * + * @address: The base address of the structure which the BIOS is to fill i= n. + * @length: The length in bytes of the structure passed to the BIOS. + * @type: The #E820Type of the address range. + */ +ssize_t e820_add_entry(uint64_t address, uint64_t length, E820Type type); + +/** + * e820_get_num_entries: The number of entries of the @e820_table. + * + * Returns the number of entries of the e820_table. + */ size_t e820_get_num_entries(void); -bool e820_get_entry(unsigned int, uint32_t, uint64_t *, uint64_t *); + +/** + * e820_get_entry: Get the address/length of an #e820_entry. + * + * If the #e820_entry stored at @index is of #E820Type @type, fills @addre= ss + * and @length with the #e820_entry values and return @true. + * Return @false otherwise. + * + * @index: The index of the #e820_entry to get values. + * @type: The @E820Type of the address range expected. + * @address: Pointer to the base address of the #e820_entry structure to + * be filled. + * @length: Pointer to the length (in bytes) of the #e820_entry structure + * to be filled. + * @return: true if the entry was found, false otherwise. + */ +bool e820_get_entry(unsigned int index, E820Type type, + uint64_t *address, uint64_t *length); =20 extern GlobalProperty pc_compat_4_0_1[]; extern const size_t pc_compat_4_0_1_len; --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560441546; cv=none; d=zoho.com; s=zohoarc; b=BpDSXDQUSLltBZi402m7SeaQeRT8AWrCzyp2q/pIOn/IfO1kzjWrZP54XWVFr2no9GE51RsqP/a0Df9FH1DBZV+hJc7pVFMI6bnWGRmHB6y3uoSnCfiKSBLn4QuXLP7i1Ui8F31ONX8YJutP7pPzgqldm1wc3eZxViUrKGFV00Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560441546; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=ZaSbfz+O7JvNSTmlxfbGs/696DYRgrINorQdkG32afs=; b=FTx6JsjbIHLprubcy7kCTYqK0cmE7aygi5gGYfMUUgKRC76lcJff0cJAfMfLxMS4gdWJJV2eCVyLxmsXPQ5rka/08pJ84ARAvH+sWGydwDe1O4bTYpE7JUa1nfvo8NL39kyFzQW08/5tCpkJ1UizFMT94IYppksmw/M9rCLXD98= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560441546622816.2771580122902; Thu, 13 Jun 2019 08:59:06 -0700 (PDT) Received: from localhost ([::1]:41202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbS7z-0002uG-GH for importer@patchew.org; Thu, 13 Jun 2019 11:59:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42482) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQpg-0001Wm-Im for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQpf-0001XS-6R for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42140) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQpd-0001Tj-2u for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:02 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 22DE5CA1F5; Thu, 13 Jun 2019 14:35:49 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D5C401001B16; Thu, 13 Jun 2019 14:35:44 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:32 +0200 Message-Id: <20190613143446.23937-7-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 13 Jun 2019 14:35:59 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 06/20] hw/i386/pc: Use e820_get_num_entries() to access e820_entries 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Li Qiang , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" To be able to extract the e820* code out of this file (in the next patch), access e820_entries with its correct helper. Reviewed-by: Li Qiang Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 86ba554439..d9589eb771 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1024,7 +1024,7 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, = PCMachineState *pcms) 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, - sizeof(struct e820_entry) * e820_entries); + sizeof(struct e820_entry) * e820_get_num_entries()); =20 fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, &hpet_cfg, sizeof(hpet_cfg)); /* allocate memory for the NUMA channel: one (64bit) word for the numb= er --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560441976; cv=none; d=zoho.com; s=zohoarc; b=agaKlvnw8Vltx/yibA4mQ5e+1QDrj16CBPo97h2aLkvUaVnfiu46PvYq/JjRZvFhnLyBSnDHD4GQ12so9ohEo+RXs77kr1K8PpFEGAlEEmGTfguuX4W0RL7WPIIa8lNnrocLJUO6r30ehCjpht7dCow16ZVfsyoAuxclw9g8oU8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560441976; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=f5n04t3u5lIehVD/ebtEzxL87La004uLp2C5ezzRkgI=; b=RvuP697L1dxc21D2F6nAdRMFMw7R9ZFqcc3CJk9JKy0b6VNnMjGWA0S8XxqYkwA4Eqtr1/Aflft2Tx+gDYnCSHJbF3M8EiYIgtepyj6hgvgls0tzjY2xLCdD8GagHcNSNLGtRcjHMBCQLcl48/W1LnF5I1CPSgQR2So+u2CeYSo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560441976693895.9190199958038; Thu, 13 Jun 2019 09:06:16 -0700 (PDT) Received: from localhost ([::1]:41240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbSEv-00085V-Gm for importer@patchew.org; Thu, 13 Jun 2019 12:06:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42871) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQpv-0001hm-Rt for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQpi-0001cL-FC for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37776) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQph-0001ZA-QK for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:06 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0A63B30860C9; Thu, 13 Jun 2019 14:35:56 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9BA9A1001B2A; Thu, 13 Jun 2019 14:35:49 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:33 +0200 Message-Id: <20190613143446.23937-8-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 13 Jun 2019 14:36:04 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 07/20] hw/i386/pc: Extract e820 memory layout code 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Li Qiang , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Suggested-by: Samuel Ortiz Reviewed-by: Li Qiang Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/Makefile.objs | 2 +- hw/i386/e820_memory_layout.c | 60 ++++++++++++++++++++++++++++ hw/i386/e820_memory_layout.h | 76 ++++++++++++++++++++++++++++++++++++ hw/i386/pc.c | 62 +---------------------------- include/hw/i386/pc.h | 48 ----------------------- target/i386/kvm.c | 1 + 6 files changed, 139 insertions(+), 110 deletions(-) create mode 100644 hw/i386/e820_memory_layout.c create mode 100644 hw/i386/e820_memory_layout.h diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index 5d9c9efd5f..d3374e0831 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -1,5 +1,5 @@ obj-$(CONFIG_KVM) +=3D kvm/ -obj-y +=3D multiboot.o +obj-y +=3D e820_memory_layout.o multiboot.o obj-y +=3D pc.o obj-$(CONFIG_I440FX) +=3D pc_piix.o obj-$(CONFIG_Q35) +=3D pc_q35.o diff --git a/hw/i386/e820_memory_layout.c b/hw/i386/e820_memory_layout.c new file mode 100644 index 0000000000..240eafff02 --- /dev/null +++ b/hw/i386/e820_memory_layout.c @@ -0,0 +1,60 @@ +/* + * QEMU BIOS e820 routines + * + * Copyright (c) 2003-2004 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + */ + +#include "qemu/osdep.h" +#include "qemu/bswap.h" +#include "e820_memory_layout.h" + +static size_t e820_entries; +struct e820_table e820_reserve; +struct e820_entry *e820_table; + +ssize_t e820_add_entry(uint64_t address, uint64_t length, E820Type type) +{ + unsigned int index =3D le32_to_cpu(e820_reserve.count); + struct e820_entry *entry; + + if (type !=3D E820_RAM) { + /* old FW_CFG_E820_TABLE entry -- reservations only */ + if (index >=3D E820_NR_ENTRIES) { + return -EBUSY; + } + entry =3D &e820_reserve.entry[index++]; + + entry->address =3D cpu_to_le64(address); + entry->length =3D cpu_to_le64(length); + entry->type =3D cpu_to_le32(type); + + e820_reserve.count =3D cpu_to_le32(index); + } + + /* new "etc/e820" file -- include ram too */ + e820_table =3D g_renew(struct e820_entry, e820_table, e820_entries + 1= ); + e820_table[e820_entries].address =3D cpu_to_le64(address); + e820_table[e820_entries].length =3D cpu_to_le64(length); + e820_table[e820_entries].type =3D cpu_to_le32(type); + e820_entries++; + + return e820_entries; +} + +size_t e820_get_num_entries(void) +{ + return e820_entries; +} + +bool e820_get_entry(unsigned int idx, E820Type type, + uint64_t *address, uint64_t *length) +{ + if (idx < e820_entries && e820_table[idx].type =3D=3D cpu_to_le32(type= )) { + *address =3D le64_to_cpu(e820_table[idx].address); + *length =3D le64_to_cpu(e820_table[idx].length); + return true; + } + return false; +} diff --git a/hw/i386/e820_memory_layout.h b/hw/i386/e820_memory_layout.h new file mode 100644 index 0000000000..64e88e4772 --- /dev/null +++ b/hw/i386/e820_memory_layout.h @@ -0,0 +1,76 @@ +/* + * QEMU BIOS e820 routines + * + * Copyright (c) 2003-2004 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + */ + +#ifndef HW_I386_E820_H +#define HW_I386_E820_H + +/** + * E820Type: Type of the e820 address range. + */ +typedef enum { + E820_RAM =3D 1, + E820_RESERVED =3D 2, + E820_ACPI =3D 3, + E820_NVS =3D 4, + E820_UNUSABLE =3D 5 +} E820Type; + +#define E820_NR_ENTRIES 16 + +struct e820_entry { + uint64_t address; + uint64_t length; + uint32_t type; +} QEMU_PACKED __attribute((__aligned__(4))); + +struct e820_table { + uint32_t count; + struct e820_entry entry[E820_NR_ENTRIES]; +} QEMU_PACKED __attribute((__aligned__(4))); + +extern struct e820_table e820_reserve; +extern struct e820_entry *e820_table; + +/** + * e820_add_entry: Add an #e820_entry to the @e820_table. + * + * Returns the number of entries of the e820_table on success, + * or a negative errno otherwise. + * + * @address: The base address of the structure which the BIOS is to fill i= n. + * @length: The length in bytes of the structure passed to the BIOS. + * @type: The #E820Type of the address range. + */ +ssize_t e820_add_entry(uint64_t address, uint64_t length, E820Type type); + +/** + * e820_get_num_entries: The number of entries of the @e820_table. + * + * Returns the number of entries of the e820_table. + */ +size_t e820_get_num_entries(void); + +/** + * e820_get_entry: Get the address/length of an #e820_entry. + * + * If the #e820_entry stored at @index is of #E820Type @type, fills @addre= ss + * and @length with the #e820_entry values and return @true. + * Return @false otherwise. + * + * @index: The index of the #e820_entry to get values. + * @type: The @E820Type of the address range expected. + * @address: Pointer to the base address of the #e820_entry structure to + * be filled. + * @length: Pointer to the length (in bytes) of the #e820_entry structure + * to be filled. + * @return: true if the entry was found, false otherwise. + */ +bool e820_get_entry(unsigned int index, E820Type type, + uint64_t *address, uint64_t *length); + +#endif diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d9589eb771..c5c96a2e10 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -79,6 +79,7 @@ #include "hw/i386/intel_iommu.h" #include "hw/net/ne2000-isa.h" #include "standard-headers/asm-x86/bootparam.h" +#include "e820_memory_layout.h" =20 /* debug PC/ISA interrupts */ //#define DEBUG_IRQ @@ -90,22 +91,6 @@ #define DPRINTF(fmt, ...) #endif =20 -#define E820_NR_ENTRIES 16 - -struct e820_entry { - uint64_t address; - uint64_t length; - uint32_t type; -} QEMU_PACKED __attribute((__aligned__(4))); - -struct e820_table { - uint32_t count; - struct e820_entry entry[E820_NR_ENTRIES]; -} QEMU_PACKED __attribute((__aligned__(4))); - -static struct e820_table e820_reserve; -static struct e820_entry *e820_table; -static size_t e820_entries; struct hpet_fw_config hpet_cfg =3D {.count =3D UINT8_MAX}; =20 /* Physical Address of PVH entry point read from kernel ELF NOTE */ @@ -872,51 +857,6 @@ static void handle_a20_line_change(void *opaque, int i= rq, int level) x86_cpu_set_a20(cpu, level); } =20 -ssize_t e820_add_entry(uint64_t address, uint64_t length, E820Type type) -{ - unsigned int index =3D le32_to_cpu(e820_reserve.count); - struct e820_entry *entry; - - if (type !=3D E820_RAM) { - /* old FW_CFG_E820_TABLE entry -- reservations only */ - if (index >=3D E820_NR_ENTRIES) { - return -EBUSY; - } - entry =3D &e820_reserve.entry[index++]; - - entry->address =3D cpu_to_le64(address); - entry->length =3D cpu_to_le64(length); - entry->type =3D cpu_to_le32(type); - - e820_reserve.count =3D cpu_to_le32(index); - } - - /* new "etc/e820" file -- include ram too */ - e820_table =3D g_renew(struct e820_entry, e820_table, e820_entries + 1= ); - e820_table[e820_entries].address =3D cpu_to_le64(address); - e820_table[e820_entries].length =3D cpu_to_le64(length); - e820_table[e820_entries].type =3D cpu_to_le32(type); - e820_entries++; - - return e820_entries; -} - -size_t e820_get_num_entries(void) -{ - return e820_entries; -} - -bool e820_get_entry(unsigned int idx, E820Type type, - uint64_t *address, uint64_t *length) -{ - if (idx < e820_entries && e820_table[idx].type =3D=3D cpu_to_le32(type= )) { - *address =3D le64_to_cpu(e820_table[idx].address); - *length =3D le64_to_cpu(e820_table[idx].length); - return true; - } - return false; -} - /* Enables contiguous-apic-ID mode, for compatibility */ static bool compat_apic_id_mode; =20 diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index fc66b61ff8..7a88768e76 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -282,54 +282,6 @@ void pc_system_firmware_init(PCMachineState *pcms, Mem= oryRegion *rom_memory); void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, const CPUArchIdList *apic_ids, GArray *entry); =20 -/** - * E820Type: Type of the e820 address range. - */ -typedef enum { - E820_RAM =3D 1, - E820_RESERVED =3D 2, - E820_ACPI =3D 3, - E820_NVS =3D 4, - E820_UNUSABLE =3D 5 -} E820Type; - -/** - * e820_add_entry: Add an #e820_entry to the @e820_table. - * - * Returns the number of entries of the e820_table on success, - * or a negative errno otherwise. - * - * @address: The base address of the structure which the BIOS is to fill i= n. - * @length: The length in bytes of the structure passed to the BIOS. - * @type: The #E820Type of the address range. - */ -ssize_t e820_add_entry(uint64_t address, uint64_t length, E820Type type); - -/** - * e820_get_num_entries: The number of entries of the @e820_table. - * - * Returns the number of entries of the e820_table. - */ -size_t e820_get_num_entries(void); - -/** - * e820_get_entry: Get the address/length of an #e820_entry. - * - * If the #e820_entry stored at @index is of #E820Type @type, fills @addre= ss - * and @length with the #e820_entry values and return @true. - * Return @false otherwise. - * - * @index: The index of the #e820_entry to get values. - * @type: The @E820Type of the address range expected. - * @address: Pointer to the base address of the #e820_entry structure to - * be filled. - * @length: Pointer to the length (in bytes) of the #e820_entry structure - * to be filled. - * @return: true if the entry was found, false otherwise. - */ -bool e820_get_entry(unsigned int index, E820Type type, - uint64_t *address, uint64_t *length); - extern GlobalProperty pc_compat_4_0_1[]; extern const size_t pc_compat_4_0_1_len; =20 diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 6899061b4e..73964fc63c 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -38,6 +38,7 @@ #include "hw/i386/apic-msidef.h" #include "hw/i386/intel_iommu.h" #include "hw/i386/x86-iommu.h" +#include "hw/i386/e820_memory_layout.h" =20 #include "hw/pci/pci.h" #include "hw/pci/msi.h" --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560439859; cv=none; d=zoho.com; s=zohoarc; b=AlroNLsM463Uk4I/DuICV8aG1gcaacj4ZLnRlczzAmavMJujAsCpg/VH3mxTP/HNRfvm3BnxGqLa2yoxocbAz/hJpdIGWopX2jtTy9ew+WyPEAbffSsm7POEuAI3V4/lYj4KW9Hv+8uadC0ahXH67QWQFE3KOlumKamLO7lBGuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560439859; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=2C8kD8sjY3wkqASXT47xdNDGhLxziJGv3Etj531tVBs=; b=hyCsqN3PMExshMpbjdo/V0+RfcC3IDdcHHHeiMShdHxU0oeUxrCyGePKeJbrsxwnmFPt6Ubfn5JkX/G/BdjqTu56Rb/4ZatE4B3/K3YmSyZcei4VaVwWIfmkbhuWxTSD0+piOvxcslA1/Bgap+8lyHt5DCuwrtUZK9TUEPHhHLI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560439859926807.8025225690666; Thu, 13 Jun 2019 08:30:59 -0700 (PDT) Received: from localhost ([::1]:40952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbRgU-0006K1-R3 for importer@patchew.org; Thu, 13 Jun 2019 11:30:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42827) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQpu-0001hd-MT for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQpj-0001ep-Nq for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35230) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQpj-0001cV-8t for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:07 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 43CDF30872E6; Thu, 13 Jun 2019 14:36:06 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6F4B61001B0F; Thu, 13 Jun 2019 14:35:56 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:34 +0200 Message-Id: <20190613143446.23937-9-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 13 Jun 2019 14:36:06 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 08/20] hw/i386/pc: Use address_space_memory in place 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Li Qiang , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The address_space_memory variable is used once. Use it in place and remove the argument. Suggested-by: Samuel Ortiz Reviewed-by: Li Qiang Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c5c96a2e10..acde575ced 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -932,7 +932,7 @@ static void pc_build_smbios(PCMachineState *pcms) } } =20 -static FWCfgState *bochs_bios_init(AddressSpace *as, PCMachineState *pcms) +static FWCfgState *bochs_bios_init(PCMachineState *pcms) { FWCfgState *fw_cfg; uint64_t *numa_fw_cfg; @@ -940,7 +940,8 @@ static FWCfgState *bochs_bios_init(AddressSpace *as, PC= MachineState *pcms) const CPUArchIdList *cpus; MachineClass *mc =3D MACHINE_GET_CLASS(pcms); =20 - fw_cfg =3D fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4, as); + fw_cfg =3D fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4, + &address_space_memory); fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); =20 /* FW_CFG_MAX_CPUS is a bit confusing/problematic on x86: @@ -1765,7 +1766,7 @@ void pc_memory_init(PCMachineState *pcms, option_rom_mr, 1); =20 - fw_cfg =3D bochs_bios_init(&address_space_memory, pcms); + fw_cfg =3D bochs_bios_init(pcms); =20 rom_set_fw(fw_cfg); =20 --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560439330; cv=none; d=zoho.com; s=zohoarc; b=iKX1eLT4QNBxuVhlr9RQOHYcpfW9pnEQhjXRx+TbmacZKAzbMhxeaq9uVdqy/JSyPYP9770kfCmMBkQJwLSBJOwrcRkvjbMxNb/gjYV4Gq1nb5tNsi6YVTYQ49IXBGu2bK33pp+H8yFAyQjs97qAunrMeH7jQ0YVTHzTNCaWakQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560439330; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=pxqvUWNR9T5K5mV17tjIyF5/2OSt3tt4N1PgIH1PMIY=; b=ZyR/Q/17JcGTSztPfXVF6H1MDRRAgervDbvyzLVkm6mCElZ6RMFRtM2umBbw2GCK86GtkMFAZ5NU8xBuq35rhSAuVxUKta88WB6fYehakvz7HofpxPjZJCTit63cS+BROKYkrApiDDctyO9xvHcohV06c4TEW6bgbByqDmv1fJE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560439330454792.3096628057311; Thu, 13 Jun 2019 08:22:10 -0700 (PDT) Received: from localhost ([::1]:40844 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbRYE-00054x-EG for importer@patchew.org; Thu, 13 Jun 2019 11:22:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42982) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQqA-0001nO-H9 for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQq6-0001uI-Ds for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37874) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQq4-0001hd-Fr for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:28 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA41430860D5; Thu, 13 Jun 2019 14:36:09 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B227C1001B0F; Thu, 13 Jun 2019 14:36:06 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:35 +0200 Message-Id: <20190613143446.23937-10-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 13 Jun 2019 14:36:10 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 09/20] hw/i386/pc: Rename bochs_bios_init as more generic fw_cfg_arch_create 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Li Qiang , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The bochs_bios_init() function is not restricted to the Bochs BIOS and is useful to other BIOS. Since it is not specific to the PC machine, and can be reused by other machines of the X86 architecture, rename it as fw_cfg_arch_create(). Suggested-by: Samuel Ortiz Reviewed-by: Li Qiang Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- v2: Rename x86_create_fw_cfg() -> fw_cfg_arch_create() (MST) --- hw/i386/pc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index acde575ced..75fb1a154a 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -932,7 +932,7 @@ static void pc_build_smbios(PCMachineState *pcms) } } =20 -static FWCfgState *bochs_bios_init(PCMachineState *pcms) +static FWCfgState *fw_cfg_arch_create(PCMachineState *pcms) { FWCfgState *fw_cfg; uint64_t *numa_fw_cfg; @@ -1512,7 +1512,7 @@ void pc_cpus_init(PCMachineState *pcms) * Limit for the APIC ID value, so that all * CPU APIC IDs are < pcms->apic_id_limit. * - * This is used for FW_CFG_MAX_CPUS. See comments on bochs_bios_init(). + * This is used for FW_CFG_MAX_CPUS. See comments on fw_cfg_arch_creat= e(). */ pcms->apic_id_limit =3D x86_cpu_apic_id_from_index(max_cpus - 1) + 1; possible_cpus =3D mc->possible_cpu_arch_ids(ms); @@ -1766,7 +1766,7 @@ void pc_memory_init(PCMachineState *pcms, option_rom_mr, 1); =20 - fw_cfg =3D bochs_bios_init(pcms); + fw_cfg =3D fw_cfg_arch_create(pcms); =20 rom_set_fw(fw_cfg); =20 --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560440404; cv=none; d=zoho.com; s=zohoarc; b=X7qyNqGcyVhIQxmXzvFSK7xEIkTpRYE/tRRacsH79bYFnmGENppZDqYJLm/ZSgiNIrtM7SKRyZXGzX4ki2NlbP7IeYEKCSv0ss9eaa+a6yFqwZZESdV2JpHRxFy5wF7ZjJMM/DXbiWC5vf4fG0Wn1kCWQ9V2BUeCxc9dnAMLerw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560440404; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=26RzvpiKk0Tw2ahsEUVqgmsrB23gI1uw541UxMTXrqA=; b=m/sFzZrKLrEP541QddObDIKcFfG5i4IjAIFlmgGTcaxZDQ584lpaFMeC5GM8U1MDs8QI7tiavaaxHNhLB+PP1F5zEZgoZwlhk+BAn8gljPqIWtm6eL4DsRepoY3AsjQ5Wb2AJhlpBEF6D1Lu7hWIyX0E5nflK0gKgHlXHYVHbfw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560440404607333.17115323876135; Thu, 13 Jun 2019 08:40:04 -0700 (PDT) Received: from localhost ([::1]:41018 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbRpW-0003y6-ET for importer@patchew.org; Thu, 13 Jun 2019 11:39:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42952) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQq8-0001mh-IW for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQq6-0001ue-Gk for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37664) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQq4-0001jD-Fz for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:30 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 42782300740A; Thu, 13 Jun 2019 14:36:13 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4BF471001DC0; Thu, 13 Jun 2019 14:36:10 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:36 +0200 Message-Id: <20190613143446.23937-11-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 13 Jun 2019 14:36:13 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 10/20] hw/i386/pc: Pass the boot_cpus value by argument 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The boot_cpus is used once. Pass it by argument, this will allow us to remove the PCMachineState argument later. Suggested-by: Samuel Ortiz Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 75fb1a154a..4c5a968143 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -932,7 +932,8 @@ static void pc_build_smbios(PCMachineState *pcms) } } =20 -static FWCfgState *fw_cfg_arch_create(PCMachineState *pcms) +static FWCfgState *fw_cfg_arch_create(PCMachineState *pcms, + uint16_t boot_cpus) { FWCfgState *fw_cfg; uint64_t *numa_fw_cfg; @@ -942,7 +943,7 @@ static FWCfgState *fw_cfg_arch_create(PCMachineState *p= cms) =20 fw_cfg =3D fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4, &address_space_memory); - fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); + fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, boot_cpus); =20 /* FW_CFG_MAX_CPUS is a bit confusing/problematic on x86: * @@ -1766,7 +1767,7 @@ void pc_memory_init(PCMachineState *pcms, option_rom_mr, 1); =20 - fw_cfg =3D fw_cfg_arch_create(pcms); + fw_cfg =3D fw_cfg_arch_create(pcms, pcms->boot_cpus); =20 rom_set_fw(fw_cfg); =20 --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560439093; cv=none; d=zoho.com; s=zohoarc; b=cVUm1E3Bok8wAApXTaXPtngbY8BzVVh2h0ko8anHEjtiEnnhyiVATpVj59hfpk6cxYgng3S9Erl4uPZgZv2WPoAm08DEfvyltcbocVkdwI89tyx/oUSdjfHwr+purKOG5wbBAjC0To5fa1saAPkOLksIclvJTy+a2y0g0UkDanc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560439093; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=s+R8dM77JHgPI4p4kUbW5Hb6LtxMNHRqxcRbX5KsBYM=; b=Jh4VJ3d9J+NUHC/rKBycVqzKHUrVWgD8+0UlzCSRPqT3O99epgXBur0qHMnnydmLj+DD8Af3dAITiDkpnzDpGHfn7PjDtzrzWYfrkibzhHV9NfdZavV1DxX3w1ToygS384qAXNdNlyLAyYFgmusbRIjEmyK0BdDTIgx6l3seXio= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560439093857268.2691233090029; Thu, 13 Jun 2019 08:18:13 -0700 (PDT) Received: from localhost ([::1]:40810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbRUQ-00016G-Mb for importer@patchew.org; Thu, 13 Jun 2019 11:18:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42953) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQq8-0001mp-If for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQq6-0001uv-LE for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21791) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQq6-0001re-Ay for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:30 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CD9307E459; Thu, 13 Jun 2019 14:36:25 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A953F1001B2A; Thu, 13 Jun 2019 14:36:13 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:37 +0200 Message-Id: <20190613143446.23937-12-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 13 Jun 2019 14:36:25 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 11/20] hw/i386/pc: Pass the apic_id_limit value by argument 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Pass the apic_id_limit value by argument, this will allow us to remove the PCMachineState argument later. Suggested-by: Samuel Ortiz Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 4c5a968143..7f5215965e 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -933,7 +933,8 @@ static void pc_build_smbios(PCMachineState *pcms) } =20 static FWCfgState *fw_cfg_arch_create(PCMachineState *pcms, - uint16_t boot_cpus) + uint16_t boot_cpus, + uint16_t apic_id_limit) { FWCfgState *fw_cfg; uint64_t *numa_fw_cfg; @@ -1767,7 +1768,7 @@ void pc_memory_init(PCMachineState *pcms, option_rom_mr, 1); =20 - fw_cfg =3D fw_cfg_arch_create(pcms, pcms->boot_cpus); + fw_cfg =3D fw_cfg_arch_create(pcms, pcms->boot_cpus, pcms->apic_id_lim= it); =20 rom_set_fw(fw_cfg); =20 --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560441753; cv=none; d=zoho.com; s=zohoarc; b=O4UZNSlGWRWuxmBWk9HIcP2ipvDO1pxs4eJTAxTLqtERKnMJlgBCrBH/ZcK6uRb8mqH4AgszDWL7gwn9omj/mVi7lIZUKvgAlSwK1MoYMFhZFND0LRQUuWZJqSRIx5LeImO6xCSTHxAcaBhxAn/g6F28nk0WkNkaqy/YxJQaL3Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560441753; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=XgtucmG9R/ODHkyKeNRhUNlIhiOoIjuLJJtgYe4qey8=; b=Llv3a+KCqC8kEPeFFeuBdU3T8z97dWfQMVvLmCT38POcC3tHKR6HozPB5l2Lc09jR1EA+wqyHNhYTlRhglDBvJJVL8vEYQslrJ81mm2wlwxbXBaKCdL3K78legjK86d9bWAMxwGnIy0xTdrjpgTLCPvz21vUewmHhCKU99dKojk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 156044175299918.749723379817283; Thu, 13 Jun 2019 09:02:32 -0700 (PDT) Received: from localhost ([::1]:41230 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbSBJ-0006gT-N9 for importer@patchew.org; Thu, 13 Jun 2019 12:02:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42984) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQqA-0001nP-HB for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQq8-0001wB-Gw for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26138) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQq6-0001tr-Di for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:30 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 40FE8C065135; Thu, 13 Jun 2019 14:36:29 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B0DA1001B2E; Thu, 13 Jun 2019 14:36:26 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:38 +0200 Message-Id: <20190613143446.23937-13-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 13 Jun 2019 14:36:29 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 12/20] hw/i386/pc: Pass the CPUArchIdList array by argument 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Pass the CPUArchIdList array by argument, this will allow us to remove the PCMachineState argument later. Suggested-by: Samuel Ortiz Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 7f5215965e..266cdf19b5 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -933,14 +933,13 @@ static void pc_build_smbios(PCMachineState *pcms) } =20 static FWCfgState *fw_cfg_arch_create(PCMachineState *pcms, + const CPUArchIdList *cpus, uint16_t boot_cpus, uint16_t apic_id_limit) { FWCfgState *fw_cfg; uint64_t *numa_fw_cfg; int i; - const CPUArchIdList *cpus; - MachineClass *mc =3D MACHINE_GET_CLASS(pcms); =20 fw_cfg =3D fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4, &address_space_memory); @@ -958,7 +957,7 @@ static FWCfgState *fw_cfg_arch_create(PCMachineState *p= cms, * So for compatibility reasons with old BIOSes we are stuck with * "etc/max-cpus" actually being apic_id_limit */ - fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)pcms->apic_id_limit); + fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, apic_id_limit); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, acpi_tables, acpi_tables_len); @@ -974,20 +973,19 @@ static FWCfgState *fw_cfg_arch_create(PCMachineState = *pcms, * of nodes, one word for each VCPU->node and one word for each node to * hold the amount of memory. */ - numa_fw_cfg =3D g_new0(uint64_t, 1 + pcms->apic_id_limit + nb_numa_nod= es); + numa_fw_cfg =3D g_new0(uint64_t, 1 + apic_id_limit + nb_numa_nodes); numa_fw_cfg[0] =3D cpu_to_le64(nb_numa_nodes); - cpus =3D mc->possible_cpu_arch_ids(MACHINE(pcms)); for (i =3D 0; i < cpus->len; i++) { unsigned int apic_id =3D cpus->cpus[i].arch_id; - assert(apic_id < pcms->apic_id_limit); + assert(apic_id < apic_id_limit); numa_fw_cfg[apic_id + 1] =3D cpu_to_le64(cpus->cpus[i].props.node_= id); } for (i =3D 0; i < nb_numa_nodes; i++) { - numa_fw_cfg[pcms->apic_id_limit + 1 + i] =3D + numa_fw_cfg[apic_id_limit + 1 + i] =3D cpu_to_le64(numa_info[i].node_mem); } fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, numa_fw_cfg, - (1 + pcms->apic_id_limit + nb_numa_nodes) * + (1 + apic_id_limit + nb_numa_nodes) * sizeof(*numa_fw_cfg)); =20 return fw_cfg; @@ -1768,7 +1766,8 @@ void pc_memory_init(PCMachineState *pcms, option_rom_mr, 1); =20 - fw_cfg =3D fw_cfg_arch_create(pcms, pcms->boot_cpus, pcms->apic_id_lim= it); + fw_cfg =3D fw_cfg_arch_create(pcms, mc->possible_cpu_arch_ids(machine), + pcms->boot_cpus, pcms->apic_id_limit); =20 rom_set_fw(fw_cfg); =20 --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560442202; cv=none; d=zoho.com; s=zohoarc; b=cDEdqcThWhEAKB3hj6wrIvYSmDW1YMAMy5Cg64FyO/LHbiv2ESZieWb0CO9ZoOcpJo9z5TSVu7+hmYEhsnceO7b5gzFOVTodmsAzF8IDXgRthZt/L/k0QajvAUF2ojKRocPphWtKgWuRVSo9QMu5RTo1Bpj9gMvKr0+1QFX1RxM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560442202; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=KrxxcnkRRpPOXkrrpUidRy5KVd60bpUM/98vgeYHkAU=; b=IYHQZpCuVlgbW+aO/MFRHyx/LNn23XKEtl8NeM5gxtswnq5lRZmHaMf8TpeDCb9Rv3M2fkbCJAmT3vTAaBb9U/2BfWkfh2HWqB6JjRmf5Nn6ysjhdS93yrluzCY2UtKqZDf8GN7m52Dc9sGLtQpPsMMAnlDLRDuYN3TXxbfat+U= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560442202866354.35661325735316; Thu, 13 Jun 2019 09:10:02 -0700 (PDT) Received: from localhost ([::1]:41266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbSIY-0002uM-U0 for importer@patchew.org; Thu, 13 Jun 2019 12:09:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43016) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQqC-0001oM-IX for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQqA-0001yA-LJ for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50568) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQqA-0001wp-Da for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:34 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A4FBE86663; Thu, 13 Jun 2019 14:36:32 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC79C1001E60; Thu, 13 Jun 2019 14:36:29 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:39 +0200 Message-Id: <20190613143446.23937-14-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 13 Jun 2019 14:36:32 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 13/20] hw/i386/pc: Let fw_cfg_init() use the generic MachineState 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We removed the PCMachineState access, we can now let the fw_cfg_init() function to take a generic MachineState object. Suggested-by: Samuel Ortiz Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 266cdf19b5..08df4f9895 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -932,7 +932,7 @@ static void pc_build_smbios(PCMachineState *pcms) } } =20 -static FWCfgState *fw_cfg_arch_create(PCMachineState *pcms, +static FWCfgState *fw_cfg_arch_create(MachineState *ms, const CPUArchIdList *cpus, uint16_t boot_cpus, uint16_t apic_id_limit) @@ -1670,6 +1670,7 @@ void pc_memory_init(PCMachineState *pcms, MemoryRegion *ram_below_4g, *ram_above_4g; FWCfgState *fw_cfg; MachineState *machine =3D MACHINE(pcms); + MachineClass *mc =3D MACHINE_GET_CLASS(machine); PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(pcms); =20 assert(machine->ram_size =3D=3D pcms->below_4g_mem_size + @@ -1766,7 +1767,7 @@ void pc_memory_init(PCMachineState *pcms, option_rom_mr, 1); =20 - fw_cfg =3D fw_cfg_arch_create(pcms, mc->possible_cpu_arch_ids(machine), + fw_cfg =3D fw_cfg_arch_create(machine, mc->possible_cpu_arch_ids(machi= ne), pcms->boot_cpus, pcms->apic_id_limit); =20 rom_set_fw(fw_cfg); --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560440706; cv=none; d=zoho.com; s=zohoarc; b=T2V3LuexJIOjqQpcCmFQGzWmsKQfN/BH5BqD+FPudqgSgBrILr2/k4AzggRpdTZAEEqKqNtE95Md63j5Iine50huZgRV8G/Oqaa7sh9FudkUPgoRNO5MUGmcNh1z2dTzQJeMfO5qpd16KEDBBoqHjFIKR7aTXJpmytLsJqF+38E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560440706; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6pcLCcQef1kttE/91np4rt1WqtUKXzSdzck0j6+8tY4=; b=nSrGUS2GNnkt0ajFAynmTprT+Zv8TPu1M8I+5t63sdeTcPFjOryjsGBQ3owyrZmGbLvthAs7zpPsWwzm9Q0LVGM0CptiCQ1Ad8UZXJgqmlUnqb2UN1muUh6bo94u/4/tIg26Ei5C+T/AQ8fPTHEHP2AcwTkiiF7eyQ86F2H3WoA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560440706108646.806855372296; Thu, 13 Jun 2019 08:45:06 -0700 (PDT) Received: from localhost ([::1]:41072 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbRuQ-0008Ob-OW for importer@patchew.org; Thu, 13 Jun 2019 11:45:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43067) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQqI-0001qq-Ka for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQqG-00022D-M8 for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50612) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQqG-0001z7-Ew for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:40 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1649DB2DC8; Thu, 13 Jun 2019 14:36:36 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1BF711001B0F; Thu, 13 Jun 2019 14:36:32 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:40 +0200 Message-Id: <20190613143446.23937-15-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 13 Jun 2019 14:36:36 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 14/20] hw/i386/pc: Let pc_build_smbios() take a FWCfgState argument 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Pass the FWCfgState object by argument, this will allow us to remove the PCMachineState argument later. Suggested-by: Samuel Ortiz Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 08df4f9895..c08869b52c 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -890,7 +890,7 @@ static uint32_t x86_cpu_apic_id_from_index(unsigned int= cpu_index) } } =20 -static void pc_build_smbios(PCMachineState *pcms) +static void pc_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg) { uint8_t *smbios_tables, *smbios_anchor; size_t smbios_tables_len, smbios_anchor_len; @@ -904,7 +904,7 @@ static void pc_build_smbios(PCMachineState *pcms) =20 smbios_tables =3D smbios_get_table_legacy(&smbios_tables_len); if (smbios_tables) { - fw_cfg_add_bytes(pcms->fw_cfg, FW_CFG_SMBIOS_ENTRIES, + fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, smbios_tables, smbios_tables_len); } =20 @@ -925,9 +925,9 @@ static void pc_build_smbios(PCMachineState *pcms) g_free(mem_array); =20 if (smbios_anchor) { - fw_cfg_add_file(pcms->fw_cfg, "etc/smbios/smbios-tables", + fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-tables", smbios_tables, smbios_tables_len); - fw_cfg_add_file(pcms->fw_cfg, "etc/smbios/smbios-anchor", + fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor", smbios_anchor, smbios_anchor_len); } } @@ -1593,7 +1593,7 @@ void pc_machine_done(Notifier *notifier, void *data) =20 acpi_setup(); if (pcms->fw_cfg) { - pc_build_smbios(pcms); + pc_build_smbios(pcms, pcms->fw_cfg); pc_build_feature_control_file(pcms); /* update FW_CFG_NB_CPUS to account for -device added CPUs */ fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560441168; cv=none; d=zoho.com; s=zohoarc; b=hIkuTuCKdZME/UK1mpEliNcZazEJEHTKpaBH5u0Nzu66F+r5+sDk1Yi2oDgKNmW0q4Fz6mpsl1idu7V8BF8sIVrRfL80EeEnUVQpABrpJhrcrosJVZP9fBPSFAzGvMSboBCORRqSBSwkldpNt5EtCEjs//TVsqNfgYRWsZzvBp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560441168; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=L7/QFgVmlYmU6iPOtk1hVPO9aLfH/IIekUiKFDOD3CU=; b=NHP5bFgLVELAPlCGJqXe+6hhVbeoT1l1Laz3/vQEw8rnbFZQMDKiT0lrUPgc1R4v+ctbork2hhNoFcZRMLVQOJ4pH78fOxARBPVCFsFsJ3m76+e41yjuSm9SFwysKaANnGyhYyk000iweqmddVHFbwHKBlQfynkJV2ZZ6bcZTx4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560441168635179.04550876985104; Thu, 13 Jun 2019 08:52:48 -0700 (PDT) Received: from localhost ([::1]:41130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbS1s-0005NO-DM for importer@patchew.org; Thu, 13 Jun 2019 11:52:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43136) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQqO-0001s9-T7 for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQqM-00026V-LG for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54382) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQqM-00024w-Es for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:46 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4864230BDE59; Thu, 13 Jun 2019 14:36:44 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82D651001B0F; Thu, 13 Jun 2019 14:36:36 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:41 +0200 Message-Id: <20190613143446.23937-16-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 13 Jun 2019 14:36:44 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 15/20] hw/i386/pc: Let pc_build_smbios() take a generic MachineState argument 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Let the pc_build_smbios() function take a generic MachineState argument. Suggested-by: Samuel Ortiz Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c08869b52c..d3de03e5e3 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -890,13 +890,12 @@ static uint32_t x86_cpu_apic_id_from_index(unsigned i= nt cpu_index) } } =20 -static void pc_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg) +static void pc_build_smbios(MachineState *ms, FWCfgState *fw_cfg) { uint8_t *smbios_tables, *smbios_anchor; size_t smbios_tables_len, smbios_anchor_len; struct smbios_phys_mem_area *mem_array; unsigned i, array_count; - MachineState *ms =3D MACHINE(pcms); X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); =20 /* tell smbios about cpuid version and features */ @@ -1593,7 +1592,7 @@ void pc_machine_done(Notifier *notifier, void *data) =20 acpi_setup(); if (pcms->fw_cfg) { - pc_build_smbios(pcms, pcms->fw_cfg); + pc_build_smbios(MACHINE(pcms), pcms->fw_cfg); pc_build_feature_control_file(pcms); /* update FW_CFG_NB_CPUS to account for -device added CPUs */ fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560439545; cv=none; d=zoho.com; s=zohoarc; b=GlZ7oW2UMNY97eWoCajmmP3L6HeVe+WXxwQep/Thy84BoLmbGvbOxCQqvsmswvr6ZHyzjplX34YZPhOz1IwO/9k5lOF+Ou06Juz1bYeiOpAzyUUZ+WLJfmCUGgX37Wx9fMB3pgDqYfEql+zqCBn1wJw0j8AXku98c3aJtWbcdkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560439545; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=agq6oyOm5pqvzimQF5drCxWydH42X1pcGUnOk0uyN7A=; b=mvU2gbp5zrDXJWDhl5Nuz8MahEHIyWyPTm+P9xI1ozJbz2hZJo7vw0zl7HL1UhG2OKzIGD3Crmm+QNDxxtnz18ievbEk+Pb9ABW+v7iz1NQDiyCh/ZM4LgXjD4g3mm/DLINyB7wn1YA6cpO5n8h97RLs892eL6BDDiWl3Izx9qc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560439545760102.42930839539065; Thu, 13 Jun 2019 08:25:45 -0700 (PDT) Received: from localhost ([::1]:40876 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbRbi-00017x-Oq for importer@patchew.org; Thu, 13 Jun 2019 11:25:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43200) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQqV-0001tZ-0X for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQqR-00029e-4X for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35734) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQqP-00027F-2i for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:50 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC7E730872F0; Thu, 13 Jun 2019 14:36:47 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B6A8E1001B16; Thu, 13 Jun 2019 14:36:44 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:42 +0200 Message-Id: <20190613143446.23937-17-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 13 Jun 2019 14:36:47 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 16/20] hw/i386/pc: Rename pc_build_smbios() as generic fw_cfg_build_smbios() 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Now that the pc_build_smbios() function has been refactored to not depend of PC specific types, rename it to a more generic name. Suggested-by: Samuel Ortiz Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d3de03e5e3..e70c02441b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -890,7 +890,7 @@ static uint32_t x86_cpu_apic_id_from_index(unsigned int= cpu_index) } } =20 -static void pc_build_smbios(MachineState *ms, FWCfgState *fw_cfg) +static void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg) { uint8_t *smbios_tables, *smbios_anchor; size_t smbios_tables_len, smbios_anchor_len; @@ -1592,7 +1592,7 @@ void pc_machine_done(Notifier *notifier, void *data) =20 acpi_setup(); if (pcms->fw_cfg) { - pc_build_smbios(MACHINE(pcms), pcms->fw_cfg); + fw_cfg_build_smbios(MACHINE(pcms), pcms->fw_cfg); pc_build_feature_control_file(pcms); /* update FW_CFG_NB_CPUS to account for -device added CPUs */ fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560441346; cv=none; d=zoho.com; s=zohoarc; b=Xz6FAaFgAGmzEq0ZJP4MMfFc6vosGN50ysBtHd3prXq6RGp4dHdz5MMra63MIBI3Jzs2NfRKviJyNnJ3/UnvQlQP4nzzVEwbeS/RrYnfoZSyUJ7vUFZ8TiZjoeqUZkHlpx9kCLsplXUjczNqDEofZf6Vf3vD1TbePG7WegWmaQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560441346; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=iueHHrYf9oNUCyiqC0+fKVQp6KoEM7sZ4mrPcuSIiHY=; b=eqQknxqSYEHqn+rVxYyGas9EnVQcoXXk+Cf06mDJOKmFkSMMrUoImX7EeHiHByEsYC/1TrcsVUYBpvkMm274gUHQDJbHAVhyYpiiL+CZxJtiJ7I1eRsMimREBjB4QOa0o8hXNVd6iuTuY0InB7MVqAY1+JWqpXavokdXKvxjY7w= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 156044134665639.61725126295039; Thu, 13 Jun 2019 08:55:46 -0700 (PDT) Received: from localhost ([::1]:41168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbS4i-0000XB-Gf for importer@patchew.org; Thu, 13 Jun 2019 11:55:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43214) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQqa-0001uT-QH for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:37:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQqX-0002Dt-Gw for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:37:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36748) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQqT-0002A7-N1 for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:36:54 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 17799223884; Thu, 13 Jun 2019 14:36:51 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 237A71001B0F; Thu, 13 Jun 2019 14:36:47 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:43 +0200 Message-Id: <20190613143446.23937-18-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 13 Jun 2019 14:36:51 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 17/20] hw/i386/pc: Let pc_build_feature_control() take a FWCfgState argument 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Pass the FWCfgState object by argument, this will allow us to remove the PCMachineState argument later. Suggested-by: Samuel Ortiz Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index e70c02441b..39155a14d9 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1521,7 +1521,8 @@ void pc_cpus_init(PCMachineState *pcms) } } =20 -static void pc_build_feature_control_file(PCMachineState *pcms) +static void pc_build_feature_control_file(PCMachineState *pcms, + FWCfgState *fw_cfg) { MachineState *ms =3D MACHINE(pcms); X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); @@ -1547,7 +1548,7 @@ static void pc_build_feature_control_file(PCMachineSt= ate *pcms) =20 val =3D g_malloc(sizeof(*val)); *val =3D cpu_to_le64(feature_control_bits | FEATURE_CONTROL_LOCKED); - fw_cfg_add_file(pcms->fw_cfg, "etc/msr_feature_control", val, sizeof(*= val)); + fw_cfg_add_file(fw_cfg, "etc/msr_feature_control", val, sizeof(*val)); } =20 static void rtc_set_cpus_count(ISADevice *rtc, uint16_t cpus_count) @@ -1593,7 +1594,7 @@ void pc_machine_done(Notifier *notifier, void *data) acpi_setup(); if (pcms->fw_cfg) { fw_cfg_build_smbios(MACHINE(pcms), pcms->fw_cfg); - pc_build_feature_control_file(pcms); + pc_build_feature_control_file(pcms, pcms->fw_cfg); /* update FW_CFG_NB_CPUS to account for -device added CPUs */ fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); } --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560442669; cv=none; d=zoho.com; s=zohoarc; b=aP5JzG5DFWaUzLEpLU3JBR2E9+0+pk9taLaP+zeWnn4jPaNIEfWpo3b2rfW1S2JrNYSXGUYotCxCc7HCPaXQ0tnzqvGuApi+MqW9sRuorDPoj1Jg6de7VLdbDQYnuXeWJKP5hYqHXWsc0IVM2ZnMHmBZj2YUAm42ZOpL+3hicxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560442669; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=llQiy6LmHq/LOd37OI4BWOmfXVuyJrUDeKmbZX5rsLU=; b=Rd11V/ftkEFOrkvW4+CDE66sFkX4dlPzXV47ThbHCFZ079tF6JJVVskarhRPkaHkdAGxHiBlUO9ff4Lnv2VqUQe563J53vKIZQj3TwJa1hQE6fOuh/MpI/xWC/OHFwmXK2AlPkXTb0AwH1hPJt0FDHx5+KFl+zJMGLQUV696Nw0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560442669398205.5077031512942; Thu, 13 Jun 2019 09:17:49 -0700 (PDT) Received: from localhost ([::1]:41344 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbSQ2-0008Fd-BT for importer@patchew.org; Thu, 13 Jun 2019 12:17:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43245) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQqe-0001vM-Jz for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:37:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQqc-0002HB-KA for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:37:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43482) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQqa-0002Br-Lo for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:37:00 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7390F89C37; Thu, 13 Jun 2019 14:36:54 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7FEC81001B2B; Thu, 13 Jun 2019 14:36:51 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:44 +0200 Message-Id: <20190613143446.23937-19-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 13 Jun 2019 14:36:54 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 18/20] hw/i386/pc: Let pc_build_feature_control() take a MachineState argument 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Let the pc_build_feature_control_file() function take a generic MachineState argument. Suggested-by: Samuel Ortiz Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 39155a14d9..0969efa87d 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1521,10 +1521,9 @@ void pc_cpus_init(PCMachineState *pcms) } } =20 -static void pc_build_feature_control_file(PCMachineState *pcms, +static void pc_build_feature_control_file(MachineState *ms, FWCfgState *fw_cfg) { - MachineState *ms =3D MACHINE(pcms); X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); CPUX86State *env =3D &cpu->env; uint32_t unused, ecx, edx; @@ -1594,7 +1593,7 @@ void pc_machine_done(Notifier *notifier, void *data) acpi_setup(); if (pcms->fw_cfg) { fw_cfg_build_smbios(MACHINE(pcms), pcms->fw_cfg); - pc_build_feature_control_file(pcms, pcms->fw_cfg); + pc_build_feature_control_file(MACHINE(pcms), pcms->fw_cfg); /* update FW_CFG_NB_CPUS to account for -device added CPUs */ fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); } --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560439829; cv=none; d=zoho.com; s=zohoarc; b=J2vS5mP+C89AHULmuOFA/nAghRD2yXxnArYp4pAgYsCU2RFSwMHlcQdn9EM7z/APKeubdy5QVWLHs1lW8Ft2D9tSYtSn65g3pRsS4uWDmkXf7zys809/9pfLK3lwC/ZKtThp6NOONAkhiylJ66wi/Tb2UK/Q7ckfZQCi2ezNNCc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560439829; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=fSWX96aJe5VieC+A1jfgivW/jbwBJrBV0uw+hdT2Yy8=; b=C74Ifvmrdjful6Unr7sojNvbGHriy/LJuIN16HnsjV+Oe6KYItG5YNZZ/gf38M3U+hQ2yYCocllzkpNeJmJY2Zu3nXMcx+Xm1Zksh8IsKBaxdJ1KxJJ/KR63bDqTs+hHOoMH362ggjOVfs05WwrDEb7JtNGtb4gKns5+2QHnw38= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560439829529578.2391186361549; Thu, 13 Jun 2019 08:30:29 -0700 (PDT) Received: from localhost ([::1]:40932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbRgF-0005Su-Ji for importer@patchew.org; Thu, 13 Jun 2019 11:30:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43279) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQqf-0001yV-RU for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:37:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQqe-0002JK-N0 for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:37:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47114) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQqe-0002H5-Ge for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:37:04 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5954FC074EE5; Thu, 13 Jun 2019 14:37:02 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DBA331001B2A; Thu, 13 Jun 2019 14:36:54 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:45 +0200 Message-Id: <20190613143446.23937-20-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 13 Jun 2019 14:37:02 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 19/20] hw/i386/pc: Rename pc_build_feature_control() as generic fw_cfg_build_* 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Now that the pc_build_feature_control_file() function has been refactored to not depend of PC specific types, rename it to a more generic name. Suggested-by: Samuel Ortiz Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/pc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 0969efa87d..d96328d8db 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1521,8 +1521,8 @@ void pc_cpus_init(PCMachineState *pcms) } } =20 -static void pc_build_feature_control_file(MachineState *ms, - FWCfgState *fw_cfg) +static void fw_cfg_build_feature_control(MachineState *ms, + FWCfgState *fw_cfg) { X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); CPUX86State *env =3D &cpu->env; @@ -1593,7 +1593,7 @@ void pc_machine_done(Notifier *notifier, void *data) acpi_setup(); if (pcms->fw_cfg) { fw_cfg_build_smbios(MACHINE(pcms), pcms->fw_cfg); - pc_build_feature_control_file(MACHINE(pcms), pcms->fw_cfg); + fw_cfg_build_feature_control(MACHINE(pcms), pcms->fw_cfg); /* update FW_CFG_NB_CPUS to account for -device added CPUs */ fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); } --=20 2.20.1 From nobody Tue May 7 16:14:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560442411; cv=none; d=zoho.com; s=zohoarc; b=RRSEC8MMPFmEixkiogDsYrqp4PT9JfllErWeqk09DNRrAOGQf7DseghLFn97X7t9mkEDtqLKdzibeMCW8S9/WEaOF+yTrdRhkprux0MdQt7OxRs2tzov3sfH+IHvwJFF/OO1txSh9AGNLt2nFos0zpwy72lBzpSLNGbMRoRMUbs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560442411; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=MD0ic3stZ+AOpICLb/sna5lNp9V3jrSsl5XFYMVFRHg=; b=FTbKqRRT+OAATwXWUUTyUtPpIuQOqqyZVXFN69XKTq3sdnUEriuInNrzBPrKpjd7a3DiJQB+2W+xkqhFHozVqQemtsDp7QV4aoCtNA6T/r8cdKKDRhKy7981ypbHhhRcU23Eih47V3nEgl8I8xU5/o/ACSXGp2+BHqpeTnULp1Y= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560442411004643.6538806331757; Thu, 13 Jun 2019 09:13:31 -0700 (PDT) Received: from localhost ([::1]:41272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbSLp-0004SD-Cn for importer@patchew.org; Thu, 13 Jun 2019 12:13:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43307) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbQqk-000285-6M for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:37:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbQqi-0002M0-7x for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:37:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56116) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hbQqh-0002LK-W6 for qemu-devel@nongnu.org; Thu, 13 Jun 2019 10:37:08 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 309C0C05FBD7; Thu, 13 Jun 2019 14:37:07 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.141]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CD48D1001B0F; Thu, 13 Jun 2019 14:37:02 +0000 (UTC) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 13 Jun 2019 16:34:46 +0200 Message-Id: <20190613143446.23937-21-philmd@redhat.com> In-Reply-To: <20190613143446.23937-1-philmd@redhat.com> References: <20190613143446.23937-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 13 Jun 2019 14:37:07 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 20/20] hw/i386/pc: Extract the x86 generic fw_cfg code 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: Yang Zhong , Eduardo Habkost , kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Rob Bradford , Paolo Bonzini , Samuel Ortiz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Extract all the functions that are not PC-machine specific into the (arch-specific) fw_cfg.c file. This will allow other X86-machine to reuse these functions. Suggested-by: Samuel Ortiz Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/i386/fw_cfg.c | 137 +++++++++++++++++++++++++++++++++++++++++++++++ hw/i386/fw_cfg.h | 8 +++ hw/i386/pc.c | 130 +------------------------------------------- 3 files changed, 146 insertions(+), 129 deletions(-) diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index 380a819230..b033d99bc4 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -13,8 +13,15 @@ */ =20 #include "qemu/osdep.h" +#include "sysemu/numa.h" +#include "hw/acpi/acpi.h" +#include "hw/firmware/smbios.h" +#include "hw/i386/pc.h" #include "hw/i386/fw_cfg.h" +#include "hw/timer/hpet.h" #include "hw/nvram/fw_cfg.h" +#include "e820_memory_layout.h" +#include "kvm_i386.h" =20 const char *fw_cfg_arch_key_name(uint16_t key) { @@ -36,3 +43,133 @@ const char *fw_cfg_arch_key_name(uint16_t key) } return NULL; } + +FWCfgState *fw_cfg_arch_create(MachineState *ms, + const CPUArchIdList *cpus, + uint16_t boot_cpus, + uint16_t apic_id_limit) +{ + FWCfgState *fw_cfg; + uint64_t *numa_fw_cfg; + int i; + + fw_cfg =3D fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4, + &address_space_memory); + fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, boot_cpus); + + /* + * FW_CFG_MAX_CPUS is a bit confusing/problematic on x86: + * + * For machine types prior to 1.8, SeaBIOS needs FW_CFG_MAX_CPUS for + * building MPTable, ACPI MADT, ACPI CPU hotplug and ACPI SRAT table, + * that tables are based on xAPIC ID and QEMU<->SeaBIOS interface + * for CPU hotplug also uses APIC ID and not "CPU index". + * This means that FW_CFG_MAX_CPUS is not the "maximum number of CPUs", + * but the "limit to the APIC ID values SeaBIOS may see". + * + * So for compatibility reasons with old BIOSes we are stuck with + * "etc/max-cpus" actually being apic_id_limit + */ + fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, apic_id_limit); + fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); + fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, + acpi_tables, acpi_tables_len); + fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override(= )); + + 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, + sizeof(struct e820_entry) * e820_get_num_entries()); + + fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, &hpet_cfg, sizeof(hpet_cfg)); + /* + * allocate memory for the NUMA channel: one (64bit) word for the numb= er + * of nodes, one word for each VCPU->node and one word for each node to + * hold the amount of memory. + */ + numa_fw_cfg =3D g_new0(uint64_t, 1 + apic_id_limit + nb_numa_nodes); + numa_fw_cfg[0] =3D cpu_to_le64(nb_numa_nodes); + for (i =3D 0; i < cpus->len; i++) { + unsigned int apic_id =3D cpus->cpus[i].arch_id; + assert(apic_id < apic_id_limit); + numa_fw_cfg[apic_id + 1] =3D cpu_to_le64(cpus->cpus[i].props.node_= id); + } + for (i =3D 0; i < nb_numa_nodes; i++) { + numa_fw_cfg[apic_id_limit + 1 + i] =3D + cpu_to_le64(numa_info[i].node_mem); + } + fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, numa_fw_cfg, + (1 + apic_id_limit + nb_numa_nodes) * + sizeof(*numa_fw_cfg)); + + return fw_cfg; +} + +void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg) +{ + uint8_t *smbios_tables, *smbios_anchor; + size_t smbios_tables_len, smbios_anchor_len; + struct smbios_phys_mem_area *mem_array; + unsigned i, array_count; + X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); + + /* tell smbios about cpuid version and features */ + smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]= ); + + smbios_tables =3D 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); + } + + /* build the array of physical mem area from e820 table */ + mem_array =3D g_malloc0(sizeof(*mem_array) * e820_get_num_entries()); + for (i =3D 0, array_count =3D 0; i < e820_get_num_entries(); i++) { + uint64_t addr, len; + + if (e820_get_entry(i, E820_RAM, &addr, &len)) { + mem_array[array_count].address =3D addr; + mem_array[array_count].length =3D len; + array_count++; + } + } + smbios_get_tables(mem_array, array_count, + &smbios_tables, &smbios_tables_len, + &smbios_anchor, &smbios_anchor_len); + g_free(mem_array); + + 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); + } +} + +void fw_cfg_build_feature_control(MachineState *ms, FWCfgState *fw_cfg) +{ + X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); + CPUX86State *env =3D &cpu->env; + uint32_t unused, ecx, edx; + uint64_t feature_control_bits =3D 0; + uint64_t *val; + + cpu_x86_cpuid(env, 1, 0, &unused, &unused, &ecx, &edx); + if (ecx & CPUID_EXT_VMX) { + feature_control_bits |=3D FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SM= X; + } + + if ((edx & (CPUID_EXT2_MCE | CPUID_EXT2_MCA)) =3D=3D + (CPUID_EXT2_MCE | CPUID_EXT2_MCA) && + (env->mcg_cap & MCG_LMCE_P)) { + feature_control_bits |=3D FEATURE_CONTROL_LMCE; + } + + if (!feature_control_bits) { + return; + } + + val =3D g_malloc(sizeof(*val)); + *val =3D cpu_to_le64(feature_control_bits | FEATURE_CONTROL_LOCKED); + fw_cfg_add_file(fw_cfg, "etc/msr_feature_control", val, sizeof(*val)); +} diff --git a/hw/i386/fw_cfg.h b/hw/i386/fw_cfg.h index 17a4bc32f2..f9047a74e8 100644 --- a/hw/i386/fw_cfg.h +++ b/hw/i386/fw_cfg.h @@ -9,6 +9,7 @@ #ifndef HW_I386_FW_CFG_H #define HW_I386_FW_CFG_H =20 +#include "hw/boards.h" #include "hw/nvram/fw_cfg.h" =20 #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0) @@ -17,4 +18,11 @@ #define FW_CFG_E820_TABLE (FW_CFG_ARCH_LOCAL + 3) #define FW_CFG_HPET (FW_CFG_ARCH_LOCAL + 4) =20 +FWCfgState *fw_cfg_arch_create(MachineState *ms, + const CPUArchIdList *cpus, + uint16_t boot_cpus, + uint16_t apic_id_limit); +void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg); +void fw_cfg_build_feature_control(MachineState *ms, FWCfgState *fw_cfg); + #endif diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d96328d8db..58b60cb538 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -80,6 +80,7 @@ #include "hw/net/ne2000-isa.h" #include "standard-headers/asm-x86/bootparam.h" #include "e820_memory_layout.h" +#include "fw_cfg.h" =20 /* debug PC/ISA interrupts */ //#define DEBUG_IRQ @@ -890,106 +891,6 @@ static uint32_t x86_cpu_apic_id_from_index(unsigned i= nt cpu_index) } } =20 -static void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg) -{ - uint8_t *smbios_tables, *smbios_anchor; - size_t smbios_tables_len, smbios_anchor_len; - struct smbios_phys_mem_area *mem_array; - unsigned i, array_count; - X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); - - /* tell smbios about cpuid version and features */ - smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]= ); - - smbios_tables =3D 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); - } - - /* build the array of physical mem area from e820 table */ - mem_array =3D g_malloc0(sizeof(*mem_array) * e820_get_num_entries()); - for (i =3D 0, array_count =3D 0; i < e820_get_num_entries(); i++) { - uint64_t addr, len; - - if (e820_get_entry(i, E820_RAM, &addr, &len)) { - mem_array[array_count].address =3D addr; - mem_array[array_count].length =3D len; - array_count++; - } - } - smbios_get_tables(mem_array, array_count, - &smbios_tables, &smbios_tables_len, - &smbios_anchor, &smbios_anchor_len); - g_free(mem_array); - - 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 FWCfgState *fw_cfg_arch_create(MachineState *ms, - const CPUArchIdList *cpus, - uint16_t boot_cpus, - uint16_t apic_id_limit) -{ - FWCfgState *fw_cfg; - uint64_t *numa_fw_cfg; - int i; - - fw_cfg =3D fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4, - &address_space_memory); - fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, boot_cpus); - - /* FW_CFG_MAX_CPUS is a bit confusing/problematic on x86: - * - * For machine types prior to 1.8, SeaBIOS needs FW_CFG_MAX_CPUS for - * building MPTable, ACPI MADT, ACPI CPU hotplug and ACPI SRAT table, - * that tables are based on xAPIC ID and QEMU<->SeaBIOS interface - * for CPU hotplug also uses APIC ID and not "CPU index". - * This means that FW_CFG_MAX_CPUS is not the "maximum number of CPUs", - * but the "limit to the APIC ID values SeaBIOS may see". - * - * So for compatibility reasons with old BIOSes we are stuck with - * "etc/max-cpus" actually being apic_id_limit - */ - fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, apic_id_limit); - fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); - fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, - acpi_tables, acpi_tables_len); - fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override(= )); - - 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, - sizeof(struct e820_entry) * e820_get_num_entries()); - - fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, &hpet_cfg, sizeof(hpet_cfg)); - /* allocate memory for the NUMA channel: one (64bit) word for the numb= er - * of nodes, one word for each VCPU->node and one word for each node to - * hold the amount of memory. - */ - numa_fw_cfg =3D g_new0(uint64_t, 1 + apic_id_limit + nb_numa_nodes); - numa_fw_cfg[0] =3D cpu_to_le64(nb_numa_nodes); - for (i =3D 0; i < cpus->len; i++) { - unsigned int apic_id =3D cpus->cpus[i].arch_id; - assert(apic_id < apic_id_limit); - numa_fw_cfg[apic_id + 1] =3D cpu_to_le64(cpus->cpus[i].props.node_= id); - } - for (i =3D 0; i < nb_numa_nodes; i++) { - numa_fw_cfg[apic_id_limit + 1 + i] =3D - cpu_to_le64(numa_info[i].node_mem); - } - fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, numa_fw_cfg, - (1 + apic_id_limit + nb_numa_nodes) * - sizeof(*numa_fw_cfg)); - - return fw_cfg; -} - static long get_file_size(FILE *f) { long where, size; @@ -1521,35 +1422,6 @@ void pc_cpus_init(PCMachineState *pcms) } } =20 -static void fw_cfg_build_feature_control(MachineState *ms, - FWCfgState *fw_cfg) -{ - X86CPU *cpu =3D X86_CPU(ms->possible_cpus->cpus[0].cpu); - CPUX86State *env =3D &cpu->env; - uint32_t unused, ecx, edx; - uint64_t feature_control_bits =3D 0; - uint64_t *val; - - cpu_x86_cpuid(env, 1, 0, &unused, &unused, &ecx, &edx); - if (ecx & CPUID_EXT_VMX) { - feature_control_bits |=3D FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SM= X; - } - - if ((edx & (CPUID_EXT2_MCE | CPUID_EXT2_MCA)) =3D=3D - (CPUID_EXT2_MCE | CPUID_EXT2_MCA) && - (env->mcg_cap & MCG_LMCE_P)) { - feature_control_bits |=3D FEATURE_CONTROL_LMCE; - } - - if (!feature_control_bits) { - return; - } - - val =3D g_malloc(sizeof(*val)); - *val =3D cpu_to_le64(feature_control_bits | FEATURE_CONTROL_LOCKED); - fw_cfg_add_file(fw_cfg, "etc/msr_feature_control", val, sizeof(*val)); -} - static void rtc_set_cpus_count(ISADevice *rtc, uint16_t cpus_count) { if (cpus_count > 0xff) { --=20 2.20.1