From nobody Sun Feb 8 16:30:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1576614935; cv=none; d=zohomail.com; s=zohoarc; b=jfcLB+4mCZlovRv1/BmzARPEP4f3SdZnC+vt74wATayY5ueYeSRSanclIGh76y9o+NZNCyTy1Inl1k4pGCwE3IyOBCh2j4bQ4UojWfsm9VPjuFNsz3Cn9Rz3u1CxSs23bSa5sSB2oMXEDarZG7XRGX+1y9kfM4MME6PqDTQYBIg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576614935; 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=PyjD9M8LWMnfi0XnEXFSpnPXsWVHFhCMSjtdjU9UsHI=; b=JBzTGCLbEmn3tzNlqUc+qu/zhMAuU0GGIb0TsRmz663BN2NMHAHoGN5hR/bO5BO6RpAaEzKN8+bOYIdEyVDuGB/BtcIcH3i+6zsfpN4Syza8fqFKWFJhmS+M3j9GOQUpRph03OWnpaZC9YB6VCpShGY7G3kFqI7rLnBrLg6AjEA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 157661493538987.09396819198616; Tue, 17 Dec 2019 12:35:35 -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-165-YNqFf_tEOOCob40NQV-iOA-1; Tue, 17 Dec 2019 15:35:32 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 193EC1800D42; Tue, 17 Dec 2019 20:35:27 +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 D6B2460BF1; Tue, 17 Dec 2019 20:35:26 +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 8E9DD18089CE; Tue, 17 Dec 2019 20:35:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBHKZNaO006110 for ; Tue, 17 Dec 2019 15:35:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6614E2166B2A; Tue, 17 Dec 2019 20:35:23 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 615542166B29 for ; Tue, 17 Dec 2019 20:35:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 62B2E801009 for ; Tue, 17 Dec 2019 20:35:21 +0000 (UTC) Received: from mail-qk1-f196.google.com (mail-qk1-f196.google.com [209.85.222.196]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-394-mz84BJr7OJqtbvGBA_J8KQ-1; Tue, 17 Dec 2019 15:35:17 -0500 Received: by mail-qk1-f196.google.com with SMTP id a203so8414471qkc.3; Tue, 17 Dec 2019 12:35:17 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:2f19:a73a:b6c3:c24a:90f3]) by smtp.gmail.com with ESMTPSA id f23sm7352679qke.104.2019.12.17.12.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2019 12:35:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576614934; 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=PyjD9M8LWMnfi0XnEXFSpnPXsWVHFhCMSjtdjU9UsHI=; b=V1UBlNARGIZSMhEIaQ5XQujaFf2q8nOEZVTg9xR8txeR3X+pBuIjzTE4Lg9eL344kBKf/5 5F32SG5MGap37PwTi4aFIbVS+piMldEkF0ydKRz4dntP5M1hZvY4sBbRgQYcH1wqWvoNqc hdZLHKuBkuZ02pBWiuJSF0Hr6dzsbJ4= 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=kaOrzxQU/CIu0t5jKh287W+ufUtM28EfjKthsTgmtw0=; b=B9ky8/nVj/lyMWJehnCFr4ioGD+iAPf+FbhkTXa80UQHcCWijkzXW+nkV9W08HGDlI e8bdQZyYTT4xAGs/v0KfUMWIRkwbGH2w+CN6ERQCY9vrohuJpcBasSwXjVlXxcQZXz9e J75L37bm9UTmyfnIuPJHCjg9QbaLN9uUubSCB9rGJfLjP/HJgQOtHP1Gv1W8v0PEpFbJ owAJexW4JIYE1BLpXHp351tTrz+VoYKyqNpZzXvklbFQhqEbcdjZjaHIuPgVvXhhfwx+ fc2mXJmrRQn7grNRl3XWcNPBeb/fwi7MZAs8xsMnxhEh7dX077IvLWZWgbkfcOdLYdiR RpNw== X-Gm-Message-State: APjAAAX/dyvuszB5PMC6p+WPqFqdaYQwAueH6vyTNPr1eEgnBS4vF9ff SCVKnmwFaxA2zIgDzfMZYH1/lYG9 X-Google-Smtp-Source: APXvYqxgtjO0PDHr9d6hL8WN7QAXdgaM0JxxKvOtiH7sK34PuapuVwAMGtZhIaDTbJY3FOKVhJi2xA== X-Received: by 2002:ae9:e649:: with SMTP id x9mr6926885qkl.405.1576614916755; Tue, 17 Dec 2019 12:35:16 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 17:35:03 -0300 Message-Id: <20191217203505.3803240-3-danielhb413@gmail.com> In-Reply-To: <20191217203505.3803240-1-danielhb413@gmail.com> References: <20191217203505.3803240-1-danielhb413@gmail.com> MIME-Version: 1.0 X-MC-Unique: mz84BJr7OJqtbvGBA_J8KQ-1 X-MC-Unique: YNqFf_tEOOCob40NQV-iOA-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xBHKZNaO006110 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , laine@laine.org, darkstego@gmail.com, crobinso@redhat.com Subject: [libvirt] [PATCH v6 2/4] 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.79 on 10.5.11.12 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 864967f375..ed8b878566 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5336,6 +5336,10 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, *bootHostdevNet =3D 0; } =20 + /* Ignore unassigned devices */ + if (hostdev->info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_U= NASSIGNED) + continue; + if (qemuCommandAddExtDevice(cmd, hostdev->info) < 0) return -1; =20 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 118a460633..bfbed5c31d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1332,6 +1332,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