From nobody Thu Dec 18 12:35:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; 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=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1692934063; cv=none; d=zohomail.com; s=zohoarc; b=ZaUcIopp0wlfKuiU/kj/5Du2bqw+k2jI190fyOT8vnG7fYXykrFzOXhZMB3gzjYawTMqj8vSXGpsHIFQGLjWwnVzJ60DBsHlnFeNLn/nDcrjpDkU1HHun7WL8D0e9FyRxLSq3O/UyrfEarw/edm1oqcd1STe1opZXtSqqv2gH4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692934063; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Fnj6P3J8XeMFecieL3gHJarfkOuKxWb7kHrUE155jqU=; b=SQsra19l9kW5Xna6ZhUptEiTaH8QCkL6VCoIchJOtilV4Z8+E46ULlXVEVq9vhlNrTiaYlXUA6+T0zugKlBEZIx2lgLQtNqtvVhm+R8+SH0qXmIdPMH6LHl1PhlrEey1gyGcPmpb4dmyf6uRG0ic9rDZ9Ayu3ZwJflSLOflf+y0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; 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 1692934063833532.2742662893122; Thu, 24 Aug 2023 20:27:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZNTj-0000jq-SW; Thu, 24 Aug 2023 23:27: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 1qZNTi-0000ir-Gn for qemu-devel@nongnu.org; Thu, 24 Aug 2023 23:27:18 -0400 Received: from mgamail.intel.com ([192.55.52.115]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZNTf-00045F-Bc for qemu-devel@nongnu.org; Thu, 24 Aug 2023 23:27:17 -0400 Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2023 20:27:04 -0700 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by orsmga006.jf.intel.com with ESMTP; 24 Aug 2023 20:27:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692934035; x=1724470035; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XZ8WXDmKNbIhilDIOXKu0XloWlkdqvrfp+US1jR2Qsk=; b=OF1fp7gjYBk+BVdJ64LA1jHq2evoXymSXCGqjZAycL6wWgHVTDlbG2Mf 8fLj6/vVR53Ezmw3kCDFFYRIrXsg04MySZTzbVRa75AXn2e4qvB73aEl/ 8MpSh2BR+VEZlXvIgwYhRATrBkWRbV2pmDWGXk4stKYakbqAv7st8/tfV 2v+oyAKmaHSazYfQq1O12iyLLFlpp6GQDov6qHx8ddq+9uDQllUGhXLio abmIMvZyJagai4xMQULqenKIUAutPR+KWgM1U34OFSNX2cNTq5tW5ar7h KaY0doUEtVqV2PwcuKvwdwuF01XF1rejNwRC7d3J3RAVL+jhyQzCEjBor g==; X-IronPort-AV: E=McAfee;i="6600,9927,10812"; a="374595773" X-IronPort-AV: E=Sophos;i="6.02,195,1688454000"; d="scan'208";a="374595773" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10812"; a="714201667" X-IronPort-AV: E=Sophos;i="6.02,195,1688454000"; d="scan'208";a="714201667" From: Zhao Liu To: "Michael S . Tsirkin" , Igor Mammedov , Ani Sinha , Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , qemu-devel@nongnu.org Cc: Michael Tokarev , Zhenyu Wang , Zhao Liu Subject: [PATCH 12/16] tests: bios-tables-test: Add test for smbios type4 thread count Date: Fri, 25 Aug 2023 11:36:15 +0800 Message-Id: <20230825033619.2075837-13-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230825033619.2075837-1-zhao1.liu@linux.intel.com> References: <20230825033619.2075837-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: none client-ip=192.55.52.115; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=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 @intel.com) X-ZM-MESSAGEID: 1692934064514100001 Content-Type: text/plain; charset="utf-8" From: Zhao Liu This tests the commit 7298fd7de5551 ("hw/smbios: Fix thread count in type4"). Add this test to cover 2 cases: 1. Test thread count field with multiple sockets and multiple dies to confirm this field could correctly calculate threads per sockets. 2. Confirm that field calculation could correctly recognize the difference between "-smp maxcpus" and "-smp cpus". Suggested-by: Igor Mammedov Signed-off-by: Zhao Liu Acked-by: Igor Mammedov --- tests/qtest/bios-tables-test.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 8cba1d8126f2..26474d376633 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -95,6 +95,7 @@ typedef struct { uint16_t smbios_cpu_curr_speed; uint8_t smbios_core_count; uint16_t smbios_core_count2; + uint8_t smbios_thread_count; uint8_t *required_struct_types; int required_struct_types_len; int type4_count; @@ -640,6 +641,7 @@ static void smbios_cpu_test(test_data *data, uint32_t a= ddr, SmbiosEntryPointType ep_type) { uint8_t core_count, expected_core_count =3D data->smbios_core_count; + uint8_t thread_count, expected_thread_count =3D data->smbios_thread_co= unt; uint16_t speed, expected_speed[2]; uint16_t core_count2, expected_core_count2 =3D data->smbios_core_count= 2; int offset[2]; @@ -663,6 +665,13 @@ static void smbios_cpu_test(test_data *data, uint32_t = addr, g_assert_cmpuint(core_count, =3D=3D, expected_core_count); } =20 + thread_count =3D qtest_readb(data->qts, + addr + offsetof(struct smbios_type_4, thread_count)= ); + + if (expected_thread_count) { + g_assert_cmpuint(thread_count, =3D=3D, expected_thread_count); + } + if (ep_type =3D=3D SMBIOS_ENTRY_POINT_TYPE_64) { core_count2 =3D qtest_readw(data->qts, addr + offsetof(struct smbios_type_4, core_count= 2)); @@ -1033,6 +1042,22 @@ static void test_acpi_q35_tcg_core_count2(void) free_test_data(&data); } =20 +static void test_acpi_q35_tcg_thread_count(void) +{ + test_data data =3D { + .machine =3D MACHINE_Q35, + .variant =3D ".thread-count", + .required_struct_types =3D base_required_struct_types, + .required_struct_types_len =3D ARRAY_SIZE(base_required_struct_typ= es), + .smbios_thread_count =3D 27, + }; + + test_acpi_one("-machine smbios-entry-point-type=3D64 " + "-smp cpus=3D15,maxcpus=3D54,sockets=3D2,dies=3D3,cores= =3D3,threads=3D3", + &data); + free_test_data(&data); +} + static void test_acpi_q35_tcg_bridge(void) { test_data data =3D {}; @@ -2189,6 +2214,8 @@ int main(int argc, char *argv[]) test_acpi_q35_tcg_core_count); qtest_add_func("acpi/q35/core-count2", test_acpi_q35_tcg_core_count2); + qtest_add_func("acpi/q35/thread-count", + test_acpi_q35_tcg_thread_count); } qtest_add_func("acpi/q35/viot", test_acpi_q35_viot); #ifdef CONFIG_POSIX --=20 2.34.1