diff mbox series

[2/2] fwts-test: add regression tests for VIOT

Message ID 20240109122110.118791-2-ivan.hu@canonical.com
State Accepted
Headers show
Series [1/2] acpi: viot: add test for ACPI VIOT table (mantis 2152) | expand

Commit Message

Ivan Hu Jan. 9, 2024, 12:21 p.m. UTC
Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 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 mbox series

Patch

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            ==========================================================