[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/23] avocado_qemu: Add Intel iommu tests
From: |
Cleber Rosa |
Subject: |
[PULL 11/23] avocado_qemu: Add Intel iommu tests |
Date: |
Tue, 13 Jul 2021 17:19:11 -0400 |
From: Eric Auger <eric.auger@redhat.com>
Add Intel IOMMU functional tests based on fedora 31.
Different configs are checked:
- strict
- caching mode, strict
- passthrough.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Willian Rampazzo <willianr@redhat.com>
Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Acked-by: Peter Xu <peterx@redhat.com>
Message-Id: <20210706131729.30749-5-eric.auger@redhat.com>
[CR: split long lines]
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
tests/acceptance/intel_iommu.py | 119 ++++++++++++++++++++++++++++++++
1 file changed, 119 insertions(+)
create mode 100644 tests/acceptance/intel_iommu.py
diff --git a/tests/acceptance/intel_iommu.py b/tests/acceptance/intel_iommu.py
new file mode 100644
index 0000000000..474d62f6bf
--- /dev/null
+++ b/tests/acceptance/intel_iommu.py
@@ -0,0 +1,119 @@
+# INTEL_IOMMU Functional tests
+#
+# Copyright (c) 2021 Red Hat, Inc.
+#
+# Author:
+# Eric Auger <eric.auger@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later. See the COPYING file in the top-level directory.
+import os
+
+from avocado import skipIf
+from avocado_qemu import LinuxTest
+
+@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+class IntelIOMMU(LinuxTest):
+ """
+ :avocado: tags=arch:x86_64
+ :avocado: tags=distro:fedora
+ :avocado: tags=distro_version:31
+ :avocado: tags=machine:q35
+ :avocado: tags=accel:kvm
+ :avocado: tags=intel_iommu
+ """
+
+ IOMMU_ADDON = ',iommu_platform=on,disable-modern=off,disable-legacy=on'
+ kernel_path = None
+ initrd_path = None
+ kernel_params = None
+
+ def set_up_boot(self):
+ path = self.download_boot()
+ self.vm.add_args('-device', 'virtio-blk-pci,bus=pcie.0,scsi=off,' +
+ 'drive=drv0,id=virtio-disk0,bootindex=1,'
+ 'werror=stop,rerror=stop' + self.IOMMU_ADDON)
+ self.vm.add_args('-device', 'virtio-gpu-pci' + self.IOMMU_ADDON)
+ self.vm.add_args('-drive',
+ 'file=%s,if=none,cache=writethrough,id=drv0' % path)
+
+ def setUp(self):
+ super(IntelIOMMU, self).setUp(None, 'virtio-net-pci' +
self.IOMMU_ADDON)
+
+ def add_common_args(self):
+ self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
+ self.vm.add_args('-object',
+ 'rng-random,id=rng0,filename=/dev/urandom')
+
+ def common_vm_setup(self, custom_kernel=None):
+ self.require_accelerator("kvm")
+ self.add_common_args()
+ self.vm.add_args("-accel", "kvm")
+
+ if custom_kernel is None:
+ return
+
+ kernel_url = self.distro.pxeboot_url + 'vmlinuz'
+ initrd_url = self.distro.pxeboot_url + 'initrd.img'
+ self.kernel_path = self.fetch_asset(kernel_url)
+ self.initrd_path = self.fetch_asset(initrd_url)
+
+ def run_and_check(self):
+ if self.kernel_path:
+ self.vm.add_args('-kernel', self.kernel_path,
+ '-append', self.kernel_params,
+ '-initrd', self.initrd_path)
+ self.launch_and_wait()
+ self.ssh_command('cat /proc/cmdline')
+ self.ssh_command('dmesg | grep -e DMAR -e IOMMU')
+ self.ssh_command('find /sys/kernel/iommu_groups/ -type l')
+ self.ssh_command('dnf -y install numactl-devel')
+
+ def test_intel_iommu(self):
+ """
+ :avocado: tags=intel_iommu_intremap
+ """
+
+ self.common_vm_setup(True)
+ self.vm.add_args('-device', 'intel-iommu,intremap=on')
+ self.vm.add_args('-machine', 'kernel_irqchip=split')
+
+ self.kernel_params = (self.distro.default_kernel_params +
+ ' quiet intel_iommu=on')
+ self.run_and_check()
+
+ def test_intel_iommu_strict(self):
+ """
+ :avocado: tags=intel_iommu_strict
+ """
+
+ self.common_vm_setup(True)
+ self.vm.add_args('-device', 'intel-iommu,intremap=on')
+ self.vm.add_args('-machine', 'kernel_irqchip=split')
+ self.kernel_params = (self.distro.default_kernel_params +
+ ' quiet intel_iommu=on,strict')
+ self.run_and_check()
+
+ def test_intel_iommu_strict_cm(self):
+ """
+ :avocado: tags=intel_iommu_strict_cm
+ """
+
+ self.common_vm_setup(True)
+ self.vm.add_args('-device', 'intel-iommu,intremap=on,caching-mode=on')
+ self.vm.add_args('-machine', 'kernel_irqchip=split')
+ self.kernel_params = (self.distro.default_kernel_params +
+ ' quiet intel_iommu=on,strict')
+ self.run_and_check()
+
+ def test_intel_iommu_pt(self):
+ """
+ :avocado: tags=intel_iommu_pt
+ """
+
+ self.common_vm_setup(True)
+ self.vm.add_args('-device', 'intel-iommu,intremap=on')
+ self.vm.add_args('-machine', 'kernel_irqchip=split')
+ self.kernel_params = (self.distro.default_kernel_params +
+ ' quiet intel_iommu=on iommu=pt')
+ self.run_and_check()
--
2.31.1
- [PULL 01/23] Acceptance Tests: use the job work directory for created VMs, (continued)
- [PULL 01/23] Acceptance Tests: use the job work directory for created VMs, Cleber Rosa, 2021/07/13
- [PULL 02/23] Acceptance Tests: log information when creating QEMUMachine, Cleber Rosa, 2021/07/13
- [PULL 04/23] Acceptance Tests: rename attribute holding the distro image checksum, Cleber Rosa, 2021/07/13
- [PULL 03/23] Acceptance Tests: distinguish between temp and logs dir, Cleber Rosa, 2021/07/13
- [PULL 05/23] Acceptance Tests: move definition of distro checksums to the framework, Cleber Rosa, 2021/07/13
- [PULL 06/23] Acceptance Tests: support choosing specific distro and version, Cleber Rosa, 2021/07/13
- [PULL 07/23] tests/acceptance: Ignore binary data sent on serial console, Cleber Rosa, 2021/07/13
- [PULL 09/23] Acceptance Tests: Add default kernel params and pxeboot url to the KNOWN_DISTROS collection, Cleber Rosa, 2021/07/13
- [PULL 08/23] avocado_qemu: Fix KNOWN_DISTROS map into the LinuxDistro class, Cleber Rosa, 2021/07/13
- [PULL 10/23] avocado_qemu: Add SMMUv3 tests, Cleber Rosa, 2021/07/13
- [PULL 11/23] avocado_qemu: Add Intel iommu tests,
Cleber Rosa <=
- [PULL 12/23] tests/acceptance: Tag NetBSD tests as 'os:netbsd', Cleber Rosa, 2021/07/13
- [PULL 13/23] tests/acceptance: Automatic set -cpu to the test vm, Cleber Rosa, 2021/07/13
- [PULL 14/23] tests/acceptance: Fix mismatch on cpu tagged tests, Cleber Rosa, 2021/07/13
- [PULL 16/23] tests/acceptance: Tagging tests with "cpu:VALUE", Cleber Rosa, 2021/07/13
- [PULL 15/23] tests/acceptance: Let the framework handle "cpu:VALUE" tagged tests, Cleber Rosa, 2021/07/13
- [PULL 17/23] python/qemu: Add args property to the QEMUMachine class, Cleber Rosa, 2021/07/13
- [PULL 19/23] tests/acceptance: Handle cpu tag on x86_cpu_model_versions tests, Cleber Rosa, 2021/07/13
- [PULL 18/23] tests/acceptance: Add set_vm_arg() to the Test class, Cleber Rosa, 2021/07/13
- [PULL 20/23] python: Configure tox to skip missing interpreters, Cleber Rosa, 2021/07/13
- [PULL 21/23] Acceptance tests: do not try to reuse packages from the system, Cleber Rosa, 2021/07/13