From patchwork Tue Jan 9 12:21:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1884406 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 4T8VQr6FqGz1yP7 for ; Tue, 9 Jan 2024 23:21:24 +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 1rNB6b-0005nb-Bz; Tue, 09 Jan 2024 12:21:17 +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 1rNB6Y-0005nU-Tj for fwts-devel@lists.ubuntu.com; Tue, 09 Jan 2024 12:21:14 +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 027963F6E6 for ; Tue, 9 Jan 2024 12:21:13 +0000 (UTC) From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/2] acpi: viot: add test for ACPI VIOT table (mantis 2152) Date: Tue, 9 Jan 2024 20:21:09 +0800 Message-Id: <20240109122110.118791-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 ACPI VIOT table was added to ACPI6.5, add tests for the VIOT table. Signed-off-by: Ivan Hu --- src/Makefile.am | 1 + src/acpi/viot/viot.c | 165 ++++++++++++++++++++++++++++++++++++ src/lib/include/fwts_acpi.h | 55 ++++++++++++ 3 files changed, 221 insertions(+) create mode 100644 src/acpi/viot/viot.c diff --git a/src/Makefile.am b/src/Makefile.am index e3bed3dd..69204479 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -154,6 +154,7 @@ fwts_SOURCES = main.c \ acpi/tpm2/tpm2.c \ acpi/uefi/uefi.c \ acpi/uniqueid/uniqueid.c \ + acpi/viot/viot.c \ acpi/waet/waet.c \ acpi/wakealarm/wakealarm.c \ acpi/wdat/wdat.c \ diff --git a/src/acpi/viot/viot.c b/src/acpi/viot/viot.c new file mode 100644 index 00000000..74394fec --- /dev/null +++ b/src/acpi/viot/viot.c @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2024 Canonical + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#include "fwts.h" + +#if defined(FWTS_HAS_ACPI) + +#include +#include +#include +#include +#include + +static fwts_acpi_table_info *table; +acpi_table_init(VIOT, &table) + +static int viot_test1(fwts_framework *fw) +{ + fwts_acpi_viot_node_hdr *node_hdr; + bool passed = true; + uint32_t offset; + fwts_acpi_table_viot *viot = (fwts_acpi_table_viot *)table->data; + + fwts_log_info_verbatim(fw, "VIOT Virtual I/O Translation Table:"); + fwts_log_info_simp_int(fw, " Node Count: ", viot->node_count); + fwts_log_info_simp_int(fw, " Node Offset: ", viot->node_offset); + + if (viot->node_offset == 0) { + fwts_failed(fw, LOG_LEVEL_HIGH, + "VIOTinvalidOffset", + "VIOT Offset for the first node should not be 0."); + return FWTS_OK; + } + + fwts_log_info_simp_int(fw, " Reserved: ", viot->reserved); + fwts_acpi_reserved_zero("VIOT", "Reserved", viot->reserved, &passed); + + offset = viot->node_offset; + + if (offset >= table->length) { + fwts_failed(fw, LOG_LEVEL_HIGH, + "VIOTOutOfRangeOffset", + "VIOT Node Data Offset is out of range."); + return FWTS_OK; + } + + node_hdr = (fwts_acpi_viot_node_hdr *)(table->data + offset); + + for (uint32_t i = 0; i < viot->node_count; i++) { + + if (fwts_acpi_structure_length_zero(fw, "VIOT", node_hdr->length, offset)) { + passed = false; + break; + } + + if ((offset + node_hdr->length) > table->length) { + fwts_failed(fw, LOG_LEVEL_HIGH, + "VIOTOutOfRangeOffset", + "VIOT Node Data Offset is out of range."); + return FWTS_OK; + } + + switch(node_hdr->type) { + case 1: + fwts_acpi_viot_pci_rng_node *pci_rng = (fwts_acpi_viot_pci_rng_node *)(table->data + offset); + fwts_log_info_verbatim(fw, " PCI Range Node Structure:"); + fwts_log_info_simp_int(fw, " Type: ", pci_rng->hdr.type); + fwts_log_info_simp_int(fw, " Reserved: ", pci_rng->hdr.reserved); + fwts_acpi_reserved_zero("VIOT", "Reserved", pci_rng->hdr.reserved, &passed); + fwts_log_info_simp_int(fw, " length: ", pci_rng->hdr.length); + fwts_log_info_simp_int(fw, " Endpoint Start: ", pci_rng->endpoint_start); + fwts_log_info_simp_int(fw, " PCI Segment Start: ", pci_rng->pci_seg_start); + fwts_log_info_simp_int(fw, " PCI Segment End: ", pci_rng->pci_seg_end); + fwts_log_info_simp_int(fw, " PCI BDF Start: ", pci_rng->pci_bdf_start); + fwts_log_info_simp_int(fw, " PCI BDF End: ", pci_rng->pci_bdf_end); + fwts_log_info_simp_int(fw, " PCI Segment End: ", pci_rng->output_node); + fwts_hexdump_data_prefix_all(fw, pci_rng->reserved, " ", sizeof(pci_rng->reserved)); + fwts_acpi_reserved_zero_array(fw, "VIOT", "Reserved", pci_rng->reserved, 6, &passed); + offset += sizeof(fwts_acpi_viot_pci_rng_node); + break; + case 2: + fwts_acpi_viot_mmio_ep_node *mmio_ep = (fwts_acpi_viot_mmio_ep_node *)(table->data + offset); + fwts_log_info_verbatim(fw, " Single MMIO Endpoint Node Structure:"); + fwts_log_info_simp_int(fw, " Type: ", mmio_ep->hdr.type); + fwts_log_info_simp_int(fw, " Reserved: ", mmio_ep->hdr.reserved); + fwts_acpi_reserved_zero("VIOT", "Reserved", mmio_ep->hdr.reserved, &passed); + fwts_log_info_simp_int(fw, " length: ", mmio_ep->hdr.length); + fwts_log_info_simp_int(fw, " Endpoint ID: ", mmio_ep->endpoint_id); + fwts_log_info_simp_int(fw, " Base Address: ", mmio_ep->base_addr); + fwts_log_info_simp_int(fw, " Output Node: ", mmio_ep->output_node); + fwts_hexdump_data_prefix_all(fw, mmio_ep->reserved, " ", sizeof(mmio_ep->reserved)); + fwts_acpi_reserved_zero_array(fw, "VIOT", "Reserved", mmio_ep->reserved, 6, &passed); + offset += sizeof(fwts_acpi_viot_mmio_ep_node); + break; + case 3: + fwts_acpi_viot_pci_iommu_node *pci_iommu = (fwts_acpi_viot_pci_iommu_node *)(table->data + offset); + fwts_log_info_verbatim(fw, " Virtio-iommu based on virtio-pci Node Structure:"); + fwts_log_info_simp_int(fw, " Type: ", pci_iommu->hdr.type); + fwts_log_info_simp_int(fw, " Reserved: ", pci_iommu->hdr.reserved); + fwts_acpi_reserved_zero("VIOT", "Reserved", pci_iommu->hdr.reserved, &passed); + fwts_log_info_simp_int(fw, " length: ", pci_iommu->hdr.length); + fwts_log_info_simp_int(fw, " PCI Segment: ", pci_iommu->pci_seg); + fwts_log_info_simp_int(fw, " PCI BDF Number: ", pci_iommu->pci_bdf_num); + fwts_log_info_simp_int(fw, " Reserved: ", pci_iommu->reserved); + fwts_acpi_reserved_zero("VIOT", "Reserved", pci_iommu->reserved, &passed); + offset += sizeof(fwts_acpi_viot_pci_iommu_node); + break; + case 4: + fwts_acpi_viot_mmio_iommu_node *mmio_iommu = (fwts_acpi_viot_mmio_iommu_node *)(table->data + offset); + fwts_log_info_verbatim(fw, " Virtio-iommu based on virtio-pci Node Structure:"); + fwts_log_info_simp_int(fw, " Type: ", mmio_iommu->hdr.type); + fwts_log_info_simp_int(fw, " Reserved: ", mmio_iommu->hdr.reserved); + fwts_acpi_reserved_zero("VIOT", "Reserved", mmio_iommu->hdr.reserved, &passed); + fwts_log_info_simp_int(fw, " length: ", mmio_iommu->hdr.length); + fwts_log_info_simp_int(fw, " Reserved: ", mmio_iommu->reserved); + fwts_acpi_reserved_zero("VIOT", "Reserved", mmio_iommu->reserved, &passed); + fwts_log_info_simp_int(fw, " Base Address: ", mmio_iommu->base_addr); + offset += sizeof(fwts_acpi_viot_mmio_iommu_node); + break; + case 0: + default: + passed = false; + fwts_failed(fw, LOG_LEVEL_HIGH, + "VIOTBadNodeType", + "VIOT node structure types must not have the value 0, 0x05..0xff, got " + "0x%2.2" PRIx8 " instead", node_hdr->type); + offset += node_hdr->length; + break; + } + + node_hdr = (fwts_acpi_viot_node_hdr *)(table->data + offset); + fwts_log_nl(fw); + } + + if (passed) + fwts_passed(fw, "No issues found in VIOT table."); + + return FWTS_OK; +} + +static fwts_framework_minor_test viot_tests[] = { + { viot_test1, "Validate VIOT table." }, + { NULL, NULL } +}; + +static fwts_framework_ops viot_ops = { + .description = "VIOT Virtual I/O Translation Table test.", + .init = VIOT_init, + .minor_tests = viot_tests +}; + +FWTS_REGISTER("viot", &viot_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ACPI) + +#endif diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h index 6b8ecefa..79763bab 100644 --- a/src/lib/include/fwts_acpi.h +++ b/src/lib/include/fwts_acpi.h @@ -2747,4 +2747,59 @@ typedef struct { uint64_t reserved; } __attribute__ ((packed)) fwts_acpi_table_ibft; +/* + * Virtual I/O Translation (VIOT) Table + * ACPI6.5 5.2.32 + */ +typedef struct +{ + + uint8_t type; + uint8_t reserved; + uint16_t length; +} __attribute__ ((packed)) fwts_acpi_viot_node_hdr; + +typedef struct +{ + fwts_acpi_viot_node_hdr hdr; + uint32_t endpoint_start; + uint16_t pci_seg_start; + uint16_t pci_seg_end; + uint16_t pci_bdf_start; + uint16_t pci_bdf_end; + uint16_t output_node; + uint8_t reserved[6]; +} __attribute__ ((packed)) fwts_acpi_viot_pci_rng_node; + +typedef struct +{ + fwts_acpi_viot_node_hdr hdr; + uint32_t endpoint_id; + uint64_t base_addr; + uint16_t output_node; + uint8_t reserved[6]; +} __attribute__ ((packed)) fwts_acpi_viot_mmio_ep_node; + +typedef struct +{ + fwts_acpi_viot_node_hdr hdr; + uint16_t pci_seg; + uint16_t pci_bdf_num; + uint64_t reserved; +} __attribute__ ((packed)) fwts_acpi_viot_pci_iommu_node; + +typedef struct +{ + fwts_acpi_viot_node_hdr hdr; + uint32_t reserved; + uint64_t base_addr; +} __attribute__ ((packed)) fwts_acpi_viot_mmio_iommu_node; + +typedef struct { + fwts_acpi_table_header header; + uint16_t node_count; + uint16_t node_offset; + uint64_t reserved; +} __attribute__ ((packed)) fwts_acpi_table_viot; + #endif From patchwork Tue Jan 9 12:21:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1884407 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 4T8VQw1KTsz1yP7 for ; Tue, 9 Jan 2024 23:21:28 +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 1rNB6h-0005oh-Ms; Tue, 09 Jan 2024 12:21:23 +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 1rNB6d-0005nt-Pa for fwts-devel@lists.ubuntu.com; Tue, 09 Jan 2024 12:21:19 +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 AE7503F6E6 for ; Tue, 9 Jan 2024 12:21:18 +0000 (UTC) From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/2] fwts-test: add regression tests for VIOT Date: Tue, 9 Jan 2024 20:21:10 +0800 Message-Id: <20240109122110.118791-2-ivan.hu@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240109122110.118791-1-ivan.hu@canonical.com> References: <20240109122110.118791-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 --- Makefile.am | 2 + fwts-test/viot-0001/acpidump-0001.log | 34 +++++++++++ fwts-test/viot-0001/acpidump-0002.log | 37 +++++++++++ fwts-test/viot-0001/test-0001.sh | 23 +++++++ fwts-test/viot-0001/test-0002.sh | 23 +++++++ fwts-test/viot-0001/viot-0001.log | 49 +++++++++++++++ fwts-test/viot-0001/viot-0002.log | 88 +++++++++++++++++++++++++++ 7 files changed, 256 insertions(+) create mode 100644 fwts-test/viot-0001/acpidump-0001.log create mode 100644 fwts-test/viot-0001/acpidump-0002.log create mode 100755 fwts-test/viot-0001/test-0001.sh create mode 100755 fwts-test/viot-0001/test-0002.sh create mode 100644 fwts-test/viot-0001/viot-0001.log create mode 100644 fwts-test/viot-0001/viot-0002.log diff --git a/Makefile.am b/Makefile.am index 46ee2a84..94081708 100644 --- a/Makefile.am +++ b/Makefile.am @@ -202,6 +202,8 @@ TESTS = fwts-test/acpidump-0001/test-0001.sh \ fwts-test/tpm2-0001/test-0002.sh \ fwts-test/uefi-0001/test-0001.sh \ fwts-test/uefi-0001/test-0002.sh \ + fwts-test/viot-0001/test-0001.sh \ + fwts-test/viot-0001/test-0002.sh \ fwts-test/waet-0001/test-0001.sh \ fwts-test/waet-0001/test-0002.sh \ fwts-test/waet-0001/test-0003.sh \ diff --git a/fwts-test/viot-0001/acpidump-0001.log b/fwts-test/viot-0001/acpidump-0001.log new file mode 100644 index 00000000..18d17916 --- /dev/null +++ b/fwts-test/viot-0001/acpidump-0001.log @@ -0,0 +1,34 @@ +FACS @ 0x00000000 + 0000: 46 41 43 53 40 00 00 00 00 00 00 00 00 00 00 00 FACS@........... + 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0020: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + +FACP @ 0x00000000 + 0000: 46 41 43 50 f4 00 00 00 03 f9 41 4d 44 20 20 20 FACP......AMD + 0010: 47 55 41 4d 20 20 20 20 00 00 04 06 41 4d 44 20 GUAM ....AMD + 0020: 40 42 0f 00 c0 2f e9 af 92 47 e8 af 00 02 09 00 @B.../...G...... + 0030: b0 00 00 00 f0 f1 00 00 00 80 00 00 00 00 00 00 ................ + 0040: 04 80 00 00 00 00 00 00 00 82 00 00 08 80 00 00 ................ + 0050: 20 80 00 00 00 00 00 00 04 02 01 04 08 00 00 00 ............... + 0060: 65 00 e9 03 00 00 00 00 01 00 0d 00 32 00 00 00 e...........2... + 0070: a5 c1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0080: 00 00 00 00 c0 2f e9 af 00 00 00 00 92 47 e8 af ...../.......G.. + 0090: 00 00 00 00 01 20 00 00 00 80 00 00 00 00 00 00 ..... .......... + 00a0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00 ................ + 00b0: 04 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 00c0: 00 00 00 00 01 08 00 00 00 82 00 00 00 00 00 00 ................ + 00d0: 01 20 00 00 08 80 00 00 00 00 00 00 01 40 00 00 . ...........@.. + 00e0: 20 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ............... + 00f0: 00 00 00 00 .... + +VIOT @ 0x00000000 + 0000: 56 49 4F 54 80 00 00 00 00 52 49 4E 54 45 4C 20 VIOT.....RINTEL + 0010: 54 65 6D 70 6C 61 74 65 00 00 00 00 49 4E 54 4C Template....INTL + 0020: 05 01 21 20 04 00 30 00 00 00 00 00 00 00 00 00 ..! ..0......... + 0030: 01 00 18 00 00 00 00 00 00 00 00 00 00 00 FF FF ................ + 0040: 60 00 00 00 00 00 00 00 02 00 18 00 00 00 01 00 `............... + 0050: 00 00 00 1C 00 00 00 00 70 00 00 00 00 00 00 00 ........p....... + 0060: 03 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0070: 04 00 10 00 00 00 00 00 00 00 00 1D 00 00 00 00 ................ diff --git a/fwts-test/viot-0001/acpidump-0002.log b/fwts-test/viot-0001/acpidump-0002.log new file mode 100644 index 00000000..7513d1d6 --- /dev/null +++ b/fwts-test/viot-0001/acpidump-0002.log @@ -0,0 +1,37 @@ +FACS @ 0x00000000 + 0000: 46 41 43 53 40 00 00 00 00 00 00 00 00 00 00 00 FACS@........... + 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0020: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + +FACP @ 0x00000000 + 0000: 46 41 43 50 f4 00 00 00 03 f9 41 4d 44 20 20 20 FACP......AMD + 0010: 47 55 41 4d 20 20 20 20 00 00 04 06 41 4d 44 20 GUAM ....AMD + 0020: 40 42 0f 00 c0 2f e9 af 92 47 e8 af 00 02 09 00 @B.../...G...... + 0030: b0 00 00 00 f0 f1 00 00 00 80 00 00 00 00 00 00 ................ + 0040: 04 80 00 00 00 00 00 00 00 82 00 00 08 80 00 00 ................ + 0050: 20 80 00 00 00 00 00 00 04 02 01 04 08 00 00 00 ............... + 0060: 65 00 e9 03 00 00 00 00 01 00 0d 00 32 00 00 00 e...........2... + 0070: a5 c1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0080: 00 00 00 00 c0 2f e9 af 00 00 00 00 92 47 e8 af ...../.......G.. + 0090: 00 00 00 00 01 20 00 00 00 80 00 00 00 00 00 00 ..... .......... + 00a0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00 ................ + 00b0: 04 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 00c0: 00 00 00 00 01 08 00 00 00 82 00 00 00 00 00 00 ................ + 00d0: 01 20 00 00 08 80 00 00 00 00 00 00 01 40 00 00 . ...........@.. + 00e0: 20 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ............... + 00f0: 00 00 00 00 .... + +VIOT @ 0x00000000 + 0000: 56 49 4F 54 B0 00 00 00 00 52 49 4E 54 45 4C 20 VIOT.....RINTEL + 0010: 54 65 6D 70 6C 61 74 65 00 00 00 00 49 4E 54 4C Template....INTL + 0020: 05 01 21 20 07 00 30 00 FF FF FF FF FF FF FF FF ..! ..0......... + 0030: 01 FF 18 00 00 00 00 00 00 00 00 00 00 00 FF FF ................ + 0040: 60 00 FF FF FF FF FF FF 02 FF 18 00 00 00 01 00 `............... + 0050: 00 00 00 1C 00 00 00 00 70 00 FF FF FF FF FF FF ........p....... + 0060: 03 FF 10 00 00 00 00 00 FF FF FF FF FF FF FF FF ................ + 0070: 04 FF 10 00 FF FF FF FF 00 00 00 1D 00 00 00 00 ................ + 0080: 00 FF 10 00 FF FF FF FF 00 00 00 1D 00 00 00 00 ................ + 0090: 06 FF 10 00 FF FF FF FF 00 00 00 1D 00 00 00 00 ................ + 00A0: 04 00 20 00 FF FF FF FF 00 00 00 1D 00 00 00 00 ................ diff --git a/fwts-test/viot-0001/test-0001.sh b/fwts-test/viot-0001/test-0001.sh new file mode 100755 index 00000000..2631a01d --- /dev/null +++ b/fwts-test/viot-0001/test-0001.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +TEST="Test acpitables against VIOT" +NAME=test-0001.sh +TMPLOG=$TMP/viot.log.$$ + +$FWTS --show-tests | grep viot > /dev/null +if [ $? -eq 1 ]; then + echo SKIP: $TEST, $NAME + exit 77 +fi + +$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/viot-0001/acpidump-0001.log viot - | cut -c7- | grep "^viot" > $TMPLOG +diff $TMPLOG $FWTSTESTDIR/viot-0001/viot-0001.log >> $FAILURE_LOG +ret=$? +if [ $ret -eq 0 ]; then + echo PASSED: $TEST, $NAME +else + echo FAILED: $TEST, $NAME +fi + +rm $TMPLOG +exit $ret diff --git a/fwts-test/viot-0001/test-0002.sh b/fwts-test/viot-0001/test-0002.sh new file mode 100755 index 00000000..e547b7ee --- /dev/null +++ b/fwts-test/viot-0001/test-0002.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +TEST="Test acpitables against VIOT" +NAME=test-0002.sh +TMPLOG=$TMP/viot.log.$$ + +$FWTS --show-tests | grep viot > /dev/null +if [ $? -eq 1 ]; then + echo SKIP: $TEST, $NAME + exit 77 +fi + +$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/viot-0001/acpidump-0002.log viot - | cut -c7- | grep "^viot" > $TMPLOG +diff $TMPLOG $FWTSTESTDIR/viot-0001/viot-0002.log >> $FAILURE_LOG +ret=$? +if [ $ret -eq 0 ]; then + echo PASSED: $TEST, $NAME +else + echo FAILED: $TEST, $NAME +fi + +rm $TMPLOG +exit $ret diff --git a/fwts-test/viot-0001/viot-0001.log b/fwts-test/viot-0001/viot-0001.log new file mode 100644 index 00000000..1b2e701d --- /dev/null +++ b/fwts-test/viot-0001/viot-0001.log @@ -0,0 +1,49 @@ +viot viot: VIOT Virtual I/O Translation Table test. +viot ---------------------------------------------------------- +viot Test 1 of 1: Validate VIOT table. +viot VIOT Virtual I/O Translation Table: +viot Node Count: 0x0004 +viot Node Offset: 0x0030 +viot Reserved: 0x0000000000000000 +viot PCI Range Node Structure: +viot Type: 0x01 +viot Reserved: 0x00 +viot length: 0x0018 +viot Endpoint Start: 0x00000000 +viot PCI Segment Start: 0x0000 +viot PCI Segment End: 0x0000 +viot PCI BDF Start: 0x0000 +viot PCI BDF End: 0xffff +viot PCI Segment End: 0x0060 +viot 00 00 00 00 00 00 +viot +viot Single MMIO Endpoint Node Structure: +viot Type: 0x02 +viot Reserved: 0x00 +viot length: 0x0018 +viot Endpoint ID: 0x00010000 +viot Base Address: 0x000000001c000000 +viot Output Node: 0x0070 +viot 00 00 00 00 00 00 +viot +viot Virtio-iommu based on virtio-pci Node Structure: +viot Type: 0x03 +viot Reserved: 0x00 +viot length: 0x0010 +viot PCI Segment: 0x0000 +viot PCI BDF Number: 0x0000 +viot Reserved: 0x0000000000000000 +viot +viot Virtio-iommu based on virtio-pci Node Structure: +viot Type: 0x04 +viot Reserved: 0x00 +viot length: 0x0010 +viot Reserved: 0x00000000 +viot Base Address: 0x000000001d000000 +viot +viot PASSED: Test 1, No issues found in VIOT table. +viot +viot ========================================================== +viot 1 passed, 0 failed, 0 warning, 0 aborted, 0 skipped, 0 +viot info only. +viot ========================================================== diff --git a/fwts-test/viot-0001/viot-0002.log b/fwts-test/viot-0001/viot-0002.log new file mode 100644 index 00000000..12aa31c9 --- /dev/null +++ b/fwts-test/viot-0001/viot-0002.log @@ -0,0 +1,88 @@ +viot viot: VIOT Virtual I/O Translation Table test. +viot ---------------------------------------------------------- +viot Test 1 of 1: Validate VIOT table. +viot VIOT Virtual I/O Translation Table: +viot Node Count: 0x0007 +viot Node Offset: 0x0030 +viot Reserved: 0xffffffffffffffff +viot FAILED [MEDIUM] VIOTReservedNonZero: Test 1, VIOT Reserved +viot field must be zero, got 0xffffffffffffffff instead +viot PCI Range Node Structure: +viot Type: 0x01 +viot Reserved: 0xff +viot FAILED [MEDIUM] VIOTReservedNonZero: Test 1, VIOT Reserved +viot field must be zero, got 0xff instead +viot length: 0x0018 +viot Endpoint Start: 0x00000000 +viot PCI Segment Start: 0x0000 +viot PCI Segment End: 0x0000 +viot PCI BDF Start: 0x0000 +viot PCI BDF End: 0xffff +viot PCI Segment End: 0x0060 +viot FF FF FF FF FF FF +viot FAILED [MEDIUM] VIOTReservedNonZero: Test 1, VIOT Reserved +viot field must be all zero, got below instead +viot Reserved [00] = 0xff +viot Reserved [01] = 0xff +viot Reserved [02] = 0xff +viot Reserved [03] = 0xff +viot Reserved [04] = 0xff +viot Reserved [05] = 0xff +viot +viot Single MMIO Endpoint Node Structure: +viot Type: 0x02 +viot Reserved: 0xff +viot FAILED [MEDIUM] VIOTReservedNonZero: Test 1, VIOT Reserved +viot field must be zero, got 0xff instead +viot length: 0x0018 +viot Endpoint ID: 0x00010000 +viot Base Address: 0x000000001c000000 +viot Output Node: 0x0070 +viot FF FF FF FF FF FF +viot FAILED [MEDIUM] VIOTReservedNonZero: Test 1, VIOT Reserved +viot field must be all zero, got below instead +viot Reserved [00] = 0xff +viot Reserved [01] = 0xff +viot Reserved [02] = 0xff +viot Reserved [03] = 0xff +viot Reserved [04] = 0xff +viot Reserved [05] = 0xff +viot +viot Virtio-iommu based on virtio-pci Node Structure: +viot Type: 0x03 +viot Reserved: 0xff +viot FAILED [MEDIUM] VIOTReservedNonZero: Test 1, VIOT Reserved +viot field must be zero, got 0xff instead +viot length: 0x0010 +viot PCI Segment: 0x0000 +viot PCI BDF Number: 0x0000 +viot Reserved: 0xffffffffffffffff +viot FAILED [MEDIUM] VIOTReservedNonZero: Test 1, VIOT Reserved +viot field must be zero, got 0xffffffffffffffff instead +viot +viot Virtio-iommu based on virtio-pci Node Structure: +viot Type: 0x04 +viot Reserved: 0xff +viot FAILED [MEDIUM] VIOTReservedNonZero: Test 1, VIOT Reserved +viot field must be zero, got 0xff instead +viot length: 0x0010 +viot Reserved: 0xffffffff +viot FAILED [MEDIUM] VIOTReservedNonZero: Test 1, VIOT Reserved +viot field must be zero, got 0xffffffff instead +viot Base Address: 0x000000001d000000 +viot +viot FAILED [HIGH] VIOTBadNodeType: Test 1, VIOT node structure +viot types must not have the value 0, 0x05..0xff, got 0x00 +viot instead +viot +viot FAILED [HIGH] VIOTBadNodeType: Test 1, VIOT node structure +viot types must not have the value 0, 0x05..0xff, got 0x06 +viot instead +viot +viot FAILED [HIGH] VIOTOutOfRangeOffset: Test 1, VIOT Node Data +viot Offset is out of range. +viot +viot ========================================================== +viot 0 passed, 12 failed, 0 warning, 0 aborted, 0 skipped, 0 +viot info only. +viot ==========================================================