From nobody Wed May 8 00:05:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558352284; cv=none; d=zoho.com; s=zohoarc; b=bYj6YV+Lzit4CxAU72Q7qtsdzOAl8ZEkmgZT21xklE7aZ1HS1RoZxScI53N/0uKgkVvH60x9xwI2IKw3hAvKEJszeSZsl0QanVrPbEouGmCpRhF5jelpLnnyy6MBfdhM1Q3D5FD5p0C3OWfMf5Ypz7oNLCIcbvkU3pvbFja4DJ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558352284; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=KgM2pO9NF+Xh3iGl8qErukhBPAPmAMxQD2+Ij5DZ/NE=; b=Dq1CDwCSxQzNyRag+LePCfVJdk4LQCkZWNzvQ7+y3btnNeDvPoLOcz+QG2qzCjDFS256NRvczHGvB8i+BfBFEgQKsW7oWdE5DNs+kC1MkdrEm6+WX4Sp1tqLRK06XND6Cg1rnOVqnPXebX9vyZGINAyNBCgEctKoMSZdLoajr9E= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558352284449735.9640901784212; Mon, 20 May 2019 04:38:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 26AF785545; Mon, 20 May 2019 11:38:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DEA18643E5; Mon, 20 May 2019 11:38:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9253B5EC72; Mon, 20 May 2019 11:38:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4KBbwNS019626 for ; Mon, 20 May 2019 07:37:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id D8C925D9D1; Mon, 20 May 2019 11:37:58 +0000 (UTC) Received: from kinshicho.redhat.com (ovpn-204-17.brq.redhat.com [10.40.204.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 415485DD80 for ; Mon, 20 May 2019 11:37:58 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 20 May 2019 13:37:46 +0200 Message-Id: <20190520113753.12345-2-abologna@redhat.com> In-Reply-To: <20190520113753.12345-1-abologna@redhat.com> References: <20190520113753.12345-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/8] tests: Simplify Intel IOMMU testing X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 20 May 2019 11:38:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Remove a bunch of irrelevant devices and make sure all input files explicitly opt out of USB controllers: the latter change will help later, when we start using DO_TEST_CAPS_LATEST(). Signed-off-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- .../intel-iommu-caching-mode.args | 9 +------- .../intel-iommu-caching-mode.xml | 23 +------------------ .../intel-iommu-device-iotlb.xml | 1 + tests/qemuxml2argvdata/intel-iommu-eim.xml | 1 + .../qemuxml2argvdata/intel-iommu-machine.xml | 1 + tests/qemuxml2argvdata/intel-iommu.xml | 1 + 6 files changed, 6 insertions(+), 30 deletions(-) diff --git a/tests/qemuxml2argvdata/intel-iommu-caching-mode.args b/tests/q= emuxml2argvdata/intel-iommu-caching-mode.args index a6d25c59fb..1d1f35a38d 100644 --- a/tests/qemuxml2argvdata/intel-iommu-caching-mode.args +++ b/tests/qemuxml2argvdata/intel-iommu-caching-mode.args @@ -24,11 +24,4 @@ server,nowait \ -rtc base=3Dutc \ -no-shutdown \ -no-acpi \ --device intel-iommu,intremap=3Don,caching-mode=3Don \ --device i82801b11-bridge,id=3Dpci.1,bus=3Dpcie.0,addr=3D0x1e \ --device pci-bridge,chassis_nr=3D2,id=3Dpci.2,bus=3Dpci.1,addr=3D0x0 \ --device ioh3420,port=3D0x10,chassis=3D3,id=3Dpci.3,bus=3Dpcie.0,addr=3D0x2= \ --device ich9-usb-ehci1,id=3Dusb,bus=3Dpci.2,addr=3D0x2.0x7 \ --netdev user,id=3Dhostnet0 \ --device rtl8139,netdev=3Dhostnet0,id=3Dnet0,mac=3D52:54:00:ab:0c:5c,bus=3D= pci.2,\ -addr=3D0x1 +-device intel-iommu,intremap=3Don,caching-mode=3Don diff --git a/tests/qemuxml2argvdata/intel-iommu-caching-mode.xml b/tests/qe= muxml2argvdata/intel-iommu-caching-mode.xml index 36a392403b..23e3702cda 100644 --- a/tests/qemuxml2argvdata/intel-iommu-caching-mode.xml +++ b/tests/qemuxml2argvdata/intel-iommu-caching-mode.xml @@ -18,31 +18,10 @@ /usr/bin/qemu-system-x86_64 - - -
- - - - -
- - - - -
- +
- -
- - - - -
- diff --git a/tests/qemuxml2argvdata/intel-iommu-device-iotlb.xml b/tests/qe= muxml2argvdata/intel-iommu-device-iotlb.xml index 3eb08ab9af..fe365eedc8 100644 --- a/tests/qemuxml2argvdata/intel-iommu-device-iotlb.xml +++ b/tests/qemuxml2argvdata/intel-iommu-device-iotlb.xml @@ -18,6 +18,7 @@ /usr/bin/qemu-system-x86_64 +
diff --git a/tests/qemuxml2argvdata/intel-iommu-eim.xml b/tests/qemuxml2arg= vdata/intel-iommu-eim.xml index 8642ed3499..9770f77383 100644 --- a/tests/qemuxml2argvdata/intel-iommu-eim.xml +++ b/tests/qemuxml2argvdata/intel-iommu-eim.xml @@ -18,6 +18,7 @@ /usr/bin/qemu-system-x86_64 +
diff --git a/tests/qemuxml2argvdata/intel-iommu-machine.xml b/tests/qemuxml= 2argvdata/intel-iommu-machine.xml index 0961e4288d..90aba16156 100644 --- a/tests/qemuxml2argvdata/intel-iommu-machine.xml +++ b/tests/qemuxml2argvdata/intel-iommu-machine.xml @@ -15,6 +15,7 @@ /usr/bin/qemu-system-x86_64 +
diff --git a/tests/qemuxml2argvdata/intel-iommu.xml b/tests/qemuxml2argvdat= a/intel-iommu.xml index 0961e4288d..90aba16156 100644 --- a/tests/qemuxml2argvdata/intel-iommu.xml +++ b/tests/qemuxml2argvdata/intel-iommu.xml @@ -15,6 +15,7 @@ /usr/bin/qemu-system-x86_64 +
--=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:05:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558352289; cv=none; d=zoho.com; s=zohoarc; b=FY29tT8XopS6vXsxCAcXvilCcFoYIRozwgZwEcfgRyTKSF028BkjsB3Hvu0g77JH2p/KS/QZzvTQuXMqcvOqfS98PN5YTjHIG0iRdin27q8cwjEQzxuyYBw3q1UeNkYtma0gyzJqZq6i860lU7PFfP6mA9ojcp3OWlNte2cf/gU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558352289; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=fRcAuoE+4Pj3COA7/Xb2U3VTIwgqEXrmBuNaQip86zY=; b=mIWjQOas+rQJvHFNFoHVaKUe/FAxxm5NYJ8EjI+mGHSDDkApoaVRmuVgQlLd4jAO5xWNx4eCasY2Qe+M5pXnSxcmqDzGCCcrrmm0uLhYcpg3ktsUhtgz8gqWVwv0V4saD0K9/v/tcUbnNf/5b/joqfSMe536Vh20wN+n/nAzpiA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558352289788932.7616210328054; Mon, 20 May 2019 04:38:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1151C04FFF1; Mon, 20 May 2019 11:38:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 870762FC5B; Mon, 20 May 2019 11:38:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 49EBE1806B1B; Mon, 20 May 2019 11:38:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4KBc0cr019634 for ; Mon, 20 May 2019 07:38:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 066CE5D967; Mon, 20 May 2019 11:38:00 +0000 (UTC) Received: from kinshicho.redhat.com (ovpn-204-17.brq.redhat.com [10.40.204.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 31BCF5D9D1 for ; Mon, 20 May 2019 11:37:59 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 20 May 2019 13:37:47 +0200 Message-Id: <20190520113753.12345-3-abologna@redhat.com> In-Reply-To: <20190520113753.12345-1-abologna@redhat.com> References: <20190520113753.12345-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/8] tests: Use DO_TEST_CAPS_*() for Intel IOMMU X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 20 May 2019 11:38:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- ...tel-iommu-caching-mode.x86_64-latest.args} | 15 ++++++--- ...tel-iommu-device-iotlb.x86_64-latest.args} | 15 ++++++--- ...rgs =3D> intel-iommu-eim.x86_64-latest.args} | 15 ++++++--- .../qemuxml2argvdata/intel-iommu-machine.args | 26 --------------- ... =3D> intel-iommu-machine.x86_64-2.6.0.args} | 9 +++-- .../qemuxml2argvdata/intel-iommu-machine.xml | 2 +- ...mu.args =3D> intel-iommu.x86_64-latest.args} | 15 ++++++--- tests/qemuxml2argvtest.c | 33 ++++--------------- ...ntel-iommu-caching-mode.x86_64-latest.xml} | 0 ...ntel-iommu-device-iotlb.x86_64-latest.xml} | 0 ....xml =3D> intel-iommu-eim.x86_64-latest.xml} | 0 ...l =3D> intel-iommu-machine.x86_64-2.6.0.xml} | 0 ...ommu.xml =3D> intel-iommu.x86_64-latest.xml} | 0 tests/qemuxml2xmltest.c | 15 +++------ 14 files changed, 58 insertions(+), 87 deletions(-) rename tests/qemuxml2argvdata/{intel-iommu-device-iotlb.args =3D> intel-io= mmu-caching-mode.x86_64-latest.args} (61%) copy tests/qemuxml2argvdata/{intel-iommu-caching-mode.args =3D> intel-iomm= u-device-iotlb.x86_64-latest.args} (61%) rename tests/qemuxml2argvdata/{intel-iommu-eim.args =3D> intel-iommu-eim.x= 86_64-latest.args} (62%) delete mode 100644 tests/qemuxml2argvdata/intel-iommu-machine.args rename tests/qemuxml2argvdata/{intel-iommu-caching-mode.args =3D> intel-io= mmu-machine.x86_64-2.6.0.args} (73%) rename tests/qemuxml2argvdata/{intel-iommu.args =3D> intel-iommu.x86_64-la= test.args} (62%) rename tests/qemuxml2xmloutdata/{intel-iommu-caching-mode.xml =3D> intel-i= ommu-caching-mode.x86_64-latest.xml} (100%) rename tests/qemuxml2xmloutdata/{intel-iommu-device-iotlb.xml =3D> intel-i= ommu-device-iotlb.x86_64-latest.xml} (100%) rename tests/qemuxml2xmloutdata/{intel-iommu-eim.xml =3D> intel-iommu-eim.= x86_64-latest.xml} (100%) rename tests/qemuxml2xmloutdata/{intel-iommu-machine.xml =3D> intel-iommu-= machine.x86_64-2.6.0.xml} (100%) rename tests/qemuxml2xmloutdata/{intel-iommu.xml =3D> intel-iommu.x86_64-l= atest.xml} (100%) diff --git a/tests/qemuxml2argvdata/intel-iommu-device-iotlb.args b/tests/q= emuxml2argvdata/intel-iommu-caching-mode.x86_64-latest.args similarity index 61% rename from tests/qemuxml2argvdata/intel-iommu-device-iotlb.args rename to tests/qemuxml2argvdata/intel-iommu-caching-mode.x86_64-latest.args index 66c4110e93..3c88f0e38f 100644 --- a/tests/qemuxml2argvdata/intel-iommu-device-iotlb.args +++ b/tests/qemuxml2argvdata/intel-iommu-caching-mode.x86_64-latest.args @@ -8,20 +8,25 @@ XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-x86_64 \ --name QEMUGuest1 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine q35,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,kernel_irqchip=3D= split \ -m 214 \ --realtime mlock=3Doff \ +-overcommit mem-lock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ -no-user-config \ -nodefaults \ --chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ -server,nowait \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc \ -no-shutdown \ -no-acpi \ --device intel-iommu,intremap=3Don,device-iotlb=3Don +-boot strict=3Don \ +-device intel-iommu,intremap=3Don,caching-mode=3Don \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/intel-iommu-caching-mode.args b/tests/q= emuxml2argvdata/intel-iommu-device-iotlb.x86_64-latest.args similarity index 61% copy from tests/qemuxml2argvdata/intel-iommu-caching-mode.args copy to tests/qemuxml2argvdata/intel-iommu-device-iotlb.x86_64-latest.args index 1d1f35a38d..ff201ec5e8 100644 --- a/tests/qemuxml2argvdata/intel-iommu-caching-mode.args +++ b/tests/qemuxml2argvdata/intel-iommu-device-iotlb.x86_64-latest.args @@ -8,20 +8,25 @@ XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-x86_64 \ --name QEMUGuest1 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine q35,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,kernel_irqchip=3D= split \ -m 214 \ --realtime mlock=3Doff \ +-overcommit mem-lock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ -no-user-config \ -nodefaults \ --chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ -server,nowait \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc \ -no-shutdown \ -no-acpi \ --device intel-iommu,intremap=3Don,caching-mode=3Don +-boot strict=3Don \ +-device intel-iommu,intremap=3Don,device-iotlb=3Don \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/intel-iommu-eim.args b/tests/qemuxml2ar= gvdata/intel-iommu-eim.x86_64-latest.args similarity index 62% rename from tests/qemuxml2argvdata/intel-iommu-eim.args rename to tests/qemuxml2argvdata/intel-iommu-eim.x86_64-latest.args index 6e53b1cf96..53dee161a8 100644 --- a/tests/qemuxml2argvdata/intel-iommu-eim.args +++ b/tests/qemuxml2argvdata/intel-iommu-eim.x86_64-latest.args @@ -8,20 +8,25 @@ XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-x86_64 \ --name QEMUGuest1 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine q35,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,kernel_irqchip=3D= split \ -m 214 \ --realtime mlock=3Doff \ +-overcommit mem-lock=3Doff \ -smp 288,sockets=3D288,cores=3D1,threads=3D1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ -no-user-config \ -nodefaults \ --chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ -server,nowait \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc \ -no-shutdown \ -no-acpi \ --device intel-iommu,intremap=3Don,eim=3Don +-boot strict=3Don \ +-device intel-iommu,intremap=3Don,eim=3Don \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/intel-iommu-machine.args b/tests/qemuxm= l2argvdata/intel-iommu-machine.args deleted file mode 100644 index d6d6f0d5f6..0000000000 --- a/tests/qemuxml2argvdata/intel-iommu-machine.args +++ /dev/null @@ -1,26 +0,0 @@ -LC_ALL=3DC \ -PATH=3D/bin \ -HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ -USER=3Dtest \ -LOGNAME=3Dtest \ -XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ -XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ -XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -QEMU_AUDIO_DRV=3Dnone \ -/usr/bin/qemu-system-x86_64 \ --name QEMUGuest1 \ --S \ --machine q35,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,iommu=3Don \ --m 214 \ --realtime mlock=3Doff \ --smp 1,sockets=3D1,cores=3D1,threads=3D1 \ --uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ --display none \ --no-user-config \ --nodefaults \ --chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ -server,nowait \ --mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ --rtc base=3Dutc \ --no-shutdown \ --no-acpi diff --git a/tests/qemuxml2argvdata/intel-iommu-caching-mode.args b/tests/q= emuxml2argvdata/intel-iommu-machine.x86_64-2.6.0.args similarity index 73% rename from tests/qemuxml2argvdata/intel-iommu-caching-mode.args rename to tests/qemuxml2argvdata/intel-iommu-machine.x86_64-2.6.0.args index 1d1f35a38d..4ebb4d15d9 100644 --- a/tests/qemuxml2argvdata/intel-iommu-caching-mode.args +++ b/tests/qemuxml2argvdata/intel-iommu-machine.x86_64-2.6.0.args @@ -8,9 +8,11 @@ XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-x86_64 \ --name QEMUGuest1 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ --machine q35,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,kernel_irqchip=3D= split \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc-q35-2.6,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff,iommu=3Don= \ -m 214 \ -realtime mlock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ @@ -24,4 +26,5 @@ server,nowait \ -rtc base=3Dutc \ -no-shutdown \ -no-acpi \ --device intel-iommu,intremap=3Don,caching-mode=3Don +-boot strict=3Don \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/intel-iommu-machine.xml b/tests/qemuxml= 2argvdata/intel-iommu-machine.xml index 90aba16156..85027cd938 100644 --- a/tests/qemuxml2argvdata/intel-iommu-machine.xml +++ b/tests/qemuxml2argvdata/intel-iommu-machine.xml @@ -5,7 +5,7 @@ 219100 1 - hvm + hvm diff --git a/tests/qemuxml2argvdata/intel-iommu.args b/tests/qemuxml2argvda= ta/intel-iommu.x86_64-latest.args similarity index 62% rename from tests/qemuxml2argvdata/intel-iommu.args rename to tests/qemuxml2argvdata/intel-iommu.x86_64-latest.args index 0a5a49b847..b4c8ca30b2 100644 --- a/tests/qemuxml2argvdata/intel-iommu.args +++ b/tests/qemuxml2argvdata/intel-iommu.x86_64-latest.args @@ -8,20 +8,25 @@ XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ QEMU_AUDIO_DRV=3Dnone \ /usr/bin/qemu-system-x86_64 \ --name QEMUGuest1 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ -S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ -machine q35,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ -m 214 \ --realtime mlock=3Doff \ +-overcommit mem-lock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ -display none \ -no-user-config \ -nodefaults \ --chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ -server,nowait \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc \ -no-shutdown \ -no-acpi \ --device intel-iommu +-boot strict=3Don \ +-device intel-iommu \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index edc19ace6f..1c2a2b3905 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2806,33 +2806,12 @@ mymain(void) QEMU_CAPS_USB_HUB); =20 DO_TEST("acpi-table", NONE); - DO_TEST("intel-iommu", - QEMU_CAPS_DEVICE_INTEL_IOMMU); - DO_TEST("intel-iommu-machine", - QEMU_CAPS_MACHINE_IOMMU); - DO_TEST("intel-iommu-caching-mode", - QEMU_CAPS_MACHINE_KERNEL_IRQCHIP, - QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT, - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_INTEL_IOMMU, - QEMU_CAPS_INTEL_IOMMU_INTREMAP, - QEMU_CAPS_INTEL_IOMMU_CACHING_MODE); - DO_TEST("intel-iommu-eim", - QEMU_CAPS_MACHINE_KERNEL_IRQCHIP, - QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT, - QEMU_CAPS_INTEL_IOMMU_INTREMAP, - QEMU_CAPS_INTEL_IOMMU_EIM, - QEMU_CAPS_DEVICE_INTEL_IOMMU); - DO_TEST("intel-iommu-device-iotlb", - QEMU_CAPS_MACHINE_KERNEL_IRQCHIP, - QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT, - QEMU_CAPS_INTEL_IOMMU_INTREMAP, - QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB, - QEMU_CAPS_DEVICE_INTEL_IOMMU); + + DO_TEST_CAPS_LATEST("intel-iommu"); + DO_TEST_CAPS_VER("intel-iommu-machine", "2.6.0"); + DO_TEST_CAPS_LATEST("intel-iommu-caching-mode"); + DO_TEST_CAPS_LATEST("intel-iommu-eim"); + DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb"); =20 DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); DO_TEST_PARSE_ERROR("cpu-hotplug-granularity", diff --git a/tests/qemuxml2xmloutdata/intel-iommu-caching-mode.xml b/tests/= qemuxml2xmloutdata/intel-iommu-caching-mode.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/intel-iommu-caching-mode.xml rename to tests/qemuxml2xmloutdata/intel-iommu-caching-mode.x86_64-latest.x= ml diff --git a/tests/qemuxml2xmloutdata/intel-iommu-device-iotlb.xml b/tests/= qemuxml2xmloutdata/intel-iommu-device-iotlb.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/intel-iommu-device-iotlb.xml rename to tests/qemuxml2xmloutdata/intel-iommu-device-iotlb.x86_64-latest.x= ml diff --git a/tests/qemuxml2xmloutdata/intel-iommu-eim.xml b/tests/qemuxml2x= mloutdata/intel-iommu-eim.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/intel-iommu-eim.xml rename to tests/qemuxml2xmloutdata/intel-iommu-eim.x86_64-latest.xml diff --git a/tests/qemuxml2xmloutdata/intel-iommu-machine.xml b/tests/qemux= ml2xmloutdata/intel-iommu-machine.x86_64-2.6.0.xml similarity index 100% rename from tests/qemuxml2xmloutdata/intel-iommu-machine.xml rename to tests/qemuxml2xmloutdata/intel-iommu-machine.x86_64-2.6.0.xml diff --git a/tests/qemuxml2xmloutdata/intel-iommu.xml b/tests/qemuxml2xmlou= tdata/intel-iommu.x86_64-latest.xml similarity index 100% rename from tests/qemuxml2xmloutdata/intel-iommu.xml rename to tests/qemuxml2xmloutdata/intel-iommu.x86_64-latest.xml diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 3b4d7efa52..f11ded4fb3 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1202,16 +1202,11 @@ mymain(void) QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW); DO_TEST("video-none-device", NONE); =20 - DO_TEST("intel-iommu", - QEMU_CAPS_DEVICE_INTEL_IOMMU); - DO_TEST("intel-iommu-machine", - QEMU_CAPS_MACHINE_IOMMU); - DO_TEST("intel-iommu-caching-mode", - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420); - DO_TEST("intel-iommu-eim", NONE); - DO_TEST("intel-iommu-device-iotlb", NONE); + DO_TEST_CAPS_LATEST("intel-iommu"); + DO_TEST_CAPS_VER("intel-iommu-machine", "2.6.0"); + DO_TEST_CAPS_LATEST("intel-iommu-caching-mode"); + DO_TEST_CAPS_LATEST("intel-iommu-eim"); + DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb"); =20 DO_TEST("cpu-check-none", NONE); DO_TEST("cpu-check-partial", NONE); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:05:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558352290; cv=none; d=zoho.com; s=zohoarc; b=CjGWDld2jODlZR8Yu7ZMoS1ztCTKVw9uiTpjSJIJG03SJbvvnu5OGErEfSYhsyLYkqotnNtgfC7td/RSjDTmO3M2ed5GNeJZTHKNzq1tk4YKwcSM5Bmy76udHuezP1qiO1ScrFVsiQCeT8hlc9INi0tEq366CojRLkNmJ77Um2U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558352290; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=cS3wFGcsBq5xKQk37Gs0yhvRQIpr84YVw6pyEeCGkEw=; b=WOsGhg8rXwktzsL1Hk0iYcGGQsVhvdhU0vLelFE8dKrrja8zNmDQvng6Ww0JF0A3IR+oHPqsUCqGUkknusZZL+6s0VrPDLywQOmEGfQDh/3W+5QPBJ9UKLNCciivdQ6jUlLRlnGitugwsiFlCVwetVSd0IiL/wEEYJT1Jo0ylaI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558352290360244.894855864051; Mon, 20 May 2019 04:38:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5D2487630; Mon, 20 May 2019 11:38:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8AC2C5D9D1; Mon, 20 May 2019 11:38:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 50CEE1806B1C; Mon, 20 May 2019 11:38:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4KBc1gs019641 for ; Mon, 20 May 2019 07:38:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 31C1D5DD8F; Mon, 20 May 2019 11:38:01 +0000 (UTC) Received: from kinshicho.redhat.com (ovpn-204-17.brq.redhat.com [10.40.204.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 716F55DD8A for ; Mon, 20 May 2019 11:38:00 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 20 May 2019 13:37:48 +0200 Message-Id: <20190520113753.12345-4-abologna@redhat.com> In-Reply-To: <20190520113753.12345-1-abologna@redhat.com> References: <20190520113753.12345-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/8] tests: Add negative test for Intel IOMMU X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 20 May 2019 11:38:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Make sure validation is working as intended by trying to use Intel IOMMU with the i440fx machine type, though we know it's q35 only, and expecting an error to be returned. Signed-off-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- .../intel-iommu-wrong-machine.xml | 24 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 2 files changed, 25 insertions(+) create mode 100644 tests/qemuxml2argvdata/intel-iommu-wrong-machine.xml diff --git a/tests/qemuxml2argvdata/intel-iommu-wrong-machine.xml b/tests/q= emuxml2argvdata/intel-iommu-wrong-machine.xml new file mode 100644 index 0000000000..ab116f83b3 --- /dev/null +++ b/tests/qemuxml2argvdata/intel-iommu-wrong-machine.xml @@ -0,0 +1,24 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1c2a2b3905..0e83acac86 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2812,6 +2812,7 @@ mymain(void) DO_TEST_CAPS_LATEST("intel-iommu-caching-mode"); DO_TEST_CAPS_LATEST("intel-iommu-eim"); DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb"); + DO_TEST_FAILURE("intel-iommu-wrong-machine", NONE); =20 DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); DO_TEST_PARSE_ERROR("cpu-hotplug-granularity", --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:05:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558352288; cv=none; d=zoho.com; s=zohoarc; b=W1w7GceHgLDMeciZGSwC/1UoWeGjxNVOM4kX93rCTUfhd1TsZ/kLuIkURDO74kimODF2p7QGYfbJV0XDAj5rPGivg9ip+RqmBJFI88EAdugqxVfdWTBIzjyy/aP6Xp0Ip0YPd9KOd9HzOX3wBGDjyIljns8S70lnYo7FrSruwpc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558352288; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=72+yEzucid7WMjSk9t8mKwp5JU6zvvC+pwMOtpzYU5w=; b=l3eUTWm4hn0uSxJgPEjYMiD76tgO7TGXqFFBHcZN6tDcLbOxJJ/jT3nKjHe781xN5si3Sb+g6qBTNz7Qc9G7tHe2pPy8zUJ6Q82BOZHxV5LXO4swGPAyx8khwo4R6A9dt0o2sol2/39iezvt8f7z7OmiQEd7QIe89XhW8nmh3kc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558352288450341.16518823376146; Mon, 20 May 2019 04:38:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 25207C04D318; Mon, 20 May 2019 11:38:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6296100200D; Mon, 20 May 2019 11:38:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 810261806B18; Mon, 20 May 2019 11:38:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4KBc2SL019646 for ; Mon, 20 May 2019 07:38:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3CDA95DD8F; Mon, 20 May 2019 11:38:02 +0000 (UTC) Received: from kinshicho.redhat.com (ovpn-204-17.brq.redhat.com [10.40.204.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 960E35DD8A for ; Mon, 20 May 2019 11:38:01 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 20 May 2019 13:37:49 +0200 Message-Id: <20190520113753.12345-5-abologna@redhat.com> In-Reply-To: <20190520113753.12345-1-abologna@redhat.com> References: <20190520113753.12345-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/8] conf: Allow NULL for virDomainDeviceInfoCallback X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 20 May 2019 11:38:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The virDomainDeviceInfoIterate() function was initially written with the expectation that all devices would embed a virDomainDeviceInfo, and thus the user-provided callback would never be passed NULL; however, that doesn't really represent reality, as multiple devices don't have any virDomainDeviceInfo associated with them. Since we still want to be able to iterate over those devices, clarify that callbacks are expected to be able to handle NULL being passed to them, and update all existing callbacks so that they actually do so. Signed-off-by: Andrea Bolognani --- src/bhyve/bhyve_device.c | 4 ++++ src/conf/domain_addr.c | 9 +++++++++ src/conf/domain_conf.c | 34 +++++++++++++++++++++++++++++++- src/libxl/libxl_driver.c | 3 +++ src/qemu/qemu_domain_address.c | 36 +++++++++++++++++++++++++++++++--- src/qemu/qemu_hotplug.c | 3 +++ 6 files changed, 85 insertions(+), 4 deletions(-) diff --git a/src/bhyve/bhyve_device.c b/src/bhyve/bhyve_device.c index 201044d9e6..8c897cbd8d 100644 --- a/src/bhyve/bhyve_device.c +++ b/src/bhyve/bhyve_device.c @@ -37,6 +37,10 @@ bhyveCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNU= SED, void *opaque) { int ret =3D -1; + + if (!info) + return 0; + if (info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) return 0; =20 diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 04c4e6d7e1..548af89682 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -1468,6 +1468,9 @@ virDomainCCWAddressAllocate(virDomainDefPtr def ATTRI= BUTE_UNUSED, virDomainDeviceInfoPtr info, void *data) { + if (!info) + return 0; + return virDomainCCWAddressAssign(info, data, true); } =20 @@ -1477,6 +1480,9 @@ virDomainCCWAddressValidate(virDomainDefPtr def ATTRI= BUTE_UNUSED, virDomainDeviceInfoPtr info, void *data) { + if (!info) + return 0; + return virDomainCCWAddressAssign(info, data, false); } =20 @@ -1694,6 +1700,9 @@ virDomainVirtioSerialAddrReserve(virDomainDefPtr def = ATTRIBUTE_UNUSED, bool b; ssize_t i; =20 + if (!info) + return 0; + if (!virDomainVirtioSerialAddrIsComplete(info)) return 0; =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a3a514136b..f42d331341 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4049,6 +4049,9 @@ virDomainDefHasDeviceAddressIterator(virDomainDefPtr = def ATTRIBUTE_UNUSED, { virDomainDeviceInfoPtr needle =3D opaque; =20 + if (!info) + return 0; + /* break iteration if the info was found */ if (virDomainDeviceInfoAddressIsEqual(info, needle)) return -1; @@ -4297,6 +4300,21 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr d= ef, } =20 =20 +/** + * virDomainDeviceInfoIterate: + * @def: domain definition + * @cb: callback + * @opaque: user data + * + * Call @cb for each device in @def. + * + * Note that some devices might not have a virDomainDeviceInfoPtr associat= ed + * with them, in which case the corresponding argument passed to the callb= ack + * will be NULL: @cb should be written to account for this possibility, wh= ich + * usually involves returning early. + * + * Return: 0 on success, <0 on failure + */ int virDomainDeviceInfoIterate(virDomainDefPtr def, virDomainDeviceInfoCallback cb, @@ -5543,6 +5561,9 @@ virDomainDefCollectBootOrder(virDomainDefPtr def ATTR= IBUTE_UNUSED, virHashTablePtr bootHash =3D data; VIR_AUTOFREE(char *) order =3D NULL; =20 + if (!info) + return 0; + if (info->bootIndex =3D=3D 0) return 0; =20 @@ -6383,7 +6404,12 @@ virDomainDeviceDefValidateAliasesIterator(virDomainD= efPtr def, void *opaque) { struct virDomainDefValidateAliasesData *data =3D opaque; - const char *alias =3D info->alias; + const char *alias; + + if (!info) + return 0; + + alias =3D info->alias; =20 if (!virDomainDeviceAliasIsUserAlias(alias)) return 0; @@ -28767,6 +28793,9 @@ virDomainDeviceInfoCheckBootIndex(virDomainDefPtr d= ef ATTRIBUTE_UNUSED, { virDomainCompatibleDeviceDataPtr data =3D opaque; =20 + if (!info) + return 0; + /* Ignore the device we're about to update */ if (data->oldInfo =3D=3D info) return 0; @@ -29856,6 +29885,9 @@ virDomainDefFindDeviceCallback(virDomainDefPtr def = ATTRIBUTE_UNUSED, { virDomainDefFindDeviceCallbackData *data =3D opaque; =20 + if (!info) + return 0; + if (STREQ_NULLABLE(info->alias, data->devAlias)) { *data->dev =3D *dev; return -1; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 2b9c6f1866..560f278761 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -3593,6 +3593,9 @@ libxlComparePCIDevice(virDomainDefPtr def ATTRIBUTE_U= NUSED, { virDomainDeviceInfoPtr info2 =3D opaque; =20 + if (!info1) + return 0; + if (info1->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI || info2->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) return 0; diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 4b99e8ca93..5bef29b9df 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -169,6 +169,9 @@ qemuDomainSpaprVIOFindByReg(virDomainDefPtr def ATTRIBU= TE_UNUSED, { virDomainDeviceInfoPtr target =3D opaque; =20 + if (!info) + return 0; + if (info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) return 0; =20 @@ -427,6 +430,9 @@ qemuDomainHasVirtioMMIODevicesCallback(virDomainDefPtr = def ATTRIBUTE_UNUSED, virDomainDeviceInfoPtr info, void *opaque) { + if (!info) + return 0; + if (info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) { /* We can stop iterating as soon as we find the first * virtio-mmio device */ @@ -1083,6 +1089,9 @@ qemuDomainFillDevicePCIConnectFlagsIter(virDomainDefP= tr def ATTRIBUTE_UNUSED, { qemuDomainFillDevicePCIConnectFlagsIterData *data =3D opaque; =20 + if (!info) + return 0; + info->pciConnectFlags =3D qemuDomainDeviceCalculatePCIConnectFlags(dev, data->driver, data->pcieFlags, @@ -1139,6 +1148,9 @@ qemuDomainFillDevicePCIExtensionFlagsIter(virDomainDe= fPtr def ATTRIBUTE_UNUSED, { virQEMUCapsPtr qemuCaps =3D opaque; =20 + if (!info) + return 0; + info->pciAddrExtFlags =3D qemuDomainDeviceCalculatePCIAddressExtensionFlags(qemuCaps, dev); =20 @@ -1188,6 +1200,9 @@ qemuDomainFindUnusedIsolationGroupIter(virDomainDefPt= r def ATTRIBUTE_UNUSED, { unsigned int *isolationGroup =3D opaque; =20 + if (!info) + return 0; + if (info->isolationGroup =3D=3D *isolationGroup) return -1; =20 @@ -1479,7 +1494,12 @@ qemuDomainAssignPCIAddressExtension(virDomainDefPtr = def ATTRIBUTE_UNUSED, void *opaque) { virDomainPCIAddressSetPtr addrs =3D opaque; - virPCIDeviceAddressPtr addr =3D &info->addr.pci; + virPCIDeviceAddressPtr addr; + + if (!info) + return 0; + + addr =3D &info->addr.pci; =20 if (info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) addr->extFlags =3D info->pciAddrExtFlags; @@ -1498,7 +1518,12 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def ATTR= IBUTE_UNUSED, { virDomainPCIAddressSetPtr addrs =3D opaque; int ret =3D -1; - virPCIDeviceAddressPtr addr =3D &info->addr.pci; + virPCIDeviceAddressPtr addr; + + if (!info) + return 0; + + addr =3D &info->addr.pci; =20 if (!virDeviceInfoPCIAddressIsPresent(info) || ((device->type =3D=3D VIR_DOMAIN_DEVICE_HOSTDEV) && @@ -1590,7 +1615,12 @@ qemuDomainCollectPCIAddressExtension(virDomainDefPtr= def ATTRIBUTE_UNUSED, void *opaque) { virDomainPCIAddressSetPtr addrs =3D opaque; - virPCIDeviceAddressPtr addr =3D &info->addr.pci; + virPCIDeviceAddressPtr addr; + + if (!info) + return 0; + + addr =3D &info->addr.pci; =20 if (info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) addr->extFlags =3D info->pciAddrExtFlags; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 59ff88565d..e275685a60 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4415,6 +4415,9 @@ static int qemuComparePCIDevice(virDomainDefPtr def A= TTRIBUTE_UNUSED, { virDomainDeviceInfoPtr info2 =3D opaque; =20 + if (!info1->type) + return 0; + if (info1->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI || info2->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) return 0; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:05:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558352293; cv=none; d=zoho.com; s=zohoarc; b=Snzl0nOG8FYBQblxXzcXYgecbXk1fNQ0EKKvnACvI33ExhQjKEDsQcl3RrAP+BXQ2pRT13L+Zn6PBa4ZvGFZIiFVZmXoJeKetEIR8yrRrfxHXyTtpbQ2zN3M6GI9yuhTfbIcv2MGIG9ObAilGTEsul3JG7Rg5hLqIxhn2jmDLQk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558352293; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=HJ+F1E8+KQEQJ40pQu+X4692gmJvL9vlUiX/L0L39R0=; b=eCkfQTkPVHeW1/iN6j1HYPHRdcVxgvIRkWM14xKmFX9xv/eG3jNG9OJ5/uOpOLBeMKSTVw2SrWFFNIZmv5zeQZewIsB+JgjoLQUxyZOo4hW3dy+17ot/aJU0WjDgfkM9Zit99cLpEQ9lWz5+hePTDGTvPnkawgeoEIwbV2z2WdM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558352293841339.2707269313685; Mon, 20 May 2019 04:38:13 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7DC773092665; Mon, 20 May 2019 11:38:12 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 49ECD2FC4B; Mon, 20 May 2019 11:38:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 07E075EC6F; Mon, 20 May 2019 11:38:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4KBc4aV019667 for ; Mon, 20 May 2019 07:38:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id EAC835D9D1; Mon, 20 May 2019 11:38:04 +0000 (UTC) Received: from kinshicho.redhat.com (ovpn-204-17.brq.redhat.com [10.40.204.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5199E5DD8A for ; Mon, 20 May 2019 11:38:02 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 20 May 2019 13:37:50 +0200 Message-Id: <20190520113753.12345-6-abologna@redhat.com> In-Reply-To: <20190520113753.12345-1-abologna@redhat.com> References: <20190520113753.12345-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/8] conf: Drop DOMAIN_DEVICE_ITERATE_GRAPHICS X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 20 May 2019 11:38:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This was a hack needed because virDomainGraphicsDef doesn't embed a virDomainDeviceInfo, but now that we have clarified the corresponding pointer can be NULL we no longer need to special-case graphics and can drop the flag. This commit is best viewed with 'git show -w'. Signed-off-by: Andrea Bolognani Reviewed-by: Erik Skultety --- src/conf/domain_conf.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f42d331341..16820424be 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4080,7 +4080,6 @@ virDomainSkipBackcompatConsole(virDomainDefPtr def, =20 enum { DOMAIN_DEVICE_ITERATE_ALL_CONSOLES =3D 1 << 0, - DOMAIN_DEVICE_ITERATE_GRAPHICS =3D 1 << 1 } virDomainDeviceIterateFlags; =20 /* @@ -4246,15 +4245,11 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr = def, return rc; } =20 - /* If the flag below is set, make sure @cb can handle @info being NULL= , as - * graphics don't have any boot info */ - if (iteratorFlags & DOMAIN_DEVICE_ITERATE_GRAPHICS) { - device.type =3D VIR_DOMAIN_DEVICE_GRAPHICS; - for (i =3D 0; i < def->ngraphics; i++) { - device.data.graphics =3D def->graphics[i]; - if ((rc =3D cb(def, &device, NULL, opaque)) !=3D 0) - return rc; - } + device.type =3D VIR_DOMAIN_DEVICE_GRAPHICS; + for (i =3D 0; i < def->ngraphics; i++) { + device.data.graphics =3D def->graphics[i]; + if ((rc =3D cb(def, &device, NULL, opaque)) !=3D 0) + return rc; } =20 /* Coverity is not very happy with this - all dead_error_condition */ @@ -6951,8 +6946,7 @@ virDomainDefValidate(virDomainDefPtr def, /* iterate the devices */ if (virDomainDeviceInfoIterateInternal(def, virDomainDefValidateDeviceItera= tor, - (DOMAIN_DEVICE_ITERATE_ALL_CONS= OLES | - DOMAIN_DEVICE_ITERATE_GRAPHICS= ), + DOMAIN_DEVICE_ITERATE_ALL_CONSO= LES, &data) < 0) return -1; =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:05:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558352294; cv=none; d=zoho.com; s=zohoarc; b=S6nYzAp0PmnBUF8Deu24X3qyTpzKL2zbG4iiJreyrAn+bIZ+UlaG1NfqgrUTJbGrXCY7GeOoJJCQJUknTqfwTNLAydDvIl+Gn9wNnUlg5RlzZhdaBciyyJpKbLDPLcBFxjmX0kTeBbuAW6WUcUYNiSB3kbsXSTbk+bxIMi5JlYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558352294; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=hb+DFMwVG1wDVVy6ZECIjthZtisV+L/Hy9EEHWBrjPs=; b=BQVkDae2mlcntnIVe8RBxEtH278U5DVrMGOrdrUx7CnCFKkY+WJeexOTn6Ryk4RRh76nA3iDKV3/GTHTxMo29tarYwu/ZVeDTTcQUdqLDDPvsq09oTIli4paDheX3PO//OH6LInPOHp2NtsUM2KDH0UvIFQE5kVAEgbCU8vNTcQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558352294276752.7252286909804; Mon, 20 May 2019 04:38:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 300EC8830C; Mon, 20 May 2019 11:38:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06D815D6A6; Mon, 20 May 2019 11:38:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AF14B5EC71; Mon, 20 May 2019 11:38:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4KBc6ZN019672 for ; Mon, 20 May 2019 07:38:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 011EE5DD7B; Mon, 20 May 2019 11:38:06 +0000 (UTC) Received: from kinshicho.redhat.com (ovpn-204-17.brq.redhat.com [10.40.204.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A8835D9D1 for ; Mon, 20 May 2019 11:38:05 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 20 May 2019 13:37:51 +0200 Message-Id: <20190520113753.12345-7-abologna@redhat.com> In-Reply-To: <20190520113753.12345-1-abologna@redhat.com> References: <20190520113753.12345-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/8] conf: Add IOMMU support to virDomainDeviceInfoIterate() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 20 May 2019 11:38:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Now that we can safely iterate over devices that don't have an associated virDomainDeviceInfo, supporting IOMMU devices is no longer a problem. Signed-off-by: Andrea Bolognani --- src/conf/domain_conf.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 16820424be..eda424dbef 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4252,6 +4252,13 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr d= ef, return rc; } =20 + if (def->iommu) { + device.type =3D VIR_DOMAIN_DEVICE_IOMMU; + device.data.iommu =3D def->iommu; + if ((rc =3D cb(def, &device, NULL, opaque)) !=3D 0) + return rc; + } + /* Coverity is not very happy with this - all dead_error_condition */ #if !STATIC_ANALYSIS /* This switch statement is here to trigger compiler warning when addi= ng --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:05:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558352297; cv=none; d=zoho.com; s=zohoarc; b=ZiLpWnCeYHjEEWcL4uy9HuC2bm0lXNVhrmd9bguczdcEfdHqqz7tn+eTIDxhXPbgFmb2T/6W7FBsSi8HPM2yptdYCGU+DLQOHthABUBIYr0w6tS86T1EvGCeMZpNKuNA5wtHO7mbQUAQ4HzmVJMcLQKl5qhZCdziImfcMURlM0Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558352297; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=E/UqJeOaQgcLA90Z7M6O7U0++Ll5vOmNDoOfidcusUk=; b=Y51twCMoK2LrBd831flWb1+qIZizKkYNmUZVEEbWRjLoxnTi/QRpwnx3hp1NsXbaTNWNufPOhMSRlaeYD95MtnokYdqGjYWcOAo2B8GppX6htjuVNIIOZqjJ4KiTr6SLPTmWnuMBmbT7rMJtnZcuZnpezb2teAUMrsUMxlMM+/M= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558352297859526.8360956620077; Mon, 20 May 2019 04:38:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A3B9D3082B1E; Mon, 20 May 2019 11:38:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F1015DD8F; Mon, 20 May 2019 11:38:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3645F1806B15; Mon, 20 May 2019 11:38:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4KBc7Dq019683 for ; Mon, 20 May 2019 07:38:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0C1A65D9D1; Mon, 20 May 2019 11:38:07 +0000 (UTC) Received: from kinshicho.redhat.com (ovpn-204-17.brq.redhat.com [10.40.204.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 676825DD97 for ; Mon, 20 May 2019 11:38:06 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 20 May 2019 13:37:52 +0200 Message-Id: <20190520113753.12345-8-abologna@redhat.com> In-Reply-To: <20190520113753.12345-1-abologna@redhat.com> References: <20190520113753.12345-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 7/8] qemu: Introduce qemuDomainDeviceDefValidateIOMMU() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Mon, 20 May 2019 11:38:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Device validation should not have to wait until command line generation time. Moving the code to a separate function also allows us to avoid some unnecessary repetition. Signed-off-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 56 ---------------------------------- src/qemu/qemu_domain.c | 66 +++++++++++++++++++++++++++++++++++++++- tests/qemuxml2argvtest.c | 2 +- 3 files changed, 66 insertions(+), 58 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index aae2f43044..e16c748d31 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6935,60 +6935,11 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd, if (!iommu) return 0; =20 - switch (iommu->model) { - case VIR_DOMAIN_IOMMU_MODEL_INTEL: - if (iommu->intremap !=3D VIR_TRISTATE_SWITCH_ABSENT && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_INTREMAP)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("iommu: interrupt remapping is not supported " - "with this QEMU binary")); - return -1; - } - if (iommu->caching_mode !=3D VIR_TRISTATE_SWITCH_ABSENT && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_CACHING_MODE))= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("iommu: caching mode is not supported " - "with this QEMU binary")); - return -1; - } - if (iommu->eim !=3D VIR_TRISTATE_SWITCH_ABSENT && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_EIM)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("iommu: eim is not supported " - "with this QEMU binary")); - return -1; - } - if (iommu->iotlb !=3D VIR_TRISTATE_SWITCH_ABSENT && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB))= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("iommu: device IOTLB is not supported " - "with this QEMU binary")); - return -1; - } - break; - case VIR_DOMAIN_IOMMU_MODEL_LAST: - break; - } - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) return 0; /* Already handled via -machine */ =20 switch (iommu->model) { case VIR_DOMAIN_IOMMU_MODEL_INTEL: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_INTEL_IOMMU)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("IOMMU device: '%s' is not supported with " - "this QEMU binary"), - virDomainIOMMUModelTypeToString(iommu->model)); - return -1; - } - if (!qemuDomainIsQ35(def)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("IOMMU device: '%s' is only supported with " - "Q35 machines"), - virDomainIOMMUModelTypeToString(iommu->model)); - return -1; - } virBufferAddLit(&opts, "intel-iommu"); if (iommu->intremap !=3D VIR_TRISTATE_SWITCH_ABSENT) { virBufferAsprintf(&opts, ",intremap=3D%s", @@ -7648,13 +7599,6 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) { switch (def->iommu->model) { case VIR_DOMAIN_IOMMU_MODEL_INTEL: - if (!qemuDomainIsQ35(def)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("IOMMU device: '%s' is only supported wit= h " - "Q35 machines"), - virDomainIOMMUModelTypeToString(def->iommu-= >model)); - return -1; - } virBufferAddLit(&buf, ",iommu=3Don"); break; case VIR_DOMAIN_IOMMU_MODEL_LAST: diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3290c5d490..e50e84a3b2 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6083,6 +6083,67 @@ qemuDomainDeviceDefValidateMemballoon(const virDomai= nMemballoonDef *memballoon, } =20 =20 +static int +qemuDomainDeviceDefValidateIOMMU(const virDomainIOMMUDef *iommu, + const virDomainDef *def, + virQEMUCapsPtr qemuCaps) +{ + switch (iommu->model) { + case VIR_DOMAIN_IOMMU_MODEL_INTEL: + if (!qemuDomainIsQ35(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("IOMMU device: '%s' is only supported with " + "Q35 machines"), + virDomainIOMMUModelTypeToString(iommu->model)); + return -1; + } + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_INTEL_IOMMU) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("IOMMU device: '%s' is not supported with " + "this QEMU binary"), + virDomainIOMMUModelTypeToString(iommu->model)); + return -1; + } + if (iommu->intremap !=3D VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_INTREMAP)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iommu: interrupt remapping is not supported " + "with this QEMU binary")); + return -1; + } + if (iommu->caching_mode !=3D VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_CACHING_MODE))= { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iommu: caching mode is not supported " + "with this QEMU binary")); + return -1; + } + if (iommu->eim !=3D VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_EIM)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iommu: eim is not supported " + "with this QEMU binary")); + return -1; + } + if (iommu->iotlb !=3D VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB))= { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iommu: device IOTLB is not supported " + "with this QEMU binary")); + return -1; + } + break; + + case VIR_DOMAIN_IOMMU_MODEL_LAST: + default: + virReportEnumRangeError(virDomainIOMMUModel, iommu->model); + } + + return 0; +} + + static int qemuDomainDeviceDefValidateZPCIAddress(virDomainDeviceInfoPtr info, virQEMUCapsPtr qemuCaps) @@ -6195,6 +6256,10 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef= *dev, ret =3D qemuDomainDeviceDefValidateMemballoon(dev->data.memballoon= , qemuCaps); break; =20 + case VIR_DOMAIN_DEVICE_IOMMU: + ret =3D qemuDomainDeviceDefValidateIOMMU(dev->data.iommu, def, qem= uCaps); + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_FS: case VIR_DOMAIN_DEVICE_SOUND: @@ -6203,7 +6268,6 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, case VIR_DOMAIN_DEVICE_SHMEM: case VIR_DOMAIN_DEVICE_MEMORY: case VIR_DOMAIN_DEVICE_PANIC: - case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_NONE: case VIR_DOMAIN_DEVICE_LAST: break; diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0e83acac86..55db5f6fca 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2812,7 +2812,7 @@ mymain(void) DO_TEST_CAPS_LATEST("intel-iommu-caching-mode"); DO_TEST_CAPS_LATEST("intel-iommu-eim"); DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb"); - DO_TEST_FAILURE("intel-iommu-wrong-machine", NONE); + DO_TEST_PARSE_ERROR("intel-iommu-wrong-machine", NONE); =20 DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); DO_TEST_PARSE_ERROR("cpu-hotplug-granularity", --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 8 00:05:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558352301; cv=none; d=zoho.com; s=zohoarc; b=h6uLasorzQtQlYEeOTLcDvhhv0S9vNV0muG+eq/YkkWsLv0yL01EOLn1cbcKU6hn6q3jFiIfvpjhxPnldkdqZNeZuw2w1pmhiIbOaVpitrP3JzqOMgIIU/I3kPfoTeb4VefWqcaFMcj8orNFli1h0lEAmjg4qDpKEKc+QP21I6g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558352301; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=TJ/QlA9X6Y5k1oT7qgjNBcI/2FoaF0503w2DdXzRUH8=; b=G4p6zOIKNq4neiS5IlYatbVMRGD+tIDx5a6Mlny2E+NzpHV9iOYxkmJE5R8WqZ8G3f/nNzxGUbkmi79f/Sw+kBX1r12B3SKD4M2EVu/wJHCc4mTEL/AEVFcl/6ikbYwvCD0SG+SM0OMuct2BtLYkmil/FL+meexEfyDcXYs7HkI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1558352301277851.6888175725825; Mon, 20 May 2019 04:38:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D0571308125C; Mon, 20 May 2019 11:38:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB8F778376; Mon, 20 May 2019 11:38:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6E8B91806B1F; Mon, 20 May 2019 11:38:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4KBc8k5019692 for ; Mon, 20 May 2019 07:38:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 176DD5D9D1; Mon, 20 May 2019 11:38:08 +0000 (UTC) Received: from kinshicho.redhat.com (ovpn-204-17.brq.redhat.com [10.40.204.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 70EF85D967 for ; Mon, 20 May 2019 11:38:07 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Mon, 20 May 2019 13:37:53 +0200 Message-Id: <20190520113753.12345-9-abologna@redhat.com> In-Reply-To: <20190520113753.12345-1-abologna@redhat.com> References: <20190520113753.12345-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 8/8] qemu: Tweak Intel IOMMU command line generation X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 20 May 2019 11:38:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Mostly add comments explaining why there are two capabilites for the same feature and how they interact. Signed-off-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e16c748d31..73f570c419 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6935,8 +6935,12 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd, if (!iommu) return 0; =20 - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) - return 0; /* Already handled via -machine */ + /* qemuDomainDeviceDefValidate() already made sure we have one of + * QEMU_CAPS_DEVICE_INTEL_IOMMU or QEMU_CAPS_MACHINE_IOMMU: here we + * handle the former case, while the latter is taken care of in + * qemuBuildMachineCommandLine() */ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_INTEL_IOMMU)) + return 0; =20 switch (iommu->model) { case VIR_DOMAIN_IOMMU_MODEL_INTEL: @@ -7594,7 +7598,10 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, } } =20 - /* We don't report errors on missing cap here - -device code will do t= hat */ + /* qemuDomainDeviceDefValidate() already made sure we have one of + * QEMU_CAPS_DEVICE_INTEL_IOMMU or QEMU_CAPS_MACHINE_IOMMU: here we + * handle the latter case, while the former is taken care of in + * qemuBuildIOMMUCommandLine() */ if (def->iommu && virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_IOMMU)) { switch (def->iommu->model) { --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list