From nobody Tue Feb 10 14:32:24 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1626211637412359.6455471230846; Tue, 13 Jul 2021 14:27:17 -0700 (PDT) Received: from localhost ([::1]:42988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3Pvw-00064H-BY for importer@patchew.org; Tue, 13 Jul 2021 17:27:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3PqG-0002gZ-2Q for qemu-devel@nongnu.org; Tue, 13 Jul 2021 17:21:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26430) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3PqC-0008Su-IV for qemu-devel@nongnu.org; Tue, 13 Jul 2021 17:21:23 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-220-TYmfDntyMKalfrS6Fcf_RQ-1; Tue, 13 Jul 2021 17:21:18 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5D5A0100B3B4; Tue, 13 Jul 2021 21:21:16 +0000 (UTC) Received: from p50.localhost.net (ovpn-117-22.rdu2.redhat.com [10.10.117.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 85DCF19C44; Tue, 13 Jul 2021 21:20:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626211280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JtX7+yJJi9eBr6Yjxo5IXUWuTnmp8evQVTVARjL0NOU=; b=QDrXrTDK7TxQ/jvJJWp1wm2Kkpa9ezfpwSbaFJrqnXReB83dN7hE1y5q7PCy1pEUmPWfZt vGZDLkJ1NcwuirNbvH66+eSZQ/XiFzSP4ULO4+E+ruvHN6cMEvGlAuTXPgAgJezHKtPMx1 NCf1pm7Av5gpljuMpqqa6bxZ1UB9yIc= X-MC-Unique: TYmfDntyMKalfrS6Fcf_RQ-1 From: Cleber Rosa To: Peter Maydell , qemu-devel@nongnu.org Subject: [PULL 11/23] avocado_qemu: Add Intel iommu tests Date: Tue, 13 Jul 2021 17:19:11 -0400 Message-Id: <20210713211923.3809241-12-crosa@redhat.com> In-Reply-To: <20210713211923.3809241-1-crosa@redhat.com> References: <20210713211923.3809241-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=crosa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=crosa@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , Willian Rampazzo , John Snow , Wainer dos Santos Moschetta , Willian Rampazzo , Kamil Rytarowski , Reinoud Zandijk , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aleksandar Rikalo , Eduardo Habkost , Greg Kurz , Eric Auger , qemu-arm@nongnu.org, Peter Xu , Pavel Dovgalyuk , Cleber Rosa , =?UTF-8?q?Alex=20Benn=C3=A9e?= , David Gibson , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-ppc@nongnu.org, Paolo Bonzini , Ryo ONODERA , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1626211638276100001 Content-Type: text/plain; charset="utf-8" From: Eric Auger Add Intel IOMMU functional tests based on fedora 31. Different configs are checked: - strict - caching mode, strict - passthrough. Signed-off-by: Eric Auger Signed-off-by: Willian Rampazzo Tested-by: Wainer dos Santos Moschetta Acked-by: Peter Xu Message-Id: <20210706131729.30749-5-eric.auger@redhat.com> [CR: split long lines] Signed-off-by: Cleber Rosa --- 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 +# +# 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=3Darch:x86_64 + :avocado: tags=3Ddistro:fedora + :avocado: tags=3Ddistro_version:31 + :avocado: tags=3Dmachine:q35 + :avocado: tags=3Daccel:kvm + :avocado: tags=3Dintel_iommu + """ + + IOMMU_ADDON =3D ',iommu_platform=3Don,disable-modern=3Doff,disable-leg= acy=3Don' + kernel_path =3D None + initrd_path =3D None + kernel_params =3D None + + def set_up_boot(self): + path =3D self.download_boot() + self.vm.add_args('-device', 'virtio-blk-pci,bus=3Dpcie.0,scsi=3Dof= f,' + + 'drive=3Ddrv0,id=3Dvirtio-disk0,bootindex=3D1,' + 'werror=3Dstop,rerror=3Dstop' + self.IOMMU_ADDON) + self.vm.add_args('-device', 'virtio-gpu-pci' + self.IOMMU_ADDON) + self.vm.add_args('-drive', + 'file=3D%s,if=3Dnone,cache=3Dwritethrough,id=3Ddr= v0' % 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=3Drng0') + self.vm.add_args('-object', + 'rng-random,id=3Drng0,filename=3D/dev/urandom') + + def common_vm_setup(self, custom_kernel=3DNone): + self.require_accelerator("kvm") + self.add_common_args() + self.vm.add_args("-accel", "kvm") + + if custom_kernel is None: + return + + kernel_url =3D self.distro.pxeboot_url + 'vmlinuz' + initrd_url =3D self.distro.pxeboot_url + 'initrd.img' + self.kernel_path =3D self.fetch_asset(kernel_url) + self.initrd_path =3D 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=3Dintel_iommu_intremap + """ + + self.common_vm_setup(True) + self.vm.add_args('-device', 'intel-iommu,intremap=3Don') + self.vm.add_args('-machine', 'kernel_irqchip=3Dsplit') + + self.kernel_params =3D (self.distro.default_kernel_params + + ' quiet intel_iommu=3Don') + self.run_and_check() + + def test_intel_iommu_strict(self): + """ + :avocado: tags=3Dintel_iommu_strict + """ + + self.common_vm_setup(True) + self.vm.add_args('-device', 'intel-iommu,intremap=3Don') + self.vm.add_args('-machine', 'kernel_irqchip=3Dsplit') + self.kernel_params =3D (self.distro.default_kernel_params + + ' quiet intel_iommu=3Don,strict') + self.run_and_check() + + def test_intel_iommu_strict_cm(self): + """ + :avocado: tags=3Dintel_iommu_strict_cm + """ + + self.common_vm_setup(True) + self.vm.add_args('-device', 'intel-iommu,intremap=3Don,caching-mod= e=3Don') + self.vm.add_args('-machine', 'kernel_irqchip=3Dsplit') + self.kernel_params =3D (self.distro.default_kernel_params + + ' quiet intel_iommu=3Don,strict') + self.run_and_check() + + def test_intel_iommu_pt(self): + """ + :avocado: tags=3Dintel_iommu_pt + """ + + self.common_vm_setup(True) + self.vm.add_args('-device', 'intel-iommu,intremap=3Don') + self.vm.add_args('-machine', 'kernel_irqchip=3Dsplit') + self.kernel_params =3D (self.distro.default_kernel_params + + ' quiet intel_iommu=3Don iommu=3Dpt') + self.run_and_check() --=20 2.31.1