From nobody Sun Feb 8 03:58:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1576503425; cv=none; d=zohomail.com; s=zohoarc; b=ijrJTv0az32lV3K+A8JA+rOyRIdf7MqZWT3ST27ISDfsUz6cEc439ZFq6rP5XBHEMKe74h44uWusiRbLc0IwJFSe1x1Vkq/ty3KdenI8PtuwtVvtMZs4Ht0j41ieRmFJ9T0QEZKu5h1hkd9sw0by6hvY0ZEm4ic+IwucjfLtbLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576503425; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=FGaMLRFzF74ijZ6x0/ZqcgJFXV4aKXe9Bvv4NZRkrYk=; b=FqjjXhQSnbKa4mJr0oywo5i2bsKLQUH4foJrFiiKsLsNMDuh9GZPoDdEzq+ka4zrs6jj2lE6bLwdoomEUUSerg2kuHczv1YLgHSLy5O8NLeJP6wWTvFwuJJVGEXEdK4FknG2kd/nQl8pkQiGZ8gtwryQMKlVftpoBfAzaH8SRBw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1576503425654293.00801127126454; Mon, 16 Dec 2019 05:37:05 -0800 (PST) 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-123-CA5-IMlyM4CwwHEemUVq4A-1; Mon, 16 Dec 2019 08:36:34 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E7CC802CB6; Mon, 16 Dec 2019 13:36:29 +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 E871E1000329; Mon, 16 Dec 2019 13:36:28 +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 8E67DADAAE; Mon, 16 Dec 2019 13:36:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBGDaR8R007565 for ; Mon, 16 Dec 2019 08:36:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 333802063FF2; Mon, 16 Dec 2019 13:36:27 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E5B42026D68 for ; Mon, 16 Dec 2019 13:36:23 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5CEC6801E65 for ; Mon, 16 Dec 2019 13:36:23 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-202-MHP2ZlTeN8ubpdiKA_g20g-1; Mon, 16 Dec 2019 08:36:21 -0500 Received: by mail-qt1-f194.google.com with SMTP id d5so4235698qto.0; Mon, 16 Dec 2019 05:36:20 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:2f19:a73a:b6c3:c24a:90f3]) by smtp.gmail.com with ESMTPSA id r12sm2414002qkm.94.2019.12.16.05.36.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2019 05:36:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576503422; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FGaMLRFzF74ijZ6x0/ZqcgJFXV4aKXe9Bvv4NZRkrYk=; b=gaZjNrQVh3CY0Yj6kldu4wNsEQazcKYoLNj3VVTVihbr8XPyMsUXMCTw0PEMXa7U5xd/qm V3ORXF7x/4eR5AqkLTpVSIBNQTO71RkuFU1p2GhIT84GytpIxSXLPzyzgrOj7lZ9utpRLn 6HdACk1Tjh8rDUq5AZgwtcg9oCqB1Tk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WOgVYmUuW96m3UrI6C+uhSOPJ4BwI4GsUd6ENeuujd4=; b=ShQ346qVuexIUF34lkMmICdVO7/XXlTY2TuNT22fqXTTRmYRn/JCzNRzLa7Slx6c8s 9T6tk+qIeF2XsK+OBObgZOXde95wNNmt/PZnEo6FsszlEnPE4wu7GYUZDK5RuMDFV2xW m5OHb19bOaR6AvMRv1mwiuH53tQ0LIogBv9Co1PYw9UdGzzsMrrH2ZILRaKQ+gLYau/x s7N0TUMuWYuRwJ8ICFJT+xPZXpA9g1V7Lz85C/fGhQRkj4vLK/rWaFSqHnVGbJmm2sLs XUIIjX7idgcRHG7vKQM1KkQX0ajxQlZ3kDRSEmEFKz0pdDnHoeYPn92CeAAzpWLinWvW vyew== X-Gm-Message-State: APjAAAXfr0RIadDCoqGqq2m70ydjSQMkw3YzJZuhuf9X6EkR8Y+QlG+V FomR+wOMepb4PCQRz+Pj9QXKUJCX X-Google-Smtp-Source: APXvYqw23J+ulZMfHSZXq0ed3tWZQLfVs9cij1d+vRitgjl2N7fRF/qtKInE+HXpQ7HwykO523Vmew== X-Received: by 2002:ac8:7956:: with SMTP id r22mr8377169qtt.16.1576503380355; Mon, 16 Dec 2019 05:36:20 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Mon, 16 Dec 2019 10:36:04 -0300 Message-Id: <20191216133607.3055202-3-danielhb413@gmail.com> In-Reply-To: <20191216133607.3055202-1-danielhb413@gmail.com> References: <20191216133607.3055202-1-danielhb413@gmail.com> MIME-Version: 1.0 X-MC-Unique: MHP2ZlTeN8ubpdiKA_g20g-1 X-MC-Unique: CA5-IMlyM4CwwHEemUVq4A-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xBGDaR8R007565 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , laine@laine.org, darkstego@gmail.com, crobinso@redhat.com Subject: [libvirt] [PATCH v4 2/5] qemu: handle unassigned PCI hostdevs in command line 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: , 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-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Previous patch made it possible for the QEMU driver to check if a given PCI hostdev is unassigned, by checking if dev->info->type is VIR_DOMAIN_DEVICE_ADDRESS_TYPE_UNASSIGNED, meaning that this device shouldn't be part of the actual guest launch. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 4 +++ .../hostdev-pci-address-unassigned.args | 31 +++++++++++++++++++ tests/qemuxml2argvtest.c | 4 +++ 3 files changed, 39 insertions(+) create mode 100644 tests/qemuxml2argvdata/hostdev-pci-address-unassigned.a= rgs diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5d12ef3d63..7f7331744f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5419,6 +5419,10 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, } } =20 + /* Ignore unassigned devices */ + if (hostdev->info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_U= NASSIGNED) + continue; + unsigned int bootIndex =3D hostdev->info->bootIndex; =20 /* bootNet will be non-0 if boot order was set and no other diff --git a/tests/qemuxml2argvdata/hostdev-pci-address-unassigned.args b/t= ests/qemuxml2argvdata/hostdev-pci-address-unassigned.args new file mode 100644 index 0000000000..42fae17444 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-pci-address-unassigned.args @@ -0,0 +1,31 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-delete \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-delete/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-delete/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-delete/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name delete \ +-S \ +-machine pc,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-m 256 \ +-realtime mlock=3Doff \ +-smp 4,sockets=3D4,cores=3D1,threads=3D1 \ +-uuid 583a8e8e-f0ce-4f53-89ab-092862148b25 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-delete/monitor.= sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device vfio-pci,host=3D0005:90:01.0,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x3 \ +-device vfio-pci,host=3D0005:90:01.2,id=3Dhostdev2,bus=3Dpci.0,addr=3D0x4 \ +-device vfio-pci,host=3D0005:90:01.3,id=3Dhostdev3,bus=3Dpci.0,addr=3D0x5 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x6 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 8655db609e..92fbf3764e 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1331,6 +1331,10 @@ mymain(void) QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_VFIO_PCI); =20 + DO_TEST("hostdev-pci-address-unassigned", + QEMU_CAPS_KVM, + QEMU_CAPS_DEVICE_VFIO_PCI); + DO_TEST("serial-file-log", QEMU_CAPS_CHARDEV_FILE_APPEND, QEMU_CAPS_DEVICE_ISA_SERIAL, --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list