All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Julia Suvorova <jusual@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>, Ani Sinha <ani@anisinha.ca>
Subject: [PULL v2 20/82] bios-tables-test: add test for number of cores > 255
Date: Wed, 2 Nov 2022 12:09:15 -0400	[thread overview]
Message-ID: <20221102160336.616599-21-mst@redhat.com> (raw)
In-Reply-To: <20221102160336.616599-1-mst@redhat.com>

From: Julia Suvorova <jusual@redhat.com>

The new test is run with a large number of cpus and checks if the
core_count field in smbios_cpu_test (structure type 4) is correct.

Choose q35 as it allows to run with -smp > 255.

Signed-off-by: Julia Suvorova <jusual@redhat.com>
Message-Id: <20220731162141.178443-5-jusual@redhat.com>
Message-Id: <20221011111731.101412-5-jusual@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/qtest/bios-tables-test.c | 58 ++++++++++++++++++++++++++--------
 1 file changed, 45 insertions(+), 13 deletions(-)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index 0db6630772..ee6b1b483d 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -92,6 +92,8 @@ typedef struct {
     SmbiosEntryPoint smbios_ep_table;
     uint16_t smbios_cpu_max_speed;
     uint16_t smbios_cpu_curr_speed;
+    uint8_t smbios_core_count;
+    uint16_t smbios_core_count2;
     uint8_t *required_struct_types;
     int required_struct_types_len;
     QTestState *qts;
@@ -631,29 +633,42 @@ static inline bool smbios_single_instance(uint8_t type)
     }
 }
 
-static bool smbios_cpu_test(test_data *data, uint32_t addr)
+static void smbios_cpu_test(test_data *data, uint32_t addr,
+                            SmbiosEntryPointType ep_type)
 {
-    uint16_t expect_speed[2];
-    uint16_t real;
+    uint8_t core_count, expected_core_count = data->smbios_core_count;
+    uint16_t speed, expected_speed[2];
+    uint16_t core_count2, expected_core_count2 = data->smbios_core_count2;
     int offset[2];
     int i;
 
     /* Check CPU speed for backward compatibility */
     offset[0] = offsetof(struct smbios_type_4, max_speed);
     offset[1] = offsetof(struct smbios_type_4, current_speed);
-    expect_speed[0] = data->smbios_cpu_max_speed ? : 2000;
-    expect_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
+    expected_speed[0] = data->smbios_cpu_max_speed ? : 2000;
+    expected_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
 
     for (i = 0; i < 2; i++) {
-        real = qtest_readw(data->qts, addr + offset[i]);
-        if (real != expect_speed[i]) {
-            fprintf(stderr, "Unexpected SMBIOS CPU speed: real %u expect %u\n",
-                    real, expect_speed[i]);
-            return false;
-        }
+        speed = qtest_readw(data->qts, addr + offset[i]);
+        g_assert_cmpuint(speed, ==, expected_speed[i]);
     }
 
-    return true;
+    core_count = qtest_readb(data->qts,
+                    addr + offsetof(struct smbios_type_4, core_count));
+
+    if (expected_core_count) {
+        g_assert_cmpuint(core_count, ==, expected_core_count);
+    }
+
+    if (ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
+        core_count2 = qtest_readw(data->qts,
+                          addr + offsetof(struct smbios_type_4, core_count2));
+
+        /* Core Count has reached its limit, checking Core Count 2 */
+        if (expected_core_count == 0xFF && expected_core_count2) {
+            g_assert_cmpuint(core_count2, ==, expected_core_count2);
+        }
+    }
 }
 
 static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
@@ -686,7 +701,7 @@ static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
         set_bit(type, struct_bitmap);
 
         if (type == 4) {
-            g_assert(smbios_cpu_test(data, addr));
+            smbios_cpu_test(data, addr, ep_type);
         }
 
         /* seek to end of unformatted string area of this struct ("\0\0") */
