From patchwork Tue Dec 26 08:09:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ivanhu X-Patchwork-Id: 1880205 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SznXJ4mFFz1ydb for ; Tue, 26 Dec 2023 19:10:56 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rI2WX-0000tK-TH; Tue, 26 Dec 2023 08:10:50 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rI2VB-0000Xw-D3 for fwts-devel@lists.ubuntu.com; Tue, 26 Dec 2023 08:09:26 +0000 Received: from canonical.com (unknown [10.101.194.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 7DD213F6CD for ; Tue, 26 Dec 2023 08:09:24 +0000 (UTC) From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/2] acpi: srat: add new Generic Port structure for srat tests (mantis 2236) Date: Tue, 26 Dec 2023 16:09:19 +0800 Message-Id: <20231226080920.115233-1-ivan.hu@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" BugLink: https://bugs.launchpad.net/fwts/+bug/2047212 The new structure(Generic Port Structure 6) was add in ACPI 6.5 Signed-off-by: Ivan Hu --- src/acpi/srat/srat.c | 67 +++++++++++++++++++++++++++++++++++++ src/lib/include/fwts_acpi.h | 11 ++++++ 2 files changed, 78 insertions(+) diff --git a/src/acpi/srat/srat.c b/src/acpi/srat/srat.c index 848d0bf6..7c98bed5 100644 --- a/src/acpi/srat/srat.c +++ b/src/acpi/srat/srat.c @@ -337,6 +337,70 @@ done: *data += sizeof(fwts_acpi_table_initiator_affinity); } +static void srat_check_port_affinity( + fwts_framework *fw, + ssize_t *length, + uint8_t **data, + bool *passed) +{ + uint32_t h_reserved = 0; + + fwts_acpi_table_port_affinity *affinity = + (fwts_acpi_table_port_affinity *)*data; + + if ((ssize_t)sizeof(fwts_acpi_table_port_affinity) > *length) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "SRATPortAffinityShort", + "SRAT Port Affinity structure too short, got " + "%zu bytes, expecting %zu bytes", + *length, sizeof(fwts_acpi_table_port_affinity)); + *passed = false; + goto done; + } + + if (!fwts_acpi_structure_length(fw, "SRAT", affinity->type, + affinity->length, sizeof(fwts_acpi_table_port_affinity))) { + *passed = false; + goto done; + } + + fwts_log_info_verbatim(fw, "SRAT Port Affinity Structure:"); + fwts_log_info_simp_int(fw, " Type: ", affinity->type); + fwts_log_info_simp_int(fw, " Length: ", affinity->length); + fwts_log_info_simp_int(fw, " Reserved: ", affinity->reserved1); + fwts_log_info_simp_int(fw, " Device Handle Type: ", affinity->device_handle_type); + fwts_log_info_simp_int(fw, " Proximity Domain: ", affinity->proximity_domain); + + fwts_acpi_reserved_zero("SRAT", "Port Affinity Reserved", affinity->reserved1, passed); + fwts_acpi_reserved_bits("SRAT", "Port Affinity Device Handle Type", affinity->device_handle_type, 1, 7, passed); + + fwts_log_info_verbatim(fw, " Device Handle:"); + if (affinity->device_handle_type == 0) { + fwts_log_info_simp_int(fw, " ACPI _HID: ", *(uint64_t *)(affinity->device_handle)); + fwts_log_info_simp_int(fw, " ACPI _UID: ", *(uint32_t *)(affinity->device_handle + 8)); + h_reserved = *(uint32_t *)(affinity->device_handle + 12); + fwts_log_info_simp_int(fw, " Reserved: ", *(uint32_t *)(affinity->device_handle + 12)); + fwts_acpi_reserved_zero("SRAT", "Port Affinity Device Handle Reserved", h_reserved, passed); + } else if (affinity->device_handle_type == 1) { + fwts_log_info_simp_int(fw, " PCI Segment: ", *(uint16_t *)(affinity->device_handle)); + fwts_log_info_simp_int(fw, " PCI BDF Number: ", *(uint16_t *)(affinity->device_handle + 2)); + fwts_log_info_verbatim(fw, " Reserved:"); + fwts_hexdump_data_prefix_all(fw, affinity->device_handle + 4, " ", 12); + fwts_acpi_reserved_zero_array(fw, "SRAT", " Port Affinity Device Handle Reserved", affinity->device_handle + 4, 12, passed); + } + fwts_log_info_simp_int(fw, " Flags: ", affinity->flags); + fwts_log_info_simp_int(fw, " Reserved: ", affinity->reserved2); + fwts_log_nl(fw); + + fwts_acpi_reserved_bits("SRAT", "Port Affinity Flags", affinity->flags, 2, 31, passed); + fwts_acpi_reserved_zero("SRAT", "Port Affinity Reserved", affinity->reserved2, passed); + +done: + *length -= sizeof(fwts_acpi_table_port_affinity); + *data += sizeof(fwts_acpi_table_port_affinity); +} + + /* * See ACPI 6.0, Section 5.2.16 */ @@ -372,6 +436,9 @@ static int srat_test1(fwts_framework *fw) case 0x05: srat_check_initiator_affinity(fw, &length, &data, &passed); break; + case 0x06: + srat_check_port_affinity(fw, &length, &data, &passed); + break; default: fwts_failed(fw, LOG_LEVEL_HIGH, "SRATInvalidType", diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h index b4671b06..6b8ecefa 100644 --- a/src/lib/include/fwts_acpi.h +++ b/src/lib/include/fwts_acpi.h @@ -447,6 +447,17 @@ typedef struct { uint32_t reserved2; } __attribute__ ((packed)) fwts_acpi_table_initiator_affinity; +typedef struct { + uint8_t type; + uint8_t length; + uint8_t reserved1; + uint8_t device_handle_type; + uint32_t proximity_domain; + uint8_t device_handle[16]; + uint32_t flags; + uint32_t reserved2; +} __attribute__ ((packed)) fwts_acpi_table_port_affinity; + /* * ACPI HPET (HPET IA-PC High Precision Event Timer Table), * 3.2.4 The ACPI 2.0 HPET Description Table (HPET) From patchwork Tue Dec 26 08:09:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ivanhu X-Patchwork-Id: 1880206 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SznXK4JK9z20Rq for ; Tue, 26 Dec 2023 19:10:57 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rI2WZ-0000tj-D2; Tue, 26 Dec 2023 08:10:51 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rI2VF-0000YQ-GC for fwts-devel@lists.ubuntu.com; Tue, 26 Dec 2023 08:09:29 +0000 Received: from canonical.com (unknown [10.101.194.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id AC1903F6CD for ; Tue, 26 Dec 2023 08:09:28 +0000 (UTC) From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/2] fwts-test: sync up with new Generic Port structure added for srat Date: Tue, 26 Dec 2023 16:09:20 +0800 Message-Id: <20231226080920.115233-2-ivan.hu@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231226080920.115233-1-ivan.hu@canonical.com> References: <20231226080920.115233-1-ivan.hu@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" Signed-off-by: Ivan Hu --- fwts-test/srat-0001/acpidump-0001.log | 6 +++-- fwts-test/srat-0001/acpidump-0002.log | 6 +++-- fwts-test/srat-0001/srat-0001.log | 13 ++++++++++ fwts-test/srat-0001/srat-0002.log | 36 ++++++++++++++++++++++++++- 4 files changed, 56 insertions(+), 5 deletions(-) diff --git a/fwts-test/srat-0001/acpidump-0001.log b/fwts-test/srat-0001/acpidump-0001.log index 20f34595..ed58de1b 100644 --- a/fwts-test/srat-0001/acpidump-0001.log +++ b/fwts-test/srat-0001/acpidump-0001.log @@ -24,7 +24,7 @@ FACP @ 0x00000000 00f0: 00 00 00 00 .... SRAT @ 0x00000000 - 0000: 53 52 41 54 e8 00 00 00 03 9e 41 4d 44 20 20 20 SRAT......AMD + 0000: 53 52 41 54 08 01 00 00 03 9e 41 4d 44 20 20 20 SRAT......AMD 0010: 46 41 4d 5f 46 5f 31 30 02 00 00 00 41 4d 44 20 FAM_F_10....AMD 0020: 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................ 0030: 00 10 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -38,4 +38,6 @@ SRAT @ 0x00000000 00b0: 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................ 00c0: 01 28 00 00 00 00 00 00 00 00 00 00 01 00 00 00 .(.............. 00d0: 00 00 00 30 01 00 00 00 01 00 00 00 01 00 00 00 ...0............ - 00e0: 00 00 00 00 00 00 00 00 + 00e0: 00 00 00 00 00 00 00 00 06 20 00 00 00 00 00 00 ................ + 00f0: 00 11 22 33 44 55 66 77 00 11 22 33 00 00 00 00 ................ + 0100: 00 00 00 00 00 00 00 00 ................ diff --git a/fwts-test/srat-0001/acpidump-0002.log b/fwts-test/srat-0001/acpidump-0002.log index 1b33aace..7bc26870 100644 --- a/fwts-test/srat-0001/acpidump-0002.log +++ b/fwts-test/srat-0001/acpidump-0002.log @@ -24,7 +24,7 @@ FACP @ 0x00000000 00f0: 00 00 00 00 .... SRAT @ 0x00000000 - 0000: 53 52 41 54 e8 00 00 00 03 9e 41 4d 44 20 20 20 SRAT......AMD + 0000: 53 52 41 54 08 01 00 00 03 9e 41 4d 44 20 20 20 SRAT......AMD 0010: 46 41 4d 5f 46 5f 31 30 02 00 00 00 41 4d 44 20 FAM_F_10....AMD 0020: 01 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 ................ 0030: 00 10 00 00 09 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -38,4 +38,6 @@ SRAT @ 0x00000000 00b0: 0f 00 00 00 ff 00 00 00 00 00 00 00 00 00 00 00 ................ 00c0: 01 28 00 00 00 00 00 00 00 00 00 00 01 00 00 00 .(.............. 00d0: 00 00 00 30 01 00 00 00 01 00 00 00 08 00 00 00 ...0............ - 00e0: 00 00 00 00 00 00 00 00 + 00e0: 00 00 00 00 00 00 00 00 06 20 01 01 00 00 00 00 ................ + 00f0: 01 02 03 04 00 00 00 00 ff ff ff ff ff ff ff ff ................ + 0100: 00 00 00 00 00 00 00 ff ................ diff --git a/fwts-test/srat-0001/srat-0001.log b/fwts-test/srat-0001/srat-0001.log index 42e90ca9..6d541403 100644 --- a/fwts-test/srat-0001/srat-0001.log +++ b/fwts-test/srat-0001/srat-0001.log @@ -82,6 +82,19 @@ srat Reserved: 0x00000001 srat Flags: 0x00000001 srat Reserved: 0x0000000000000000 srat +srat SRAT Port Affinity Structure: +srat Type: 0x06 +srat Length: 0x20 +srat Reserved: 0x00 +srat Device Handle Type: 0x00 +srat Proximity Domain: 0x00000000 +srat Device Handle: +srat ACPI _HID: 0x7766554433221100 +srat ACPI _UID: 0x33221100 +srat Reserved: 0x00000000 +srat Flags: 0x00000000 +srat Reserved: 0x00000000 +srat srat PASSED: Test 1, No issues found in SRAT table. srat srat ========================================================== diff --git a/fwts-test/srat-0001/srat-0002.log b/fwts-test/srat-0001/srat-0002.log index e5bc0433..3523ed1d 100644 --- a/fwts-test/srat-0001/srat-0002.log +++ b/fwts-test/srat-0001/srat-0002.log @@ -93,8 +93,42 @@ srat srat FAILED [HIGH] SRATReservedBitsNonZero: Test 1, SRAT Memory srat Affinity Flags Bits [31..3] must be zero, got 0x00000008 srat instead +srat SRAT Port Affinity Structure: +srat Type: 0x06 +srat Length: 0x20 +srat Reserved: 0x01 +srat Device Handle Type: 0x01 +srat Proximity Domain: 0x00000000 +srat FAILED [MEDIUM] SRATReservedNonZero: Test 1, SRAT Port +srat Affinity Reserved field must be zero, got 0x01 instead +srat Device Handle: +srat PCI Segment: 0x0201 +srat PCI BDF Number: 0x0403 +srat Reserved: +srat 00 00 00 00 FF FF FF FF FF FF FF FF +srat FAILED [MEDIUM] SRATReservedNonZero: Test 1, SRAT Port +srat Affinity Device Handle Reserved field must be all zero, +srat got below instead +srat Port Affinity Device Handle Reserved [00] = 0x00 +srat Port Affinity Device Handle Reserved [01] = 0x00 +srat Port Affinity Device Handle Reserved [02] = 0x00 +srat Port Affinity Device Handle Reserved [03] = 0x00 +srat Port Affinity Device Handle Reserved [04] = 0xff +srat Port Affinity Device Handle Reserved [05] = 0xff +srat Port Affinity Device Handle Reserved [06] = 0xff +srat Port Affinity Device Handle Reserved [07] = 0xff +srat Port Affinity Device Handle Reserved [08] = 0xff +srat Port Affinity Device Handle Reserved [09] = 0xff +srat Port Affinity Device Handle Reserved [10] = 0xff +srat Port Affinity Device Handle Reserved [11] = 0xff +srat Flags: 0x00000000 +srat Reserved: 0xff000000 +srat +srat FAILED [MEDIUM] SRATReservedNonZero: Test 1, SRAT Port +srat Affinity Reserved field must be zero, got 0xff000000 +srat instead srat srat ========================================================== -srat 0 passed, 4 failed, 0 warning, 0 aborted, 0 skipped, 0 +srat 0 passed, 7 failed, 0 warning, 0 aborted, 0 skipped, 0 srat info only. srat ==========================================================