From patchwork Fri Apr 21 07:39:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1771715 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=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=omV84lSa; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (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 4Q2mdW5hqjz23tD for ; Fri, 21 Apr 2023 17:39:59 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pplN3-0007Hd-V8; Fri, 21 Apr 2023 07:39:53 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pplN1-0007HR-8r for fwts-devel@lists.ubuntu.com; Fri, 21 Apr 2023 07:39:51 +0000 Received: from canonical.com (unknown [106.104.136.95]) (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 C54FE3F558 for ; Fri, 21 Apr 2023 07:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1682062790; bh=Kpslyd6UEsfBIpMGbSEDhLCyg5Y5y+5Te1WKjNFf9A8=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=omV84lSabAXS89RVUitmxXS3x9iBFXSRWxjKY6J5vFBxlILbhN2PuovTlWxfaDBwl +8Skq+zKo3VfKDuL+lXR0cRTeGFXWHxjQaiqqxa1LwatlFKItbZnRtTHjjX/hN2klg DHMZ0hZOqmDBmTulX3YPhnE+mGrBo5hfJmXMgowHSVxOSFGPAgF26PhlbeO5q9yRf9 4XJVbh/RNIbwJ9pwwfoCdonQbEQLOxkJahLHPmGsGnfFdsW1SVz2zPr4C9MGTLCA5S aT2MPRQOmlF23hWM8uPmNyAa4mIPHlgdt1kv3f8EB3Ry7X6aHBlGf4QFYpAHZuFofe JF1OjhskQoVwQ== From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/2] acpi: ivrs: add tests for ACPI IVRS table Date: Fri, 21 Apr 2023 15:39:40 +0800 Message-Id: <20230421073941.34588-1-ivan.hu@canonical.com> X-Mailer: git-send-email 2.25.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/2017208 Signed-off-by: Ivan Hu --- src/Makefile.am | 1 + src/acpi/ivrs/ivrs.c | 233 ++++++++++++++++++++++++++++++++++++ src/lib/include/fwts_acpi.h | 47 ++++++++ 3 files changed, 281 insertions(+) create mode 100644 src/acpi/ivrs/ivrs.c diff --git a/src/Makefile.am b/src/Makefile.am index 9f348ad1..c6dcd421 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -107,6 +107,7 @@ fwts_SOURCES = main.c \ acpi/hpet/hpet.c \ acpi/hmat/hmat.c \ acpi/iort/iort.c \ + acpi/ivrs/ivrs.c \ acpi/lid/lid.c \ acpi/lpit/lpit.c \ acpi/madt/madt.c \ diff --git a/src/acpi/ivrs/ivrs.c b/src/acpi/ivrs/ivrs.c new file mode 100644 index 00000000..a9170cb5 --- /dev/null +++ b/src/acpi/ivrs/ivrs.c @@ -0,0 +1,233 @@ +/* + * Copyright (C) 2023 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#include "fwts.h" + +#if defined(FWTS_HAS_ACPI) + +#include +#include +#include +#include +#include + +static fwts_acpi_table_info *table; +acpi_table_init(IVRS, &table) + +static void ivrs_ivhd_device_entries_check( + fwts_framework *fw, + const uint8_t *entries, + const uint16_t entries_len, + bool *passed) +{ + uint8_t type_range = entries[0] >> 6; + uint16_t offset = 0; + + while (offset < entries_len) { + type_range = entries[offset] >> 6; + if (type_range == 0) { + fwts_acpi_reserved_type(fw, "IVRS", entries[offset], 1, 5, passed); + offset += 4; + + } else if (type_range == 1) { + if (entries[offset] < 66 || entries[offset] == 68 || entries[offset] == 68 || entries[offset] > 72) { + fwts_failed(fw, LOG_LEVEL_HIGH, + "IVRSBadType", + "IVRS must have device entry types 66..67 or 70..72" + ", got %" PRId8 " instead", entries[offset]); + *passed = false; + } + offset += 8; + } else + break; + } +} + +static void ivrs_ivhd_10_test( + fwts_framework *fw, + const fwts_acpi_table_ivhd_10 *entry, + bool *passed) +{ + + uint16_t entries_len = entry->ivhd.length - sizeof(fwts_acpi_table_ivhd_10); + + fwts_log_info_verbatim(fw, " I/O Virtualization Hardware Definition Type 10h:"); + fwts_log_info_simp_int(fw, " Type: ", entry->ivhd.type); + fwts_log_info_simp_int(fw, " Flags: ", entry->ivhd.flags); + fwts_log_info_simp_int(fw, " Length: ", entry->ivhd.length); + fwts_log_info_simp_int(fw, " DeviceID: ", entry->ivhd.device_id); + fwts_log_info_simp_int(fw, " Capability Offset: ", entry->ivhd.capability_offset); + fwts_log_info_simp_int(fw, " IOMMU Base Address: ", entry->ivhd.iommu_base_address); + fwts_log_info_simp_int(fw, " PCI Segment Group: ", entry->ivhd.pci_seg_group); + fwts_log_info_simp_int(fw, " IOMMU Info: ", entry->ivhd.iommu_info); + fwts_log_info_simp_int(fw, " IOMMU Feature Reporting: ", entry->iommu_feature_reoprt); + + fwts_acpi_reserved_bits("IVRS", "IOMMU Info", entry->ivhd.iommu_info, 5, 7, passed); + fwts_acpi_reserved_bits("IVRS", "IOMMU Info", entry->ivhd.iommu_info, 13, 15, passed); + + ivrs_ivhd_device_entries_check(fw, entry->ivhd_device_entries,entries_len , passed); +} + +static void ivrs_ivhd_11_40_test( + fwts_framework *fw, + const fwts_acpi_table_ivhd_11_40 *entry, + bool *passed) +{ + + uint16_t entries_len = entry->ivhd.length - sizeof(fwts_acpi_table_ivhd_11_40); + + fwts_log_info_simp_int(fw, " Type: ", entry->ivhd.type); + fwts_log_info_simp_int(fw, " Flags: ", entry->ivhd.flags); + fwts_log_info_simp_int(fw, " Length: ", entry->ivhd.length); + fwts_log_info_simp_int(fw, " DeviceID: ", entry->ivhd.device_id); + fwts_log_info_simp_int(fw, " Capability Offset: ", entry->ivhd.capability_offset); + fwts_log_info_simp_int(fw, " IOMMU Base Address: ", entry->ivhd.iommu_base_address); + fwts_log_info_simp_int(fw, " PCI Segment Group: ", entry->ivhd.pci_seg_group); + fwts_log_info_simp_int(fw, " IOMMU Info: ", entry->ivhd.iommu_info); + fwts_log_info_simp_int(fw, " IOMMU Attribute: ", entry->iommu_attr); + fwts_log_info_simp_int(fw, " EFR Register Image: ", entry->efr_reg_image); + fwts_log_info_simp_int(fw, " WFR Register Image 2: ", entry->efr_reg_image_2); + fwts_acpi_reserved_bits("IVRS", "Flags", entry->ivhd.flags, 6, 7, passed); + fwts_acpi_reserved_bits("IVRS", "IOMMU Info", entry->ivhd.iommu_info, 5, 7, passed); + fwts_acpi_reserved_bits("IVRS", "IOMMU Info", entry->ivhd.iommu_info, 13, 15, passed); + fwts_acpi_reserved_bits("IVRS", "IOMMU Attribute", entry->iommu_attr, 0, 12, passed); + fwts_acpi_reserved_bits("IVRS", "IOMMU Attribute", entry->iommu_attr, 28, 31, passed); + + ivrs_ivhd_device_entries_check(fw, entry->ivhd_device_entries, entries_len, passed); +} + +static void ivrs_ivmd_test( + fwts_framework *fw, + const fwts_acpi_table_ivmd *entry, + bool *passed) +{ + fwts_log_info_verbatim(fw, " I/O Virtualization Memory Definition:"); + fwts_log_info_simp_int(fw, " Type: ", entry->type); + fwts_log_info_simp_int(fw, " Flags: ", entry->flags); + fwts_log_info_simp_int(fw, " Length: ", entry->length); + fwts_log_info_simp_int(fw, " DeviceID: ", entry->device_id); + fwts_log_info_simp_int(fw, " Auxiliary data: ", entry->auxiliary_data); + fwts_log_info_simp_int(fw, " Reserved: ", entry->reserved); + fwts_log_info_simp_int(fw, " PCI Segment Group: ", entry->pci_seg_group); + fwts_log_info_simp_int(fw, " Start address: ", entry->start_address); + fwts_log_info_simp_int(fw, " Memory block length: ", entry->mem_block_len); + + fwts_acpi_reserved_bits("IVRS", "Flags", entry->flags, 4, 7, passed); + fwts_acpi_reserved_zero("IVRS", "Reserved", entry->reserved, passed); + +} + +static int ivrs_test1(fwts_framework *fw) +{ + bool passed = true; + fwts_acpi_table_ivrs *ivrs = (fwts_acpi_table_ivrs *)table->data; + fwts_acpi_table_ivhd *entry; + + uint32_t offset; + + if (!fwts_acpi_table_length(fw, "IVRS", table->length, sizeof(fwts_acpi_table_ivrs))) + return FWTS_OK; + + fwts_log_info_verbatim(fw, "IVRS I/O Virtualization Reporting Structure:"); + + fwts_log_info_simp_int(fw, " IVinfo: ", ivrs->ivinfo); + fwts_log_info_simp_int(fw, " Reserved: ", ivrs->reserved); + fwts_log_nl(fw); + + if (ivrs->header.revision == 0 || ivrs->header.revision > 2) { + passed = false; + fwts_failed(fw, LOG_LEVEL_HIGH, + "IVRSBadRevision", + "IVRS format revision number must have the value with 1 or 2, got " + "0x%2.2" PRIx8 "instead", ivrs->header.revision); + } + fwts_acpi_reserved_bits("IVRS", "IVinfo", ivrs->ivinfo, 2, 4, &passed); + fwts_acpi_reserved_bits("IVRS", "IVinfo", ivrs->ivinfo, 23, 31, &passed); + fwts_acpi_reserved_zero("IVRS", "Reserved", ivrs->reserved, &passed); + + entry = (fwts_acpi_table_ivhd *) (table->data + sizeof(fwts_acpi_table_ivrs)); + offset = sizeof(fwts_acpi_table_ivrs); + + while (offset < table->length) { + + switch(entry->type) { + case 0x10: + ivrs_ivhd_10_test(fw, (fwts_acpi_table_ivhd_10 *)entry, &passed); + offset += entry->length; + break; + case 0x11: + fwts_log_info_verbatim(fw, " I/O Virtualization Hardware Definition Type 11h:"); + ivrs_ivhd_11_40_test(fw, (fwts_acpi_table_ivhd_11_40 *)entry, &passed); + offset += entry->length; + break; + case 0x40: + fwts_log_info_verbatim(fw, " I/O Virtualization Hardware Definition Type 40h:"); + if (ivrs->header.revision != 2) { + passed = false; + fwts_failed(fw, LOG_LEVEL_HIGH, + "IVRSBadRevision", + "IVRS only allows the inclusion of IVHD type 40h on the revision 2, got " + "0x%2.2" PRIx8 "instead", ivrs->header.revision); + } + ivrs_ivhd_11_40_test(fw, (fwts_acpi_table_ivhd_11_40 *)entry, &passed); + offset += entry->length; + break; + case 0x20: + case 0x21: + case 0x22: + ivrs_ivmd_test(fw, (fwts_acpi_table_ivmd *)entry, &passed); + offset += entry->length; + break; + default: + passed = false; + fwts_failed(fw, LOG_LEVEL_HIGH, + "IVRSBadIVHDType", + "IVHD or IVMD must have type with Type 0x10, 0x11, 0x20 to 0x22 " + "and 0x40 , got 0x%2.2" PRIx8 " instead", entry->type); + break; + } + + if (fwts_acpi_structure_range(fw, "IVRS", table->length, offset)) { + passed = false; + break; + } + + entry = (fwts_acpi_table_ivhd *) (table->data + offset); + fwts_log_nl(fw); + } + + if (passed) + fwts_passed(fw, "No issues found in IVRS table."); + + return FWTS_OK; +} + +static fwts_framework_minor_test ivrs_tests[] = { + { ivrs_test1, "Validate IVRS table." }, + { NULL, NULL } +}; + +static fwts_framework_ops ivrs_ops = { + .description = "IVRS I/O Virtualization Reporting Structure test.", + .init = IVRS_init, + .minor_tests = ivrs_tests +}; + +FWTS_REGISTER("ivrs", &ivrs_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 76290ffb..7d8d4682 100644 --- a/src/lib/include/fwts_acpi.h +++ b/src/lib/include/fwts_acpi.h @@ -2475,4 +2475,51 @@ typedef struct { uint8_t reserved1[3]; } __attribute__ ((packed)) fwts_acpi_table_aest_interrupt; +/* + * ACPI IVRS (I/O Virtualization Reporting Structure) + * https://www.amd.com/system/files/TechDocs/48882_3.07_PUB.pdf + */ +typedef struct { + fwts_acpi_table_header header; + uint32_t ivinfo; + uint64_t reserved; +} __attribute__ ((packed)) fwts_acpi_table_ivrs; + +typedef struct { + uint8_t type; + uint8_t flags; + uint16_t length; + uint16_t device_id; + uint16_t capability_offset; + uint64_t iommu_base_address; + uint16_t pci_seg_group; + uint16_t iommu_info; +} __attribute__ ((packed)) fwts_acpi_table_ivhd; + +typedef struct { + fwts_acpi_table_ivhd ivhd; + uint32_t iommu_feature_reoprt; + uint8_t ivhd_device_entries[0]; +} __attribute__ ((packed)) fwts_acpi_table_ivhd_10; + +typedef struct { + fwts_acpi_table_ivhd ivhd; + uint32_t iommu_attr; + uint64_t efr_reg_image; + uint64_t efr_reg_image_2; + uint8_t ivhd_device_entries[0]; +} __attribute__ ((packed)) fwts_acpi_table_ivhd_11_40; + +typedef struct { + uint8_t type; + uint8_t flags; + uint16_t length; + uint16_t device_id; + uint16_t auxiliary_data; + uint64_t reserved; + uint16_t pci_seg_group; + uint64_t start_address; + uint64_t mem_block_len; +} __attribute__ ((packed)) fwts_acpi_table_ivmd; + #endif From patchwork Fri Apr 21 07:39:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1771716 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=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=Hzurv3sa; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (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 4Q2mdb58XTz23tD for ; Fri, 21 Apr 2023 17:40:03 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pplNA-0007Ic-3M; Fri, 21 Apr 2023 07:40:00 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pplN6-0007I5-QF for fwts-devel@lists.ubuntu.com; Fri, 21 Apr 2023 07:39:56 +0000 Received: from canonical.com (unknown [106.104.136.95]) (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-0.canonical.com (Postfix) with ESMTPSA id 53D6C3F31B for ; Fri, 21 Apr 2023 07:39:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1682062796; bh=9qW9nSM3bhXi6iWmY4o5dE3yZJU+8pxLxgk/ylHTMGo=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Hzurv3saKdOr5ccOyhGaJ9a9WvnyNRG58A/38btEZjifgg7iZHWfNPkN4T+f1PSzR CHd1HvemDOfZtyrj3vmeFKfhkgwLNXMe6yjAEjIS9WC5cob4uT3lZyRLdBl1DzAouQ ARk0P4RZODps1nB4DPmRzFfAVuZwnW5jUOuL8qF3tXn9/FaJ+R8pBl7y+tPaM6olEC hVHyiWe+MfM6y3YMPhy2lPuxQ+Og3fKgLkEYzo/qB6vWnKi5hJLYtxeNjiran9vXTo R/upqeGV2dq3NS/K0TF5unOyzv6mnTpmXh4ZJy3GV12oqfShpMwMhmMHpthv8In51w kV6EKpMZ4nI3g== From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/2] fwts-test: add regression tests for IVRS Date: Fri, 21 Apr 2023 15:39:41 +0800 Message-Id: <20230421073941.34588-2-ivan.hu@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230421073941.34588-1-ivan.hu@canonical.com> References: <20230421073941.34588-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/ivrs-0001/acpidump-0001.log | 59 ++++++++++++++ fwts-test/ivrs-0001/acpidump-0002.log | 59 ++++++++++++++ fwts-test/ivrs-0001/ivrs-0001.log | 83 +++++++++++++++++++ fwts-test/ivrs-0001/ivrs-0002.log | 111 ++++++++++++++++++++++++++ fwts-test/ivrs-0001/test-0001.sh | 23 ++++++ fwts-test/ivrs-0001/test-0002.sh | 23 ++++++ 7 files changed, 360 insertions(+) create mode 100644 fwts-test/ivrs-0001/acpidump-0001.log create mode 100644 fwts-test/ivrs-0001/acpidump-0002.log create mode 100644 fwts-test/ivrs-0001/ivrs-0001.log create mode 100644 fwts-test/ivrs-0001/ivrs-0002.log create mode 100755 fwts-test/ivrs-0001/test-0001.sh create mode 100755 fwts-test/ivrs-0001/test-0002.sh diff --git a/Makefile.am b/Makefile.am index c3c13514..58f5bbe2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -126,6 +126,8 @@ TESTS = fwts-test/acpidump-0001/test-0001.sh \ fwts-test/hmat-0001/test-0002.sh \ fwts-test/iort-0001/test-0001.sh \ fwts-test/iort-0001/test-0002.sh \ + fwts-test/ivrs-0001/test-0001.sh \ + fwts-test/ivrs-0001/test-0002.sh \ fwts-test/klog-0001/test-0001.sh \ fwts-test/klog-0001/test-0002.sh \ fwts-test/klog-0001/test-0003.sh \ diff --git a/fwts-test/ivrs-0001/acpidump-0001.log b/fwts-test/ivrs-0001/acpidump-0001.log new file mode 100644 index 00000000..a5ed2d1c --- /dev/null +++ b/fwts-test/ivrs-0001/acpidump-0001.log @@ -0,0 +1,59 @@ +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 .... + +IVRS @ 0x00000000 + 0000: 49 56 52 53 10 02 00 00 02 6C 49 4E 54 45 4C 20 IVRS.....lINTEL + 0010: 54 45 4D 50 4C 41 54 45 01 00 00 00 49 4E 54 4C TEMPLATE....INTL + 0020: 31 03 21 20 41 30 20 00 00 00 00 00 00 00 00 00 1.! A0 ......... + 0030: 10 B0 64 00 02 00 40 00 00 00 F0 FD 00 00 00 00 ..d...@......... + 0040: 00 00 00 00 6F 8F 04 80 03 08 00 00 01 08 00 00 ....o........... + 0050: 02 08 00 00 04 FE FF 00 42 00 FF 00 00 A5 00 00 ........B....... + 0060: 43 00 FF 00 00 A5 00 00 46 00 FF 00 44 33 22 11 C.......F...D3". + 0070: 47 00 FF 00 44 33 22 11 04 FF FF 00 48 00 00 00 G...D3".....H... + 0080: 00 A0 00 02 48 00 00 D7 21 A0 00 01 48 00 00 00 ....H...!...H... + 0090: 22 01 00 01 11 30 48 00 02 00 40 00 00 00 F0 FD ".....H...@..... + 00a0: 00 00 00 00 00 00 00 00 00 00 04 00 DE 4A 25 22 .............J%" + 00b0: EF 73 6D 20 00 00 00 00 00 00 00 00 03 08 00 00 .sm ............ + 00c0: 04 FE FF 00 43 00 FF 00 00 A5 00 00 04 FF FF 00 ....C........... + 00d0: 01 00 00 00 48 00 00 00 00 A0 00 02 40 30 D4 00 ....H.......@... + 00e0: 02 00 40 00 00 00 F0 FD 00 00 00 00 00 00 00 00 ..@............. + 00f0: 00 00 04 00 DE 4A 25 22 EF 73 6D 20 00 00 00 00 .....J%".sm .... + 0100: 00 00 00 00 03 08 00 00 04 FE FF 00 43 00 FF 00 ............C... + 0110: 00 A5 00 00 04 FF FF 00 03 00 00 00 48 00 00 00 ............H... + 0120: 00 A0 00 02 48 00 00 D7 21 A0 00 01 48 00 00 00 ....H...!...H... + 0130: 22 01 00 01 F0 A5 00 40 49 4E 54 43 30 30 32 30 "......@INTC0020 + 0140: 00 00 00 00 00 00 00 00 02 09 5C 5F 53 42 2E 44 ..........\_SB.D + 0150: 45 56 30 F0 A5 00 40 49 4E 54 43 30 30 32 30 00 EV0...@INTC0020. + 0160: 00 00 00 00 00 00 00 02 09 5C 5F 53 42 2E 44 45 .........\_SB.DE + 0170: 56 31 F0 A5 00 40 49 4E 54 43 30 30 32 30 00 00 V1...@INTC0020.. + 0180: 00 00 00 00 00 00 02 09 5C 5F 53 42 2E 44 45 56 ........\_SB.DEV + 0190: 32 F0 A5 00 40 49 4E 54 43 30 30 32 30 00 00 00 2...@INTC0020... + 01a0: 00 00 00 00 00 02 09 5C 5F 53 42 2E 44 45 56 33 .......\_SB.DEV3 + 01b0: 20 0D 20 00 22 11 00 00 00 00 00 00 00 00 00 00 . ."........... + 01c0: CD AB 78 56 34 12 00 00 DC FE 00 00 00 00 00 00 ..xV4........... + 01d0: 21 0D 20 00 22 11 00 00 00 00 00 00 00 00 00 00 !. ."........... + 01e0: CD AB 78 56 34 12 00 00 DC FE 00 00 00 00 00 00 ..xV4........... + 01f0: 22 0D 20 00 22 11 00 00 00 00 00 00 00 00 00 00 ". ."........... + 0200: CD AB 78 56 34 12 00 00 DC FE 00 00 00 00 00 00 ..xV4........... diff --git a/fwts-test/ivrs-0001/acpidump-0002.log b/fwts-test/ivrs-0001/acpidump-0002.log new file mode 100644 index 00000000..66007a8e --- /dev/null +++ b/fwts-test/ivrs-0001/acpidump-0002.log @@ -0,0 +1,59 @@ +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 .... + +IVRS @ 0x00000000 + 0000: 49 56 52 53 10 02 00 00 02 6C 49 4E 54 45 4C 20 IVRS.....lINTEL + 0010: 54 45 4D 50 4C 41 54 45 01 00 00 00 49 4E 54 4C TEMPLATE....INTL + 0020: 31 03 21 20 44 30 20 07 00 00 00 00 CC 00 00 00 1.! A0 ......... + 0030: 10 B0 64 00 02 00 40 00 00 00 F0 FD 00 00 00 00 ..d...@......... + 0040: 00 00 20 40 6F 8F 04 80 03 08 00 00 01 08 00 00 ....o........... + 0050: 02 08 00 00 04 FE FF 00 42 00 FF 00 00 A5 00 00 ........B....... + 0060: 43 00 FF 00 00 A5 00 00 46 00 FF 00 44 33 22 11 C.......F...D3". + 0070: 47 00 FF 00 44 33 22 11 04 FF FF 00 48 00 00 00 G...D3".....H... + 0080: 00 A0 00 02 48 00 00 D7 21 A0 00 01 44 00 00 00 ....H...!...H... + 0090: 22 01 00 01 11 30 48 00 02 00 40 00 00 00 F0 FD ".....H...@..... + 00a0: 00 00 00 00 00 00 00 00 00 02 04 00 DE 4A 25 22 .............J%" + 00b0: EF 73 6D 20 00 00 00 00 00 00 00 00 03 08 00 00 .sm ............ + 00c0: 04 FE FF 00 43 00 FF 00 00 A5 00 00 04 FF FF 00 ....C........... + 00d0: 00 00 00 00 48 00 00 00 00 A0 00 02 40 30 D4 00 ....H.......@... + 00e0: 02 00 40 00 00 00 F0 FD 00 00 00 00 00 00 00 00 ..@............. + 00f0: 04 02 04 F0 DE 4A 25 22 EF 73 6D 20 00 00 00 00 .....J%".sm .... + 0100: 00 00 00 00 03 08 00 00 04 FE FF 00 43 00 FF 00 ............C... + 0110: 00 A5 00 00 04 FF FF 00 00 00 00 00 48 00 00 00 ............H... + 0120: 00 A0 00 02 48 00 00 D7 21 A0 00 01 48 00 00 00 ....H...!...H... + 0130: 22 01 00 01 F0 A5 00 40 49 4E 54 43 30 30 32 30 "......@INTC0020 + 0140: 00 00 00 00 00 00 00 00 02 09 5C 5F 53 42 2E 44 ..........\_SB.D + 0150: 45 56 30 F0 A5 00 40 49 4E 54 43 30 30 32 30 00 EV0...@INTC0020. + 0160: 00 00 00 00 00 00 00 02 09 5C 5F 53 42 2E 44 45 .........\_SB.DE + 0170: 56 31 F0 A5 00 40 49 4E 54 43 30 30 32 30 00 00 V1...@INTC0020.. + 0180: 00 00 00 00 00 00 02 09 5C 5F 53 42 2E 44 45 56 ........\_SB.DEV + 0190: 32 F0 A5 00 40 49 4E 54 43 30 30 32 30 00 00 00 2...@INTC0020... + 01a0: 00 00 00 00 00 02 09 5C 5F 53 42 2E 44 45 56 33 .......\_SB.DEV3 + 01b0: 20 1D 20 00 22 11 00 00 00 00 00 00 00 00 00 00 . ."........... + 01c0: CD AB 78 56 34 12 00 00 DC FE 00 00 00 00 00 00 ..xV4........... + 01d0: 21 0D 20 00 22 11 00 00 00 00 00 00 00 00 00 00 !. ."........... + 01e0: CD AB 78 56 34 12 00 00 DC FE 00 00 00 00 00 00 ..xV4........... + 01f0: 22 0D 20 00 22 11 00 00 00 00 00 00 00 FF 00 00 ". ."........... + 0200: CD AB 78 56 34 12 00 00 DC FE 00 00 00 00 00 00 ..xV4........... diff --git a/fwts-test/ivrs-0001/ivrs-0001.log b/fwts-test/ivrs-0001/ivrs-0001.log new file mode 100644 index 00000000..0281c287 --- /dev/null +++ b/fwts-test/ivrs-0001/ivrs-0001.log @@ -0,0 +1,83 @@ +ivrs ivrs: IVRS I/O Virtualization Reporting Structure test. +ivrs ---------------------------------------------------------- +ivrs Test 1 of 1: Validate IVRS table. +ivrs IVRS I/O Virtualization Reporting Structure: +ivrs IVinfo: 0x00203041 +ivrs Reserved: 0x0000000000000000 +ivrs +ivrs I/O Virtualization Hardware Definition Type 10h: +ivrs Type: 0x10 +ivrs Flags: 0xb0 +ivrs Length: 0x0064 +ivrs DeviceID: 0x0002 +ivrs Capability Offset: 0x0040 +ivrs IOMMU Base Address: 0x00000000fdf00000 +ivrs PCI Segment Group: 0x0000 +ivrs IOMMU Info: 0x0000 +ivrs IOMMU Feature Reporting: 0x80048f6f +ivrs +ivrs I/O Virtualization Hardware Definition Type 11h: +ivrs Type: 0x11 +ivrs Flags: 0x30 +ivrs Length: 0x0048 +ivrs DeviceID: 0x0002 +ivrs Capability Offset: 0x0040 +ivrs IOMMU Base Address: 0x00000000fdf00000 +ivrs PCI Segment Group: 0x0000 +ivrs IOMMU Info: 0x0000 +ivrs IOMMU Attribute: 0x00040000 +ivrs EFR Register Image: 0x206d73ef22254ade +ivrs WFR Register Image 2: 0x0000000000000000 +ivrs +ivrs I/O Virtualization Hardware Definition Type 40h: +ivrs Type: 0x40 +ivrs Flags: 0x30 +ivrs Length: 0x00d4 +ivrs DeviceID: 0x0002 +ivrs Capability Offset: 0x0040 +ivrs IOMMU Base Address: 0x00000000fdf00000 +ivrs PCI Segment Group: 0x0000 +ivrs IOMMU Info: 0x0000 +ivrs IOMMU Attribute: 0x00040000 +ivrs EFR Register Image: 0x206d73ef22254ade +ivrs WFR Register Image 2: 0x0000000000000000 +ivrs +ivrs I/O Virtualization Memory Definition: +ivrs Type: 0x20 +ivrs Flags: 0x0d +ivrs Length: 0x0020 +ivrs DeviceID: 0x1122 +ivrs Auxiliary data: 0x0000 +ivrs Reserved: 0x0000000000000000 +ivrs PCI Segment Group: 0xabcd +ivrs Start address: 0xfedc000012345678 +ivrs Memory block length: 0x0d21000000000000 +ivrs +ivrs I/O Virtualization Memory Definition: +ivrs Type: 0x21 +ivrs Flags: 0x0d +ivrs Length: 0x0020 +ivrs DeviceID: 0x1122 +ivrs Auxiliary data: 0x0000 +ivrs Reserved: 0x0000000000000000 +ivrs PCI Segment Group: 0xabcd +ivrs Start address: 0xfedc000012345678 +ivrs Memory block length: 0x0d22000000000000 +ivrs +ivrs I/O Virtualization Memory Definition: +ivrs Type: 0x22 +ivrs Flags: 0x0d +ivrs Length: 0x0020 +ivrs DeviceID: 0x1122 +ivrs Auxiliary data: 0x0000 +ivrs Reserved: 0x0000000000000000 +ivrs PCI Segment Group: 0xabcd +ivrs Start address: 0xfedc000012345678 +ivrs Memory block length: 0x0000000000000000 +ivrs +ivrs PASSED: Test 1, No issues found in IVRS table. +ivrs +ivrs ========================================================== +ivrs 1 passed, 0 failed, 0 warning, 0 aborted, 0 skipped, 0 +ivrs info only. +ivrs ========================================================== diff --git a/fwts-test/ivrs-0001/ivrs-0002.log b/fwts-test/ivrs-0001/ivrs-0002.log new file mode 100644 index 00000000..42db2218 --- /dev/null +++ b/fwts-test/ivrs-0001/ivrs-0002.log @@ -0,0 +1,111 @@ +ivrs ivrs: IVRS I/O Virtualization Reporting Structure test. +ivrs ---------------------------------------------------------- +ivrs Test 1 of 1: Validate IVRS table. +ivrs IVRS I/O Virtualization Reporting Structure: +ivrs IVinfo: 0x07203044 +ivrs Reserved: 0x000000cc00000000 +ivrs +ivrs FAILED [HIGH] IVRSReservedBitsNonZero: Test 1, IVRS IVinfo +ivrs Bits [4..2] must be zero, got 0x07203044 instead +ivrs FAILED [HIGH] IVRSReservedBitsNonZero: Test 1, IVRS IVinfo +ivrs Bits [31..23] must be zero, got 0x07203044 instead +ivrs FAILED [MEDIUM] IVRSReservedNonZero: Test 1, IVRS Reserved +ivrs field must be zero, got 0x000000cc00000000 instead +ivrs I/O Virtualization Hardware Definition Type 10h: +ivrs Type: 0x10 +ivrs Flags: 0xb0 +ivrs Length: 0x0064 +ivrs DeviceID: 0x0002 +ivrs Capability Offset: 0x0040 +ivrs IOMMU Base Address: 0x00000000fdf00000 +ivrs PCI Segment Group: 0x0000 +ivrs IOMMU Info: 0x4020 +ivrs IOMMU Feature Reporting: 0x80048f6f +ivrs FAILED [HIGH] IVRSReservedBitsNonZero: Test 1, IVRS IOMMU +ivrs Info Bits [7..5] must be zero, got 0x4020 instead +ivrs FAILED [HIGH] IVRSReservedBitsNonZero: Test 1, IVRS IOMMU +ivrs Info Bits [15..13] must be zero, got 0x4020 instead +ivrs FAILED [HIGH] IVRSBadType: Test 1, IVRS must have device +ivrs entry types 66..67 or 70..72, got 68 instead +ivrs +ivrs I/O Virtualization Hardware Definition Type 11h: +ivrs Type: 0x11 +ivrs Flags: 0x30 +ivrs Length: 0x0048 +ivrs DeviceID: 0x0002 +ivrs Capability Offset: 0x0040 +ivrs IOMMU Base Address: 0x00000000fdf00000 +ivrs PCI Segment Group: 0x0000 +ivrs IOMMU Info: 0x0000 +ivrs IOMMU Attribute: 0x00040200 +ivrs EFR Register Image: 0x206d73ef22254ade +ivrs WFR Register Image 2: 0x0000000000000000 +ivrs FAILED [HIGH] IVRSReservedBitsNonZero: Test 1, IVRS IOMMU +ivrs Attribute Bits [12..0] must be zero, got 0x00040200 +ivrs instead +ivrs FAILED [HIGH] IVRSBadSubTableType: Test 1, IVRS must have +ivrs subtable with Type 1..4, got 0 instead +ivrs +ivrs I/O Virtualization Hardware Definition Type 40h: +ivrs Type: 0x40 +ivrs Flags: 0x30 +ivrs Length: 0x00d4 +ivrs DeviceID: 0x0002 +ivrs Capability Offset: 0x0040 +ivrs IOMMU Base Address: 0x00000000fdf00000 +ivrs PCI Segment Group: 0x0000 +ivrs IOMMU Info: 0x0000 +ivrs IOMMU Attribute: 0xf0040204 +ivrs EFR Register Image: 0x206d73ef22254ade +ivrs WFR Register Image 2: 0x0000000000000000 +ivrs FAILED [HIGH] IVRSReservedBitsNonZero: Test 1, IVRS IOMMU +ivrs Attribute Bits [12..0] must be zero, got 0xf0040204 +ivrs instead +ivrs FAILED [HIGH] IVRSReservedBitsNonZero: Test 1, IVRS IOMMU +ivrs Attribute Bits [31..28] must be zero, got 0xf0040204 +ivrs instead +ivrs FAILED [HIGH] IVRSBadSubTableType: Test 1, IVRS must have +ivrs subtable with Type 1..4, got 0 instead +ivrs +ivrs I/O Virtualization Memory Definition: +ivrs Type: 0x20 +ivrs Flags: 0x1d +ivrs Length: 0x0020 +ivrs DeviceID: 0x1122 +ivrs Auxiliary data: 0x0000 +ivrs Reserved: 0x0000000000000000 +ivrs PCI Segment Group: 0xabcd +ivrs Start address: 0xfedc000012345678 +ivrs Memory block length: 0x0d21000000000000 +ivrs FAILED [HIGH] IVRSReservedBitsNonZero: Test 1, IVRS Flags +ivrs Bits [7..4] must be zero, got 0x1d instead +ivrs +ivrs I/O Virtualization Memory Definition: +ivrs Type: 0x21 +ivrs Flags: 0x0d +ivrs Length: 0x0020 +ivrs DeviceID: 0x1122 +ivrs Auxiliary data: 0x0000 +ivrs Reserved: 0x0000000000000000 +ivrs PCI Segment Group: 0xabcd +ivrs Start address: 0xfedc000012345678 +ivrs Memory block length: 0x0d22000000000000 +ivrs +ivrs I/O Virtualization Memory Definition: +ivrs Type: 0x22 +ivrs Flags: 0x0d +ivrs Length: 0x0020 +ivrs DeviceID: 0x1122 +ivrs Auxiliary data: 0x0000 +ivrs Reserved: 0x0000ff0000000000 +ivrs PCI Segment Group: 0xabcd +ivrs Start address: 0xfedc000012345678 +ivrs Memory block length: 0x0000000000000000 +ivrs FAILED [MEDIUM] IVRSReservedNonZero: Test 1, IVRS Reserved +ivrs field must be zero, got 0x0000ff0000000000 instead +ivrs +ivrs +ivrs ========================================================== +ivrs 0 passed, 13 failed, 0 warning, 0 aborted, 0 skipped, 0 +ivrs info only. +ivrs ========================================================== diff --git a/fwts-test/ivrs-0001/test-0001.sh b/fwts-test/ivrs-0001/test-0001.sh new file mode 100755 index 00000000..02ccf383 --- /dev/null +++ b/fwts-test/ivrs-0001/test-0001.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +TEST="Test apci table against IVRS" +NAME=test-0001.sh +TMPLOG=$TMP/ivrs.log.$$ + +$FWTS --show-tests | grep IVRS > /dev/null +if [ $? -eq 1 ]; then + echo SKIP: $TEST, $NAME + exit 77 +fi + +$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/ivrs-0001/acpidump-0001.log ivrs - | cut -c7- | grep "^ivrs" > $TMPLOG +diff $TMPLOG $FWTSTESTDIR/ivrs-0001/ivrs-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/ivrs-0001/test-0002.sh b/fwts-test/ivrs-0001/test-0002.sh new file mode 100755 index 00000000..4766bf6e --- /dev/null +++ b/fwts-test/ivrs-0001/test-0002.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +TEST="Test apci table against invalid IVRS" +NAME=test-0001.sh +TMPLOG=$TMP/ivrs.log.$$ + +$FWTS --show-tests | grep IVRS > /dev/null +if [ $? -eq 1 ]; then + echo SKIP: $TEST, $NAME + exit 77 +fi + +$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/ivrs-0001/acpidump-0002.log ivrs - | cut -c7- | grep "^ivrs" > $TMPLOG +diff $TMPLOG $FWTSTESTDIR/ivrs-0001/ivrs-0002.log >> $FAILURE_LOG +ret=$? +if [ $ret -eq 0 ]; then + echo PASSED: $TEST, $NAME +else + echo FAILED: $TEST, $NAME +fi + +rm $TMPLOG +exit $ret