@@ -908,6 +923,21 @@ static void test_acpi_q35_tcg(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_tcg_core_count2(void)
+{
+    test_data data = {
+        .machine = MACHINE_Q35,
+        .variant = ".core-count2",
+        .required_struct_types = base_required_struct_types,
+        .required_struct_types_len = ARRAY_SIZE(base_required_struct_types),
+        .smbios_core_count = 0xFF,
+        .smbios_core_count2 = 275,
+    };
+
+    test_acpi_one("-machine smbios-entry-point-type=64 -smp 275", &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_q35_tcg_bridge(void)
 {
     test_data data;
@@ -1887,6 +1917,8 @@ int main(int argc, char *argv[])
             if (has_kvm) {
                 qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic);
                 qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar);
+                qtest_add_func("acpi/q35/core-count2",
+                               test_acpi_q35_tcg_core_count2);
             }
             qtest_add_func("acpi/q35/viot", test_acpi_q35_viot);
 #ifdef CONFIG_POSIX
-- 
MST



  parent reply	other threads:[~2022-11-02 16:24 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02 16:02 [PULL v2 00/82] pci,pc,virtio: features, tests, fixes, cleanups Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 01/82] hw/i386/e820: remove legacy reserved entries for e820 Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 02/82] tests/acpi: allow SSDT changes Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 03/82] acpi/ssdt: Fix aml_or() and aml_and() in if clause Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 04/82] acpi/nvdimm: define macro for NVDIMM Device _DSM Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 05/82] acpi/nvdimm: Implement ACPI NVDIMM Label Methods Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 06/82] test/acpi/bios-tables-test: SSDT: update golden master binaries Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 07/82] virtio-crypto: Support asynchronous mode Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 08/82] crypto: Support DER encodings Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 09/82] crypto: Support export akcipher to pkcs8 Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 10/82] cryptodev: Add a lkcf-backend for cryptodev Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 11/82] acpi/tests/avocado/bits: initial commit of test scripts that are run by biosbits Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 12/82] acpi/tests/avocado/bits: disable acpi PSS tests that are failing in biosbits Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 13/82] acpi/tests/avocado/bits: add biosbits config file for running bios tests Michael S. Tsirkin
