From nobody Wed Nov 27 16:57:26 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=1697745117; cv=none; d=zohomail.com; s=zohoarc; b=DtlyF3ACdVUlX9tpwCSNAG1NcS5x5IBOT6FFbv1ca5B00mLlPnbrsredd95AxknTg92KWhka416kBt52lvHg4zcGgrOACO3eyvpmT7ktXWHKVXjg23piev/DtGWWoUyPvKoGARcrWEQ8lfrLoW0MsAUahPIOctGv9Km7HZUvXA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1697745117; 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=NwMMcG5cEaHfQ2TgGjb60VwjA/LGsrSX8V2jHOn88fg=; b=fHakFFz8zJwBV+SFMoT7I2Mh/McO4Azco+UHqKOY73KAEq3ab7m62VSo6pz7sg6u5vSbpMPtnU5XO3yLXNv9Z31YV62IvigxHcjI4T8oG9TazZT+8jrmd3K+wUjnET3DwWKzmHinpdYUAFP/nZCN8z8X3CgGcqRGuL+hulX3RK8= 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 169774511785854.48041033702941; Thu, 19 Oct 2023 12:51:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtXfX-0006pg-RP; Thu, 19 Oct 2023 14:22:52 -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 1qtXed-0005hI-Ea for qemu-devel@nongnu.org; Thu, 19 Oct 2023 14:21: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 1qtXeb-0000gL-RZ for qemu-devel@nongnu.org; Thu, 19 Oct 2023 14:21:55 -0400 Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-252-5zngDwRzMEeWeKDo-IYYjQ-1; Thu, 19 Oct 2023 14:21:41 -0400 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2c51ca27f71so49416471fa.2 for ; Thu, 19 Oct 2023 11:21:41 -0700 (PDT) Received: from redhat.com ([2a06:c701:73d2:bf00:e379:826:5137:6b23]) by smtp.gmail.com with ESMTPSA id e38-20020a05600c4ba600b004075d5664basm4943631wmp.8.2023.10.19.11.21.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 11:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697739713; 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=NwMMcG5cEaHfQ2TgGjb60VwjA/LGsrSX8V2jHOn88fg=; b=CUKrUxh3JgR2X0/OYX7NLmxoS/YHo0l78n+t5pSiiYwt+GJtvng9iwtTjYdxtBU1eIN8oz boWjQQi/ScO1lvetyWx4jbSzNTh62GnwcYgbMKgekCed7vrvfH1dHr/qZyx89r6fXY6HlI eT/Nr68zd5vaMtoIplGC/rDUy3hxfC8= X-MC-Unique: 5zngDwRzMEeWeKDo-IYYjQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697739700; x=1698344500; 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=NwMMcG5cEaHfQ2TgGjb60VwjA/LGsrSX8V2jHOn88fg=; b=jBicCSKRyHEs1pmSWttUknKlGzZY/MOJZTcFebjz7jvtpl5dfFoYAO3NtTeZ0gx6Nb 1TZtTnrlqzV93Pg6OjYVJwoUlVKDrVK3EyN/bmQWFxXHSk9PAudREl4+xioZ8FBQNPCz sgPZ2lwzGasJpIKBDG7dvgGNsabPkuYL2ScaAA4WinZRQYPDW/V76u0QR4PAMCSAXj9g +gOaptWpW14llshxK2/L9lWHsrqBHqFHm9fF3SyefvtO2QibN6MjbCqXqQJoHGWmVExp LSLGXG7PDeq1B1FjYfzdol1dlYyym+CWVIYNJGH18Yb3JYkVmW0xIgAY49zJnQnemD+C tpLQ== X-Gm-Message-State: AOJu0YyT/L9Co3sLmffDF0QHuIhaJMNAsUnHw8+Fa0aY6LmziG/xBTGQ pDaVIKzCqnp299le/+fbTHX0BCs1ii9TR6b/afvpca4zAV3MApvSmGB4EBu4TVy4Vh8lN0+VX01 9V3btVi5QWueJaw6UJyf7xNrLynD9xSFygsrRJWmuMlh3V5x1P3vZBQBF7wOw0ZDX/I9q X-Received: by 2002:a2e:b0e1:0:b0:2c5:1f46:3323 with SMTP id h1-20020a2eb0e1000000b002c51f463323mr2047505ljl.47.1697739699758; Thu, 19 Oct 2023 11:21:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFT2v1h+YX61qvaKU1lSOJ+6GEtGMVcMdz1Uw+70TspVHxNhl+yqY2QaucfYKvU9UgcN5VzyA== X-Received: by 2002:a2e:b0e1:0:b0:2c5:1f46:3323 with SMTP id h1-20020a2eb0e1000000b002c51f463323mr2047494ljl.47.1697739699458; Thu, 19 Oct 2023 11:21:39 -0700 (PDT) Date: Thu, 19 Oct 2023 14:21:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhao Liu , Igor Mammedov , Ani Sinha Subject: [PULL v2 10/78] tests: bios-tables-test: Add test for smbios type4 count 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1697745119408100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhao Liu This tests the commit d79a284a44bb7 ("hw/smbios: Fix smbios_smp_sockets calculation"). In smbios_get_tables() (hw/smbios/smbios.c), smbios type4 table is built for each socket, so the count of type4 tables should be equal to the number of sockets. Thus for the topology in this case, there're the following considerations: 1. The topology should include multiple sockets to ensure smbios could create type4 tables for each socket. 2. In addition to sockets, for the more general topology, we should also configure as many topology levels as possible (multiple dies, no module since x86 hasn't supported it), to ensure that smbios is able to exclude the effect of other topology levels to create the type4 tables only for sockets. 3. The original miscalculation bug also misused "smp.cpus", so it's necessary to configure "cpus" (presented threads for machine) and "maxcpus" (total threads for machine) as well to make sure that configuring unpluged CPUs in smp (cpus < maxcpus) does not affect the correctness of the count of type4 tables. Based on these considerations, select the topology as the follow: -smp cpus=3D100,maxcpus=3D120,sockets=3D5,dies=3D2,cores=3D4,threads=3D3 The expected count of type4 tables =3D sockets (5). Suggested-by: Igor Mammedov Signed-off-by: Zhao Liu Message-Id: <20230928125943.1816922-4-zhao1.liu@linux.intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 9f4bc15aab..cdbfb51559 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -97,6 +97,7 @@ typedef struct { uint16_t smbios_core_count2; uint8_t *required_struct_types; int required_struct_types_len; + int type4_count; QTestState *qts; } test_data; =20 @@ -673,12 +674,21 @@ static void smbios_cpu_test(test_data *data, uint32_t= addr, } } =20 +static void smbios_type4_count_test(test_data *data, int type4_count) +{ + int expected_type4_count =3D data->type4_count; + + if (expected_type4_count) { + g_assert_cmpuint(type4_count, =3D=3D, expected_type4_count); + } +} + static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_t= ype) { DECLARE_BITMAP(struct_bitmap, SMBIOS_MAX_TYPE+1) =3D { 0 }; =20 SmbiosEntryPoint *ep_table =3D &data->smbios_ep_table; - int i =3D 0, len, max_len =3D 0; + int i =3D 0, len, max_len =3D 0, type4_count =3D 0; uint8_t type, prv, crt; uint64_t addr; =20 @@ -704,6 +714,7 @@ static void test_smbios_structs(test_data *data, Smbios= EntryPointType ep_type) =20 if (type =3D=3D 4) { smbios_cpu_test(data, addr, ep_type); + type4_count++; } =20 /* seek to end of unformatted string area of this struct ("\0\0") = */ @@ -747,6 +758,8 @@ static void test_smbios_structs(test_data *data, Smbios= EntryPointType ep_type) for (i =3D 0; i < data->required_struct_types_len; i++) { g_assert(test_bit(data->required_struct_types[i], struct_bitmap)); } + + smbios_type4_count_test(data, type4_count); } =20 static void test_acpi_load_tables(test_data *data) @@ -970,6 +983,22 @@ static void test_acpi_q35_tcg(void) free_test_data(&data); } =20 +static void test_acpi_q35_tcg_type4_count(void) +{ + test_data data =3D { + .machine =3D MACHINE_Q35, + .variant =3D ".type4-count", + .required_struct_types =3D base_required_struct_types, + .required_struct_types_len =3D ARRAY_SIZE(base_required_struct_typ= es), + .type4_count =3D 5, + }; + + test_acpi_one("-machine smbios-entry-point-type=3D64 " + "-smp cpus=3D100,maxcpus=3D120,sockets=3D5," + "dies=3D2,cores=3D4,threads=3D3", &data); + free_test_data(&data); +} + static void test_acpi_q35_tcg_core_count2(void) { test_data data =3D { @@ -2147,6 +2176,8 @@ int main(int argc, char *argv[]) if (has_kvm) { qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xap= ic); qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar= ); + qtest_add_func("acpi/q35/type4-count", + test_acpi_q35_tcg_type4_count); qtest_add_func("acpi/q35/core-count2", test_acpi_q35_tcg_core_count2); } --=20 MST