From nobody Mon May 13 00:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778815; cv=none; d=zohomail.com; s=zohoarc; b=EuFhfFxeUj52YIyyV0EjM1eLDOCcZw9kwWZm5b1Qiv2m8mAs0NLP8WBKm5VVlrqk6XXKRwfpdqvNQMds5Wo83ThOsCMrueWUG8W1GibB/vlJbI818Sk7bXPth5DapklUiERKpCeh5fp4/podsvPP7lw47KVYtg5XOgh799floJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778815; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=C0DcxDO3m2vtxwdKzv4jUJfjIm4ktk+IdMc2OXd8j08=; b=n2wtVtvuRFt3ozkt5+5H0pguF5WRH4rHotSlyTkl3uDvz0n5fmDxvZLBV1HivlNSlFSdBKqOgDLcoxJP7kB1bATr26qMkd6YFcNllMifalwF+dERGEXhoN2QaSSebHC10rfSjdVe1SfORXtIen7TygsIcXUFwBmD7ICqd4DSb/A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778815361763.7058398468978; Mon, 18 Mar 2024 09:20:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFeR-00075C-FB; Mon, 18 Mar 2024 12:15:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeG-00071Z-5u for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:15:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeE-0004WR-KR for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:15:39 -0400 Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-74-57thVi9VNRWlkUiW6QaDGQ-1; Mon, 18 Mar 2024 12:15:35 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-513e0c5f399so1755644e87.3 for ; Mon, 18 Mar 2024 09:15:35 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id j17-20020a05600c191100b00414612e755fsm605975wmq.8.2024.03.18.09.15.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=C0DcxDO3m2vtxwdKzv4jUJfjIm4ktk+IdMc2OXd8j08=; b=YeY9gmcDOpkAOvfsnGZKIQJbVdagILqDUUvmIM6E03/ZSGOLmkgKLyRvhgXA4dVbuy/t8Q qkaP1QKI2AGMxbNAw3A9rrM3pRsmalGSG00zKs3wNgUbkAkOWhH+QzBRUmL0geHrpQAYu4 FzDngIIp/bTtk3RUKQtHXgY2Qr4A7Ag= X-MC-Unique: 57thVi9VNRWlkUiW6QaDGQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778533; x=1711383333; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=C0DcxDO3m2vtxwdKzv4jUJfjIm4ktk+IdMc2OXd8j08=; b=JsCEe6IAawzAbchsQvucIGZd2O1mKJw3dlowsl2tg8tmynvmBwI6ZrCI9JZU6czwcz N5S0GxR4LaY1cszYsFFTJwufr+s9u0odquUAj+qHppE35Sp/HtIguAq5pPLnkQYU+a2F 0mauuuY3hQWo+aytdzxO7C+sQFsJavpyIYlKGu+ZGTXqvs7GZdL9ltihy9Snq+c1YiBB 2ayiD54fMSucoBLnrDcFVWeqCWvD91U16Nb1OFyc4hVAuw3OWwzBu1x/g+arNIKZj5F6 6DoXDCUom+wEtFV0glrJk2hdBsczwEBr6kT22weY59S6UfYqx2bYLybW8mLQnrpaZ8Sm pq9Q== X-Gm-Message-State: AOJu0Yw/Qb83fUZuaMROvLR2Mdrj1efyy8prdDiLSe83O5NCnH7QcPyQ oRPNckA5o1L/B+9V3ntGkdgnSq9WBZBs9NfetXIuaIsrC8desgCYeh9XuV7qNGVhDf+uWQULhMb X9SiJg64QHxyXKyI8RyWzbNiE0VYRloqGlLzSpdaE82fi9C/04bhwhOtx1lwYLcmMl4Ry2hRJl4 LH9cwA/Ys7ZByEImWLEHDs4tvNxCav7A== X-Received: by 2002:ac2:5487:0:b0:513:e668:cbac with SMTP id t7-20020ac25487000000b00513e668cbacmr3300765lfk.55.1710778533604; Mon, 18 Mar 2024 09:15:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0lSbU5WDnfMW2kP/TJNsjAf4zDZxZfMByDk3WWlJWs8sZIzqLer+xs8729OiLF7NJnXcADQ== X-Received: by 2002:ac2:5487:0:b0:513:e668:cbac with SMTP id t7-20020ac25487000000b00513e668cbacmr3300734lfk.55.1710778532981; Mon, 18 Mar 2024 09:15:32 -0700 (PDT) Date: Mon, 18 Mar 2024 12:15:29 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Felix Wu , Nabih Estefan , Ani Sinha , Igor Mammedov Subject: [PULL 01/24] SMBIOS: fix long lines Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778816555100009 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Break up long lines to fit under 80/90 char limit. Fixes: 04f143d828 ("Implement SMBIOS type 9 v2.6") Fixes: 735eee07d1 ("Implement base of SMBIOS type 9 descriptor.") Cc: "Felix Wu" Cc: Nabih Estefan Reviewed-by: Ani Sinha Signed-off-by: Michael S. Tsirkin --- hw/smbios/smbios.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index e3d5d8f2e2..949c2d74a1 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -1592,12 +1592,15 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) t =3D g_new0(struct type9_instance, 1); save_opt(&t->slot_designation, opts, "slot_designation"); t->slot_type =3D qemu_opt_get_number(opts, "slot_type", 0); - t->slot_data_bus_width =3D qemu_opt_get_number(opts, "slot_dat= a_bus_width", 0); + t->slot_data_bus_width =3D + qemu_opt_get_number(opts, "slot_data_bus_width", 0); t->current_usage =3D qemu_opt_get_number(opts, "current_usage"= , 0); t->slot_length =3D qemu_opt_get_number(opts, "slot_length", 0); t->slot_id =3D qemu_opt_get_number(opts, "slot_id", 0); - t->slot_characteristics1 =3D qemu_opt_get_number(opts, "slot_c= haracteristics1", 0); - t->slot_characteristics2 =3D qemu_opt_get_number(opts, "slot_c= haracteristics2", 0); + t->slot_characteristics1 =3D + qemu_opt_get_number(opts, "slot_characteristics1", 0); + t->slot_characteristics2 =3D + qemu_opt_get_number(opts, "slot_characteristics2", 0); save_opt(&t->pcidev, opts, "pcidev"); QTAILQ_INSERT_TAIL(&type9, t, next); return; --=20 MST From nobody Mon May 13 00:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778692; cv=none; d=zohomail.com; s=zohoarc; b=WYfQUyYyU/UMGrzWsPjYNyiver/L2I4ND9H5QAZo0F4fZbQ3MNqklrv5MPkVTifxknOHs5Pl7hgbLw/G6l4dG+T3Rsn7YZLfKzVVKLKd/Iza/oFFGhCpulpe7mhkwjOtMmfmQZ66o6WlKhAHXp11/SqkV6IY5jjickPjkWRdTnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778692; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Vb2XPO70AEln4QjXZz3yhsVjTizmmAgSKUpNYloZ4WY=; b=ZnmVTawrPSGJIc0QH/kyiZld+g+BVdI/usmtARZ42+vc41DTZeRwCk3IhH3zmUUkMJDq+vXnlgkw65Yn32iYf/QdU5wriRtKnO1LKtK0cQpuMXJAjllX1wBiItyXbODeYzCIcGGcXAQ5OqbogtC18Fgal1U/vUHWGrU2JmLI+Yw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778692232150.5189946409156; Mon, 18 Mar 2024 09:18:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFeQ-00074s-TJ; Mon, 18 Mar 2024 12:15:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeM-000736-Eb for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:15:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeI-0004YC-Ac for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:15:45 -0400 Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-Uu2O5rtpMLKvFUwUfz0uMg-1; Mon, 18 Mar 2024 12:15:39 -0400 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-513e3ed9bc4so1433167e87.3 for ; Mon, 18 Mar 2024 09:15:39 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id fj14-20020a05600c0c8e00b00413385ec7e6sm18525269wmb.47.2024.03.18.09.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:15:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Vb2XPO70AEln4QjXZz3yhsVjTizmmAgSKUpNYloZ4WY=; b=L8xP/mfujITQSvXXTxqTtukjFBht4alfg2cNi0c4NdUu+ZZ5yLQDGq9lJaTw1CwyBfTBNp alTahWAt/Q6vgSgJQ4JWq91KpGcsMDGbfeEsPqgaacf3J0OpMw4otjhyWbPZgE21gdTjXD /kHMEvsStr5f6qAQIIUH6JSCmMBhGMU= X-MC-Unique: Uu2O5rtpMLKvFUwUfz0uMg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778537; x=1711383337; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Vb2XPO70AEln4QjXZz3yhsVjTizmmAgSKUpNYloZ4WY=; b=udtaa8qCTTb72652P61YUXEEaLxtYD0dMyuAsWAHfrgIoxJCJeCIL3MK7BAmT9Hikf LoWLBje5f1zCXHGwf516lM9eHZtDTSvImdMgKMfOIXaDDnNlQ0PeVczjA6HgWLqXjPBB fTtmNcQgQ/NzJr0WSbmAOpaFDyd/bBMiIQ4/G9CzbQ5tfDQHoKu0jIBYBVAPD3+tQn0b one0UnTM+y2sDWkiBeZlL0lXvJNvXp8I/ph4ki08cRPN+/d9kwg+JqdBP4sd3Nbk0TUB pXPOO5UyenckMqq5yJnjiWdo89fJCyuyePryOvsgAORixPQoO0qJbFNcpxGNkkOZgZn9 EwjA== X-Gm-Message-State: AOJu0Yywa1jSZ8tR0V2QJdVWEgyKbVl66PhdKEFJL41/pe3xcJVbRXIE oGsppf2rj/Cgf6LbUdETwcc1JMzuFmoLFiYHznVAZHZGe908k0cGzGgrmX6zL01zGbteUHAN5i5 2msoFoVP6pNk8aIY4DF92OKz5S04k+sFKU28eD1wuJeTGL59fwsk4Wq4FbM7Td+tkEtivpQy3Vx 9lY9TfdEbo/RucESvlkr+hmQ1Wa0E7GQ== X-Received: by 2002:ac2:5b4c:0:b0:513:dbcd:7b87 with SMTP id i12-20020ac25b4c000000b00513dbcd7b87mr5935277lfp.45.1710778536947; Mon, 18 Mar 2024 09:15:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHIgj/Lp5jF3nKobkQnCf+d2quJ4MMXqroBLW0H1WUuvzdCxIjmS2bO6kCJAs7EkSMzyroqew== X-Received: by 2002:ac2:5b4c:0:b0:513:dbcd:7b87 with SMTP id i12-20020ac25b4c000000b00513dbcd7b87mr5935247lfp.45.1710778536311; Mon, 18 Mar 2024 09:15:36 -0700 (PDT) Date: Mon, 18 Mar 2024 12:15:33 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Lukas Stockner , Marcel Apfelbaum , Markus Armbruster , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Eric Blake Subject: [PULL 02/24] qapi: document PCIe Gen5/Gen6 speeds since 9.0 Message-ID: <1bdef7a6290b1a7ed820aa2e9c25fa85069b2b85.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778694147100003 Document that PCIe Gen5/Gen6 speeds are only in QAPI since 9.0 - the rest is since 4.0. Cc: Lukas Stockner Cc: Marcel Apfelbaum Fixes: c08da86dc4 ("pcie: Support PCIe Gen5/Gen6 link speeds") Suggested-by: Markus Armbruster Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- qapi/common.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qapi/common.json b/qapi/common.json index 867a9ad9b0..7558ce5430 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -107,9 +107,9 @@ # # @16: 16.0GT/s # -# @32: 32.0GT/s +# @32: 32.0GT/s (since 9.0) # -# @64: 64.0GT/s +# @64: 64.0GT/s (since 9.0) # # Since: 4.0 ## --=20 MST From nobody Mon May 13 00:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778645; cv=none; d=zohomail.com; s=zohoarc; b=JSQdIZMgfGYWvIogGJGa9fF0+IdZnlgAW/GkiAM2UdJ26taXARQGr86EEdbaDoJqKwWJb51yM4DNhStuJ06we8CstwPyVXBhO39CGoW551BiEay5FDVtPyWckMLgS9KTUmtyUh9n8mTddQLIa0y8XLS95Z/hVQKBHW3WqMI0EPA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778645; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LgMKQIgmrlt2/gT6pFRai77FFjqKkjfoJlKBE508wB8=; b=ClukKI1rq/W1u2zRziIE3oqEHoKW/ij/OQJFIs5MgSsW08B6iArXW3046dzEt6DSmgbkO+HIufyeqXnNaX9vckXVr4fWYQSZ12LPHGpNQ8Fy4F7O41u+3K9AHKKpsFVaHWEs6uHq/H3HerRUH0Icvr/4nxVbZxnXWL/k0pxCrMo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17107786454371016.8532228504416; Mon, 18 Mar 2024 09:17:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFeW-00075p-DY; Mon, 18 Mar 2024 12:15:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeN-00073F-Go for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:15:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeM-0004aW-1z for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:15:47 -0400 Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-610-lxgHLeZfPj68QKUEYpm96A-1; Mon, 18 Mar 2024 12:15:43 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-513da602cafso2722871e87.1 for ; Mon, 18 Mar 2024 09:15:42 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id w9-20020a05600c474900b0041408af4b34sm7818539wmo.10.2024.03.18.09.15.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778545; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LgMKQIgmrlt2/gT6pFRai77FFjqKkjfoJlKBE508wB8=; b=RkY7VGSv/opIpEYO+fJDuXC8Us1SbTw6YhJeQF0JuPCsTUxKSCU4+kl5Iy10wLa/XmdgwY xGJxEbgPckMTPkxP+7H+qZ46srYu2Q6RtphA6Bd7ljdcWgn1UmD8VCICbAsOXiClkMtOQq Ln80ernAMXTVZ+L4KIlVQlkVXm7KFv0= X-MC-Unique: lxgHLeZfPj68QKUEYpm96A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778540; x=1711383340; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LgMKQIgmrlt2/gT6pFRai77FFjqKkjfoJlKBE508wB8=; b=DdId0dRqm0dwhjlYkUFrGKwyBfjrjJXK7XmCZo3Us1mXq1zq+4rCLXL3WbiWoszrsU liYXWGtUMYTek7LAG766Jt+8Mg9bv6lgp+9oo1V/Juqd5GY1FwqXrXzIXX8Q/4NgkQtC k4m6vo7zMTt7AA1SB1j2a7lGweTR8yYFsUX+ZUSO1I5B/O+yJ4nYqcwXug61FeheJcpo IT2iOi0hleBgpKHlWSdKJYtZGVfcAzVTEpLBctUARtMiTOKFZRedYW7w6/AHG6ctSKpU jXF8M6pKLrbu2gUnZgT82+dbkiBx97c6HRWDCNds/NV6cBLN/wJgo4yzNljzQ7MEv72V YGbg== X-Gm-Message-State: AOJu0YxS4I3hlecXQekl9g0tZNXIqPW6LjNNljPErC56TZwIK0ASVDjB Nc9jg0FBNhmWmiXBivMLkvHSrtgFJAFU19/jP9G0jXIwKJgf/rmStMLK7N2Ar1JY0B88cdBSKBM IPrVM9kH0PWmbVOnfZePo8nuI3618VQfZLOf+cwCD2hC/wJtBvuvS1z0tx6V5vQLFtP0AQdgIvx FzJjw0B9cpmxLwtJQao9dcovnvBm39HA== X-Received: by 2002:ac2:5b5e:0:b0:513:d1cd:b902 with SMTP id i30-20020ac25b5e000000b00513d1cdb902mr7678065lfp.32.1710778540153; Mon, 18 Mar 2024 09:15:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfJwSLvV25bVw3/ZZn9bT44TODshzLSpj0xAhllnCGOWmBpEh3o1Ykms8ughzKUiZITIY4VA== X-Received: by 2002:ac2:5b5e:0:b0:513:d1cd:b902 with SMTP id i30-20020ac25b5e000000b00513d1cdb902mr7678048lfp.32.1710778539643; Mon, 18 Mar 2024 09:15:39 -0700 (PDT) Date: Mon, 18 Mar 2024 12:15:36 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Thomas =?utf-8?Q?Wei=C3=9Fschuh?= , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Subject: [PULL 03/24] docs/specs/pvpanic: mark shutdown event as not implemented Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778648191100003 From: Thomas Wei=C3=9Fschuh Mention the fact that this event is not yet implemented to avoid confusion. As requested by Michael. Signed-off-by: Thomas Wei=C3=9Fschuh Message-Id: <20240313-pvpanic-note-v1-1-7f2571cdaedc@t-8ch.de> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/specs/pvpanic.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/specs/pvpanic.rst b/docs/specs/pvpanic.rst index 61a80480ed..b0f27860ec 100644 --- a/docs/specs/pvpanic.rst +++ b/docs/specs/pvpanic.rst @@ -29,7 +29,7 @@ bit 1 a guest panic has happened and will be handled by the guest; the host should record it or report it, but should not affect the execution of the guest. -bit 2 +bit 2 (to be implemented) a regular guest shutdown has happened and should be processed by the host =20 PCI Interface --=20 MST From nobody Mon May 13 00:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778597; cv=none; d=zohomail.com; s=zohoarc; b=j3cri6oWW58a8kZ6vVHWMqJ/6tTPKigwZ/3KQyEzQI8sSy+L0ssSg0CcTc1zkgImTPBzcHqe3KQyucoFdkbIJmHyl2U1izMCvNp6/PwZok17AR24U1IDEqy+cMnCtJ96KgSBUPO+UoSdWuWCeSGQ2vPAeanNYHLciAbOBEuxCKg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778597; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VAGzRhA3KrnZclGngelP6JYgHXE64SaHbxnIXaBAvLk=; b=VfWvvqrRuqVqZ0HTnc2PER4CoRhWmOaNnimCIGyifjIE35x3GeMCFms00BaQChp2WM00mM/X4dY9SKDyMl1WADswUKSA0YDZnFjG59cehOidxhS12vs8GzynY9sfYrCZ6ylCsGZYPAygNSdQfC2xKWigdojZuqZmK8fRRabX5+8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17107785974061023.3290597166542; Mon, 18 Mar 2024 09:16:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFeY-00077K-Qc; Mon, 18 Mar 2024 12:15:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeR-00075J-8C for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:15:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeO-0004aw-I9 for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:15:51 -0400 Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-517-0bVnEgNSMnmdVVIkGr3x5g-1; Mon, 18 Mar 2024 12:15:45 -0400 Received: by mail-lf1-f72.google.com with SMTP id 2adb3069b0e04-514b4c75fc5so512202e87.2 for ; Mon, 18 Mar 2024 09:15:45 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id t14-20020a05600c450e00b0041409db0349sm7074200wmo.48.2024.03.18.09.15.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778547; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VAGzRhA3KrnZclGngelP6JYgHXE64SaHbxnIXaBAvLk=; b=RkBXWT+msnhb6cuYe51trIZo0aBTrL4991MH8Jo8gfFDzhGMaBpylC93YZgavzFKB7lT/C /PVDhHUKeBfvqULGvJt+ApSWqSBfEM+uAFJWJCIAc3uDeeE8RLvh++MzSYP62uLku6ZfPf g+wHwb3a9rPV1mdlW+44sbKhymD9PoA= X-MC-Unique: 0bVnEgNSMnmdVVIkGr3x5g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778543; x=1711383343; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VAGzRhA3KrnZclGngelP6JYgHXE64SaHbxnIXaBAvLk=; b=W1wz1Y1X5P1zlr+1e1Cb5VoJbswaottoNmWSe+hEqgqfv5WNtgn/Kk5x8zdMo2mHxZ uWBt+Q01tj/nPG1QK4nt5jSHeRVXN7hW12lFqIBjAPkzCiZYpNcOcDBFFDj51/T6zNtq NhY56bNOzZwVrxWl6fl6JsM1r0Dsk/t8ylTFlmhheAGvJ2HSz+CEsSGgnno5pj9Wt4dt CfLy+jZ5JGd9BFGOecn7pBudjGcan3wrSnF6HBGjwsf2iPJsYR0xLgId33myqRTY/oII dOZqtILv+fXhW4heAUWju5Y4hEdeoiersBaCkXe4ND/Io61gSmjvXe8uzMHa/QVWsKUN iSag== X-Gm-Message-State: AOJu0YzBHLKJOUMxjODYkeECa/vDvV6F9fr4ktvtnNsDtz9+0jKJ/yye Q+xEOoyQ5CqMWj+qrxeGDUSB1N/xIwNCmAevijy1bsz2STcC30o/GpV0N72bZWPcdNmZhYxDT54 DtvNGFFPjkNu5qAH21Z0uxkIqWF8K20neG02aQMop7B3+0m+mkmyWpaTtvWFfG3UyfVGh4/tBKL jLaMFGEe6richmtTLjkkDIxypnau5FzQ== X-Received: by 2002:a19:5f5a:0:b0:513:d372:20f7 with SMTP id a26-20020a195f5a000000b00513d37220f7mr7541813lfj.21.1710778543410; Mon, 18 Mar 2024 09:15:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgek161MYUHnJIbjyYLQZ0h22d8qmpM22vUfL3pAJbbWqVTj8oNWXTIjsVD8Jq+m/tE9Bclg== X-Received: by 2002:a19:5f5a:0:b0:513:d372:20f7 with SMTP id a26-20020a195f5a000000b00513d37220f7mr7541794lfj.21.1710778542845; Mon, 18 Mar 2024 09:15:42 -0700 (PDT) Date: Mon, 18 Mar 2024 12:15:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Fiona Ebner Subject: [PULL 04/24] tests: smbios: make it possible to write SMBIOS only test Message-ID: <53002d9028f9d8b3215dafd7c0a55047bb5c9804.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778599793100007 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Cureently it not possible to run SMBIOS test without ACPI one, which gets into the way when testing ACPI-less configs. Extract SMBIOS testing into separate routines that could also be run without ACPI dependency and use that for testing SMBIOS. As the 1st user add "acpi/piix4/smbios-options" test case. Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-2-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 47 +++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 21811a1ab5..b2992bafa8 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -858,6 +858,27 @@ static void test_vm_prepare(const char *params, test_d= ata *data) g_free(args); } =20 +static void process_smbios_tables_noexit(test_data *data) +{ + /* + * TODO: make SMBIOS tests work with UEFI firmware, + * Bug on uefi-test-tools to provide entry point: + * https://bugs.launchpad.net/qemu/+bug/1821884 + */ + if (!(data->uefi_fl1 && data->uefi_fl2)) { + SmbiosEntryPointType ep_type =3D test_smbios_entry_point(data); + test_smbios_structs(data, ep_type); + } +} + +static void test_smbios(const char *params, test_data *data) +{ + test_vm_prepare(params, data); + boot_sector_test(data->qts); + process_smbios_tables_noexit(data); + qtest_quit(data->qts); +} + static void process_acpi_tables_noexit(test_data *data) { test_acpi_load_tables(data); @@ -868,15 +889,7 @@ static void process_acpi_tables_noexit(test_data *data) test_acpi_asl(data); } =20 - /* - * TODO: make SMBIOS tests work with UEFI firmware, - * Bug on uefi-test-tools to provide entry point: - * https://bugs.launchpad.net/qemu/+bug/1821884 - */ - if (!(data->uefi_fl1 && data->uefi_fl2)) { - SmbiosEntryPointType ep_type =3D test_smbios_entry_point(data); - test_smbios_structs(data, ep_type); - } + process_smbios_tables_noexit(data); } =20 static void process_acpi_tables(test_data *data) @@ -2064,6 +2077,20 @@ static void test_acpi_q35_pvpanic_isa(void) free_test_data(&data); } =20 +static void test_acpi_pc_smbios_options(void) +{ + uint8_t req_type11[] =3D { 11 }; + test_data data =3D { + .machine =3D MACHINE_PC, + .variant =3D ".pc_smbios_options", + .required_struct_types =3D req_type11, + .required_struct_types_len =3D ARRAY_SIZE(req_type11), + }; + + test_smbios("-smbios type=3D11,value=3DTEST", &data); + free_test_data(&data); +} + static void test_oem_fields(test_data *data) { int i; @@ -2215,6 +2242,8 @@ int main(int argc, char *argv[]) #ifdef CONFIG_POSIX qtest_add_func("acpi/piix4/acpierst", test_acpi_piix4_acpi_ers= t); #endif + qtest_add_func("acpi/piix4/smbios-options", + test_acpi_pc_smbios_options); } if (qtest_has_machine(MACHINE_Q35)) { qtest_add_func("acpi/q35", test_acpi_q35_tcg); --=20 MST From nobody Mon May 13 00:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778788; cv=none; d=zohomail.com; s=zohoarc; b=GchVzZgkaEeNlRe8V9QalbA6zAv1KPVHwUlY8xmJjc06yIl3n+MbBHapgubEeapQ8+G6XKgv0K5OQIUhw6uJgf3UwEyv5dBlWR/KpJ/XnFYA98jf6jJ1B7xbhiB4/w49xnIPUwtb0175b5Q/o9XVC6HcoI8UVPG3ZVCL2HbUOTY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778788; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8d1jC5pXP2pg+IhFhot7syCv1JspX4H/Mza9SReTv6M=; b=KqBYrPg84CPx4p2sLkqpztdRovjDux209PLNJHdt6+fG6W0tq1JSIOeF8MJX0e2h5HwfT2zCy0mpqGDM2xu6s4YhP04/PLd8x/7SCIGFr4r9d/EwEeBb1MCL2Idue5JyBPfrR+bFKMk4TB8scRRzCxxLQgJx5lMP/q7m591LzMs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17107787885711019.1521001922566; Mon, 18 Mar 2024 09:19:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFet-0007J2-4W; Mon, 18 Mar 2024 12:16:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeT-00075z-6h for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:15:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeR-0004bS-Hz for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:15:52 -0400 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-370-_wzDt6T7MBuKIzNAKl0YrA-1; Mon, 18 Mar 2024 12:15:48 -0400 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40e435a606aso24420895e9.3 for ; Mon, 18 Mar 2024 09:15:48 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id n20-20020a05600c4f9400b00414610d9223sm687173wmq.14.2024.03.18.09.15.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:15:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778550; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8d1jC5pXP2pg+IhFhot7syCv1JspX4H/Mza9SReTv6M=; b=XKSuGiShOVemxrLHANX8aD95c0tIyWNiH1si1xiHxGmSy5BOJFboNx1fKYD7D/517TJdLx e8uUy+idyljeHkwa2pqp1TQMSRss3ioUt+GPKlbi9FjOU/idLUd70Vni3j8By/3Uo40SlG CGLOPZwap96AOVZ1P1W8xo2kE3wM98c= X-MC-Unique: _wzDt6T7MBuKIzNAKl0YrA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778547; x=1711383347; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8d1jC5pXP2pg+IhFhot7syCv1JspX4H/Mza9SReTv6M=; b=Ceb035jxgGx2AOtyPfZtWXYPu8Z1ybAPF9RuDhhj0YCEShXyeik6Uw6qOkNZjdZhrf kU3PVBpLok8VBGqQhsxUIAS945iBY6I2+VzDaBxOIC1y3IrhpFoM0dAyk7MvTJqsUMMb nreQs6a8vwCDNj1LApfDKibzSzrVA5Jvg16F9uYQtuLOFr5oBkXi8Zhu3s3UEVN5M1Pb aT0p2YJFZxTRjMIs0QakEvZAeQkGctk1RT2K2l6HIk9M4cR4YX/4r0vD93wIDq1la/ul VlHhsQFVlvlDI63g5w6Ciwr8Qw2pDfrUn5Ob+qfaT9GHQv0L8jAi5CDWeuSPFQp/HtG6 T0iA== X-Gm-Message-State: AOJu0Yxve6rcOvHsIDN/MQlhKXOUW+lR8h9QD4++8wuMDLM4c4scQIqU i91kjWiig/EvrWUt1DuTI3ZZTrwdWbP8SAzFw0Q2dDL86YS5+u8l5MtIqDG0g7HSEHmX/+EmcvP ymX+YSPX4PVk7dG5dlosFVCdfQ2jE67K9+jiK+laal/rIOSb6g/U6AndgvlwGPba/QZ6khkVtO5 wC40q8zVJjHUolPon2rxEZnPBNpxL10w== X-Received: by 2002:a05:600c:3b24:b0:414:c63:a781 with SMTP id m36-20020a05600c3b2400b004140c63a781mr2788653wms.1.1710778546673; Mon, 18 Mar 2024 09:15:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEw/sgTN9t+PBLuBuLzNZ6aCF0W9/g9KluberChmqPTXSkXcuAjiIOLBuZMw3vswXzUc6EcQ== X-Received: by 2002:a05:600c:3b24:b0:414:c63:a781 with SMTP id m36-20020a05600c3b2400b004140c63a781mr2788636wms.1.1710778546227; Mon, 18 Mar 2024 09:15:46 -0700 (PDT) Date: Mon, 18 Mar 2024 12:15:43 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Fiona Ebner Subject: [PULL 05/24] tests: smbios: add test for -smbios type=11 option Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778790473100006 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-3-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 17 +++++++++++++++++ tests/data/smbios/type11_blob | Bin 0 -> 11 bytes 2 files changed, 17 insertions(+) create mode 100644 tests/data/smbios/type11_blob diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index b2992bafa8..a116f88e1d 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -2091,6 +2091,21 @@ static void test_acpi_pc_smbios_options(void) free_test_data(&data); } =20 +static void test_acpi_pc_smbios_blob(void) +{ + uint8_t req_type11[] =3D { 11 }; + test_data data =3D { + .machine =3D MACHINE_PC, + .variant =3D ".pc_smbios_blob", + .required_struct_types =3D req_type11, + .required_struct_types_len =3D ARRAY_SIZE(req_type11), + }; + + test_smbios("-machine smbios-entry-point-type=3D32 " + "-smbios file=3Dtests/data/smbios/type11_blob", &data); + free_test_data(&data); +} + static void test_oem_fields(test_data *data) { int i; @@ -2244,6 +2259,8 @@ int main(int argc, char *argv[]) #endif qtest_add_func("acpi/piix4/smbios-options", test_acpi_pc_smbios_options); + qtest_add_func("acpi/piix4/smbios-blob", + test_acpi_pc_smbios_blob); } if (qtest_has_machine(MACHINE_Q35)) { qtest_add_func("acpi/q35", test_acpi_q35_tcg); diff --git a/tests/data/smbios/type11_blob b/tests/data/smbios/type11_blob new file mode 100644 index 0000000000000000000000000000000000000000..1d8fea4b0c6f040a13ba99c3fad= 762538b795614 GIT binary patch literal 11 Scmd;PW!S(N;u;*nzyJUX)&c?m literal 0 HcmV?d00001 --=20 MST From nobody Mon May 13 00:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778739; cv=none; d=zohomail.com; s=zohoarc; b=mME7H8EbZCKBIGiAF0TS6MPa0G26of2XO3qrbppA++yGNzCA9sIPYTvZiXpqY38PRUw20tbnVcjaD8ic9pZwJVWHuCTCskisCKzMsdBTOF1a0Cp57BJ6bNVWy+wvunLEoojqHIhn5vX8gWIMrWWmsWN9YbaUh2dkiyTYvzkRPA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778739; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9GIqYF1ojYqPGWd3cMEoiuZhI6Rp902S/5cqNYYeWpo=; b=UqeEAxKQ7i5qBndzLfhdgibTH07zjlmhynIQX9UVIaOFFhn/Fw+rN5rRpyelx2TthxoR2zxehA2OkT+26HRLkgcgmNBLweRKtP7zJ7roGCZEEFN3qnjThtDpaBgucfM9KV8Y0GfRA25dHrFZSiAUfAkP0y4N6u9tMFmwinkCsrI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778739388380.54156858675356; Mon, 18 Mar 2024 09:18:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFeZ-00077g-U7; Mon, 18 Mar 2024 12:15:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeV-000766-6L for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:15:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeT-0004cd-HO for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:15:54 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-390-di3o6JOSORSJRzslYO9q5w-1; Mon, 18 Mar 2024 12:15:51 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-413f7a2167dso20477905e9.1 for ; Mon, 18 Mar 2024 09:15:51 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id f6-20020a5d50c6000000b0033e891d97d6sm10102807wrt.107.2024.03.18.09.15.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=9GIqYF1ojYqPGWd3cMEoiuZhI6Rp902S/5cqNYYeWpo=; b=JSCsWGNJN1FseCp4u7wfqXlusaaxqXvCqgerXdHgZjx/3eUfvYxTVfxXTWGZv82WFxJ317 wOPi4hB96GsLDoXDQMZ22e0asL9fODgQTcVjLh6pK4PpbKVLa+DQXuSWBRGmNXFiZGlMT9 8cTyDgew73ZDLQOSpmIGmZHlETNvAvI= X-MC-Unique: di3o6JOSORSJRzslYO9q5w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778550; x=1711383350; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9GIqYF1ojYqPGWd3cMEoiuZhI6Rp902S/5cqNYYeWpo=; b=TFFZrhKOGMpLM3RtAOZJTutKkWd7O/UFf8OMvDfB2e6OdnolTovTy3H9UZ8qRksBm7 GAe3gl6lysJ9+OsBag+Xbp3fBHcKf07bu6mWLhaL168516uQEKO4l3625PBFAPh2WhfZ Nn8ueXhIQKg4CfYebj0itvHIgIgzUhyEaEgAZ8fhYFJrgONUjOc53pqM2wqdG5xJBB4W q2e+ttolj+kZ3/OSzvhxO22760FPuXMQGH0R7TI/3so/jfQAqu2sLPixAzcw45OEgjwS KOTIPj7eN81zoN3V1Bx5dV2wyhLfFQjtgw67oArCtuqY9X+H8fiuuf2drgIn/B4HVXcj 9w8w== X-Gm-Message-State: AOJu0YxjreHySogQ4cjK35tDnFJ10h7a+/jYtVI2kXdfWq6LxwiQvaNd pzKSxZKTwxcmjQzOn8RTfyf7wxBnOJV5nAf/TyLpF1pYdb4Mds/gl1eDB4dFGEn9LxBadLr10qX yYnyZExf2Y+/2YbIG+ftt3iOXV85/N4HAi1A1B8hQiD/RcuDPQi3+qElCTkM4K+OBZ0hsu23E23 sJHyMCkQ7ZPszvBpv/zOQx6Nlc1t3xUg== X-Received: by 2002:a5d:648e:0:b0:33e:d5ff:a53b with SMTP id o14-20020a5d648e000000b0033ed5ffa53bmr8004189wri.44.1710778549799; Mon, 18 Mar 2024 09:15:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbMII1CZWQsuEA2yEJMgdufY9vbtTEfDBvZ1wqTeZ4yH//GOhL8ZoEtcLLsgvjm37vm3COtA== X-Received: by 2002:a5d:648e:0:b0:33e:d5ff:a53b with SMTP id o14-20020a5d648e000000b0033ed5ffa53bmr8004160wri.44.1710778549260; Mon, 18 Mar 2024 09:15:49 -0700 (PDT) Date: Mon, 18 Mar 2024 12:15:46 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Fiona Ebner Subject: [PULL 06/24] tests: smbios: add test for legacy mode CLI options Message-ID: <579094cb995b605af07ba3ced3d0a5dc1545509c.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778740309100004 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Unfortunately having 2.0 machine type deprecated is not enough to get rid of legacy SMBIOS handling since 'isapc' also uses that and it's staying around. Hence add test for CLI options handling to be sure that it ain't broken during SMBIOS code refactoring. Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-4-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 17 +++++++++++++++++ tests/data/smbios/type11_blob.legacy | Bin 0 -> 10 bytes 2 files changed, 17 insertions(+) create mode 100644 tests/data/smbios/type11_blob.legacy diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index a116f88e1d..d1ff4db7a2 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -2106,6 +2106,21 @@ static void test_acpi_pc_smbios_blob(void) free_test_data(&data); } =20 +static void test_acpi_isapc_smbios_legacy(void) +{ + uint8_t req_type11[] =3D { 1, 11 }; + test_data data =3D { + .machine =3D "isapc", + .variant =3D ".pc_smbios_legacy", + .required_struct_types =3D req_type11, + .required_struct_types_len =3D ARRAY_SIZE(req_type11), + }; + + test_smbios("-smbios file=3Dtests/data/smbios/type11_blob.legacy " + "-smbios type=3D1,family=3DTEST", &data); + free_test_data(&data); +} + static void test_oem_fields(test_data *data) { int i; @@ -2261,6 +2276,8 @@ int main(int argc, char *argv[]) test_acpi_pc_smbios_options); qtest_add_func("acpi/piix4/smbios-blob", test_acpi_pc_smbios_blob); + qtest_add_func("acpi/piix4/smbios-legacy", + test_acpi_isapc_smbios_legacy); } if (qtest_has_machine(MACHINE_Q35)) { qtest_add_func("acpi/q35", test_acpi_q35_tcg); diff --git a/tests/data/smbios/type11_blob.legacy b/tests/data/smbios/type1= 1_blob.legacy new file mode 100644 index 0000000000000000000000000000000000000000..aef463aab903405958b0a85f85c= 5980671c08bee GIT binary patch literal 10 Rcmd;PW!S(N;u;*n000Tp0s;U4 literal 0 HcmV?d00001 --=20 MST From nobody Mon May 13 00:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778738; cv=none; d=zohomail.com; s=zohoarc; b=dTSwGapDbad16kTXeqP8Q+LYe0N7AWjmGrDtsvg8rBfpt3E2oXx3ZCazmJoqtE2u9EgnByOBmh5rIvlRYhJJP+zC5e0FwRHZT+OUMOomwqLH0jP42RWUf8hDieqHqkMYJ8uOgnMiuB3Z6NKAMa+PdtC1mslcWJtXR3SewZIulMc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778738; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=G4uSwZ/MizuMlWmoJcnBQJMBFs8dEzQrjhYJsZpx96c=; b=aiY1OzMk99/pT79MJBFaiffcGia3XUhFe5fb5mz5r8lXoifV/pUsLu7l0jMR90OcWQ57eWkWcP6w+yq+uRpeYGBGFH4/YqZ2gYdHuHHlLpw/U1mzh7c9CVzPHJHRqOu2B81j01bT2JVry2vG8T2JqWoMIVoYxY31xVuRmvQt9xI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778738619418.34534562745546; Mon, 18 Mar 2024 09:18:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFeu-0007Ly-1p; Mon, 18 Mar 2024 12:16:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFec-00078A-37 for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeX-0004dD-Gj for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:01 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-217-ClFxfxPfOYGE1mfAPBjXBA-1; Mon, 18 Mar 2024 12:15:55 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-3417fbb38daso310860f8f.3 for ; Mon, 18 Mar 2024 09:15:55 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id n6-20020a5d4006000000b0033e699fc6b4sm10175671wrp.69.2024.03.18.09.15.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:15:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778556; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=G4uSwZ/MizuMlWmoJcnBQJMBFs8dEzQrjhYJsZpx96c=; b=PcnVspY13sjiibWlG5XyVoRJ67L3MxB0wLG9YTpT9ceFGVM3imiiFlEVQh2CpfZ+JEjFkM pJJXyJVJhEqf4H675s1QzYzEs+3oEXeEsXHgaiU8ORnQMP2hTvt3d/Zhg68lfI71yq9bh1 B1fp3QL3IMz5czCpTuFRIuP0NT4kjLg= X-MC-Unique: ClFxfxPfOYGE1mfAPBjXBA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778554; x=1711383354; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=G4uSwZ/MizuMlWmoJcnBQJMBFs8dEzQrjhYJsZpx96c=; b=dYi5s2LDUXuRogAkZmJOkZV65L3TR7hIr7i07DAOip2L5lxACf0j15hrsLCgswgebg Bo7htD5nWjwbTeOlTH0cH7zqbNILh07ebRFezi/s9Ny2lHh7P8YVlxhgWYN5Z6Zvw6mV QjjcC2x84qgGGt6pg9Ov9NxawNgbypnz/fr89zBRI3PNEL0gNvYfS2e/8V1pqR6hqu2W FLBRGtrlx/kCQ4TzWTQdKk/7+r73h0krQ7UFVSr6WiK1rckPLiL1vuip567e1mCx4jNZ o+MEyMywL2glryg+Ak4MdTae9ef/KkXAgmz2j68maa5C3jIARlP1UHnt4Dh9M4WHx0bQ PGNw== X-Gm-Message-State: AOJu0YyDlNu6Rj11TTClOT1XWERdgZkd62xyU7clkU2atmvjeaSajMiJ tMFTGwZ4u6ciXauJVZq43qUE97IUstWSDIinGF+PZbibHszuHF4wafW148nrm2KWDFF+9i4CLgW oC0EbZ471WCDyBfn68ixqOVkRuNrLo/nqYRlsrNacTgVb4WS6VogWMMzJxmcyIy1PC1kln7NnN1 h/91ShcWQxl6OMRFx7VUVTL1m1xOFDgQ== X-Received: by 2002:a05:6000:4e4:b0:33e:78c4:3738 with SMTP id cr4-20020a05600004e400b0033e78c43738mr10423215wrb.54.1710778553838; Mon, 18 Mar 2024 09:15:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGjfAxQqcnv0UP4PlclIOInFi8dmabiAWEbUq8Miw7LDUHTmljgN/Ct3JGJKRFci78gG+VWMA== X-Received: by 2002:a05:6000:4e4:b0:33e:78c4:3738 with SMTP id cr4-20020a05600004e400b0033e78c43738mr10423177wrb.54.1710778553285; Mon, 18 Mar 2024 09:15:53 -0700 (PDT) Date: Mon, 18 Mar 2024 12:15:49 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Fiona Ebner , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 07/24] smbios: cleanup smbios_get_tables() from legacy handling Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778740305100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov smbios_get_tables() bails out right away if leagacy mode is enabled and won't generate any SMBIOS tables. At the same time x86 specific fw_cfg_build_smbios() will genarate legacy tables and then proceed to preparing temporary mem_array for useless call to smbios_get_tables() and then discard it. Drop legacy related check in smbios_get_tables() and return from fw_cfg_build_smbios() early if legacy tables where built without proceeding to non legacy part of the function. Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-5-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/fw_cfg.c | 1 + hw/smbios/smbios.c | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index 98a478c276..a635234e68 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -74,6 +74,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState= *fw_cfg) if (smbios_tables) { fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, smbios_tables, smbios_tables_len); + return; } =20 /* build the array of physical mem area from e820 table */ diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 949c2d74a1..a1741a64a6 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -1229,12 +1229,6 @@ void smbios_get_tables(MachineState *ms, { unsigned i, dimm_cnt, offset; =20 - if (smbios_legacy) { - *tables =3D *anchor =3D NULL; - *tables_len =3D *anchor_len =3D 0; - return; - } - if (!smbios_immutable) { smbios_build_type_0_table(); smbios_build_type_1_table(); --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778754; cv=none; d=zohomail.com; s=zohoarc; b=NFX210pKdi5IyJWV/vnaQN0+wUBjdkH34pJ76nI5kXfBcQwb71iEogHY4uQ8ZRLFJB7QRbeq9Zr9q3kbzImRzS0sMbOWF4xcmnlZ6emUYdIl9xeYvSl7kwzXfsKmol/r46sIzCpE0KFsuZW0tvKIfhPbyWZG7MIo0SZN/VdCKnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778754; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aoA2peaGF2qOzBoAWlslzkVrIFIZMqTVQz88w0hXmqE=; b=oJiCP3JoYXQAcdmdfMyEWTRGOUXhJhHH/eDGQ8KufnJIC7PSUWuioWiRzpLHOFr5oN5jvr99durMSTHncjiCRn4aMem3ovac4jJevnzpDpUdkJrQTYn7hqUSaOJpXGbd/TGtz3K9w3zhYbTymua7jn1zPd5p65QaI9UFrf5wuI4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778754865107.26125999479495; Mon, 18 Mar 2024 09:19:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFew-0007Q3-9l; Mon, 18 Mar 2024 12:16:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFeu-0007N6-CH for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFes-0004e3-K7 for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:20 -0400 Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-553-F6EbXTIOMlGjZUi0GwqVbA-1; Mon, 18 Mar 2024 12:16:02 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-3416632aeffso851267f8f.1 for ; Mon, 18 Mar 2024 09:16:02 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id a26-20020a5d457a000000b0033e7e9c8657sm10137260wrc.45.2024.03.18.09.15.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:15:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778564; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aoA2peaGF2qOzBoAWlslzkVrIFIZMqTVQz88w0hXmqE=; b=JEQ7IhyouN7f/87bZKy7qpm5Mv/GJJy2+GEorxvGE73FZoIkGR2dxLeHyPU5rQZpz0Sy6k 0RwfZE4bQIFhsueqJp1l4XBpk66GV4c8T4m+grn+dfAzRdqlZONn0+nOca4DNi5kEN9zS0 QgJWaVezp/j3ofXwYQD950hbBZ+U8Zs= X-MC-Unique: F6EbXTIOMlGjZUi0GwqVbA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778561; x=1711383361; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aoA2peaGF2qOzBoAWlslzkVrIFIZMqTVQz88w0hXmqE=; b=shovFH/7OWEW06j+cbITlTgWKi3MZNWr2kWpDP7j824LpWsx9dKuWRGBvLR/+7gWZ6 Or3ew8laFyGWsaG1xNduTAe+piY3aZflx+CF9LOOID+jeyhxhX6WORiq/4oPNZtE69I5 kgCkeYwSS3FV/SU6JirApx/LQ+FCeUpX4lVq/CLgK722wYUGT7Bb6dJW9BF1yscudF5N +SncxpU1L6O1Ek2nq9spBrmbVA4AdErbQF656MmlWeeaQ1yXz0kF1SOBUyJFf+trzyN4 /jgpfVsOHGSxnDcR/4+n5YrbCRIAqnvIbW12TdFH9ulsnjUbiG1YAenQFeIP3LJgCisN BX8Q== X-Gm-Message-State: AOJu0YzJI/HkTS1oYB72cMjngkmxtkdSft+pgL9fFMeRFAQDKKfiP52X wglzerNZBzlSI6kWho8izXAGKBHXIWKnW6ik6X+jTUSaLtLq1tJc6TStLUGVWBo9CkhM8YQPpII za0Bsraj+tQyJekwVir2tCcA0t7kkA9ApqAVozUYfMOufpSKP82S4lFojOntMNbKmgNhGY3xHRz xKNq+y4L2mtmwQKdtqEnoDtGr4FxW9QQ== X-Received: by 2002:a5d:42cf:0:b0:33d:4ee2:883d with SMTP id t15-20020a5d42cf000000b0033d4ee2883dmr8354328wrr.39.1710778558063; Mon, 18 Mar 2024 09:15:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLmuJjSB+Q1fhj0qTUO1mcdtqJ23AZiChAccQKv0I7rQuMy5PokGFJ0WFtLCO++RNmVnhhDQ== X-Received: by 2002:a5d:42cf:0:b0:33d:4ee2:883d with SMTP id t15-20020a5d42cf000000b0033d4ee2883dmr8354298wrr.39.1710778557454; Mon, 18 Mar 2024 09:15:57 -0700 (PDT) Date: Mon, 18 Mar 2024 12:15:53 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Fiona Ebner , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 08/24] smbios: get rid of smbios_smp_sockets global Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778756342100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov it makes smbios_validate_table() independent from smbios_smp_sockets global, which in turn lets smbios_get_tables() avoid using not related legacy code. Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-6-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/firmware/smbios.h | 2 +- hw/i386/fw_cfg.c | 2 +- hw/smbios/smbios.c | 22 +++++++++------------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h index c21b8d3285..36744b6cc9 100644 --- a/include/hw/firmware/smbios.h +++ b/include/hw/firmware/smbios.h @@ -313,7 +313,7 @@ void smbios_set_defaults(const char *manufacturer, cons= t char *product, const char *version, bool legacy_mode, bool uuid_encoded, SmbiosEntryPointType ep_type); void smbios_set_default_processor_family(uint16_t processor_family); -uint8_t *smbios_get_table_legacy(MachineState *ms, size_t *length); +uint8_t *smbios_get_table_legacy(uint32_t expected_t4_count, size_t *lengt= h); void smbios_get_tables(MachineState *ms, const struct smbios_phys_mem_area *mem_array, const unsigned int mem_array_size, diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index a635234e68..fcb4fb0769 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -70,7 +70,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState= *fw_cfg) /* tell smbios about cpuid version and features */ smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]= ); =20 - smbios_tables =3D smbios_get_table_legacy(ms, &smbios_tables_len); + smbios_tables =3D smbios_get_table_legacy(ms->smp.cpus, &smbios_tables= _len); if (smbios_tables) { fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, smbios_tables, smbios_tables_len); diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index a1741a64a6..003c539d76 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -70,7 +70,7 @@ static SmbiosEntryPoint ep; static int smbios_type4_count =3D 0; static bool smbios_immutable; static bool smbios_have_defaults; -static uint32_t smbios_cpuid_version, smbios_cpuid_features, smbios_smp_so= ckets; +static uint32_t smbios_cpuid_version, smbios_cpuid_features; =20 static DECLARE_BITMAP(have_binfile_bitmap, SMBIOS_MAX_TYPE+1); static DECLARE_BITMAP(have_fields_bitmap, SMBIOS_MAX_TYPE+1); @@ -539,14 +539,11 @@ opts_init(smbios_register_config); */ #define SMBIOS_21_MAX_TABLES_LEN 0xffff =20 -static void smbios_validate_table(MachineState *ms) +static void smbios_validate_table(uint32_t expected_t4_count) { - uint32_t expect_t4_count =3D smbios_legacy ? - ms->smp.cpus : smbios_smp_sockets; - - if (smbios_type4_count && smbios_type4_count !=3D expect_t4_count) { + if (smbios_type4_count && smbios_type4_count !=3D expected_t4_count) { error_report("Expected %d SMBIOS Type 4 tables, got %d instead", - expect_t4_count, smbios_type4_count); + expected_t4_count, smbios_type4_count); exit(1); } =20 @@ -634,7 +631,7 @@ static void smbios_build_type_1_fields(void) } } =20 -uint8_t *smbios_get_table_legacy(MachineState *ms, size_t *length) +uint8_t *smbios_get_table_legacy(uint32_t expected_t4_count, size_t *lengt= h) { if (!smbios_legacy) { *length =3D 0; @@ -644,7 +641,7 @@ uint8_t *smbios_get_table_legacy(MachineState *ms, size= _t *length) if (!smbios_immutable) { smbios_build_type_0_fields(); smbios_build_type_1_fields(); - smbios_validate_table(ms); + smbios_validate_table(expected_t4_count); smbios_immutable =3D true; } *length =3D smbios_entries_len; @@ -1235,10 +1232,9 @@ void smbios_get_tables(MachineState *ms, smbios_build_type_2_table(); smbios_build_type_3_table(); =20 - smbios_smp_sockets =3D ms->smp.sockets; - assert(smbios_smp_sockets >=3D 1); + assert(ms->smp.sockets >=3D 1); =20 - for (i =3D 0; i < smbios_smp_sockets; i++) { + for (i =3D 0; i < ms->smp.sockets; i++) { smbios_build_type_4_table(ms, i); } =20 @@ -1284,7 +1280,7 @@ void smbios_get_tables(MachineState *ms, smbios_build_type_41_table(errp); smbios_build_type_127_table(); =20 - smbios_validate_table(ms); + smbios_validate_table(ms->smp.sockets); smbios_entry_point_setup(); smbios_immutable =3D true; } --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778596; cv=none; d=zohomail.com; s=zohoarc; b=nprfx/fxS5YcvMSfAdIJ9TsfISZW788qZw5sjP/KB4cz7CsgbOw/3Scovx3nh/Ewhm0qQIpTzxnUBGRgss/p+CqJG4W4JXhrXYalvhgJAoZZANYV3VFBTZqDduNRGQjLiCZSdBqXO6ydVTa4nNjYjQL5hi62v0o5Dyo+f5IkS0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778596; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=odPqgcRarP/qfco3bEKoj8jaqMYx3BuQ+fTJjBu4E9k=; b=oLNCWZkShvZNQqWn54pxOGf9+7RsYQ++wRMSfSxb24DiAkZGV9S96OHdhOxkZLTqn6DvgrcSxJqV91wikPSTqQgcfhVSf6ktNQcESMniyX59pHPPg9unLNAjuk/wq2Ysn7W4ZMc7auL+EYheMlQAeUWKikgA28pAiJsV3ukwF6c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17107785965621003.2048298269349; Mon, 18 Mar 2024 09:16:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFf1-0007UJ-AV; Mon, 18 Mar 2024 12:16:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFex-0007Rp-H0 for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFet-0004eM-Kv for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:23 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-198-eY0ZZT8sOlSJQuCmxhvpjA-1; Mon, 18 Mar 2024 12:16:04 -0400 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-41413c99712so3684115e9.3 for ; Mon, 18 Mar 2024 09:16:04 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id d6-20020a05600c34c600b004140837a0d4sm8222211wmq.3.2024.03.18.09.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778566; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=odPqgcRarP/qfco3bEKoj8jaqMYx3BuQ+fTJjBu4E9k=; b=ZcHcnlET0wKq7sMmUIWwyAEGyjp5xIZdMGLgjbU/BIcCvf5kb3mkIFjhV9ImLT4PHVj91Z geLjh0C0DmOngnBGfU9lSO+8EIjzA/3PLvfbuZups7P8NXvpixWWUGJ7wev7wuColx78C9 dZNsqtuCgNRBAQh+54yfTPeh+W/96/I= X-MC-Unique: eY0ZZT8sOlSJQuCmxhvpjA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778562; x=1711383362; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=odPqgcRarP/qfco3bEKoj8jaqMYx3BuQ+fTJjBu4E9k=; b=ft+A7f5bnVf0kS+y4TInAf/chicp6+1aU6pbPqri6PSEeQDg2P3wNcc9Cbsj0hSRbQ iow7o8PhyPfRQvBe3CuItO1ZmgMH7bpWQrBa5tS8KqETQy9noGibbEroBZQgrJAOIWf9 T1fu+APT8EOt+ct0iSYi+1AAomS4A85VKSKO7gR3GYzS2niKGUrsztGeapV3WZiDCyCL VEVre1n34Z3fcC6D0diKd8a/iIjhaRuHSabbc47+EF5RELWX9HwLfL+vZ4TAxS/0ho+Z po/w6wb9r/3BkzCHNBVbXF5m+hm5k1lxJJWFRAb9sSDogP+8EgZmMDJITefpyn+ulWL1 jN0A== X-Gm-Message-State: AOJu0Yy8DtEKymqwKBHYSXYKeExpr7M37aIiiFITpWF8XxBT71upersx qydKXzOGgNWYMGVfPT8NX7Sa7w8e2TmU7VfnoxVHleSeQufYO5Tyd0e3WvJ3xpH1i4+6WPwv/V5 OwplFWi0OPliHN3MFPaaQjqaBidvqb1k4Ay5MIqCUvqFSmayPwUCInZyNxCjV6AZjJIATEOk3MJ 0PoSnv1LeY5gNUc7WcnSc3BwFdSL8GdQ== X-Received: by 2002:a05:600c:524c:b0:414:cd1:e46d with SMTP id fc12-20020a05600c524c00b004140cd1e46dmr3307387wmb.23.1710778562380; Mon, 18 Mar 2024 09:16:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGYtH6+pcelhFS1te3Ktfz2rupk7YbN8zWHT/vn59oCUwf/m7Y9T0HMXw/o3XSv/GWfeQVeJQ== X-Received: by 2002:a05:600c:524c:b0:414:cd1:e46d with SMTP id fc12-20020a05600c524c00b004140cd1e46dmr3307344wmb.23.1710778561762; Mon, 18 Mar 2024 09:16:01 -0700 (PDT) Date: Mon, 18 Mar 2024 12:15:57 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Daniel Henrique Barboza , Fiona Ebner , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , Song Gao , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei , qemu-arm@nongnu.org, qemu-riscv@nongnu.org Subject: [PULL 09/24] smbios: get rid of smbios_legacy global Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778598268100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov clean up smbios_set_defaults() which is reused by legacy and non legacy machines from being aware of 'legacy' notion and need to turn it off. And push legacy handling up to PC machine code where it's relevant. Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Acked-by: Daniel Henrique Barboza Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-7-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/firmware/smbios.h | 2 +- hw/arm/virt.c | 2 +- hw/i386/fw_cfg.c | 7 ++++--- hw/loongarch/virt.c | 2 +- hw/riscv/virt.c | 2 +- hw/smbios/smbios.c | 35 +++++++++++++++-------------------- 6 files changed, 23 insertions(+), 27 deletions(-) diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h index 36744b6cc9..7b42e7b4ac 100644 --- a/include/hw/firmware/smbios.h +++ b/include/hw/firmware/smbios.h @@ -310,7 +310,7 @@ struct smbios_type_127 { void smbios_entry_add(QemuOpts *opts, Error **errp); void smbios_set_cpuid(uint32_t version, uint32_t features); void smbios_set_defaults(const char *manufacturer, const char *product, - const char *version, bool legacy_mode, + const char *version, bool uuid_encoded, SmbiosEntryPointType ep_type); void smbios_set_default_processor_family(uint16_t processor_family); uint8_t *smbios_get_table_legacy(uint32_t expected_t4_count, size_t *lengt= h); diff --git a/hw/arm/virt.c b/hw/arm/virt.c index e5cd935232..b634c908a7 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1650,7 +1650,7 @@ static void virt_build_smbios(VirtMachineState *vms) } =20 smbios_set_defaults("QEMU", product, - vmc->smbios_old_sys_ver ? "1.0" : mc->name, false, + vmc->smbios_old_sys_ver ? "1.0" : mc->name, true, SMBIOS_ENTRY_POINT_TYPE_64); =20 /* build the array of physical mem area from base_memmap */ diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index fcb4fb0769..c1e9c0fd9c 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -63,15 +63,16 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgSta= te *fw_cfg) if (pcmc->smbios_defaults) { /* These values are guest ABI, do not change */ smbios_set_defaults("QEMU", mc->desc, mc->name, - pcmc->smbios_legacy_mode, pcmc->smbios_uuid_en= coded, + pcmc->smbios_uuid_encoded, pcms->smbios_entry_point_type); } =20 /* tell smbios about cpuid version and features */ smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]= ); =20 - smbios_tables =3D smbios_get_table_legacy(ms->smp.cpus, &smbios_tables= _len); - if (smbios_tables) { + if (pcmc->smbios_legacy_mode) { + smbios_tables =3D smbios_get_table_legacy(ms->smp.cpus, + &smbios_tables_len); fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, smbios_tables, smbios_tables_len); return; diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index efce112310..53bfdcee61 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -355,7 +355,7 @@ static void virt_build_smbios(LoongArchMachineState *la= ms) return; } =20 - smbios_set_defaults("QEMU", product, mc->name, false, + smbios_set_defaults("QEMU", product, mc->name, true, SMBIOS_ENTRY_POINT_TYPE_64); =20 smbios_get_tables(ms, NULL, 0, &smbios_tables, &smbios_tables_len, diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index a094af97c3..535fd047ba 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1275,7 +1275,7 @@ static void virt_build_smbios(RISCVVirtState *s) product =3D "KVM Virtual Machine"; } =20 - smbios_set_defaults("QEMU", product, mc->name, false, + smbios_set_defaults("QEMU", product, mc->name, true, SMBIOS_ENTRY_POINT_TYPE_64); =20 if (riscv_is_32bit(&s->soc[0])) { diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 003c539d76..9f9087601c 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -54,7 +54,6 @@ struct smbios_table { =20 static uint8_t *smbios_entries; static size_t smbios_entries_len; -static bool smbios_legacy =3D true; static bool smbios_uuid_encoded =3D true; /* end: legacy structures & constants for <=3D 2.0 machines */ =20 @@ -633,9 +632,16 @@ static void smbios_build_type_1_fields(void) =20 uint8_t *smbios_get_table_legacy(uint32_t expected_t4_count, size_t *lengt= h) { - if (!smbios_legacy) { - *length =3D 0; - return NULL; + /* drop unwanted version of command-line file blob(s) */ + g_free(smbios_tables); + smbios_tables =3D NULL; + + /* also complain if fields were given for types > 1 */ + if (find_next_bit(have_fields_bitmap, + SMBIOS_MAX_TYPE + 1, 2) < SMBIOS_MAX_TYPE + 1) { + error_report("can't process fields for smbios " + "types > 1 on machine versions < 2.1!"); + exit(1); } =20 if (!smbios_immutable) { @@ -1129,28 +1135,13 @@ void smbios_set_default_processor_family(uint16_t p= rocessor_family) } =20 void smbios_set_defaults(const char *manufacturer, const char *product, - const char *version, bool legacy_mode, + const char *version, bool uuid_encoded, SmbiosEntryPointType ep_type) { smbios_have_defaults =3D true; - smbios_legacy =3D legacy_mode; smbios_uuid_encoded =3D uuid_encoded; smbios_ep_type =3D ep_type; =20 - /* drop unwanted version of command-line file blob(s) */ - if (smbios_legacy) { - g_free(smbios_tables); - /* in legacy mode, also complain if fields were given for types > = 1 */ - if (find_next_bit(have_fields_bitmap, - SMBIOS_MAX_TYPE+1, 2) < SMBIOS_MAX_TYPE+1) { - error_report("can't process fields for smbios " - "types > 1 on machine versions < 2.1!"); - exit(1); - } - } else { - g_free(smbios_entries); - } - SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer); SMBIOS_SET_DEFAULT(type1.product, product); SMBIOS_SET_DEFAULT(type1.version, version); @@ -1226,6 +1217,10 @@ void smbios_get_tables(MachineState *ms, { unsigned i, dimm_cnt, offset; =20 + /* drop unwanted (legacy) version of command-line file blob(s) */ + g_free(smbios_entries); + smbios_entries =3D NULL; + if (!smbios_immutable) { smbios_build_type_0_table(); smbios_build_type_1_table(); --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778625; cv=none; d=zohomail.com; s=zohoarc; b=nYWcc/Ai6jkauwO/VKVbM/J5s+GqtOzwyewHfZm28xfqVMyRFkmlOBRy+gnOVfzaspUyZ5zBPae0xkipPAtPaEYt7RKwNlrOZYFgdL0pc6sYhgzDL+NA7eTnEWlDT/Sq5pPaAz+F6OcXvZz8bKCV+ETVpzdIE22bXruL+jyAu/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778625; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=PP1fbOrCM8+i+U1CUJ7OlG1bOMoCZY0hrHdBMs68YuA=; b=Moq3XmiXhNk4pmkEdzycpfToagh7J1KkHLyNWSLn2UhoXXzV79bgzoZpbd7M08ISvWGcKEy13gxUNrmNLfEroe3E0aonM35PimKLtum6HSu9Vd43GXI/lz1h4pDECGJjCMAeT/EIRVzCR1dFlQXZOBdS9m8fIvmVnmZtQnhOtaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778625328355.13026677237883; Mon, 18 Mar 2024 09:17:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFf0-0007To-6p; Mon, 18 Mar 2024 12:16:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFew-0007QX-9z for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFes-0004ej-Mz for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:21 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-656-c_r_p_8kMmuE04AL8Jv7-Q-1; Mon, 18 Mar 2024 12:16:07 -0400 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-33ecc0f0c95so2389339f8f.3 for ; Mon, 18 Mar 2024 09:16:07 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id n2-20020a5d4002000000b0033e93e00f68sm10122137wrp.61.2024.03.18.09.16.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778569; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PP1fbOrCM8+i+U1CUJ7OlG1bOMoCZY0hrHdBMs68YuA=; b=J7TQ4eBbvGt5cAS2exTALjwrEzPJigAX4cmEy17OSAiEFPE1CnoETt1qhqaLMSPnwPBnWx /u0OUlXW546P0MyAR1fKA3MIT4P8ckHCQ4ziXxPiSWgv1rigCnuDRPmDhW4mpL9T/QX1zp irjckd55D3bWTnj0nMZW74rrblp87zg= X-MC-Unique: c_r_p_8kMmuE04AL8Jv7-Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778566; x=1711383366; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PP1fbOrCM8+i+U1CUJ7OlG1bOMoCZY0hrHdBMs68YuA=; b=TQibSYcWEupThbUT9OmWHAEnaWGCR8SUKJpQSfl8U0J+VmE6lVx3zULOf9ZU5p2JqQ xlWebYSimjRmd6Lps38uPJgUd3oTwesn4nWNhrs3pmA3RBNjhLxfeIuhYEm0ZSpv6pTU 42nPn2sCqnuKU6cTriPPQAaUyb4NRoUxKBndbabF3aM6r2K4z06rhE/okh4eEuAuel6K BRYEzWsbOeAQEfSVk1FKRwH0obexhwFBz5PCALd53kQQtweqHVEgmCIJT1ACmlJX60CQ YchQ+gWYLUeLFYR3akFdEhsG6Hc5ujQLG9Xv+E7uTvuWH65p9VJI2rezcxorlydFop7k O4lg== X-Gm-Message-State: AOJu0YxLhkhGSFlYYZfZ0Ogz8HbCUMjToVkmNgtME3Za/ecsHvh7MXU2 19MhgZiMzPIiTImDs+Bc9EijCvmMndNISdYJtdsOzPYUZqwbskoyMez8HPpH2zObsunE8ZdiHlj s6JhPTkkq4dsIvH0n+7PHZqKnrI9+7w81ZV7J0IT+KIGgT6NdMrPx+c5cMjnLdZfDyJ41GyVbIM fQ8RrI+Gv9PjJ+rB9s1wjGcKMTMGYHtw== X-Received: by 2002:adf:ec03:0:b0:33e:b6d6:c342 with SMTP id x3-20020adfec03000000b0033eb6d6c342mr7212468wrn.34.1710778565795; Mon, 18 Mar 2024 09:16:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEpLwNzHuAq/3nqQ/zTo12xUMGEUX6lLgf9+myynA24W7GgsSxsSFE5HVvNeufXyOG3c5Nupg== X-Received: by 2002:adf:ec03:0:b0:33e:b6d6:c342 with SMTP id x3-20020adfec03000000b0033eb6d6c342mr7212442wrn.34.1710778565191; Mon, 18 Mar 2024 09:16:05 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:02 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Fiona Ebner , Ani Sinha Subject: [PULL 10/24] smbios: avoid mangling user provided tables Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778625936100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov currently smbios_entry_add() preserves internally '-smbios type=3D' options but tables provided with '-smbios file=3D' are stored directly into blob that eventually will be exposed to VM. And then later QEMU adds default/'-smbios type' entries on top into the same blob. It makes impossible to generate tables more than once, hence 'immutable' guard was used. Make it possible to regenerate final blob by storing user provided blobs into a dedicated area (usr_blobs) and then copy it when composing final blob. Which also makes handling of -smbios options consistent. As side effect of this and previous commits there is no need to generate legacy smbios_entries at the time options are parsed. Instead compose smbios_entries on demand from usr_blobs like it is done for non-legacy SMBIOS tables. Signed-off-by: Igor Mammedov Tested-by: Fiona Ebner Reviewed-by: Ani Sinha Message-Id: <20240314152302.2324164-8-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/smbios/smbios.c | 187 +++++++++++++++++++++++---------------------- 1 file changed, 96 insertions(+), 91 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 9f9087601c..aab4ffb4cb 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -57,6 +57,14 @@ static size_t smbios_entries_len; static bool smbios_uuid_encoded =3D true; /* end: legacy structures & constants for <=3D 2.0 machines */ =20 +/* + * SMBIOS tables provided by user with '-smbios file=3D' option + */ +uint8_t *usr_blobs; +size_t usr_blobs_len; +static GArray *usr_blobs_sizes; +static unsigned usr_table_max; +static unsigned usr_table_cnt; =20 uint8_t *smbios_tables; size_t smbios_tables_len; @@ -67,7 +75,6 @@ static SmbiosEntryPointType smbios_ep_type =3D SMBIOS_ENT= RY_POINT_TYPE_32; static SmbiosEntryPoint ep; =20 static int smbios_type4_count =3D 0; -static bool smbios_immutable; static bool smbios_have_defaults; static uint32_t smbios_cpuid_version, smbios_cpuid_features; =20 @@ -632,9 +639,8 @@ static void smbios_build_type_1_fields(void) =20 uint8_t *smbios_get_table_legacy(uint32_t expected_t4_count, size_t *lengt= h) { - /* drop unwanted version of command-line file blob(s) */ - g_free(smbios_tables); - smbios_tables =3D NULL; + int i; + size_t usr_offset; =20 /* also complain if fields were given for types > 1 */ if (find_next_bit(have_fields_bitmap, @@ -644,12 +650,33 @@ uint8_t *smbios_get_table_legacy(uint32_t expected_t4= _count, size_t *length) exit(1); } =20 - if (!smbios_immutable) { - smbios_build_type_0_fields(); - smbios_build_type_1_fields(); - smbios_validate_table(expected_t4_count); - smbios_immutable =3D true; + g_free(smbios_entries); + smbios_entries_len =3D sizeof(uint16_t); + smbios_entries =3D g_malloc0(smbios_entries_len); + + for (i =3D 0, usr_offset =3D 0; usr_blobs_sizes && i < usr_blobs_sizes= ->len; + i++) + { + struct smbios_table *table; + struct smbios_structure_header *header; + size_t size =3D g_array_index(usr_blobs_sizes, size_t, i); + + header =3D (struct smbios_structure_header *)(usr_blobs + usr_offs= et); + smbios_entries =3D g_realloc(smbios_entries, smbios_entries_len + + size + sizeof(*table)); + table =3D (struct smbios_table *)(smbios_entries + smbios_entries_= len); + table->header.type =3D SMBIOS_TABLE_ENTRY; + table->header.length =3D cpu_to_le16(sizeof(*table) + size); + memcpy(table->data, header, size); + smbios_entries_len +=3D sizeof(*table) + size; + (*(uint16_t *)smbios_entries) =3D + cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1); + usr_offset +=3D size; } + + smbios_build_type_0_fields(); + smbios_build_type_1_fields(); + smbios_validate_table(expected_t4_count); *length =3D smbios_entries_len; return smbios_entries; } @@ -1217,69 +1244,69 @@ void smbios_get_tables(MachineState *ms, { unsigned i, dimm_cnt, offset; =20 - /* drop unwanted (legacy) version of command-line file blob(s) */ - g_free(smbios_entries); - smbios_entries =3D NULL; + g_free(smbios_tables); + smbios_tables =3D g_memdup2(usr_blobs, usr_blobs_len); + smbios_tables_len =3D usr_blobs_len; + smbios_table_max =3D usr_table_max; + smbios_table_cnt =3D usr_table_cnt; =20 - if (!smbios_immutable) { - smbios_build_type_0_table(); - smbios_build_type_1_table(); - smbios_build_type_2_table(); - smbios_build_type_3_table(); + smbios_build_type_0_table(); + smbios_build_type_1_table(); + smbios_build_type_2_table(); + smbios_build_type_3_table(); =20 - assert(ms->smp.sockets >=3D 1); + assert(ms->smp.sockets >=3D 1); =20 - for (i =3D 0; i < ms->smp.sockets; i++) { - smbios_build_type_4_table(ms, i); - } + for (i =3D 0; i < ms->smp.sockets; i++) { + smbios_build_type_4_table(ms, i); + } =20 - smbios_build_type_8_table(); - smbios_build_type_9_table(errp); - smbios_build_type_11_table(); + smbios_build_type_8_table(); + smbios_build_type_9_table(errp); + smbios_build_type_11_table(); =20 #define MAX_DIMM_SZ (16 * GiB) #define GET_DIMM_SZ ((i < dimm_cnt - 1) ? MAX_DIMM_SZ \ : ((current_machine->ram_size - 1)= % MAX_DIMM_SZ) + 1) =20 - dimm_cnt =3D QEMU_ALIGN_UP(current_machine->ram_size, MAX_DIMM_SZ)= / MAX_DIMM_SZ; + dimm_cnt =3D QEMU_ALIGN_UP(current_machine->ram_size, MAX_DIMM_SZ) / + MAX_DIMM_SZ; =20 - /* - * The offset determines if we need to keep additional space betwe= en - * table 17 and table 19 header handle numbers so that they do - * not overlap. For example, for a VM with larger than 8 TB guest - * memory and DIMM like chunks of 16 GiB, the default space between - * the two tables (T19_BASE - T17_BASE =3D 512) is not enough. - */ - offset =3D (dimm_cnt > (T19_BASE - T17_BASE)) ? \ - dimm_cnt - (T19_BASE - T17_BASE) : 0; + /* + * The offset determines if we need to keep additional space between + * table 17 and table 19 header handle numbers so that they do + * not overlap. For example, for a VM with larger than 8 TB guest + * memory and DIMM like chunks of 16 GiB, the default space between + * the two tables (T19_BASE - T17_BASE =3D 512) is not enough. + */ + offset =3D (dimm_cnt > (T19_BASE - T17_BASE)) ? \ + dimm_cnt - (T19_BASE - T17_BASE) : 0; =20 - smbios_build_type_16_table(dimm_cnt); + smbios_build_type_16_table(dimm_cnt); =20 - for (i =3D 0; i < dimm_cnt; i++) { - smbios_build_type_17_table(i, GET_DIMM_SZ); - } - - for (i =3D 0; i < mem_array_size; i++) { - smbios_build_type_19_table(i, offset, mem_array[i].address, - mem_array[i].length); - } - - /* - * make sure 16 bit handle numbers in the headers of tables 19 - * and 32 do not overlap. - */ - assert((mem_array_size + offset) < (T32_BASE - T19_BASE)); - - smbios_build_type_32_table(); - smbios_build_type_38_table(); - smbios_build_type_41_table(errp); - smbios_build_type_127_table(); - - smbios_validate_table(ms->smp.sockets); - smbios_entry_point_setup(); - smbios_immutable =3D true; + for (i =3D 0; i < dimm_cnt; i++) { + smbios_build_type_17_table(i, GET_DIMM_SZ); } =20 + for (i =3D 0; i < mem_array_size; i++) { + smbios_build_type_19_table(i, offset, mem_array[i].address, + mem_array[i].length); + } + + /* + * make sure 16 bit handle numbers in the headers of tables 19 + * and 32 do not overlap. + */ + assert((mem_array_size + offset) < (T32_BASE - T19_BASE)); + + smbios_build_type_32_table(); + smbios_build_type_38_table(); + smbios_build_type_41_table(errp); + smbios_build_type_127_table(); + + smbios_validate_table(ms->smp.sockets); + smbios_entry_point_setup(); + /* return tables blob and entry point (anchor), and their sizes */ *tables =3D smbios_tables; *tables_len =3D smbios_tables_len; @@ -1378,13 +1405,10 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) { const char *val; =20 - assert(!smbios_immutable); - val =3D qemu_opt_get(opts, "file"); if (val) { struct smbios_structure_header *header; - int size; - struct smbios_table *table; /* legacy mode only */ + size_t size; =20 if (!qemu_opts_validate(opts, qemu_smbios_file_opts, errp)) { return; @@ -1401,9 +1425,9 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) * (except in legacy mode, where the second '\0' is implicit and * will be inserted by the BIOS). */ - smbios_tables =3D g_realloc(smbios_tables, smbios_tables_len + siz= e); - header =3D (struct smbios_structure_header *)(smbios_tables + - smbios_tables_len); + usr_blobs =3D g_realloc(usr_blobs, usr_blobs_len + size); + header =3D (struct smbios_structure_header *)(usr_blobs + + usr_blobs_len); =20 if (load_image_size(val, (uint8_t *)header, size) !=3D size) { error_setg(errp, "Failed to load SMBIOS file %s", val); @@ -1424,34 +1448,15 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) smbios_type4_count++; } =20 - smbios_tables_len +=3D size; - if (size > smbios_table_max) { - smbios_table_max =3D size; + if (!usr_blobs_sizes) { + usr_blobs_sizes =3D g_array_new(false, false, sizeof(size_t)); } - smbios_table_cnt++; - - /* add a copy of the newly loaded blob to legacy smbios_entries */ - /* NOTE: This code runs before smbios_set_defaults(), so we don't - * yet know which mode (legacy vs. aggregate-table) will be - * required. We therefore add the binary blob to both legacy - * (smbios_entries) and aggregate (smbios_tables) tables, and - * delete the one we don't need from smbios_set_defaults(), - * once we know which machine version has been requested. - */ - if (!smbios_entries) { - smbios_entries_len =3D sizeof(uint16_t); - smbios_entries =3D g_malloc0(smbios_entries_len); + g_array_append_val(usr_blobs_sizes, size); + usr_blobs_len +=3D size; + if (size > usr_table_max) { + usr_table_max =3D size; } - smbios_entries =3D g_realloc(smbios_entries, smbios_entries_len + - size + sizeof(*table)); - table =3D (struct smbios_table *)(smbios_entries + smbios_entries_= len); - table->header.type =3D SMBIOS_TABLE_ENTRY; - table->header.length =3D cpu_to_le16(sizeof(*table) + size); - memcpy(table->data, header, size); - smbios_entries_len +=3D sizeof(*table) + size; - (*(uint16_t *)smbios_entries) =3D - cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1); - /* end: add a copy of the newly loaded blob to legacy smbios_entri= es */ + usr_table_cnt++; =20 return; } --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778841; cv=none; d=zohomail.com; s=zohoarc; b=k5RWhnl6mLib2sg2ac9Qcr9hHD3kuVZqaxkKYjl4X5aVufr3MwzE68nPj+UXnbE777RJ0Kq0vrIqggxoGYQTAUibZMLLFSzdCDcddF0w2C5Tv4HSB1WkCaNVjBkYYtapDymPlDk+83bVcDlJUcaY6CwNVBKvSv2SQ85e4FbR+0Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778841; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Uc/CeWRDvT/TFblRTj0MYAUNkQhIh6oufOKqKBoDnoc=; b=gnAMysT6UVpcUTb3HsxLk3/T/sVg0i8gA+VvFs6e6N1XrWWc8th81Z/0RVX7772SKnevp0ogWynAmvGgZUfgwhYWr5VUNVgQB+7zDGkGY9+wRU1eNWbKGl8wbWkTpJhySVLPVHW7LvjU/vjelUyjAto6N82dVUCnD9S3mMIw1B4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778841952400.2068148317712; Mon, 18 Mar 2024 09:20:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFex-0007RY-4P; Mon, 18 Mar 2024 12:16:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFev-0007Pn-OR for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFes-0004gX-M1 for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:21 -0400 Received: from mail-vk1-f198.google.com (mail-vk1-f198.google.com [209.85.221.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-227-Go5CynVXOdmWlA5TycfM6Q-1; Mon, 18 Mar 2024 12:16:15 -0400 Received: by mail-vk1-f198.google.com with SMTP id 71dfb90a1353d-4d425addd29so3653145e0c.0 for ; Mon, 18 Mar 2024 09:16:15 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id p5-20020ac5cca5000000b004d33a329719sm1104519vkm.38.2024.03.18.09.16.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778576; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Uc/CeWRDvT/TFblRTj0MYAUNkQhIh6oufOKqKBoDnoc=; b=Uj9TjfDBMsYJ9pQFRXh3H4Xf+C6JQd0RC81OouQGwy7jgTkWA7nr59B+qzOxGarMXDeFDG IME7DaK+/EAtXXQB/iIFVRfAif4l5rll6888ncjlE6NNdz+3Eeat8E/4v1GldAW4JNjEIE mAtq9zJpOPsSC+RPJKoXCBxdC1KT6qM= X-MC-Unique: Go5CynVXOdmWlA5TycfM6Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778574; x=1711383374; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Uc/CeWRDvT/TFblRTj0MYAUNkQhIh6oufOKqKBoDnoc=; b=irKpIB393oVQS8wXjHQhs4JX3afdDK1GiWyixcY6e9Z3Qf/ts8zUOYoEGONqihn5yZ C17JJ/wCrUpUoEX0JoAu1gLPgtnwMTdG2sCAvlz7j4/kLtdjDxY3yfzxifv41RxTQU5t Snq64p6dzotOb2zT2moHlqd4DOXMIjtOC2GqU+Ni79wzqx4fpeytIVWx7nELqKl3hNKm 85OBObxo+AQ0Lw8FFLpLDKzXI4DRU/x1ghycjnhhhDsHtvmlIjuqOJK38of2YMHIlx5M J3biLb2e4PjdtVLp7gIB/MW95EEcRCfyrDa77gE0GMRl1MjglAJzluIxMqXuZYJOnJXf 7IhQ== X-Gm-Message-State: AOJu0Yy/jgdQYwakFpuycJUpBdCIDSnI0RjrzG+ASYtmAgDOJNEpzVni FVYY94s8z7lvosacC3XQifhEAiS1EKOL5NHzAraR4+MNR9v7pbr6OxO2FlzXRRPH4jr3q69Wf1S s6N2KlhlzZKf2iRYa3WaJJV8d+59x6AtJfi/C0gYBFXAaC5RAqOp08MPa9KIB2/y9W58sRxHNjb xIKTWf+8xohwDvsvAlGCeHRY5f78s0ag== X-Received: by 2002:a05:6122:984:b0:4b9:e8bd:3b2 with SMTP id g4-20020a056122098400b004b9e8bd03b2mr115579vkd.2.1710778572915; Mon, 18 Mar 2024 09:16:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IETP5FEgOUGFTFcQyI0HbOtCrOPlBmF9GhKeAAjmWaTleBFtXv6KRKeK0GeSbtKBvpFjmWU9g== X-Received: by 2002:a05:6122:984:b0:4b9:e8bd:3b2 with SMTP id g4-20020a056122098400b004b9e8bd03b2mr115371vkd.2.1710778571091; Mon, 18 Mar 2024 09:16:11 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:05 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Fiona Ebner , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 11/24] smbios: don't check type4 structures in legacy mode Message-ID: <9cd7fd69cfad9180e22b9adb728fc7b596b4bc1e.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778842652100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov legacy mode doesn't support structures of type 2 and more, and CLI has a check for '-smbios type' option, however it's still possible to sneak in type4 as a blob with '-smbios file' option. However doing the later makes SMBIOS tables broken since SeaBIOS doesn't expect that. Rather than trying to add support for type4 to legacy code (both QEMU and SeaBIOS), simplify smbios_get_table_legacy() by dropping not relevant check in legacy code and error out on type4 blob. Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-9-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/firmware/smbios.h | 2 +- hw/i386/fw_cfg.c | 3 +-- hw/smbios/smbios.c | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h index 7b42e7b4ac..0f0dca8f83 100644 --- a/include/hw/firmware/smbios.h +++ b/include/hw/firmware/smbios.h @@ -313,7 +313,7 @@ void smbios_set_defaults(const char *manufacturer, cons= t char *product, const char *version, bool uuid_encoded, SmbiosEntryPointType ep_type); void smbios_set_default_processor_family(uint16_t processor_family); -uint8_t *smbios_get_table_legacy(uint32_t expected_t4_count, size_t *lengt= h); +uint8_t *smbios_get_table_legacy(size_t *length); void smbios_get_tables(MachineState *ms, const struct smbios_phys_mem_area *mem_array, const unsigned int mem_array_size, diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index c1e9c0fd9c..d1281066f4 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -71,8 +71,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState= *fw_cfg) smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]= ); =20 if (pcmc->smbios_legacy_mode) { - smbios_tables =3D smbios_get_table_legacy(ms->smp.cpus, - &smbios_tables_len); + smbios_tables =3D smbios_get_table_legacy(&smbios_tables_len); fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, smbios_tables, smbios_tables_len); return; diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index aab4ffb4cb..30196d2911 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -545,14 +545,17 @@ opts_init(smbios_register_config); */ #define SMBIOS_21_MAX_TABLES_LEN 0xffff =20 -static void smbios_validate_table(uint32_t expected_t4_count) +static void smbios_check_type4_count(uint32_t expected_t4_count) { if (smbios_type4_count && smbios_type4_count !=3D expected_t4_count) { error_report("Expected %d SMBIOS Type 4 tables, got %d instead", expected_t4_count, smbios_type4_count); exit(1); } +} =20 +static void smbios_validate_table(void) +{ if (smbios_ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_32 && smbios_tables_len > SMBIOS_21_MAX_TABLES_LEN) { error_report("SMBIOS 2.1 table length %zu exceeds %d", @@ -637,7 +640,7 @@ static void smbios_build_type_1_fields(void) } } =20 -uint8_t *smbios_get_table_legacy(uint32_t expected_t4_count, size_t *lengt= h) +uint8_t *smbios_get_table_legacy(size_t *length) { int i; size_t usr_offset; @@ -650,6 +653,12 @@ uint8_t *smbios_get_table_legacy(uint32_t expected_t4_= count, size_t *length) exit(1); } =20 + if (test_bit(4, have_binfile_bitmap)) { + error_report("can't process table for smbios " + "type 4 on machine versions < 2.1!"); + exit(1); + } + g_free(smbios_entries); smbios_entries_len =3D sizeof(uint16_t); smbios_entries =3D g_malloc0(smbios_entries_len); @@ -676,7 +685,7 @@ uint8_t *smbios_get_table_legacy(uint32_t expected_t4_c= ount, size_t *length) =20 smbios_build_type_0_fields(); smbios_build_type_1_fields(); - smbios_validate_table(expected_t4_count); + smbios_validate_table(); *length =3D smbios_entries_len; return smbios_entries; } @@ -1304,7 +1313,8 @@ void smbios_get_tables(MachineState *ms, smbios_build_type_41_table(errp); smbios_build_type_127_table(); =20 - smbios_validate_table(ms->smp.sockets); + smbios_check_type4_count(ms->smp.sockets); + smbios_validate_table(); smbios_entry_point_setup(); =20 /* return tables blob and entry point (anchor), and their sizes */ --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778740; cv=none; d=zohomail.com; s=zohoarc; b=i6d5cICxG2RC35olAvqnuX8xG+UZyLoAe99g/wdn/+H3sxL9MEYwMXZuHk7orfEvEA7Ch6hroUIZ30/1e+RDepPMeeetOd/yEWrk+rhE8Xgs99xBP5tbv0YEBAzv5ypMcBAsvc7/cDa+Ux7Hl2TtTP1Xyr4saaRS0j3+hO+tTHs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778740; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EmhlT2tArR795qwjPsN2LzEPLg2rhync7H6puhjrXTE=; b=K8k0c3J2A2uAiF7kT7v8dAWQxLQiqSXJ89UI4s92aeh3Iex8NAwhp0nByb6CioM8gi25OguyL3XQo0Ccl0EE/vgn+sbn81cJDTyn0j5cRJRAqvk6ZN4dywr0rPGz2LoI6Mje/FpxIgHiXz4vZgdrKCDYi4FFfd+UJ9b0UgdDYl4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778740801774.0644355911435; Mon, 18 Mar 2024 09:19:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFf6-0007dV-0s; Mon, 18 Mar 2024 12:16:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFez-0007TU-Lc for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFew-0004i2-Fv for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:24 -0400 Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-693-mFuCNvOkObKmi0pMRNOh1Q-1; Mon, 18 Mar 2024 12:16:19 -0400 Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-29a5bae5b3fso4044828a91.2 for ; Mon, 18 Mar 2024 09:16:18 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id so10-20020a17090b1f8a00b0029df6fd2780sm6453073pjb.9.2024.03.18.09.16.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778581; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EmhlT2tArR795qwjPsN2LzEPLg2rhync7H6puhjrXTE=; b=BUv0BQTH82hAVLmzhiuVX2okSzODjP8bzqROCNyskbsYP9p3C/W4sNRuSnKBd6mONDraPA Jvwwr9xC4aCzg3MGj2gxt0HFqebS09Hmc/gcZcPWCAvkfTya8wNJx9kuJ7PQhd5WqsR4v8 bf/974LjjQ0AWaP95Kgrc9gcR81HXTY= X-MC-Unique: mFuCNvOkObKmi0pMRNOh1Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778578; x=1711383378; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EmhlT2tArR795qwjPsN2LzEPLg2rhync7H6puhjrXTE=; b=v1VTvedDmLMxKkLnLSXzuBf5ClWOCXF0lVMb7Le3qbZN05ZGGzkiWBgXSUPmMa+BpZ bhtheGb3rT1g9O9LxdLNCzuCRc6F/ncIyo97K2o6JqPR7JfinrBOey6n31o0Mr3f/o26 avfNxM9FjblS75ouV7eG9iI/HPMb/RRvvVYnYSEE3lUZu0dhOBiYPUow5EkK/gQtU+qP XrtgovdFz8A4lpa5WAD4UFFvevDCFXAR1heUGfo6rCENPHkce/s6coJ7SnwOnkPrSL9p 0L19YvHaaorBkrdd/Mo8+Zrdy0XvqDhxe10D/kvFaHeHyV9jiaijLG6re56Vl3Z26tVn xoyg== X-Gm-Message-State: AOJu0YwjEwHYM4+yMZOxVsN0Li/f9NrQuUSSQhkTqjFdkARYgM2lVdIe 9OEBU/BjPfUtnLU7Aah8cixb/cew1F0kwuz3SWe79lKuofMnTdaLAeEZ0A9OlU15/lc4dpANW2y 39DJdx4REOZBLcVGA8kF1Dy/Bkjqhuq6KJn46z6H0t/1uMbMeOcoVK4ef1sAUVrz2hMi+3hy0fZ czU5X5R3b/nioy3lu7M77Ln8b1Af22CQ== X-Received: by 2002:a17:90b:ecc:b0:29b:9a08:6007 with SMTP id gz12-20020a17090b0ecc00b0029b9a086007mr8519066pjb.46.1710778577621; Mon, 18 Mar 2024 09:16:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHq121vnI5TfSb1cb5Zm2WAVcSJJ9HyL76IXwiR6QccA5HrGz7qOv4smfwulKfkJqNi0qGxUw== X-Received: by 2002:a17:90b:ecc:b0:29b:9a08:6007 with SMTP id gz12-20020a17090b0ecc00b0029b9a086007mr8519021pjb.46.1710778576841; Mon, 18 Mar 2024 09:16:16 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:11 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 12/24] smbios: add smbios_add_usr_blob_size() helper Message-ID: <684b49fda6735fef7ee07bb2c628b37fa114ca1e.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778742305100017 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov it will be used by follow up patch when legacy handling is moved out into a separate file. Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Message-Id: <20240314152302.2324164-10-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/smbios/smbios.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 30196d2911..090a6eb018 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -1411,6 +1411,14 @@ static bool save_opt_list(size_t *ndest, char ***des= t, QemuOpts *opts, return true; } =20 +static void smbios_add_usr_blob_size(size_t size) +{ + if (!usr_blobs_sizes) { + usr_blobs_sizes =3D g_array_new(false, false, sizeof(size_t)); + } + g_array_append_val(usr_blobs_sizes, size); +} + void smbios_entry_add(QemuOpts *opts, Error **errp) { const char *val; @@ -1458,10 +1466,12 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) smbios_type4_count++; } =20 - if (!usr_blobs_sizes) { - usr_blobs_sizes =3D g_array_new(false, false, sizeof(size_t)); - } - g_array_append_val(usr_blobs_sizes, size); + /* + * preserve blob size for legacy mode so it could build its + * blobs flavor from 'usr_blobs' + */ + smbios_add_usr_blob_size(size); + usr_blobs_len +=3D size; if (size > usr_table_max) { usr_table_max =3D size; --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778637; cv=none; d=zohomail.com; s=zohoarc; b=KIQD+NWDa2jx7wwOPdUnb9Ol3bld0L3v6ClZWsiRbAB+UGQHFvXA9vR5exAyB0i3JWrZV/MLbGCBWT04P7NileUD8NMyqH+JVTBCKy2TVGLvhMVAI6jwzM8bsKQj8q7Akqj2Yq/8KEVtaypZSQ3Yb31afrbLy4JiRbsnhCFL0Uw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778637; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0UpINeiZr4GYa2v1+ory0bETtErkm76rqIiPEkMW7hk=; b=KPSNm6O4/sBu9xTea99qxAL604Bo3V+MvI/2x6y2qIwL5wqLIRRj1QAnJ2ZJBKMICBB1xJykiNBvv7TN1pUPR+lfYm1CRs6Zn4oyDVSSQYJj6ynDeasna/1p7H4yRZ3FzufS9JXtdV6P/7HM3AdOPZQ6WIhHhsvpGAo2xDtritM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778637334332.988194342311; Mon, 18 Mar 2024 09:17:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFf9-0007lg-TK; Mon, 18 Mar 2024 12:16:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFf1-0007UL-Br for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFez-0004iq-Ac for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:27 -0400 Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-327-LNE2yJUqMIiPvbUcz4w4Xg-1; Mon, 18 Mar 2024 12:16:23 -0400 Received: by mail-lj1-f199.google.com with SMTP id 38308e7fff4ca-2d49815c625so21074351fa.1 for ; Mon, 18 Mar 2024 09:16:22 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id l12-20020a05600c4f0c00b0041409d4841dsm7084394wmq.33.2024.03.18.09.16.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0UpINeiZr4GYa2v1+ory0bETtErkm76rqIiPEkMW7hk=; b=Mu/97P7ZkNy3/itLygBBAbAvF2euGCoKE70a7qLJqxr+Y++xVZhjg5QjjKXBaQnFgel1/j of/GAldTtKrke03kRqJR02iMbW/u8/J2W6JT4dp6p1L1C+5HiqgcEBmcvZXyESCSIRBOC/ HrF6WG8pwqCsM1c4lP8gpmIPnIfL0+A= X-MC-Unique: LNE2yJUqMIiPvbUcz4w4Xg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778581; x=1711383381; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0UpINeiZr4GYa2v1+ory0bETtErkm76rqIiPEkMW7hk=; b=nY4CATEj/OL9xyA0Ae/V9x4Gqcy79PlApGLR7JyeBoR+Z9/OPGF2iDu/+CRpws/GUi 7Wd/8ttGGpylu6dS7NC0O0DRXQq0B4DbPJ+8tnNZv/euwzPGiC/JFjVUtj/OYeGOEAJP 5VSiUro/Osov1WPctOh6kRzMzwAr129OBWWnhmF+AdCsHrnQu+96P5sSi0GMM2alX4Pv TJDZpDo/82i8Tcl04k1BAdddWbV97w0tmjpnAdBlobjTvJfjY9aDAZRpMJDPn6z/Y+Nl cZfH8aIe9CWgfLU87niFLrtyp+13/AHB9tuhbSSluaCGUQPubljWEk9131Kai6mDK0zF utag== X-Gm-Message-State: AOJu0YzqYdT4vxSri/eXUVu6MgAW68KUTMo/ejA8UPFg7U1cuDfe+NgN Ac62Zbx+mPVDfZlZss9+lTWKpyFKGOnpPmwxKKwdqbaOwW4+ORX72WsizA5gAhgrg2xNsQy+kru 5a/65dzmdFmPuOBxlW8wPJy94nLWUSlACkRzAaSgDqkpERKVu19+W/ncbbiCI4DwTjTVbe8mI6Q TE6Ugxf6addtfd2JG6q3+JSPT61GdhyA== X-Received: by 2002:a19:384e:0:b0:512:be8e:79da with SMTP id d14-20020a19384e000000b00512be8e79damr7842352lfj.8.1710778580681; Mon, 18 Mar 2024 09:16:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFBfMgkYJtQeFmoNU2U2Z8GWGC3q6gqbOry3IEHf5vvAmfLAAuNS0A0lCV9O/6H2fOb3+7UQ== X-Received: by 2002:a19:384e:0:b0:512:be8e:79da with SMTP id d14-20020a19384e000000b00512be8e79damr7842328lfj.8.1710778580073; Mon, 18 Mar 2024 09:16:20 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:17 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 13/24] smbios: rename/expose structures/bitmaps used by both legacy and modern code Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778637996100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov As a preparation to move legacy handling into a separate file, add prefix 'smbios_' to type0/type1/have_binfile_bitmap/have_fields_bitmap and expose them in smbios.h so that they can be reused in legacy and modern code. Doing it as a separate patch to avoid rename cluttering follow-up patch which will move legacy code into a separate file. Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Message-Id: <20240314152302.2324164-11-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/firmware/smbios.h | 16 +++++ hw/smbios/smbios.c | 113 ++++++++++++++++------------------- 2 files changed, 69 insertions(+), 60 deletions(-) diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h index 0f0dca8f83..05707c6341 100644 --- a/include/hw/firmware/smbios.h +++ b/include/hw/firmware/smbios.h @@ -2,6 +2,7 @@ #define QEMU_SMBIOS_H =20 #include "qapi/qapi-types-machine.h" +#include "qemu/bitmap.h" =20 /* * SMBIOS Support @@ -16,8 +17,23 @@ * */ =20 +typedef struct { + const char *vendor, *version, *date; + bool have_major_minor, uefi; + uint8_t major, minor; +} smbios_type0_t; +extern smbios_type0_t smbios_type0; + +typedef struct { + const char *manufacturer, *product, *version, *serial, *sku, *family; + /* uuid is in qemu_uuid */ +} smbios_type1_t; +extern smbios_type1_t smbios_type1; =20 #define SMBIOS_MAX_TYPE 127 +extern DECLARE_BITMAP(smbios_have_binfile_bitmap, SMBIOS_MAX_TYPE + 1); +extern DECLARE_BITMAP(smbios_have_fields_bitmap, SMBIOS_MAX_TYPE + 1); + #define offsetofend(TYPE, MEMBER) \ (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER)) =20 diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 090a6eb018..6c24fb75d3 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -78,19 +78,11 @@ static int smbios_type4_count =3D 0; static bool smbios_have_defaults; static uint32_t smbios_cpuid_version, smbios_cpuid_features; =20 -static DECLARE_BITMAP(have_binfile_bitmap, SMBIOS_MAX_TYPE+1); -static DECLARE_BITMAP(have_fields_bitmap, SMBIOS_MAX_TYPE+1); +DECLARE_BITMAP(smbios_have_binfile_bitmap, SMBIOS_MAX_TYPE + 1); +DECLARE_BITMAP(smbios_have_fields_bitmap, SMBIOS_MAX_TYPE + 1); =20 -static struct { - const char *vendor, *version, *date; - bool have_major_minor, uefi; - uint8_t major, minor; -} type0; - -static struct { - const char *manufacturer, *product, *version, *serial, *sku, *family; - /* uuid is in qemu_uuid */ -} type1; +smbios_type0_t smbios_type0; +smbios_type1_t smbios_type1; =20 static struct { const char *manufacturer, *product, *version, *serial, *asset, *locati= on; @@ -599,36 +591,36 @@ static void smbios_maybe_add_str(int type, int offset= , const char *data) static void smbios_build_type_0_fields(void) { smbios_maybe_add_str(0, offsetof(struct smbios_type_0, vendor_str), - type0.vendor); + smbios_type0.vendor); smbios_maybe_add_str(0, offsetof(struct smbios_type_0, bios_version_st= r), - type0.version); + smbios_type0.version); smbios_maybe_add_str(0, offsetof(struct smbios_type_0, bios_release_date_str), - type0.date); - if (type0.have_major_minor) { + smbios_type0.date); + if (smbios_type0.have_major_minor) { smbios_add_field(0, offsetof(struct smbios_type_0, system_bios_major_release), - &type0.major, 1); + &smbios_type0.major, 1); smbios_add_field(0, offsetof(struct smbios_type_0, system_bios_minor_release), - &type0.minor, 1); + &smbios_type0.minor, 1); } } =20 static void smbios_build_type_1_fields(void) { smbios_maybe_add_str(1, offsetof(struct smbios_type_1, manufacturer_st= r), - type1.manufacturer); + smbios_type1.manufacturer); smbios_maybe_add_str(1, offsetof(struct smbios_type_1, product_name_st= r), - type1.product); + smbios_type1.product); smbios_maybe_add_str(1, offsetof(struct smbios_type_1, version_str), - type1.version); + smbios_type1.version); smbios_maybe_add_str(1, offsetof(struct smbios_type_1, serial_number_s= tr), - type1.serial); + smbios_type1.serial); smbios_maybe_add_str(1, offsetof(struct smbios_type_1, sku_number_str), - type1.sku); + smbios_type1.sku); smbios_maybe_add_str(1, offsetof(struct smbios_type_1, family_str), - type1.family); + smbios_type1.family); if (qemu_uuid_set) { /* We don't encode the UUID in the "wire format" here because this * function is for legacy mode and needs to keep the guest ABI, and @@ -646,14 +638,14 @@ uint8_t *smbios_get_table_legacy(size_t *length) size_t usr_offset; =20 /* also complain if fields were given for types > 1 */ - if (find_next_bit(have_fields_bitmap, + if (find_next_bit(smbios_have_fields_bitmap, SMBIOS_MAX_TYPE + 1, 2) < SMBIOS_MAX_TYPE + 1) { error_report("can't process fields for smbios " "types > 1 on machine versions < 2.1!"); exit(1); } =20 - if (test_bit(4, have_binfile_bitmap)) { + if (test_bit(4, smbios_have_binfile_bitmap)) { error_report("can't process table for smbios " "type 4 on machine versions < 2.1!"); exit(1); @@ -694,10 +686,10 @@ uint8_t *smbios_get_table_legacy(size_t *length) =20 bool smbios_skip_table(uint8_t type, bool required_table) { - if (test_bit(type, have_binfile_bitmap)) { + if (test_bit(type, smbios_have_binfile_bitmap)) { return true; /* user provided their own binary blob(s) */ } - if (test_bit(type, have_fields_bitmap)) { + if (test_bit(type, smbios_have_fields_bitmap)) { return false; /* user provided fields via command line */ } if (smbios_have_defaults && required_table) { @@ -725,25 +717,25 @@ static void smbios_build_type_0_table(void) { SMBIOS_BUILD_TABLE_PRE(0, T0_BASE, false); /* optional, leave up to BI= OS */ =20 - SMBIOS_TABLE_SET_STR(0, vendor_str, type0.vendor); - SMBIOS_TABLE_SET_STR(0, bios_version_str, type0.version); + SMBIOS_TABLE_SET_STR(0, vendor_str, smbios_type0.vendor); + SMBIOS_TABLE_SET_STR(0, bios_version_str, smbios_type0.version); =20 t->bios_starting_address_segment =3D cpu_to_le16(0xE800); /* from SeaB= IOS */ =20 - SMBIOS_TABLE_SET_STR(0, bios_release_date_str, type0.date); + SMBIOS_TABLE_SET_STR(0, bios_release_date_str, smbios_type0.date); =20 t->bios_rom_size =3D 0; /* hardcoded in SeaBIOS with FIXME comment */ =20 t->bios_characteristics =3D cpu_to_le64(0x08); /* Not supported */ t->bios_characteristics_extension_bytes[0] =3D 0; t->bios_characteristics_extension_bytes[1] =3D 0x14; /* TCD/SVVP | VM = */ - if (type0.uefi) { + if (smbios_type0.uefi) { t->bios_characteristics_extension_bytes[1] |=3D 0x08; /* |=3D UEFI= */ } =20 - if (type0.have_major_minor) { - t->system_bios_major_release =3D type0.major; - t->system_bios_minor_release =3D type0.minor; + if (smbios_type0.have_major_minor) { + t->system_bios_major_release =3D smbios_type0.major; + t->system_bios_minor_release =3D smbios_type0.minor; } else { t->system_bios_major_release =3D 0; t->system_bios_minor_release =3D 0; @@ -773,18 +765,18 @@ static void smbios_build_type_1_table(void) { SMBIOS_BUILD_TABLE_PRE(1, T1_BASE, true); /* required */ =20 - SMBIOS_TABLE_SET_STR(1, manufacturer_str, type1.manufacturer); - SMBIOS_TABLE_SET_STR(1, product_name_str, type1.product); - SMBIOS_TABLE_SET_STR(1, version_str, type1.version); - SMBIOS_TABLE_SET_STR(1, serial_number_str, type1.serial); + SMBIOS_TABLE_SET_STR(1, manufacturer_str, smbios_type1.manufacturer); + SMBIOS_TABLE_SET_STR(1, product_name_str, smbios_type1.product); + SMBIOS_TABLE_SET_STR(1, version_str, smbios_type1.version); + SMBIOS_TABLE_SET_STR(1, serial_number_str, smbios_type1.serial); if (qemu_uuid_set) { smbios_encode_uuid(&t->uuid, &qemu_uuid); } else { memset(&t->uuid, 0, 16); } t->wake_up_type =3D 0x06; /* power switch */ - SMBIOS_TABLE_SET_STR(1, sku_number_str, type1.sku); - SMBIOS_TABLE_SET_STR(1, family_str, type1.family); + SMBIOS_TABLE_SET_STR(1, sku_number_str, smbios_type1.sku); + SMBIOS_TABLE_SET_STR(1, family_str, smbios_type1.family); =20 SMBIOS_BUILD_TABLE_POST; } @@ -1178,9 +1170,9 @@ void smbios_set_defaults(const char *manufacturer, co= nst char *product, smbios_uuid_encoded =3D uuid_encoded; smbios_ep_type =3D ep_type; =20 - SMBIOS_SET_DEFAULT(type1.manufacturer, manufacturer); - SMBIOS_SET_DEFAULT(type1.product, product); - SMBIOS_SET_DEFAULT(type1.version, version); + SMBIOS_SET_DEFAULT(smbios_type1.manufacturer, manufacturer); + SMBIOS_SET_DEFAULT(smbios_type1.product, product); + SMBIOS_SET_DEFAULT(smbios_type1.version, version); SMBIOS_SET_DEFAULT(type2.manufacturer, manufacturer); SMBIOS_SET_DEFAULT(type2.product, product); SMBIOS_SET_DEFAULT(type2.version, version); @@ -1453,13 +1445,13 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) } =20 if (header->type <=3D SMBIOS_MAX_TYPE) { - if (test_bit(header->type, have_fields_bitmap)) { + if (test_bit(header->type, smbios_have_fields_bitmap)) { error_setg(errp, "can't load type %d struct, fields already spec= ified!", header->type); return; } - set_bit(header->type, have_binfile_bitmap); + set_bit(header->type, smbios_have_binfile_bitmap); } =20 if (header->type =3D=3D 4) { @@ -1490,41 +1482,42 @@ void smbios_entry_add(QemuOpts *opts, Error **errp) return; } =20 - if (test_bit(type, have_binfile_bitmap)) { + if (test_bit(type, smbios_have_binfile_bitmap)) { error_setg(errp, "can't add fields, binary file already loaded= !"); return; } - set_bit(type, have_fields_bitmap); + set_bit(type, smbios_have_fields_bitmap); =20 switch (type) { case 0: if (!qemu_opts_validate(opts, qemu_smbios_type0_opts, errp)) { return; } - save_opt(&type0.vendor, opts, "vendor"); - save_opt(&type0.version, opts, "version"); - save_opt(&type0.date, opts, "date"); - type0.uefi =3D qemu_opt_get_bool(opts, "uefi", false); + save_opt(&smbios_type0.vendor, opts, "vendor"); + save_opt(&smbios_type0.version, opts, "version"); + save_opt(&smbios_type0.date, opts, "date"); + smbios_type0.uefi =3D qemu_opt_get_bool(opts, "uefi", false); =20 val =3D qemu_opt_get(opts, "release"); if (val) { - if (sscanf(val, "%hhu.%hhu", &type0.major, &type0.minor) != =3D 2) { + if (sscanf(val, "%hhu.%hhu", &smbios_type0.major, + &smbios_type0.minor) !=3D 2) { error_setg(errp, "Invalid release"); return; } - type0.have_major_minor =3D true; + smbios_type0.have_major_minor =3D true; } return; case 1: if (!qemu_opts_validate(opts, qemu_smbios_type1_opts, errp)) { return; } - save_opt(&type1.manufacturer, opts, "manufacturer"); - save_opt(&type1.product, opts, "product"); - save_opt(&type1.version, opts, "version"); - save_opt(&type1.serial, opts, "serial"); - save_opt(&type1.sku, opts, "sku"); - save_opt(&type1.family, opts, "family"); + save_opt(&smbios_type1.manufacturer, opts, "manufacturer"); + save_opt(&smbios_type1.product, opts, "product"); + save_opt(&smbios_type1.version, opts, "version"); + save_opt(&smbios_type1.serial, opts, "serial"); + save_opt(&smbios_type1.sku, opts, "sku"); + save_opt(&smbios_type1.family, opts, "family"); =20 val =3D qemu_opt_get(opts, "uuid"); if (val) { --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778774; cv=none; d=zohomail.com; s=zohoarc; b=n/vyLr2uyk4sDD+emrAZD1VDIfhrHdJ/xj5WzF9Sg3ZLx5pUjWJUUp4uJi1I6wA+YEb50CEh6QwTfuelUBHhMCliPcOiLZ7BI+U6pCVGdyt+zdFyevo43rcWC40/w/IsZBFAW/ks2Wvc3WBS8SA2jODrQPtV9qwzvTCipAjiUSI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778774; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lNFNyUZNdVz6oPVpBpM8Rnr81qSoFxR0/XMg3L8r+jU=; b=bIXEEkPtVgHz0U0M4sk+z8CodZ7CKTFR917s0pOtP/wmFY3yOv1OI21Fgrlwlp+k1wZvBgu/9cpNS9mTCWNVw8o8/8+aDm/cCKRAJv8AMdXoImPEAoF9VBP0L6/YErgVRXmfTIiCN3o9xerx2RzaZ8Aa7ueEtqqbUlmiwr/+PPo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778774431196.83403982857772; Mon, 18 Mar 2024 09:19:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFfD-0007t1-BC; Mon, 18 Mar 2024 12:16:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFf5-0007cx-PB for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFf3-0004ja-CQ for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:31 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-264-nr0YfenROjKXWdtAuii15Q-1; Mon, 18 Mar 2024 12:16:27 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-33eca7270ccso1793675f8f.1 for ; Mon, 18 Mar 2024 09:16:27 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id h2-20020a5d6e02000000b0033e91e53e8fsm10223436wrz.24.2024.03.18.09.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778588; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lNFNyUZNdVz6oPVpBpM8Rnr81qSoFxR0/XMg3L8r+jU=; b=CkVXgVDFZbeZglBxhJGr0qz4c+8+THWAG7nCE+5D3ERFBdAG0bycr0/3RnDFExvuajEpKL 5jLYw0CxGJ7yMPrCw1V4wHTZ4eGzHO7jRl6q8TRMY92gvtr7n9vbWHKNyGtduxyRkO8HZD k3NsSOjAfACvakOM0kmEQLLNgVaAfTQ= X-MC-Unique: nr0YfenROjKXWdtAuii15Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778584; x=1711383384; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lNFNyUZNdVz6oPVpBpM8Rnr81qSoFxR0/XMg3L8r+jU=; b=sLdJQTG4qwyLIMnktaevCwqnXT6WOpeg1KmOIvnD3+tvFczvLul5V+rjXKDpzIbDqY b5VX7n9jZjzszkmlaHwMVNrw5bATVlNnPZ7vRK1dAZsX1VlhmHSqnFF4XWHorzxuz2CM zhj8z60l4GQuZ/Vd67cfkp7Cq2Y7qyUf94PouMonujDwqBZjXMi67ddHDN/1iXBwtM4J pX8IQo8kY6pib+HhvpQ+RgMaZm1nfJjGv2ZMRfjUms8jXrhjmEF1KjQpvN3EavWZoJ+a uy9BJX+5NjLc6nixfYiTRRICx6AfeyO0WQ8I+nnZdDlCW1zs1piYgxONfKnCBrhDH/l0 CZXg== X-Gm-Message-State: AOJu0YxkyRioV4DOO2Uf6r6RZ4mOK39HOe/mQd2vgG+97tYYRr9qZSgd /V7j5Bqxuvzl4fAoFENbyGMyfXgFDr82uwlRnq4fS1+ZlIZb6SdQZ+eVvL2uo/D0ffUeRxdMxRj UEOjFpsw1k5SSXMPGvNFyi9xciPdpSqIPl8XuA9WUVlK6vJOqgac1rQmfIR1P99k/OHsu9Fs6Ze lGJhctMWx47hiflEg3w2o31NSn6XogfQ== X-Received: by 2002:a5d:6a48:0:b0:33d:eb13:9e27 with SMTP id t8-20020a5d6a48000000b0033deb139e27mr68855wrw.23.1710778583722; Mon, 18 Mar 2024 09:16:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH6QxOVpLj0srGizqlduQc91CvqKRuiivQvHJDZYihaBnyi1fg426l5MuJOa64AoVh253bCxw== X-Received: by 2002:a5d:6a48:0:b0:33d:eb13:9e27 with SMTP id t8-20020a5d6a48000000b0033deb139e27mr68826wrw.23.1710778583205; Mon, 18 Mar 2024 09:16:23 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:20 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 14/24] smbios: build legacy mode code only for 'pc' machine Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778776514100007 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov basically moving code around without functional change. And exposing some symbols so that they could be shared between smbbios.c and new smbios_legacy.c plus some meson magic to build smbios_legacy.c only for 'pc' machine and otherwise replace it with stub if not selected. Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Message-Id: <20240314152302.2324164-12-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/firmware/smbios.h | 5 + hw/smbios/smbios.c | 164 +----------------------------- hw/smbios/smbios_legacy.c | 179 +++++++++++++++++++++++++++++++++ hw/smbios/smbios_legacy_stub.c | 15 +++ hw/i386/Kconfig | 1 + hw/smbios/Kconfig | 2 + hw/smbios/meson.build | 4 + 7 files changed, 207 insertions(+), 163 deletions(-) create mode 100644 hw/smbios/smbios_legacy.c create mode 100644 hw/smbios/smbios_legacy_stub.c diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h index 05707c6341..ccc51e72f5 100644 --- a/include/hw/firmware/smbios.h +++ b/include/hw/firmware/smbios.h @@ -17,6 +17,9 @@ * */ =20 +extern uint8_t *usr_blobs; +extern GArray *usr_blobs_sizes; + typedef struct { const char *vendor, *version, *date; bool have_major_minor, uefi; @@ -323,6 +326,8 @@ struct smbios_type_127 { struct smbios_structure_header header; } QEMU_PACKED; =20 +void smbios_validate_table(void); +void smbios_add_usr_blob_size(size_t size); void smbios_entry_add(QemuOpts *opts, Error **errp); void smbios_set_cpuid(uint32_t version, uint32_t features); void smbios_set_defaults(const char *manufacturer, const char *product, diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 6c24fb75d3..242106fd87 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -31,38 +31,12 @@ #include "hw/pci/pci_device.h" #include "smbios_build.h" =20 -/* legacy structures and constants for <=3D 2.0 machines */ -struct smbios_header { - uint16_t length; - uint8_t type; -} QEMU_PACKED; - -struct smbios_field { - struct smbios_header header; - uint8_t type; - uint16_t offset; - uint8_t data[]; -} QEMU_PACKED; - -struct smbios_table { - struct smbios_header header; - uint8_t data[]; -} QEMU_PACKED; - -#define SMBIOS_FIELD_ENTRY 0 -#define SMBIOS_TABLE_ENTRY 1 - -static uint8_t *smbios_entries; -static size_t smbios_entries_len; static bool smbios_uuid_encoded =3D true; -/* end: legacy structures & constants for <=3D 2.0 machines */ - /* * SMBIOS tables provided by user with '-smbios file=3D' option */ uint8_t *usr_blobs; size_t usr_blobs_len; -static GArray *usr_blobs_sizes; static unsigned usr_table_max; static unsigned usr_table_cnt; =20 @@ -546,7 +520,7 @@ static void smbios_check_type4_count(uint32_t expected_= t4_count) } } =20 -static void smbios_validate_table(void) +void smbios_validate_table(void) { if (smbios_ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_32 && smbios_tables_len > SMBIOS_21_MAX_TABLES_LEN) { @@ -556,134 +530,6 @@ static void smbios_validate_table(void) } } =20 - -/* legacy setup functions for <=3D 2.0 machines */ -static void smbios_add_field(int type, int offset, const void *data, size_= t len) -{ - struct smbios_field *field; - - if (!smbios_entries) { - smbios_entries_len =3D sizeof(uint16_t); - smbios_entries =3D g_malloc0(smbios_entries_len); - } - smbios_entries =3D g_realloc(smbios_entries, smbios_entries_len + - sizeof(*field) + len); - field =3D (struct smbios_field *)(smbios_entries + smbios_entries_len); - field->header.type =3D SMBIOS_FIELD_ENTRY; - field->header.length =3D cpu_to_le16(sizeof(*field) + len); - - field->type =3D type; - field->offset =3D cpu_to_le16(offset); - memcpy(field->data, data, len); - - smbios_entries_len +=3D sizeof(*field) + len; - (*(uint16_t *)smbios_entries) =3D - cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1); -} - -static void smbios_maybe_add_str(int type, int offset, const char *data) -{ - if (data) { - smbios_add_field(type, offset, data, strlen(data) + 1); - } -} - -static void smbios_build_type_0_fields(void) -{ - smbios_maybe_add_str(0, offsetof(struct smbios_type_0, vendor_str), - smbios_type0.vendor); - smbios_maybe_add_str(0, offsetof(struct smbios_type_0, bios_version_st= r), - smbios_type0.version); - smbios_maybe_add_str(0, offsetof(struct smbios_type_0, - bios_release_date_str), - smbios_type0.date); - if (smbios_type0.have_major_minor) { - smbios_add_field(0, offsetof(struct smbios_type_0, - system_bios_major_release), - &smbios_type0.major, 1); - smbios_add_field(0, offsetof(struct smbios_type_0, - system_bios_minor_release), - &smbios_type0.minor, 1); - } -} - -static void smbios_build_type_1_fields(void) -{ - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, manufacturer_st= r), - smbios_type1.manufacturer); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, product_name_st= r), - smbios_type1.product); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, version_str), - smbios_type1.version); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, serial_number_s= tr), - smbios_type1.serial); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, sku_number_str), - smbios_type1.sku); - smbios_maybe_add_str(1, offsetof(struct smbios_type_1, family_str), - smbios_type1.family); - if (qemu_uuid_set) { - /* We don't encode the UUID in the "wire format" here because this - * function is for legacy mode and needs to keep the guest ABI, and - * because we don't know what's the SMBIOS version advertised by t= he - * BIOS. - */ - smbios_add_field(1, offsetof(struct smbios_type_1, uuid), - &qemu_uuid, 16); - } -} - -uint8_t *smbios_get_table_legacy(size_t *length) -{ - int i; - size_t usr_offset; - - /* also complain if fields were given for types > 1 */ - if (find_next_bit(smbios_have_fields_bitmap, - SMBIOS_MAX_TYPE + 1, 2) < SMBIOS_MAX_TYPE + 1) { - error_report("can't process fields for smbios " - "types > 1 on machine versions < 2.1!"); - exit(1); - } - - if (test_bit(4, smbios_have_binfile_bitmap)) { - error_report("can't process table for smbios " - "type 4 on machine versions < 2.1!"); - exit(1); - } - - g_free(smbios_entries); - smbios_entries_len =3D sizeof(uint16_t); - smbios_entries =3D g_malloc0(smbios_entries_len); - - for (i =3D 0, usr_offset =3D 0; usr_blobs_sizes && i < usr_blobs_sizes= ->len; - i++) - { - struct smbios_table *table; - struct smbios_structure_header *header; - size_t size =3D g_array_index(usr_blobs_sizes, size_t, i); - - header =3D (struct smbios_structure_header *)(usr_blobs + usr_offs= et); - smbios_entries =3D g_realloc(smbios_entries, smbios_entries_len + - size + sizeof(*table)); - table =3D (struct smbios_table *)(smbios_entries + smbios_entries_= len); - table->header.type =3D SMBIOS_TABLE_ENTRY; - table->header.length =3D cpu_to_le16(sizeof(*table) + size); - memcpy(table->data, header, size); - smbios_entries_len +=3D sizeof(*table) + size; - (*(uint16_t *)smbios_entries) =3D - cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1); - usr_offset +=3D size; - } - - smbios_build_type_0_fields(); - smbios_build_type_1_fields(); - smbios_validate_table(); - *length =3D smbios_entries_len; - return smbios_entries; -} -/* end: legacy setup functions for <=3D 2.0 machines */ - - bool smbios_skip_table(uint8_t type, bool required_table) { if (test_bit(type, smbios_have_binfile_bitmap)) { @@ -1403,14 +1249,6 @@ static bool save_opt_list(size_t *ndest, char ***des= t, QemuOpts *opts, return true; } =20 -static void smbios_add_usr_blob_size(size_t size) -{ - if (!usr_blobs_sizes) { - usr_blobs_sizes =3D g_array_new(false, false, sizeof(size_t)); - } - g_array_append_val(usr_blobs_sizes, size); -} - void smbios_entry_add(QemuOpts *opts, Error **errp) { const char *val; diff --git a/hw/smbios/smbios_legacy.c b/hw/smbios/smbios_legacy.c new file mode 100644 index 0000000000..21f143e738 --- /dev/null +++ b/hw/smbios/smbios_legacy.c @@ -0,0 +1,179 @@ +/* + * SMBIOS legacy support + * + * Copyright (C) 2009 Hewlett-Packard Development Company, L.P. + * Copyright (C) 2013 Red Hat, Inc. + * + * Authors: + * Alex Williamson + * Markus Armbruster + * + * This work is licensed under the terms of the GNU GPL, version 2. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#include "qemu/osdep.h" +#include "qemu/bswap.h" +#include "hw/firmware/smbios.h" +#include "sysemu/sysemu.h" +#include "qemu/error-report.h" + +struct smbios_header { + uint16_t length; + uint8_t type; +} QEMU_PACKED; + +struct smbios_field { + struct smbios_header header; + uint8_t type; + uint16_t offset; + uint8_t data[]; +} QEMU_PACKED; + +struct smbios_table { + struct smbios_header header; + uint8_t data[]; +} QEMU_PACKED; + +#define SMBIOS_FIELD_ENTRY 0 +#define SMBIOS_TABLE_ENTRY 1 + +static uint8_t *smbios_entries; +static size_t smbios_entries_len; +GArray *usr_blobs_sizes; + +void smbios_add_usr_blob_size(size_t size) +{ + if (!usr_blobs_sizes) { + usr_blobs_sizes =3D g_array_new(false, false, sizeof(size_t)); + } + g_array_append_val(usr_blobs_sizes, size); +} + +static void smbios_add_field(int type, int offset, const void *data, size_= t len) +{ + struct smbios_field *field; + + if (!smbios_entries) { + smbios_entries_len =3D sizeof(uint16_t); + smbios_entries =3D g_malloc0(smbios_entries_len); + } + smbios_entries =3D g_realloc(smbios_entries, smbios_entries_len + + sizeof(*field) + len); + field =3D (struct smbios_field *)(smbios_entries + smbios_entries_len); + field->header.type =3D SMBIOS_FIELD_ENTRY; + field->header.length =3D cpu_to_le16(sizeof(*field) + len); + + field->type =3D type; + field->offset =3D cpu_to_le16(offset); + memcpy(field->data, data, len); + + smbios_entries_len +=3D sizeof(*field) + len; + (*(uint16_t *)smbios_entries) =3D + cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1); +} + +static void smbios_maybe_add_str(int type, int offset, const char *data) +{ + if (data) { + smbios_add_field(type, offset, data, strlen(data) + 1); + } +} + +static void smbios_build_type_0_fields(void) +{ + smbios_maybe_add_str(0, offsetof(struct smbios_type_0, vendor_str), + smbios_type0.vendor); + smbios_maybe_add_str(0, offsetof(struct smbios_type_0, bios_version_st= r), + smbios_type0.version); + smbios_maybe_add_str(0, offsetof(struct smbios_type_0, + bios_release_date_str), + smbios_type0.date); + if (smbios_type0.have_major_minor) { + smbios_add_field(0, offsetof(struct smbios_type_0, + system_bios_major_release), + &smbios_type0.major, 1); + smbios_add_field(0, offsetof(struct smbios_type_0, + system_bios_minor_release), + &smbios_type0.minor, 1); + } +} + +static void smbios_build_type_1_fields(void) +{ + smbios_maybe_add_str(1, offsetof(struct smbios_type_1, manufacturer_st= r), + smbios_type1.manufacturer); + smbios_maybe_add_str(1, offsetof(struct smbios_type_1, product_name_st= r), + smbios_type1.product); + smbios_maybe_add_str(1, offsetof(struct smbios_type_1, version_str), + smbios_type1.version); + smbios_maybe_add_str(1, offsetof(struct smbios_type_1, serial_number_s= tr), + smbios_type1.serial); + smbios_maybe_add_str(1, offsetof(struct smbios_type_1, sku_number_str), + smbios_type1.sku); + smbios_maybe_add_str(1, offsetof(struct smbios_type_1, family_str), + smbios_type1.family); + if (qemu_uuid_set) { + /* + * We don't encode the UUID in the "wire format" here because this + * function is for legacy mode and needs to keep the guest ABI, and + * because we don't know what's the SMBIOS version advertised by t= he + * BIOS. + */ + smbios_add_field(1, offsetof(struct smbios_type_1, uuid), + &qemu_uuid, 16); + } +} + +uint8_t *smbios_get_table_legacy(size_t *length) +{ + int i; + size_t usr_offset; + + /* complain if fields were given for types > 1 */ + if (find_next_bit(smbios_have_fields_bitmap, + SMBIOS_MAX_TYPE + 1, 2) < SMBIOS_MAX_TYPE + 1) { + error_report("can't process fields for smbios " + "types > 1 on machine versions < 2.1!"); + exit(1); + } + + if (test_bit(4, smbios_have_binfile_bitmap)) { + error_report("can't process table for smbios " + "type 4 on machine versions < 2.1!"); + exit(1); + } + + g_free(smbios_entries); + smbios_entries_len =3D sizeof(uint16_t); + smbios_entries =3D g_malloc0(smbios_entries_len); + + for (i =3D 0, usr_offset =3D 0; usr_blobs_sizes && i < usr_blobs_sizes= ->len; + i++) + { + struct smbios_table *table; + struct smbios_structure_header *header; + size_t size =3D g_array_index(usr_blobs_sizes, size_t, i); + + header =3D (struct smbios_structure_header *)(usr_blobs + usr_offs= et); + smbios_entries =3D g_realloc(smbios_entries, smbios_entries_len + + size + sizeof(*table)); + table =3D (struct smbios_table *)(smbios_entries + smbios_entries_= len); + table->header.type =3D SMBIOS_TABLE_ENTRY; + table->header.length =3D cpu_to_le16(sizeof(*table) + size); + memcpy(table->data, header, size); + smbios_entries_len +=3D sizeof(*table) + size; + (*(uint16_t *)smbios_entries) =3D + cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1); + usr_offset +=3D size; + } + + smbios_build_type_0_fields(); + smbios_build_type_1_fields(); + smbios_validate_table(); + *length =3D smbios_entries_len; + return smbios_entries; +} diff --git a/hw/smbios/smbios_legacy_stub.c b/hw/smbios/smbios_legacy_stub.c new file mode 100644 index 0000000000..f29b15316c --- /dev/null +++ b/hw/smbios/smbios_legacy_stub.c @@ -0,0 +1,15 @@ +/* + * IPMI SMBIOS firmware handling + * + * Copyright (c) 2024 Igor Mammedov, Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/firmware/smbios.h" + +void smbios_add_usr_blob_size(size_t size) +{ +} diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index a1846be6f7..a6ee052f9a 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -76,6 +76,7 @@ config I440FX select PIIX select DIMM select SMBIOS + select SMBIOS_LEGACY select FW_CFG_DMA =20 config ISAPC diff --git a/hw/smbios/Kconfig b/hw/smbios/Kconfig index 553adf4bfc..8d989a2f1b 100644 --- a/hw/smbios/Kconfig +++ b/hw/smbios/Kconfig @@ -1,2 +1,4 @@ config SMBIOS bool +config SMBIOS_LEGACY + bool diff --git a/hw/smbios/meson.build b/hw/smbios/meson.build index 7046967462..a59039f669 100644 --- a/hw/smbios/meson.build +++ b/hw/smbios/meson.build @@ -4,5 +4,9 @@ smbios_ss.add(when: 'CONFIG_IPMI', if_true: files('smbios_type_38.c'), if_false: files('smbios_type_38-stub.c')) =20 +smbios_ss.add(when: 'CONFIG_SMBIOS_LEGACY', + if_true: files('smbios_legacy.c'), + if_false: files('smbios_legacy_stub.c')) + system_ss.add_all(when: 'CONFIG_SMBIOS', if_true: smbios_ss) system_ss.add(when: 'CONFIG_SMBIOS', if_false: files('smbios-stub.c')) --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778614; cv=none; d=zohomail.com; s=zohoarc; b=faPBtjP30hUuEVs6iTe4GbKod6sgt08NMLw0Km5Oeipkzul/bDBmbWFsnEvqqFd/Xh2qD/ZqyCvuSx00ou/SzEfxYqTpKnk61YlWf0JkDmbRWQOmC8oaYsxOF8a4eCjx8KqQst7rFGJs8zqIufXKLEedddDL7K/Vis1o93IYD08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778614; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+2NU3RdVHDfdhC7PtdUsznUnUG0uH352XNbJ00IycZU=; b=Cyh8Uj4EOozRzzUaVa0BnLhm5SM8W7Dr4GP8QNM15hmHVa2nZIxfhTjCz5YekEu6qM7gpIDk2IYdt5ppzZG5tmth4pB5aG0CwWiPrnK66lGBOi1Fd/tWMdMvvSU4wQtb7g9kxNL1SKBAlqkJ0Q+dTLjQ1plXYllBrjrmnVWi9MM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778614157679.8797808501902; Mon, 18 Mar 2024 09:16:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFfF-00082H-HQ; Mon, 18 Mar 2024 12:16:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfD-0007tW-Bs for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFf5-0004jk-SP for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:36 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-96-GgfXB7r6PrG2BuqLkMJEdA-1; Mon, 18 Mar 2024 12:16:29 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-33ed8677d16so1308869f8f.1 for ; Mon, 18 Mar 2024 09:16:29 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id bv16-20020a0560001f1000b00341798ba0a8sm1892563wrb.87.2024.03.18.09.16.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+2NU3RdVHDfdhC7PtdUsznUnUG0uH352XNbJ00IycZU=; b=EWF+/UHk1TMYcH+nHQIfc3gMMt8PAj7EZUF7kfcN3BKZvoic2xxUhWjL8/9ZXSsD4Xjd+W HqhvrIOdftJfqrjI2SSazmruheSNAezAPpexJN+68jDow/iAQntmLPeTcrgfzHx7l6wrTu 3c/cfr78SRdtBWqOt/kcHWmrNpF/WCI= X-MC-Unique: GgfXB7r6PrG2BuqLkMJEdA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778588; x=1711383388; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+2NU3RdVHDfdhC7PtdUsznUnUG0uH352XNbJ00IycZU=; b=KSJ9H6f6EDJ+xmuMrO6GwEBsyuzTLGEC1VRIYIOHLsjOpizgloBoJfLLUBXDQN1DMB QsfLZKegWh4RHB7YgQjFdvZRVqwLBXauZ7x7xz9iF08w9e+XOJd3DYGhZavEWLptYXvh Z9eK77fEADLrip2KsLgpfFFqqM/R5GsA+M398+QNggnBqzx8kdOMOZDjil9L4UweBqcm HLwHzWEHQCD6ByGWQ/q5kJDOoWFxwdueD/nNoKSbSPZJ8Vx41928Va0Ao2inRDOF32Xf uBTcfyjyHjfygpLZmDwFQxOOnF0rrnEMFXwcJzWDTdoqhivYS50weGOpR5tyWmctYfnK Ju+g== X-Gm-Message-State: AOJu0YxIByfS6SkEGkpXzZ1QeGBzAkhVa09R3XkxDa15TqE3jGDzXMdr emSu7ezQXPYSN+qLeqfAzKVGeD3lgYG3cSIJPWKaLqTf//s5Jsf8pfQtNTMd0fJj2/tOm8GEqG9 f0SS5hfzufyf87+Ddg5wYE5teP2lT6V5vlrnDj1CnyY3ncn+pBjAWkEuKDyNLvXQi2NfZWeS/XL 78Vsm6p5VO0XAQ19clVDmcnnrBf3JEjg== X-Received: by 2002:adf:fa52:0:b0:33d:a1c4:9c63 with SMTP id y18-20020adffa52000000b0033da1c49c63mr9682915wrr.49.1710778588038; Mon, 18 Mar 2024 09:16:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExwsDV6retvT4AXi9Q/totjrophQkvzqZehNJ2HPcgGFLls82e7hufFZpHU+M79ypG1uVeVQ== X-Received: by 2002:adf:fa52:0:b0:33d:a1c4:9c63 with SMTP id y18-20020adffa52000000b0033da1c49c63mr9682881wrr.49.1710778587534; Mon, 18 Mar 2024 09:16:27 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:23 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 15/24] smbios: handle errors consistently Message-ID: <643e1c9ef9d90a6e80b82998d41c91302fef506b.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778615904100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Current code uses mix of error_report()+exit(1) and error_setg() to handle errors. Use newer error_setg() everywhere, beside consistency it will allow to detect error condition without killing QEMU and attempt switch-over to SMBIOS3.x tables/entrypoint in follow up patch. while at it, clear smbios_tables pointer after freeing. that will avoid double free if smbios_get_tables() is called multiple times. Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Message-Id: <20240314152302.2324164-13-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/firmware/smbios.h | 4 ++-- hw/i386/fw_cfg.c | 3 ++- hw/smbios/smbios.c | 34 ++++++++++++++++++++++------------ hw/smbios/smbios_legacy.c | 22 ++++++++++++++-------- 4 files changed, 40 insertions(+), 23 deletions(-) diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h index ccc51e72f5..d4b91d5a14 100644 --- a/include/hw/firmware/smbios.h +++ b/include/hw/firmware/smbios.h @@ -326,7 +326,7 @@ struct smbios_type_127 { struct smbios_structure_header header; } QEMU_PACKED; =20 -void smbios_validate_table(void); +bool smbios_validate_table(Error **errp); void smbios_add_usr_blob_size(size_t size); void smbios_entry_add(QemuOpts *opts, Error **errp); void smbios_set_cpuid(uint32_t version, uint32_t features); @@ -334,7 +334,7 @@ void smbios_set_defaults(const char *manufacturer, cons= t char *product, const char *version, bool uuid_encoded, SmbiosEntryPointType ep_type); void smbios_set_default_processor_family(uint16_t processor_family); -uint8_t *smbios_get_table_legacy(size_t *length); +uint8_t *smbios_get_table_legacy(size_t *length, Error **errp); void smbios_get_tables(MachineState *ms, const struct smbios_phys_mem_area *mem_array, const unsigned int mem_array_size, diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index d1281066f4..e387bf50d0 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -71,7 +71,8 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState= *fw_cfg) smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]= ); =20 if (pcmc->smbios_legacy_mode) { - smbios_tables =3D smbios_get_table_legacy(&smbios_tables_len); + smbios_tables =3D smbios_get_table_legacy(&smbios_tables_len, + &error_fatal); fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES, smbios_tables, smbios_tables_len); return; diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 242106fd87..f7ca7d77e3 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -19,7 +19,6 @@ #include "qemu/units.h" #include "qapi/error.h" #include "qemu/config-file.h" -#include "qemu/error-report.h" #include "qemu/module.h" #include "qemu/option.h" #include "sysemu/sysemu.h" @@ -511,23 +510,25 @@ opts_init(smbios_register_config); */ #define SMBIOS_21_MAX_TABLES_LEN 0xffff =20 -static void smbios_check_type4_count(uint32_t expected_t4_count) +static bool smbios_check_type4_count(uint32_t expected_t4_count, Error **e= rrp) { if (smbios_type4_count && smbios_type4_count !=3D expected_t4_count) { - error_report("Expected %d SMBIOS Type 4 tables, got %d instead", - expected_t4_count, smbios_type4_count); - exit(1); + error_setg(errp, "Expected %d SMBIOS Type 4 tables, got %d instead= ", + expected_t4_count, smbios_type4_count); + return false; } + return true; } =20 -void smbios_validate_table(void) +bool smbios_validate_table(Error **errp) { if (smbios_ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_32 && smbios_tables_len > SMBIOS_21_MAX_TABLES_LEN) { - error_report("SMBIOS 2.1 table length %zu exceeds %d", - smbios_tables_len, SMBIOS_21_MAX_TABLES_LEN); - exit(1); + error_setg(errp, "SMBIOS 2.1 table length %zu exceeds %d", + smbios_tables_len, SMBIOS_21_MAX_TABLES_LEN); + return false; } + return true; } =20 bool smbios_skip_table(uint8_t type, bool required_table) @@ -1151,15 +1152,18 @@ void smbios_get_tables(MachineState *ms, smbios_build_type_41_table(errp); smbios_build_type_127_table(); =20 - smbios_check_type4_count(ms->smp.sockets); - smbios_validate_table(); + if (!smbios_check_type4_count(ms->smp.sockets, errp)) { + goto err_exit; + } + if (!smbios_validate_table(errp)) { + goto err_exit; + } smbios_entry_point_setup(); =20 /* return tables blob and entry point (anchor), and their sizes */ *tables =3D smbios_tables; *tables_len =3D smbios_tables_len; *anchor =3D (uint8_t *)&ep; - /* calculate length based on anchor string */ if (!strncmp((char *)&ep, "_SM_", 4)) { *anchor_len =3D sizeof(struct smbios_21_entry_point); @@ -1168,6 +1172,12 @@ void smbios_get_tables(MachineState *ms, } else { abort(); } + + return; +err_exit: + g_free(smbios_tables); + smbios_tables =3D NULL; + return; } =20 static void save_opt(const char **dest, QemuOpts *opts, const char *name) diff --git a/hw/smbios/smbios_legacy.c b/hw/smbios/smbios_legacy.c index 21f143e738..a6544bf55a 100644 --- a/hw/smbios/smbios_legacy.c +++ b/hw/smbios/smbios_legacy.c @@ -19,7 +19,7 @@ #include "qemu/bswap.h" #include "hw/firmware/smbios.h" #include "sysemu/sysemu.h" -#include "qemu/error-report.h" +#include "qapi/error.h" =20 struct smbios_header { uint16_t length; @@ -128,7 +128,7 @@ static void smbios_build_type_1_fields(void) } } =20 -uint8_t *smbios_get_table_legacy(size_t *length) +uint8_t *smbios_get_table_legacy(size_t *length, Error **errp) { int i; size_t usr_offset; @@ -136,15 +136,15 @@ uint8_t *smbios_get_table_legacy(size_t *length) /* complain if fields were given for types > 1 */ if (find_next_bit(smbios_have_fields_bitmap, SMBIOS_MAX_TYPE + 1, 2) < SMBIOS_MAX_TYPE + 1) { - error_report("can't process fields for smbios " + error_setg(errp, "can't process fields for smbios " "types > 1 on machine versions < 2.1!"); - exit(1); + goto err_exit; } =20 if (test_bit(4, smbios_have_binfile_bitmap)) { - error_report("can't process table for smbios " - "type 4 on machine versions < 2.1!"); - exit(1); + error_setg(errp, "can't process table for smbios " + "type 4 on machine versions < 2.1!"); + goto err_exit; } =20 g_free(smbios_entries); @@ -173,7 +173,13 @@ uint8_t *smbios_get_table_legacy(size_t *length) =20 smbios_build_type_0_fields(); smbios_build_type_1_fields(); - smbios_validate_table(); + if (!smbios_validate_table(errp)) { + goto err_exit; + } + *length =3D smbios_entries_len; return smbios_entries; +err_exit: + g_free(smbios_entries); + return NULL; } --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778811; cv=none; d=zohomail.com; s=zohoarc; b=gidtqh1SSUki2sBJyPIG7zDsgp6qm5k5rXzqfF6Fy9m2fFVoIa6TMLtysRUhxDURD0CgiyPiEUBVysiGlieQVcyHa06Yxp8t1e0wvjgXh6/rwqOIH7nQPqtnz+sdhb7L/xwV5744gkoFPu8+Qp963LPCgu5crcTlgzG9zYcI8YI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778811; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QWKuhfl1vUGxImS8wUGBNUDNid5d+Po/4qnMfxE2Umw=; b=ZSGYGOCZiQ3JotMOTidBYHRbys9aHMzy7Zc7pXTbfAvggcrXtxoKu7eD8a+MSb7f6/ja4YfAZjaBdZe3rp4qL4Q9/jFyoXDi8grcjhiqmm1Jc0J61x3i2Uio6Px6NA9NgF7OdtUDKDp3obU0MgOSYamJ7IKdrog7UW7R3Nn/JXw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778811370535.1337456341453; Mon, 18 Mar 2024 09:20:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFfK-000875-3a; Mon, 18 Mar 2024 12:16:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfF-00082A-7r for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfD-0004kZ-3e for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:40 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-274-bW8umZFlMQaxGyaCb2S2nA-1; Mon, 18 Mar 2024 12:16:34 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-34172041676so673073f8f.1 for ; Mon, 18 Mar 2024 09:16:34 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id bo16-20020a056000069000b0033ecb111a5csm10045255wrb.83.2024.03.18.09.16.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778595; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QWKuhfl1vUGxImS8wUGBNUDNid5d+Po/4qnMfxE2Umw=; b=VcMqa45ykEsudtrm0FlfUcctjMchID917jjsW1i3IZdS8tifAyBadx7rNw5zajjrxTm61R iSzIOft/rWfM19QqxTCk751SnAu3UVFdlxYIfxbYuxefBzTK3/gdUPykl+HKKu5oKvxd8q MzyH6wNUYNGF3KNDmvAal50+qJQuyz8= X-MC-Unique: bW8umZFlMQaxGyaCb2S2nA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778593; x=1711383393; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QWKuhfl1vUGxImS8wUGBNUDNid5d+Po/4qnMfxE2Umw=; b=BMr6IKi6Bu8OYzghW1GqmJxc/8Xnt0Qxb2sAXqgdPPn6BHQX1LBSF2P6719Es/je52 MjWYEJJZkmWzy7kngAeGNsEl4Varx9qDG0z9U9HEndfsaiU0yq7/C/eDNVTelN0AgssJ 6svg/2h08wUVyTm5P3q5D67H80mh5tHWANWHMC6oVy85CULmL/puI4f2PFJUk5DyOq+I 71ZWOkxULFi17bJFcJKc2FMNNNv7+4tRoyu4eYGrDVi8RnJJaYxUjVYKobUoMcPfinl1 EZ0u5+4cd6Sluyj1roqDwRptnMDJrIlwTcUYvkLMCHApwKssqNNALaUUnyW6l8S+oZ3T Cl1A== X-Gm-Message-State: AOJu0YwYdHsuzjh1X4rsTnUPSGNfHtwqUIFX8X5onIVWeMAOmw9j/n7m ty738KY1wuS96BF3vY9xacg/UGZi+dERTWfekj1lTbp5yI3SXVAcbuoaxLQ46b+MhLaUKnVjGeu fVwFbWIm5n2Sqd5OqKH3J32ljDrHthKsHGBIaGZPXrFbqBd4P6iQ410OPPxMg6IGYV0ncBR6XpS YuA1gKRJJ49Qcc3b1tY2NyFya27p9sZQ== X-Received: by 2002:adf:eb07:0:b0:33d:3f23:eea7 with SMTP id s7-20020adfeb07000000b0033d3f23eea7mr48669wrn.35.1710778592610; Mon, 18 Mar 2024 09:16:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEw8kZjmoip5CQMKTOwhyYA6n1d2MiJ0xbeJujuTpPPFQcyCRdC+dQgQsoN3F7qJA7ys2Ihng== X-Received: by 2002:adf:eb07:0:b0:33d:3f23:eea7 with SMTP id s7-20020adfeb07000000b0033d3f23eea7mr48626wrn.35.1710778591953; Mon, 18 Mar 2024 09:16:31 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:27 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Daniel Henrique Barboza , Ani Sinha , Fiona Ebner , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Song Gao , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , Liu Zhiwei , qemu-arm@nongnu.org, qemu-riscv@nongnu.org Subject: [PULL 16/24] smbios: get rid of global smbios_ep_type Message-ID: <69ea07a56ef54050a61b91fe8236fef4908fe5d1.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778812597100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Signed-off-by: Igor Mammedov Acked-by: Daniel Henrique Barboza Reviewed-by: Ani Sinha Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-14-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/fw_cfg.h | 3 ++- include/hw/firmware/smbios.h | 5 +++-- hw/arm/virt.c | 4 ++-- hw/i386/fw_cfg.c | 8 ++++---- hw/i386/pc.c | 2 +- hw/loongarch/virt.c | 7 ++++--- hw/riscv/virt.c | 6 +++--- hw/smbios/smbios.c | 27 +++++++++++++++------------ hw/smbios/smbios_legacy.c | 2 +- 9 files changed, 35 insertions(+), 29 deletions(-) diff --git a/hw/i386/fw_cfg.h b/hw/i386/fw_cfg.h index 1e1de6b4a3..92e310f5fd 100644 --- a/hw/i386/fw_cfg.h +++ b/hw/i386/fw_cfg.h @@ -23,7 +23,8 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms, uint16_t boot_cpus, uint16_t apic_id_limit); -void fw_cfg_build_smbios(PCMachineState *ms, FWCfgState *fw_cfg); +void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, + SmbiosEntryPointType ep_type); void fw_cfg_build_feature_control(MachineState *ms, FWCfgState *fw_cfg); void fw_cfg_add_acpi_dsdt(Aml *scope, FWCfgState *fw_cfg); =20 diff --git a/include/hw/firmware/smbios.h b/include/hw/firmware/smbios.h index d4b91d5a14..8d3fb2fb3b 100644 --- a/include/hw/firmware/smbios.h +++ b/include/hw/firmware/smbios.h @@ -326,16 +326,17 @@ struct smbios_type_127 { struct smbios_structure_header header; } QEMU_PACKED; =20 -bool smbios_validate_table(Error **errp); +bool smbios_validate_table(SmbiosEntryPointType ep_type, Error **errp); void smbios_add_usr_blob_size(size_t size); void smbios_entry_add(QemuOpts *opts, Error **errp); void smbios_set_cpuid(uint32_t version, uint32_t features); void smbios_set_defaults(const char *manufacturer, const char *product, const char *version, - bool uuid_encoded, SmbiosEntryPointType ep_type); + bool uuid_encoded); void smbios_set_default_processor_family(uint16_t processor_family); uint8_t *smbios_get_table_legacy(size_t *length, Error **errp); void smbios_get_tables(MachineState *ms, + SmbiosEntryPointType ep_type, const struct smbios_phys_mem_area *mem_array, const unsigned int mem_array_size, uint8_t **tables, size_t *tables_len, diff --git a/hw/arm/virt.c b/hw/arm/virt.c index b634c908a7..a9a913aead 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1651,13 +1651,13 @@ static void virt_build_smbios(VirtMachineState *vms) =20 smbios_set_defaults("QEMU", product, vmc->smbios_old_sys_ver ? "1.0" : mc->name, - true, SMBIOS_ENTRY_POINT_TYPE_64); + true); =20 /* build the array of physical mem area from base_memmap */ mem_array.address =3D vms->memmap[VIRT_MEM].base; mem_array.length =3D ms->ram_size; =20 - smbios_get_tables(ms, &mem_array, 1, + smbios_get_tables(ms, SMBIOS_ENTRY_POINT_TYPE_64, &mem_array, 1, &smbios_tables, &smbios_tables_len, &smbios_anchor, &smbios_anchor_len, &error_fatal); diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index e387bf50d0..d802d2787f 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -48,7 +48,8 @@ const char *fw_cfg_arch_key_name(uint16_t key) return NULL; } =20 -void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg) +void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState *fw_cfg, + SmbiosEntryPointType ep_type) { #ifdef CONFIG_SMBIOS uint8_t *smbios_tables, *smbios_anchor; @@ -63,8 +64,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState= *fw_cfg) if (pcmc->smbios_defaults) { /* These values are guest ABI, do not change */ smbios_set_defaults("QEMU", mc->desc, mc->name, - pcmc->smbios_uuid_encoded, - pcms->smbios_entry_point_type); + pcmc->smbios_uuid_encoded); } =20 /* tell smbios about cpuid version and features */ @@ -89,7 +89,7 @@ void fw_cfg_build_smbios(PCMachineState *pcms, FWCfgState= *fw_cfg) array_count++; } } - smbios_get_tables(ms, mem_array, array_count, + smbios_get_tables(ms, ep_type, mem_array, array_count, &smbios_tables, &smbios_tables_len, &smbios_anchor, &smbios_anchor_len, &error_fatal); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index feb7a93083..44eb073abd 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -672,7 +672,7 @@ void pc_machine_done(Notifier *notifier, void *data) =20 acpi_setup(); if (x86ms->fw_cfg) { - fw_cfg_build_smbios(pcms, x86ms->fw_cfg); + fw_cfg_build_smbios(pcms, x86ms->fw_cfg, pcms->smbios_entry_point_= type); fw_cfg_build_feature_control(MACHINE(pcms), x86ms->fw_cfg); /* update FW_CFG_NB_CPUS to account for -device added CPUs */ fw_cfg_modify_i16(x86ms->fw_cfg, FW_CFG_NB_CPUS, x86ms->boot_cpus); diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 53bfdcee61..441d764843 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -355,10 +355,11 @@ static void virt_build_smbios(LoongArchMachineState *= lams) return; } =20 - smbios_set_defaults("QEMU", product, mc->name, - true, SMBIOS_ENTRY_POINT_TYPE_64); + smbios_set_defaults("QEMU", product, mc->name, true); =20 - smbios_get_tables(ms, NULL, 0, &smbios_tables, &smbios_tables_len, + smbios_get_tables(ms, SMBIOS_ENTRY_POINT_TYPE_64, + NULL, 0, + &smbios_tables, &smbios_tables_len, &smbios_anchor, &smbios_anchor_len, &error_fatal); =20 if (smbios_anchor) { diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 535fd047ba..72a55b8af1 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -1275,8 +1275,7 @@ static void virt_build_smbios(RISCVVirtState *s) product =3D "KVM Virtual Machine"; } =20 - smbios_set_defaults("QEMU", product, mc->name, - true, SMBIOS_ENTRY_POINT_TYPE_64); + smbios_set_defaults("QEMU", product, mc->name, true); =20 if (riscv_is_32bit(&s->soc[0])) { smbios_set_default_processor_family(0x200); @@ -1288,7 +1287,8 @@ static void virt_build_smbios(RISCVVirtState *s) mem_array.address =3D s->memmap[VIRT_DRAM].base; mem_array.length =3D ms->ram_size; =20 - smbios_get_tables(ms, &mem_array, 1, + smbios_get_tables(ms, SMBIOS_ENTRY_POINT_TYPE_64, + &mem_array, 1, &smbios_tables, &smbios_tables_len, &smbios_anchor, &smbios_anchor_len, &error_fatal); diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index f7ca7d77e3..0ab77b5ec8 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -43,7 +43,6 @@ uint8_t *smbios_tables; size_t smbios_tables_len; unsigned smbios_table_max; unsigned smbios_table_cnt; -static SmbiosEntryPointType smbios_ep_type =3D SMBIOS_ENTRY_POINT_TYPE_32; =20 static SmbiosEntryPoint ep; =20 @@ -520,9 +519,9 @@ static bool smbios_check_type4_count(uint32_t expected_= t4_count, Error **errp) return true; } =20 -bool smbios_validate_table(Error **errp) +bool smbios_validate_table(SmbiosEntryPointType ep_type, Error **errp) { - if (smbios_ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_32 && + if (ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_32 && smbios_tables_len > SMBIOS_21_MAX_TABLES_LEN) { error_setg(errp, "SMBIOS 2.1 table length %zu exceeds %d", smbios_tables_len, SMBIOS_21_MAX_TABLES_LEN); @@ -669,14 +668,15 @@ static void smbios_build_type_3_table(void) SMBIOS_BUILD_TABLE_POST; } =20 -static void smbios_build_type_4_table(MachineState *ms, unsigned instance) +static void smbios_build_type_4_table(MachineState *ms, unsigned instance, + SmbiosEntryPointType ep_type) { char sock_str[128]; size_t tbl_len =3D SMBIOS_TYPE_4_LEN_V28; unsigned threads_per_socket; unsigned cores_per_socket; =20 - if (smbios_ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_64) { + if (ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_64) { tbl_len =3D SMBIOS_TYPE_4_LEN_V30; } =20 @@ -1011,11 +1011,10 @@ void smbios_set_default_processor_family(uint16_t p= rocessor_family) =20 void smbios_set_defaults(const char *manufacturer, const char *product, const char *version, - bool uuid_encoded, SmbiosEntryPointType ep_type) + bool uuid_encoded) { smbios_have_defaults =3D true; smbios_uuid_encoded =3D uuid_encoded; - smbios_ep_type =3D ep_type; =20 SMBIOS_SET_DEFAULT(smbios_type1.manufacturer, manufacturer); SMBIOS_SET_DEFAULT(smbios_type1.product, product); @@ -1032,9 +1031,9 @@ void smbios_set_defaults(const char *manufacturer, co= nst char *product, SMBIOS_SET_DEFAULT(type17.manufacturer, manufacturer); } =20 -static void smbios_entry_point_setup(void) +static void smbios_entry_point_setup(SmbiosEntryPointType ep_type) { - switch (smbios_ep_type) { + switch (ep_type) { case SMBIOS_ENTRY_POINT_TYPE_32: memcpy(ep.ep21.anchor_string, "_SM_", 4); memcpy(ep.ep21.intermediate_anchor_string, "_DMI_", 5); @@ -1084,6 +1083,7 @@ static void smbios_entry_point_setup(void) } =20 void smbios_get_tables(MachineState *ms, + SmbiosEntryPointType ep_type, const struct smbios_phys_mem_area *mem_array, const unsigned int mem_array_size, uint8_t **tables, size_t *tables_len, @@ -1092,6 +1092,9 @@ void smbios_get_tables(MachineState *ms, { unsigned i, dimm_cnt, offset; =20 + assert(ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_32 || + ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_64); + g_free(smbios_tables); smbios_tables =3D g_memdup2(usr_blobs, usr_blobs_len); smbios_tables_len =3D usr_blobs_len; @@ -1106,7 +1109,7 @@ void smbios_get_tables(MachineState *ms, assert(ms->smp.sockets >=3D 1); =20 for (i =3D 0; i < ms->smp.sockets; i++) { - smbios_build_type_4_table(ms, i); + smbios_build_type_4_table(ms, i, ep_type); } =20 smbios_build_type_8_table(); @@ -1155,10 +1158,10 @@ void smbios_get_tables(MachineState *ms, if (!smbios_check_type4_count(ms->smp.sockets, errp)) { goto err_exit; } - if (!smbios_validate_table(errp)) { + if (!smbios_validate_table(ep_type, errp)) { goto err_exit; } - smbios_entry_point_setup(); + smbios_entry_point_setup(ep_type); =20 /* return tables blob and entry point (anchor), and their sizes */ *tables =3D smbios_tables; diff --git a/hw/smbios/smbios_legacy.c b/hw/smbios/smbios_legacy.c index a6544bf55a..06907cd16c 100644 --- a/hw/smbios/smbios_legacy.c +++ b/hw/smbios/smbios_legacy.c @@ -173,7 +173,7 @@ uint8_t *smbios_get_table_legacy(size_t *length, Error = **errp) =20 smbios_build_type_0_fields(); smbios_build_type_1_fields(); - if (!smbios_validate_table(errp)) { + if (!smbios_validate_table(SMBIOS_ENTRY_POINT_TYPE_32, errp)) { goto err_exit; } =20 --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778842; cv=none; d=zohomail.com; s=zohoarc; b=J3vqGOAq641r4BUTmCmfbKsZ24HRGa9VA8Lqe2594+WN64OV/LW+s6W21hzU6qXK9b3jHRqjVcd89xqNQl60Pzq8YU7//Pw/PH0zUuXw5g//ylXuCyRpYeqE+/4f46HOf/+De9+FusBNPWe7UtUVf1YunP1gkdeZD59QYnIklYo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778842; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yZWruUO8dFIZZVtmp1f4qBT11vEoiubRwmFIaapjlUQ=; b=WN0GlqrzcKhCDtfWbHDoBpt+Bc1K0jB8rAOZ9pWPfNNj4VAgFWu1mTPiGYypaGXAygjygOg4NOU6zLmKIPd5w/IN/BCgqJFNo4+g+Mq9gldU0PLva+Ni1eP1PjDBiaYi0V2k9+V5WXFgrS7uqLLGcmmiiziocInxmFB6fWDbEt4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778842490269.8908103041199; Mon, 18 Mar 2024 09:20:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFfa-0000sp-FG; Mon, 18 Mar 2024 12:17:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfU-0000IG-2o for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfF-0004lI-Nh for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:55 -0400 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-Sv6FKCiAM5q8QsAj1TghUw-1; Mon, 18 Mar 2024 12:16:37 -0400 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4140e6bbc87so6434255e9.2 for ; Mon, 18 Mar 2024 09:16:37 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id q11-20020a05600c46cb00b0041312d21a35sm18649855wmo.7.2024.03.18.09.16.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=yZWruUO8dFIZZVtmp1f4qBT11vEoiubRwmFIaapjlUQ=; b=XrkIIXGIb8qds5B4eY4ptU1HtID0iKvYZ3sUv3d/HJHnHBqSqa4vHfYxAPwmlRsEyTTLnO e9G0VXBbMAOct9ffuKIw0227P5Xjb2hGlx9aBnURatunmyQ5nwhL0ebIHOkofr2RIVcnhk CzYcwMSdiuHj+DODQD6V5qyNt3gGJLM= X-MC-Unique: Sv6FKCiAM5q8QsAj1TghUw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778595; x=1711383395; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=yZWruUO8dFIZZVtmp1f4qBT11vEoiubRwmFIaapjlUQ=; b=hoq+LRtVEeQT4EmBBbobdbm5HijNWXlh90ojpTmMg1a4wRQV+6MLUvZYmPzugi5zUc UawdqC0mqWmfxe/UKWaCYtoGPXPnHdk3NYipMyFV1/tkY/5GFkXetUaY4xfLhxI1MYZB YOETV6xzTydE/zm3LAKdwu5azIOuYu6HI5sMI6WPMuHWA22myrEUxi/jzZFAA+0A64rz J+soAeKIornasxhYj6BIDuh+vhOJFne17UTRbNro4bg9gbsAXg2L4qnkrolCHvEcHDkq 1ev3LNu0UsOrqWalsK9e+VlqoWDPI5EDiRWJHBhL0TR1d1nbEkVbl4Qp4xhoCPLyH2no wAcw== X-Gm-Message-State: AOJu0Yz9DUIjnL9EOes+wtKKGjUrSaK8Osx2rTL7XUkqUbzz9mzbbILa eWuW00MNHRZbmTqyS5FHFKextZF/psjFPkLftEB1h7ENWJHL50Iqzf5EMKCDcick1ChuFtR/1MH OurwzZlisfzVokEHG/06OC4KcatQ9iSKR04DqTaLSl0P48Mdz0UjRMHrEcwWepbDODOJhv4DVmG CwgSjllPOK5H77RCyIxxuJA1uIPALWXA== X-Received: by 2002:a05:600c:4686:b0:414:c5:8503 with SMTP id p6-20020a05600c468600b0041400c58503mr7514997wmo.38.1710778595538; Mon, 18 Mar 2024 09:16:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1mjFKLM9C6mWEK/TfGwcNV8csr5z5QmQ7yGuXKF2/URoCEXjkN/r64bXmyxuf3aNtm8JMCA== X-Received: by 2002:a05:600c:4686:b0:414:c5:8503 with SMTP id p6-20020a05600c468600b0041400c58503mr7514977wmo.38.1710778595036; Mon, 18 Mar 2024 09:16:35 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:32 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Fiona Ebner , Ani Sinha Subject: [PULL 17/24] smbios: clear smbios_type4_count before building tables Message-ID: <6735a4943e024715cf256625f02231e88f76c40b.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778844635100007 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov it will help to keep type 4 tables accounting correct in case SMBIOS tables are built multiple times. Signed-off-by: Igor Mammedov Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-15-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/smbios/smbios.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 0ab77b5ec8..48713aa505 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -1096,6 +1096,7 @@ void smbios_get_tables(MachineState *ms, ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_64); =20 g_free(smbios_tables); + smbios_type4_count =3D 0; smbios_tables =3D g_memdup2(usr_blobs, usr_blobs_len); smbios_tables_len =3D usr_blobs_len; smbios_table_max =3D usr_table_max; --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778738; cv=none; d=zohomail.com; s=zohoarc; b=I/xIlltnpR5SHXgwTy9lr5qBvKV+D+RQH8YDOiuyq2IZgRo/8peGIMCNG2K/qwqsZaLnOcvsJq/efifvLv5HkuIBhl4PQNufT9bxwOZfccQGOqKYZCRcyrulZ3GWNBYXd8Q1+dBQtv0ADr3HF2Im02YcwuUG8jnZYuC0Sh3eiE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778738; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3PquRgok1zJPddWo+hTweh0skOewFWtqO+jh37rKiqc=; b=Ov95uUhpbbV9xCg6knrJZiVoT+2Hff2Deh17ug3EF7+OFg2rtaVXwR8hHm2lse2dpD8VGPX45Xqq77LkuI14k0M91pSp4Mu/DomhljhZmDez/GRQaahbHex+/L2r3/WRlahe/Kt/2KgYPcSEqZweiVOww2qcWPm7DycKXpOr/Mg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778738904630.7984758757148; Mon, 18 Mar 2024 09:18:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFfR-00005t-VU; Mon, 18 Mar 2024 12:16:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfJ-00085L-74 for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfH-0004lg-5v for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:44 -0400 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-160-s6eihdbTOjitqOEeH2D97Q-1; Mon, 18 Mar 2024 12:16:40 -0400 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-41413823c1bso3959425e9.1 for ; Mon, 18 Mar 2024 09:16:40 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id bt3-20020a056000080300b0033f20497d4asm5965569wrb.5.2024.03.18.09.16.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778601; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3PquRgok1zJPddWo+hTweh0skOewFWtqO+jh37rKiqc=; b=YrhbaJjDf2cl4f6ZccV5BaQ9W/EXxtHfoZvWS2B3Zlpc95pK/VXY7Nkbr0r1zRsY+CmsOp TeRUzTPSb0FDomXQeukpXBwDCD3mfR3c4XADHVzmGL0C4f62zbHARc+oj7emUDav8mzbWg fMLOZXrzNDADsywk7qGINHU6PBJv4qA= X-MC-Unique: s6eihdbTOjitqOEeH2D97Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778599; x=1711383399; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=3PquRgok1zJPddWo+hTweh0skOewFWtqO+jh37rKiqc=; b=dt9GqFo4G5BmXKbWLa8W8Kvv0pVzofwpw+ed7EswzGwWF1RcgSCghVDccyvk9i8ONz kqjh/tznCvrJeLB2y8VubDvICxXk1B9LNSU2WvcZ+wvnG17BuU823ppLQghOdTjyU44q /+i6oSm9gYy4jv4jql5gUJl8oEl2BGn6UHrISfDPkx4kDfVPNPExM0yoxPDZG6oCZkXN 0Q660jjfrpOgsfUi8fDeayHh7+QbZE3YMQNgSyISP8G2N38G1AW75WlK+rLwirTzHF4F yeX9u5s9SgvCEHnr8CeAWLYb36vDsA5dFy/ZX2rOAeWWTuSCAg3yDJfJjmbAgDIBPVVt XSJw== X-Gm-Message-State: AOJu0YyY+3Hjs8T8OzrXVJ+MBky0ZO6yMm/4ZKasaQAIeNdsGm/h+UML Xw8pj98/vNltCCQYX+0wPv/9VaQUCrtOHHLmFW3nL3DLI/h/x9s/hyUu25k23VlGtz3wJXepzlh 2wFA3/Soa8qGOzQiej3MHcofG4WtRtdL9yxijhngDQWJPo+Jgg4EHBFOuwRRZZbVst1Cov58CSb 6ggCAiHLuIzFM9XDr4dK79v8c5ZjeY5w== X-Received: by 2002:a05:600c:4f04:b0:412:e0f7:ef52 with SMTP id l4-20020a05600c4f0400b00412e0f7ef52mr57448wmq.19.1710778599271; Mon, 18 Mar 2024 09:16:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG3ORGzjXCzfKbfbFOBylAYK6/00IVbsyv1+VlkO7ECWTb6uBUCjoOkRbmYJYJ/DAoUZqzYMQ== X-Received: by 2002:a05:600c:4f04:b0:412:e0f7:ef52 with SMTP id l4-20020a05600c4f0400b00412e0f7ef52mr57409wmq.19.1710778598704; Mon, 18 Mar 2024 09:16:38 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:35 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Markus Armbruster , Ani Sinha , Fiona Ebner , Eric Blake , Eduardo Habkost , Marcel Apfelbaum , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Yanan Wang Subject: [PULL 18/24] smbios: extend smbios-entry-point-type with 'auto' value Message-ID: <4901b80e13be62fc8ea2d8844941f336076af266.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778740301100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov later patches will use it to pick SMBIOS version at runtime depending on configuration. Signed-off-by: Igor Mammedov Acked-by: Markus Armbruster Reviewed-by: Ani Sinha Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-16-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/machine.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qapi/machine.json b/qapi/machine.json index bb5a178909..0840c91e70 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1797,10 +1797,13 @@ # # @64: SMBIOS version 3.0 (64-bit) Entry Point # +# @auto: Either 2.x or 3.x SMBIOS version, 2.x if configuration can be +# described by it and 3.x otherwise (since: 9.0) +# # Since: 7.0 ## { 'enum': 'SmbiosEntryPointType', - 'data': [ '32', '64' ] } + 'data': [ '32', '64', 'auto' ] } =20 ## # @MemorySizeConfiguration: --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778707; cv=none; d=zohomail.com; s=zohoarc; b=LWkGYvc5Roct9Sl3m7tzugUmUrmJGRvPrEdFveTRoa7D0DhSSoESpgyDcEZWtzDkBu2KXnZJS2zH1V6fFHL/YHmZItM/RY0nHaMKyI8MPN2qL//UVGdvnm+ESmILqO5tw94MlUtFWTWPGrVhRWxvdgpeuUNwIskFcxY8BsbX5YA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778707; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=v7D6ze7bzSDpMd9lkDC7i4XBFfIEIjDkSkct4Vx/D5I=; b=kag8/IdGA3H/SDq8jPOxJm+TwVj1t8i72F5RLsVMWKAW9PFgR7u+d6FY9OIg7ZHaj2Kddz9mXAanawrTc3Ws2Ii4/BjDlnp4XMqxT/16qvGDcj+bYiKqT79mgu4Pfs3roPE9drgn5WiitwHAM93rmdv7j9xjG3cR/CuAlNivSwE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778707564850.1624828326427; Mon, 18 Mar 2024 09:18:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFfS-00008o-3b; Mon, 18 Mar 2024 12:16:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfM-0008Ib-ED for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfK-0004mI-RL for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:48 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-450-GULcyox2MbGPl_nVZt_HhQ-1; Mon, 18 Mar 2024 12:16:43 -0400 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-33ec604d3b3so3044477f8f.1 for ; Mon, 18 Mar 2024 09:16:43 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id n2-20020a5d4002000000b0033e93e00f68sm10122463wrp.61.2024.03.18.09.16.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778605; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=v7D6ze7bzSDpMd9lkDC7i4XBFfIEIjDkSkct4Vx/D5I=; b=ZMC98pu5uGHq3JGMm/HvBdFov6FXMVkUT0A0dSfrX+x9TGsYoRr7XEKRM7DF3d4W7b8B0V UPd2LWYV2si8cCJSkyP6NKoDRm8vx81ad/XxpTPFz1gBJv7lwPvVbf2QGF5XQyG/OIPFNB U0spB/HTKub9kLNXoppoM6oCWQIUmC8= X-MC-Unique: GULcyox2MbGPl_nVZt_HhQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778602; x=1711383402; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=v7D6ze7bzSDpMd9lkDC7i4XBFfIEIjDkSkct4Vx/D5I=; b=pLl0gamj9DQcawQtO3UG7ZE4N5/QxR+PBBSH8ixSnro4RxzydB5jGH9cW0K6B0BOFd uHhkNA7fkl84KuaHWvWuiC6RsBBlxAbvRtAT6Bz3aC3c1tkRH/s43hQv1+yyYMm3yEyG u7WtE/WqHV9vT5tiL/0qlykbBF/FftodviChJRzvBTG19YXVDSOLyDCcFS4WcrLH5qR2 iggnWIWyy5tHSC9k3qnfML/nc8ZgsirBRvhswJK0fAMHW7FOY3zCqnH+86hYFb8/PQRl +xM/aVNowFEAviaKkbSegwIgZEkHbmXYItwSzeoEUNh3ZG3rGQzSPju+F19nmqbMB6oo pImA== X-Gm-Message-State: AOJu0YyEcO4KmFjAJYogessgxGXJNXd0ej58u2BG4q1qOh38Qo8PYGdq LyyS7s0JYp+hCxxYC9EdAeJKfaU52LDlNBIBiZzpXa9pSX0Yee3RuYxW7kFXWsebx3jkNqAx8yH cZ3duJusKhf+OB/0tk89XDGsh1OS7ehYC6Fxfg5WwNrFm/KDzK6BjCLX726ZOS4w/DGR3Q07dLu BJcOsmc0vHBlWkupxOHb9agA4qH/66AQ== X-Received: by 2002:adf:f20f:0:b0:33e:c0db:441 with SMTP id p15-20020adff20f000000b0033ec0db0441mr9641748wro.7.1710778602131; Mon, 18 Mar 2024 09:16:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVK8ajBREh60Dig4xkRE8jRcSGY9kgqxC5PB8myzqUthBgMW0gE+p9nBw6hpXPGpiPurXNXA== X-Received: by 2002:adf:f20f:0:b0:33e:c0db:441 with SMTP id p15-20020adff20f000000b0033ec0db0441mr9641714wro.7.1710778601554; Mon, 18 Mar 2024 09:16:41 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:38 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Fiona Ebner Subject: [PULL 19/24] smbios: in case of entry point is 'auto' try to build v2 tables 1st Message-ID: <4840c8a2b4666cf1b320a387c3f8b609258e7654.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778710162100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov QEMU for some time now uses SMBIOS 3.0 for PC/Q35 machines by default, however Windows has a bug in locating SMBIOS 3.0 entrypoint and fails to find tables when booted on SeaBIOS (on UEFI SMBIOS 3.0 tables work fine since firmware hands over tables in another way) Missing SMBIOS tables may lead to some issues for guest though (worst are: possible reactiveation, inability to get virtio drivers from 'Windows Update') It's unclear at this point if MS will fix the issue on their side. So instead of it (or rather in addition) this patch will try to workaround the issue. aka, use smbios-entry-point-type=3Dauto to make QEMU try generating conservative SMBIOS 2.0 tables and if that fails (due to limits/requested configuration) fallback to SMBIOS 3.0 tables. With this in place majority of users will use SMBIOS 2.0 tables which work fine with (Windows + legacy BIOS). The configurations that is not to possible to describe with SMBIOS 2.0 will switch automatically to SMBIOS 3.0 (which will trigger Windows bug but there is nothing QEMU can do here, so go and aks Microsoft to real fix). Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-17-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/smbios/smbios.c | 52 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index 48713aa505..b0467347c5 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -1082,7 +1082,7 @@ static void smbios_entry_point_setup(SmbiosEntryPoint= Type ep_type) } } =20 -void smbios_get_tables(MachineState *ms, +static bool smbios_get_tables_ep(MachineState *ms, SmbiosEntryPointType ep_type, const struct smbios_phys_mem_area *mem_array, const unsigned int mem_array_size, @@ -1091,6 +1091,7 @@ void smbios_get_tables(MachineState *ms, Error **errp) { unsigned i, dimm_cnt, offset; + ERRP_GUARD(); =20 assert(ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_32 || ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_64); @@ -1177,11 +1178,56 @@ void smbios_get_tables(MachineState *ms, abort(); } =20 - return; + return true; err_exit: g_free(smbios_tables); smbios_tables =3D NULL; - return; + return false; +} + +void smbios_get_tables(MachineState *ms, + SmbiosEntryPointType ep_type, + const struct smbios_phys_mem_area *mem_array, + const unsigned int mem_array_size, + uint8_t **tables, size_t *tables_len, + uint8_t **anchor, size_t *anchor_len, + Error **errp) +{ + Error *local_err =3D NULL; + bool is_valid; + ERRP_GUARD(); + + switch (ep_type) { + case SMBIOS_ENTRY_POINT_TYPE_AUTO: + case SMBIOS_ENTRY_POINT_TYPE_32: + is_valid =3D smbios_get_tables_ep(ms, SMBIOS_ENTRY_POINT_TYPE_32, + mem_array, mem_array_size, + tables, tables_len, + anchor, anchor_len, + &local_err); + if (is_valid || ep_type !=3D SMBIOS_ENTRY_POINT_TYPE_AUTO) { + break; + } + /* + * fall through in case AUTO endpoint is selected and + * SMBIOS 2.x tables can't be generated, to try if SMBIOS 3.x + * tables would work + */ + case SMBIOS_ENTRY_POINT_TYPE_64: + error_free(local_err); + local_err =3D NULL; + is_valid =3D smbios_get_tables_ep(ms, SMBIOS_ENTRY_POINT_TYPE_64, + mem_array, mem_array_size, + tables, tables_len, + anchor, anchor_len, + &local_err); + break; + default: + abort(); + } + if (!is_valid) { + error_propagate(errp, local_err); + } } =20 static void save_opt(const char **dest, QemuOpts *opts, const char *name) --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778834; cv=none; d=zohomail.com; s=zohoarc; b=lG/QpzonokaK2uMOu0cTZS7AUNcOzgHslP468kmO6k4No+uQdi5g1oLfYj1jOHZpss5hfjlwtJFcie79oa/RbxcJFUv/LydMldIA/JLq4rWwiRTRoHxiNmhfWFeF6Tt7qAl5DgA6nI5PQm13Lxt1HUAvSveAO8Uvn1ib7uEkKQo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778834; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6/92uxUK8rityKiz36sQzzfXKAYAnQ5fkEB0NWVuirw=; b=VfgVP9VT+dATxCy8Sg8gaiQggeTYdHiryTsoLqdsp4BF+Arjky742Elx3iUMDVg0RaQRMUj7D32p1taqLbnbChLncSYdguJE5KWuXlksPEdjFQgE0C+wCx4HgtqdRhjGI7jfzW+NX7wEhVICrUTd0XHV8e/4ARqjvFzXaogjwuU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778834779616.8568113789559; Mon, 18 Mar 2024 09:20:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFfZ-0000kP-EB; Mon, 18 Mar 2024 12:17:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfS-0000Ba-Qz for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfQ-0004n7-Mt for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:54 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-290-c0vqcgjHMSC-VdmxF_hbbg-1; Mon, 18 Mar 2024 12:16:48 -0400 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3418412a734so76634f8f.0 for ; Mon, 18 Mar 2024 09:16:48 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id t14-20020a05600001ce00b0033d6c928a95sm10153073wrx.63.2024.03.18.09.16.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=6/92uxUK8rityKiz36sQzzfXKAYAnQ5fkEB0NWVuirw=; b=XoYbyUIxSDs88hU5sGv8fPOWaR4GFhvs/yWTqr1k0z+El67F8biefD5O6vyQNliHxl4M2f n4WLKVKi/wG0CHBlWOzbBMhTebXIzqeuvlLXQ9IomTp6IF7/Cn8QQ3COXtg8M+I/RT2qPn vBAJEeiCQncm3PA6+JjIvTn8qE3052g= X-MC-Unique: c0vqcgjHMSC-VdmxF_hbbg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778607; x=1711383407; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6/92uxUK8rityKiz36sQzzfXKAYAnQ5fkEB0NWVuirw=; b=ZkLo6HIhXiDTamD9uTaXXfokAcy07WdkKrjN92ato1vROsd/Nhjmg8q5j4CDWWxdOv K89UafC5Fy+uiwtvfxHJ7c1dVZGF4FopBvLJ3YQGfNNit/X2kZIeCaPsCHAU0RlsigS0 7Ku3uKfaUK23Y/x/GEVk1zT6dxkSZmU854IrguUcuYPpUaafxqBiskpmx5n8JQ7+qSa0 FrQibGUmkoLByBVlps3mXeIPtrYoNqEjHxtHH6bMR/Pqog6ou+x6J6w8GPpIRhl7pAxq zT8VYEOAXnf4bj31sX2hy5j4iKbaWKMCCZj8bBnwbqYHONu4/YU0xGvPJ0QFIDZGaS+b ugtg== X-Gm-Message-State: AOJu0Yxtvlsm2+Z4v3ZByQP8S9OvmSHiEHKBXF9c/dth6fHt/pFJNx+b bsMdqXDbOBu6y46Hr5Yx0CAxyGbEAVkcqTVvcbrOpF2sTnip/o758rBbA/qE5QZLT+ioPw1FSWI Zvd1fN/wiMBLp2uoZI8Ogml0FjYd3olyaAy1sQhEsdRGoAlwVSMf9eHa+bcPBIdJF/nMBQ2/S4S QALp1oGB30xt357giD9jrc1xvawvVvhg== X-Received: by 2002:adf:eed2:0:b0:33e:7f51:c2f7 with SMTP id a18-20020adfeed2000000b0033e7f51c2f7mr7866619wrp.52.1710778606835; Mon, 18 Mar 2024 09:16:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6QpQAIjuYOnlYNrQIC08dF1KZwnCS0o21u8gcqH627NL54m1Bj78w5u2D9tV+oXzJTq44yQ== X-Received: by 2002:adf:eed2:0:b0:33e:7f51:c2f7 with SMTP id a18-20020adfeed2000000b0033e7f51c2f7mr7866595wrp.52.1710778606365; Mon, 18 Mar 2024 09:16:46 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:41 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Fiona Ebner Subject: [PULL 20/24] smbios: error out when building type 4 table is not possible Message-ID: <5ed7948213af8cba0c6153611aa0aea55069bac2.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778836596100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov If SMBIOS v2 version is requested but number of cores/threads are more than it's possible to describe with v2, error out instead of silently ignoring the fact and filling core/thread count with bogus values. This will help caller to decide if it should fallback to SMBIOSv3 when smbios-entry-point-type=3D'auto' Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-18-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/smbios/smbios.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c index b0467347c5..eed5787b15 100644 --- a/hw/smbios/smbios.c +++ b/hw/smbios/smbios.c @@ -669,7 +669,8 @@ static void smbios_build_type_3_table(void) } =20 static void smbios_build_type_4_table(MachineState *ms, unsigned instance, - SmbiosEntryPointType ep_type) + SmbiosEntryPointType ep_type, + Error **errp) { char sock_str[128]; size_t tbl_len =3D SMBIOS_TYPE_4_LEN_V28; @@ -723,6 +724,12 @@ static void smbios_build_type_4_table(MachineState *ms= , unsigned instance, if (tbl_len =3D=3D SMBIOS_TYPE_4_LEN_V30) { t->core_count2 =3D t->core_enabled2 =3D cpu_to_le16(cores_per_sock= et); t->thread_count2 =3D cpu_to_le16(threads_per_socket); + } else if (t->core_count =3D=3D 0xFF || t->thread_count =3D=3D 0xFF) { + error_setg(errp, "SMBIOS 2.0 doesn't support number of processor " + "cores/threads more than 255, use " + "-machine smbios-entry-point-type=3D64 option to = enable " + "SMBIOS 3.0 support"); + return; } =20 SMBIOS_BUILD_TABLE_POST; @@ -1111,7 +1118,10 @@ static bool smbios_get_tables_ep(MachineState *ms, assert(ms->smp.sockets >=3D 1); =20 for (i =3D 0; i < ms->smp.sockets; i++) { - smbios_build_type_4_table(ms, i, ep_type); + smbios_build_type_4_table(ms, i, ep_type, errp); + if (*errp) { + goto err_exit; + } } =20 smbios_build_type_8_table(); --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778819; cv=none; d=zohomail.com; s=zohoarc; b=J4i58zzCap6UKTmH+O6ZUOILHAV6akaxRGN6et3jIez9WQbFkdsHmbzEVh2YLQDHxmLxPws8rehLH5gM/vBanuo9ZSxEyKTb4FrOU2qR7seNyMAfYyqdbjwOaU8PHWmnoZQStIlkcAYyKBcREr+LjhlQHjL+jeHGMQxyVE6TiNY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778819; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8zbjoNWJje0hUAaroUJ9ZV+Rtxkcmj8KdCgGsYtrckw=; b=aM7929TbrUqCZsjTnHT0ODeq/aqpsW8U37lNH9qo87RFSMAWe1OOVVUuLzUPJt+fYR3bngMf7HqqIHm11L+P0yJv+xRxK73qipO/WZlZmDKsRnrkNXLNr7xBgQvKnRvvwZUYQcYWxYEYHbYLvgF4OKodXrYaDCLrJ37pN///nY8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778819199513.751506310218; Mon, 18 Mar 2024 09:20:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFfa-0000uR-Ki; Mon, 18 Mar 2024 12:17:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfW-0000VF-JD for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfV-0004o9-3g for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:16:58 -0400 Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-692-fvApRFqqP5aVhN4T2TD51g-1; Mon, 18 Mar 2024 12:16:53 -0400 Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-6e70785d542so1310778b3a.0 for ; Mon, 18 Mar 2024 09:16:53 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id a3-20020a62d403000000b006e6bfff6085sm8705539pfh.143.2024.03.18.09.16.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=8zbjoNWJje0hUAaroUJ9ZV+Rtxkcmj8KdCgGsYtrckw=; b=dcWFa2fpDoStgcvQminJr9Oe0qfUgis1p0xCdR0y/68y2e+tTV0LfG9S8rLuqX8Ywq7Xjz de+pjPjMFbwkjNzuM4N9owHej2OP+N4sFcHo9uF9a5Qp9jyMiDKgNNoMYbKFTkaCif+rx7 PqTnJikn/4zVbAreQq1UlarzejI0SuI= X-MC-Unique: fvApRFqqP5aVhN4T2TD51g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778612; x=1711383412; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8zbjoNWJje0hUAaroUJ9ZV+Rtxkcmj8KdCgGsYtrckw=; b=K7aIkEKvLGHCblC/+9MH8+RaQvulGExavL0wzQRf5jTuv5nAy5m9eoX06fq/uY2+A+ ILRXl8R/r+xb1bky79w6bWhJi1dbGoKVRxsd0Cf2+OIWJuW7Iqcj3SsChUX9zHWI+a6s MwzXUA0dv3wswSnx/750Ckh4jsArVyXy9V5znea+s9gNhYstrRiwYnzU1qvFSMhTVzGP OsW9DnCYNckPu4SJEOsNPgyynMQ1eH6ZkKoE4BS4Brhwz25a9a8HpuU5EonB/Ks+ALL6 zKM9LZL1TGRDLZMVouWSVFXNNC88T5/598jiLQV2NLeF22qkuNmeTfdDBXKALwTM3RyU 2wEA== X-Gm-Message-State: AOJu0Yw6fsxujDb2WrNQZlukOGG+aygu/SVusEjEElz4FHSVYVTX2S0k HeuIHdFgX33Y134babGQK3YncmyEs8O9igpctci0rvYb1CcgebUN7mzRIw59ShVMBYwPHTUdgNz oaSMBepPkWXKighmVDVExqjEM/2IEPlnH7WwercZK0aErGJz7j+hQwIZdTurlRaeK7Y3ngBTU3N YthV4Os6WHeD3FJaflOpM1zPivMCgt/Q== X-Received: by 2002:a05:6a21:1583:b0:1a3:67bc:252 with SMTP id nr3-20020a056a21158300b001a367bc0252mr73347pzb.17.1710778612396; Mon, 18 Mar 2024 09:16:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGtDccwvwswBw1izhsuxnt1TenQM4FxXdJJYLRl4upQWxORovvfbEcPqiTfFyJ4rPVPDmKXUA== X-Received: by 2002:a05:6a21:1583:b0:1a3:67bc:252 with SMTP id nr3-20020a056a21158300b001a367bc0252mr73310pzb.17.1710778611721; Mon, 18 Mar 2024 09:16:51 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:46 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 21/24] tests: acpi/smbios: whitelist expected blobs Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -9 X-Spam_score: -1.0 X-Spam_bar: - X-Spam_report: (-1.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778820571100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Signed-off-by: Igor Mammedov Acked-by: Ani Sinha Message-Id: <20240314152302.2324164-19-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..81148a604f 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,2 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/SSDT.dimmpxm", --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778774; cv=none; d=zohomail.com; s=zohoarc; b=SAxpuGR8ksCyvdwrtMox8D+vZLzsgSZqFTSix/ZEk7zRXDBcNuXQPi+J5PqjhczfeYfTSAt51fQSJIolqBDXvD5HXbNNBCRlVbgGaEPL2St2P5L8Ya+0KlY+PfQb6cp4lauhyeniHbLe9Agk/G17Xgdh2+6Q3weqWcsrk5B2z4o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778774; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aVNpxLYgQa8mn+iVqcjp/uygNfGlH8NPfTbHmWsTQGc=; b=A+G3D/YHtDI+7Xqhb9i0w1XmyzSqXNtMsW4LBqqbLBCFz/pSSEyGOr097dgS13TM06RPJcQ9Jc+PL2rT1B6sEApFieB3wjVh4VtmLHtUMocMOCedGCzlL/hyLp4XJWUDnfMrcGjHDCvFZZ0X2QgAu3C7QMq2ZCCoAe9x8MmRzYw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778774322567.1481001215999; Mon, 18 Mar 2024 09:19:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFff-0001eA-KB; Mon, 18 Mar 2024 12:17:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfe-0001T6-55 for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:17:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfc-0004pJ-Fi for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:17:05 -0400 Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-22-ILjAHalFPSaYfavCG4-EXA-1; Mon, 18 Mar 2024 12:17:02 -0400 Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-6e729f8e8c1so867972b3a.0 for ; Mon, 18 Mar 2024 09:17:02 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id a5-20020aa78e85000000b006e6857da474sm8268979pfr.178.2024.03.18.09.16.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aVNpxLYgQa8mn+iVqcjp/uygNfGlH8NPfTbHmWsTQGc=; b=gPYeagXK8jLrAbckTWTc0jC8OevYnHkMEk+R5EEJ7odKCQUFDcxibhq0zkWIGbtRqGMPbl aAA3XuiTl2mH9MH9rEeT+wNa3hOpabls96kKHgq590iDuG0tD6x++NvaiLFsq+BPyXqlf0 gQy7h7DXuPCrB+s9YlSzf7H4+Qo10u0= X-MC-Unique: ILjAHalFPSaYfavCG4-EXA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778621; x=1711383421; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aVNpxLYgQa8mn+iVqcjp/uygNfGlH8NPfTbHmWsTQGc=; b=OPx6VoCpLIQDS176Bf7cAk+oBJrk2sktXKILp8mo/r8vrVcV34cpJIoF0N3ybhETIE 4hcuTwYRkWVk+vQcm5tG9VwLdk8e1cZEklGGfdAsMBw84dAX9XSpHO3wj+f1Ah2rC1Ec 62azjMrzoXkUnm3yAVsQ6GaJaqClKEphVCDYrZaLUZvR07H/cuF78SGSLgVHdkpFbwNb nQqS8vhZ4qV1157A7Yw7mAhs9Fp4YN9L2/TAZTFLgrZgXwuA0C5kfoSmSGN+mZgP4XEp XOYARADHJYQ+8T5NPdc7BmfgHFN9hx5seHqrU0jXQR4w087NW45ci+oXj4LmgYqUGVxa 42Tw== X-Gm-Message-State: AOJu0YxTjh6ABYKBReiMpXXH0CNPJbKg/+H2s1b9QqtnwBm/0ChZeMtS JCFRSBwL2geG9wvDgVFZ8GAT21Xg5Tvim9Fr7BK6VyZJVpzt9ePjWCchGdq28/IXtpW0OPmXv/+ 5vTYQSVzATsQZ0Y7vWjiSxkBTANXxRF1FryVLrJ8lrjf8KL4hEVenODTqXo8XlU0peB32irZxpa 3ikt6LcliwQd+CGZfCyIcTgJ5Hk4wZsQ== X-Received: by 2002:a05:6a00:14c4:b0:6e7:8dd:ed8f with SMTP id w4-20020a056a0014c400b006e708dded8fmr189378pfu.21.1710778621019; Mon, 18 Mar 2024 09:17:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGHbRntzI+EnTG3Khg6393kA9M+61FgoRh4cM3R4DIz2NF67hTmoK46HS/4VkmRSzpVa/IAEQ== X-Received: by 2002:a05:6a00:14c4:b0:6e7:8dd:ed8f with SMTP id w4-20020a056a0014c400b006e708dded8fmr189249pfu.21.1710778619093; Mon, 18 Mar 2024 09:16:59 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:52 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Fiona Ebner , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 22/24] pc/q35: set SMBIOS entry point type to 'auto' by default Message-ID: <2c7c45b3d0ba097ac99bf4b9a13c6de1d7724032.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778776449100005 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Use smbios-entry-point-type=3D'auto' for newer machine types as a workaround for Windows not detecting SMBIOS tables. Which makes QEMU pick SMBIOS tables based on configuration (with 2.x preferred and fallback to 3.x if the former isn't compatible with configuration) Default compat setting of smbios-entry-point-type after series for pc/q35 machines: * 9.0-newer: 'auto' * 8.1-8.2: '64' * 8.0-older: '32' Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2008 Signed-off-by: Igor Mammedov Reviewed-by: Ani Sinha Tested-by: Fiona Ebner Message-Id: <20240314152302.2324164-20-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/pc.c | 2 +- hw/i386/pc_piix.c | 4 ++++ hw/i386/pc_q35.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 44eb073abd..e80f02bef4 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1832,7 +1832,7 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) mc->nvdimm_supported =3D true; mc->smp_props.dies_supported =3D true; mc->default_ram_id =3D "pc.ram"; - pcmc->default_smbios_ep_type =3D SMBIOS_ENTRY_POINT_TYPE_64; + pcmc->default_smbios_ep_type =3D SMBIOS_ENTRY_POINT_TYPE_AUTO; =20 object_class_property_add(oc, PC_MACHINE_MAX_RAM_BELOW_4G, "size", pc_machine_get_max_ram_below_4g, pc_machine_set_max_ram_below_4g, diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index c9a6c0aa68..18ba076609 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -525,12 +525,16 @@ DEFINE_I440FX_MACHINE(v9_0, "pc-i440fx-9.0", NULL, =20 static void pc_i440fx_8_2_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); + pc_i440fx_9_0_machine_options(m); m->alias =3D NULL; m->is_default =3D false; =20 compat_props_add(m->compat_props, hw_compat_8_2, hw_compat_8_2_len); compat_props_add(m->compat_props, pc_compat_8_2, pc_compat_8_2_len); + /* For pc-i44fx-8.2 and 8.1, use SMBIOS 3.X by default */ + pcmc->default_smbios_ep_type =3D SMBIOS_ENTRY_POINT_TYPE_64; } =20 DEFINE_I440FX_MACHINE(v8_2, "pc-i440fx-8.2", NULL, diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 8a427c4647..b5922b44af 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -376,11 +376,14 @@ DEFINE_Q35_MACHINE(v9_0, "pc-q35-9.0", NULL, =20 static void pc_q35_8_2_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_q35_9_0_machine_options(m); m->alias =3D NULL; m->max_cpus =3D 1024; compat_props_add(m->compat_props, hw_compat_8_2, hw_compat_8_2_len); compat_props_add(m->compat_props, pc_compat_8_2, pc_compat_8_2_len); + /* For pc-q35-8.2 and 8.1, use SMBIOS 3.X by default */ + pcmc->default_smbios_ep_type =3D SMBIOS_ENTRY_POINT_TYPE_64; } =20 DEFINE_Q35_MACHINE(v8_2, "pc-q35-8.2", NULL, --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778739; cv=none; d=zohomail.com; s=zohoarc; b=SzJS5YcD2Ojk2mGPB4j//I1ipXhX3Mm7jtACRJ9crBTaAvtLjrFSGHDBOSdii8Ti8WnoHq618JkAQGJBW69WIFnSiNtwsShDYhduhDYomv3wdXWe0RQWGWtLFZtnLsKQuDhTHUJF9w1YVnGGD3TEp370cMvdTpuWuTXhKZOwstE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778739; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Oudmh77QqdmxVDf9O5bZqapc21I8SNv8IFbcNJgWAaM=; b=KI83tUomJZSsaVP3M6E6Ko77t5YqX0oWj8LrPQhzm7lHFotAB4gEtIRmMQdBjrtRgfjn24t2Q1SqHp3wcq/LT3BgOLf8PTvSfB5YEDKRcKnXk+m/NeMkRO7Y/S7ey8oQd6IjUhbEG//uCDAgwm/NAGjJfQXlhAKseaJ/MqOiIqQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778739486192.6133861647436; Mon, 18 Mar 2024 09:18:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFfk-00026d-6Z; Mon, 18 Mar 2024 12:17:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfh-0001vG-LJ for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:17:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfg-0004pr-4l for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:17:09 -0400 Received: from mail-oa1-f72.google.com (mail-oa1-f72.google.com [209.85.160.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-473-M8xD82bEM6KZu7ZQ_1_pdQ-1; Mon, 18 Mar 2024 12:17:06 -0400 Received: by mail-oa1-f72.google.com with SMTP id 586e51a60fabf-221bd0d2bf6so5985654fac.2 for ; Mon, 18 Mar 2024 09:17:05 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id y71-20020a62ce4a000000b006e6b989514bsm8431082pfg.60.2024.03.18.09.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778627; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Oudmh77QqdmxVDf9O5bZqapc21I8SNv8IFbcNJgWAaM=; b=BP88uBLdXlRSt+JNpUJeu2eFQu+wqBbqSVVAQKAeWOtQRN7XeL7Uw897i6I9c8/Kgza7ty QLwf7b6DWkSM+naBS4SOLu91Q9LlJYDN/YsqrEyrNU8TRyS9ON2mcsPeB9kCrOAQz5j+T6 uE/iwmsag5nYEoVDCjd543Qw2XnhpxM= X-MC-Unique: M8xD82bEM6KZu7ZQ_1_pdQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778625; x=1711383425; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Oudmh77QqdmxVDf9O5bZqapc21I8SNv8IFbcNJgWAaM=; b=LgDhzbTdLHt9IRHRQ+aVyppY+FRerlSVDSaLPVfZc0XRxYX5rZRd/X4QmI7oVZLLyh rCvUmkMs3kjFJuiaKgT7rJS9QoKasQpiGmiGjLL/3QXh2CjhZWACx7Xo04nF1lLpQioP Dqn4RnOPH4rMRtnzMQwwnsFaPoYiLULS/iMSbrE1ZiqlHk2ch49bdBtiVa0WpNn97PE2 ZzdL7zLU/k7a9KZj2qTVW6FoImOWXEwJ0cpqMikJWymV+CeHzWb8r6FuGuDhvQJlJaJD CmVZo+ewV237Ztq1jfimH01Wbm1q5nIrBaB7ZzgzwOogj4RZTQ88197IHa2jdv+AxQew B2Eg== X-Gm-Message-State: AOJu0YyDDtwWTtvP5L9TqU/5Bw+eCqQre3HS/rgFcxy9wKaPVVw1m8nn 2kzZzbq0GjEnHtTx3F4IkGcBgXfc/3jj97S5xppk1Fpwu3uEVuk9A6yYJ6QPtccSbL2E1fYQ58M 5aU4rNrcCBUVUKmo5oqR2Ltd2flNpZqjMqw5fyfEpXdhJM6F7dwkZr6J/1SN+JE99zF8Ouras+d b1UkPaCXBeSKTCMbWp0c+Ro3p50gkheQ== X-Received: by 2002:a05:6871:586:b0:220:8c56:d30d with SMTP id u6-20020a056871058600b002208c56d30dmr13292983oan.42.1710778624784; Mon, 18 Mar 2024 09:17:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHjOfmy111eUVW7u5ws+pOO/oIKXxreARKaqddZH2bSwYwY4uGjqF2RiUYv5s1Z5QLnyfZ45Q== X-Received: by 2002:a05:6871:586:b0:220:8c56:d30d with SMTP id u6-20020a056871058600b002208c56d30dmr13292937oan.42.1710778624091; Mon, 18 Mar 2024 09:17:04 -0700 (PDT) Date: Mon, 18 Mar 2024 12:16:59 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 23/24] tests: acpi: update expected SSDT.dimmpxm blob Message-ID: <86e372ad1e22df373878e5c1cbda2d5026a34331.1710778506.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -9 X-Spam_score: -1.0 X-Spam_bar: - X-Spam_report: (-1.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SORBS_WEB=1.5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778740303100002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov address shift is caused by switch to 32-bit SMBIOS entry point which has slightly different size from 64-bit one and happens to trigger a bit different memory layout. Expected diff: - Name (MEMA, 0x07FFE000) + Name (MEMA, 0x07FFF000) Signed-off-by: Igor Mammedov Acked-by: Ani Sinha Message-Id: <20240314152302.2324164-21-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 1 - tests/data/acpi/q35/SSDT.dimmpxm | Bin 1815 -> 1815 bytes 2 files changed, 1 deletion(-) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index 81148a604f..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,2 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/SSDT.dimmpxm", diff --git a/tests/data/acpi/q35/SSDT.dimmpxm b/tests/data/acpi/q35/SSDT.di= mmpxm index 70f133412f5e0aa128ab210245a8de7304eeb843..9ea4e0d0ceaa8a5cbd706afb6d4= 9de853fafe654 100644 GIT binary patch delta 23 ecmbQvH=3DU0wIM^jboSlJzam_|9E_UV*|JeaVTLvQl delta 23 ecmbQvH=3DU0wIM^jboSlJzanD9BE_UVz|JeaVy9Ofw --=20 MST From nobody Mon May 13 00:10:44 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1710778798; cv=none; d=zohomail.com; s=zohoarc; b=M6fwifJcyU5yIMgaen6Gro1JcYwRYskz5KdRGd8tsjR4XXVhKxaMFGHz2nF93sjo7DppCfgd2QK1BSXG+/XY7I/IJpE5kv7fuiuwOJ+vkL05ZUd2gVo5z+V3CToD4jhtRlNu6UmnCR65VqDPNm2vTG6ckOA9mvdG63PPL7sZn2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710778798; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UeZ5d5rzVIIFteQdA/cbu9zu3ciyKvxSa3RVrtkb9L4=; b=VnV/sg1AL02qro06u9rDXwfz9WNDp9z+OA7PZ7+ELMCCNpxmse3a2rbNebgNY7KTE934K6Iy66KZhvQO5RCVi8VEMF3+VRCToE7+VGKUtoavgvUdvJ8Xeop+QjJO6g2Weavaw6Fcwe9LrpExm3bHRRxAh4R7IR1JRmCBRBP9s30= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710778798183115.57493152757661; Mon, 18 Mar 2024 09:19:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rmFfr-0002PF-Kj; Mon, 18 Mar 2024 12:17:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfq-0002OQ-LK for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:17:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rmFfp-0004rf-8r for qemu-devel@nongnu.org; Mon, 18 Mar 2024 12:17:18 -0400 Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-44-bk3MCaTgMmC4njHIIivwMg-1; Mon, 18 Mar 2024 12:17:15 -0400 Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-29c7932c5f5so3232638a91.1 for ; Mon, 18 Mar 2024 09:17:12 -0700 (PDT) Received: from redhat.com ([2.52.5.113]) by smtp.gmail.com with ESMTPSA id v10-20020a17090ac90a00b0029be7922b32sm7959526pjt.26.2024.03.18.09.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 09:17:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710778636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=UeZ5d5rzVIIFteQdA/cbu9zu3ciyKvxSa3RVrtkb9L4=; b=bCvpnqFjD3khaVKUKv8QYbGRBeIVrGM2X3QWlJpnXFKb/URbDXisxBUL5eGriaSOfyYgnZ AFM1Coo0shv26gOzsc8D6XQODohBewnqBukkWzlraitmDxhC4i49rC40SvzUNdHlkhFqQM sld8Nj1YcEY7nhB4VHiB+rmG0zq8zMI= X-MC-Unique: bk3MCaTgMmC4njHIIivwMg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710778631; x=1711383431; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UeZ5d5rzVIIFteQdA/cbu9zu3ciyKvxSa3RVrtkb9L4=; b=F90xzUmLuFq0igMpuroZA6DJGKOnxmtIkF9r6RoNrIrXhS8980ciyRxl7NPL8cNArv kmwdgM6l/s5Pi48pGa5TUEppZq1hXt+3opCX+tdSRbK/vVzkXH0U1yiEsRyL/SHyUDLf QA6nJf5AOydW6TTjcB0aeGp/C0X9kJ+aFUFpRK1vZNssuIYlu+YxF/053o2FS42qvt8K I8AYJJYkEbfJV0/9V/isoWSVscGeLXWtqf73ak83657wnp/p7bq16RzcBV+gte2GRLVZ ++VagMBOr73mBTAReo2vuOmqv3VyzswADIBFx5D1Y8kTGIXC8TuhtygAlVs72CtRBk4L 5gIQ== X-Gm-Message-State: AOJu0YwcZCLLrTrYKS1a7seesr1hxwpeCyMC7ROPvvpy1x9AIYf2GsQh bbcxP4WPQbHI9K2hezqaXKmY5B1E90P/RXJzbLM8SQee1jd2AAbPwiIAPdlfUmYMB/Vj9ClVj9h NzuKrWMjMcUcVdji3IcTLp2bw9Lk+imQRYGo9I+J9K1FJ3jIC+SROcxJ+v7G5K++wyruFeoBbyO 5qDqeMp/QghzDU6/cPqBXq4VP36+m1+w== X-Received: by 2002:a17:90a:d70f:b0:29f:76d4:306a with SMTP id y15-20020a17090ad70f00b0029f76d4306amr95136pju.24.1710778630841; Mon, 18 Mar 2024 09:17:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHF5MzdmXdTDIjt9SelZTOOy/8UTPKC7Mtw7+npeEpjgginsbYIssEdKu1ldBGXCEMzfMgLbQ== X-Received: by 2002:a17:90a:d70f:b0:29f:76d4:306a with SMTP id y15-20020a17090ad70f00b0029f76d4306amr95087pju.24.1710778630185; Mon, 18 Mar 2024 09:17:10 -0700 (PDT) Date: Mon, 18 Mar 2024 12:17:04 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 24/24] smbios: add extra comments to smbios_get_table_legacy() Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1710778798449100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20240314152302.2324164-22-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/smbios/smbios_legacy.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/smbios/smbios_legacy.c b/hw/smbios/smbios_legacy.c index 06907cd16c..c37a8ee821 100644 --- a/hw/smbios/smbios_legacy.c +++ b/hw/smbios/smbios_legacy.c @@ -151,6 +151,9 @@ uint8_t *smbios_get_table_legacy(size_t *length, Error = **errp) smbios_entries_len =3D sizeof(uint16_t); smbios_entries =3D g_malloc0(smbios_entries_len); =20 + /* + * build a set of legacy smbios_table entries using user provided blobs + */ for (i =3D 0, usr_offset =3D 0; usr_blobs_sizes && i < usr_blobs_sizes= ->len; i++) { @@ -166,6 +169,10 @@ uint8_t *smbios_get_table_legacy(size_t *length, Error= **errp) table->header.length =3D cpu_to_le16(sizeof(*table) + size); memcpy(table->data, header, size); smbios_entries_len +=3D sizeof(*table) + size; + /* + * update number of entries in the blob, + * see SeaBIOS: qemu_cfg_legacy():QEMU_CFG_SMBIOS_ENTRIES + */ (*(uint16_t *)smbios_entries) =3D cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1); usr_offset +=3D size; --=20 MST