2022-11-02 16:08 ` [PULL v2 14/82] acpi/tests/avocado/bits: add acpi and smbios avocado tests that uses biosbits Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 15/82] acpi/tests/avocado/bits/doc: add a doc file to describe the acpi bits test Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 16/82] MAINTAINERS: add myself as the maintainer for acpi biosbits avocado tests Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 17/82] hw/smbios: add core_count2 to smbios table type 4 Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 18/82] bios-tables-test: teach test to use smbios 3.0 tables Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 19/82] tests/acpi: allow changes for core_count2 test Michael S. Tsirkin
2022-11-02 16:09 ` Michael S. Tsirkin [this message]
2022-11-02 16:09 ` [PULL v2 21/82] tests/acpi: update tables for new core count test Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 22/82] tests/acpi: virt: allow acpi MADT and FADT changes Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 23/82] acpi: fadt: support revision 6.0 of the ACPI specification Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 24/82] acpi: arm/virt: madt: bump to revision 4 accordingly to ACPI 6.0 Errata A Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 25/82] tests/acpi: virt: update ACPI MADT and FADT binaries Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 26/82] hw/pci: PCIe Data Object Exchange emulation Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 27/82] hw/mem/cxl-type3: Add MSIX support Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 28/82] hw/cxl/cdat: CXL CDAT Data Object Exchange implementation Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 29/82] hw/mem/cxl-type3: Add CXL CDAT Data Object Exchange Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 30/82] hw/pci-bridge/cxl-upstream: Add a CDAT table access DOE Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 31/82] vhost: Change the sequence of device start Michael S. Tsirkin
2022-11-05 16:35   ` Bernhard Beschow
2022-11-05 16:43     ` Michael S. Tsirkin
2022-11-06 18:00       ` Christian A. Ehrhardt
2022-11-07 13:30         ` Michael S. Tsirkin
2022-11-07 17:31           ` Christian A. Ehrhardt
2022-11-07 17:54             ` Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 32/82] vhost-user: Support vhost_dev_start Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 33/82] hw/virtio/virtio-iommu-pci: Enforce the device is plugged on the root bus Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 34/82] virtio: re-order vm_running and use_started checks Michael S. Tsirkin
2022-11-02 16:09 ` [PULL v2 35/82] virtio: introduce __virtio_queue_reset() Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 36/82] virtio: introduce virtio_queue_reset() Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 37/82] virtio: introduce virtio_queue_enable() Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 38/82] virtio: core: vq reset feature negotation support Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 39/82] virtio-pci: support queue reset Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 40/82] virtio-pci: support queue enable Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 41/82] vhost: expose vhost_virtqueue_start() Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 42/82] vhost: expose vhost_virtqueue_stop() Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 43/82] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_reset() Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 44/82] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_restart() Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 45/82] virtio-net: introduce flush_or_purge_queued_packets() Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 46/82] virtio-net: support queue reset Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 47/82] virtio-net: support queue_enable Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 48/82] vhost: vhost-kernel: enable vq reset feature Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 49/82] virtio-net: " Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 50/82] virtio-rng-pci: Allow setting nvectors, so we can use MSI-X Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 51/82] vhost-user: Fix out of order vring host notification handling Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 52/82] acpi: pc: vga: use AcpiDevAmlIf interface to build VGA device descriptors Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 53/82] tests: acpi: whitelist DSDT before generating PCI-ISA bridge AML automatically Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 54/82] acpi: pc/q35: drop ad-hoc PCI-ISA bridge AML routines and let bus ennumeration generate AML Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 55/82] tests: acpi: update expected DSDT after ISA bridge is moved directly under PCI host bridge Michael S. Tsirkin
2022-11-02 16:10 ` [PULL v2 56/82] tests: acpi: whitelist DSDT before generating ICH9_SMB AML automatically Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 57/82] acpi: add get_dev_aml_func() helper Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 58/82] acpi: enumerate SMB bridge automatically along with other PCI devices Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 59/82] tests: acpi: update expected blobs Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 60/82] tests: acpi: pc/q35 whitelist DSDT before \_GPE cleanup Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 61/82] acpi: pc/35: sanitize _GPE declaration order Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 62/82] tests: acpi: update expected blobs Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 63/82] hw/acpi/erst.c: Fix memory handling issues Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 64/82] MAINTAINERS: Add qapi/virtio.json to section "virtio" Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 65/82] msix: Assert that specified vector is in range Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 66/82] hw/i386/pc.c: CXL Fixed Memory Window should not reserve e820 in bios Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 67/82] hw/i386/acpi-build: Remove unused struct Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 68/82] hw/i386/acpi-build: Resolve redundant attribute Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 69/82] hw/i386/acpi-build: Resolve north rather than south bridges Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 70/82] hmat acpi: Don't require initiator value in -numa Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 71/82] tests: acpi: add and whitelist *.hmat-noinitiator expected blobs Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 72/82] tests: acpi: q35: add test for hmat nodes without initiators Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 73/82] tests: acpi: q35: update expected blobs *.hmat-noinitiators expected HMAT: Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 74/82] tests: Add HMAT AArch64/virt empty table files Michael S. Tsirkin
2022-11-02 16:11 ` [PULL v2 75/82] hw/arm/virt: Enable HMAT on arm virt machine Michael S. Tsirkin
2022-11-02 16:12 ` [PULL v2 76/82] tests: acpi: aarch64/virt: add a test for hmat nodes with no initiators Michael S. Tsirkin
2022-11-02 16:12 ` [PULL v2 77/82] tests: virt: Update expected *.acpihmatvirt tables Michael S. Tsirkin
2022-11-02 16:12 ` [PULL v2 78/82] vfio: move implement of vfio_get_xlat_addr() to memory.c Michael S. Tsirkin
2022-11-02 16:12 ` [PULL v2 79/82] intel-iommu: don't warn guest errors when getting rid2pasid entry Michael S. Tsirkin
2022-11-02 16:12 ` [PULL v2 80/82] intel-iommu: drop VTDBus Michael S. Tsirkin
2022-11-02 16:12 ` [PULL v2 81/82] intel-iommu: convert VTD_PE_GET_FPD_ERR() to be a function Michael S. Tsirkin
2022-11-02 16:12 ` [PULL v2 82/82] intel-iommu: PASID support Michael S. Tsirkin
2022-11-02 19:47 ` [PULL v2 00/82] pci,pc,virtio: features, tests, fixes, cleanups Stefan Hajnoczi
2022-11-03 12:13   ` Michael S. Tsirkin
2022-11-03 13:29     ` Stefan Hajnoczi
2022-11-03 14:54       ` Michael S. Tsirkin
2022-11-03 21:59       ` Michael S. Tsirkin
2022-11-03 13:31     ` Philippe Mathieu-Daudé
2022-11-03 15:42       ` Ani Sinha
2022-11-03 15:49         ` Stefan Hajnoczi
2022-11-03 15:58           ` Michael S. Tsirkin
2022-11-03 16:27             ` Stefan Hajnoczi
2022-11-03 15:59           ` Daniel P. Berrangé
2022-11-03 16:25             ` Stefan Hajnoczi
2022-11-03 16:38               ` Daniel P. Berrangé
2022-11-03 16:47                 ` Peter Maydell
2022-11-03 16:49                   ` Daniel P. Berrangé
2022-11-03 17:05                     ` Stefan Hajnoczi
2022-11-03 16:47                 ` Daniel P. Berrangé
2022-11-03 16:47         ` Ani Sinha
2022-11-03 16:48           ` Ani Sinha
2022-11-03 16:56             ` Ani Sinha
2022-11-03 17:41               ` Daniel P. Berrangé
2022-11-03 17:44                 ` Ani Sinha
2022-11-03 20:32                   ` Michael S. Tsirkin
2022-11-04  3:07                     ` Ani Sinha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221102160336.616599-21-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=ani@anisinha.ca \
    --cc=imammedo@redhat.com \
    --cc=jusual@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.