From nobody Sun Feb 8 05:41:38 2026 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1564078222; cv=none; d=zoho.com; s=zohoarc; b=LEQYL0M56lYqE/oq7iiELL7id+RyNB8azeWrsuxp/ikg2jqJPZK0WXxoO0Hic/yoYx8OohvhIhkv4KgO1kYKI8meOjfkAre+2Pma/+CBECLuBJbveWK8vUWwMZ3zSaq8bKlIu2mj7cd+hI9GET6zIYrn+1thetI+vTtmT+0bU90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564078222; 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:ARC-Authentication-Results; bh=ZeoY0tDScnA9l7jvXjOu+l5LiaZ+YOxMhLeoH0KCeSk=; b=FjZCjtF9t/inrjOkfh75B6c4DKPOu0LVZv6dFaGxBW8uIe6oc/Fd6HXmGq9CI3BjtoCrzigQVrx/V1ukOHZ5cKkJTEfRl7smiV4OxeiZUmSdH75TybFPvFyRNOjHcYKB5JoRBaRzNrSm7WCG5sFHe3OEnCBZ6ptgW7u1TdErZAg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail 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 15640782227651022.4085244194157; Thu, 25 Jul 2019 11:10:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 28E673091761; Thu, 25 Jul 2019 18:10:21 +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 F178136FB; Thu, 25 Jul 2019 18:10:20 +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 ADD5F1800209; Thu, 25 Jul 2019 18:10:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6PIAHTm031586 for ; Thu, 25 Jul 2019 14:10:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7A20E5D772; Thu, 25 Jul 2019 18:10:17 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7499D5D71A for ; Thu, 25 Jul 2019 18:10:15 +0000 (UTC) Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1657781DEE for ; Thu, 25 Jul 2019 18:10:14 +0000 (UTC) Received: by mail-qk1-f174.google.com with SMTP id g18so37130103qkl.3 for ; Thu, 25 Jul 2019 11:10:14 -0700 (PDT) Received: from rekt.ibmuc.com ([2804:431:c7c6:30ed:e8ca:caf:6199:5dc7]) by smtp.gmail.com with ESMTPSA id e8sm21639968qkn.95.2019.07.25.11.10.11 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 25 Jul 2019 11:10:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NR0R5ogbrsrV7/JSUgU1SjX3aa8MyVr3gV8XWuIVt5M=; b=GgdfUv/uYF8gO40Mfa9wUObkvFleTltMY3IkdDD+Vc6cYf62nN45YKpF5eisisk+7M quGs726gnrC5qa1YVfUt1TGNEab0tgQ44BtF1fyekXU1Avox3H0RGtSySZ+Fuao9QoYL v2I6P7jtMV2Sn61TncUVJYk1CT+GD8DBwqJZaTKq3+W0ROq6hPWuqq6sDmboZFts3/V8 FvUumu4N69PuA44sgduH+aJ8XHj018+lkOUJT0FMWbapbFoGdCHwCJav9IvXCD7/2xCr pvBy8CmgwgGmXmzqp47+u6+V1U6YQ3SV83af1dCE0wtvf9ZeyEUoY4rsUQqzjPDb6J3Z WgIw== 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=NR0R5ogbrsrV7/JSUgU1SjX3aa8MyVr3gV8XWuIVt5M=; b=tiv1qdLohf8N0ZPLDXUelZffY5+tWYoaPmt837t+6HlqW9d86hIfnujPhQ6sPprwOf bVA/JFl+TGeqaeV9BM1HXfGZRu33MoXtWn+Ct29bx+li6KxhcO5FWZCrNeI5RIoMxnb5 JhoTmv0IywKsvkxDKutVdbHOZcnicxclsXJBtLYmfyXymYmdSmDC61qZuay/jywBUS/J 5ISK3PbK1rOLGRma6HAdQRRgzsN2S1Uuv7cPuKHiNpSRwtkvVnDZjQkixA71Ocg4i2/j yjeG0bC+HzB61S0S82aeMc1UIUXcataubSxkkcAzVcxsBaobwsYMp5yWnn5QDBAlDRIW irKA== X-Gm-Message-State: APjAAAWy6fiP33A71t/dueApFtrJtjXuVNrnwmzImgwgsb8YBhVM/eCd ZdR0CBtW/TKWR/I9q4LPGbMzYkjU X-Google-Smtp-Source: APXvYqxu10J4Nj5uSVqeH2NySFRD29e4r3xS2HQDEYNvE8/J0F1KuB1PGbCKNTUiNIZtombae3bjgw== X-Received: by 2002:ae9:c00f:: with SMTP id u15mr58004353qkk.426.1564078213145; Thu, 25 Jul 2019 11:10:13 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 25 Jul 2019 15:09:51 -0300 Message-Id: <20190725180951.8926-8-danielhb413@gmail.com> In-Reply-To: <20190725180951.8926-1-danielhb413@gmail.com> References: <20190725180951.8926-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 25 Jul 2019 18:10:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 25 Jul 2019 18:10:14 +0000 (UTC) for IP:'209.85.222.174' DOMAIN:'mail-qk1-f174.google.com' HELO:'mail-qk1-f174.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.151 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.222.174 mail-qk1-f174.google.com 209.85.222.174 mail-qk1-f174.google.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v2 7/7] tests: Add a baseline test for multifunction pci device use case 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 25 Jul 2019 18:10:21 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Shivaprasad G Bhat There are already good number of test cases with hostdevices, few have multifunction devices but none having more than one than one multifunction cards. This patch adds a case where there are two multifunction cards and two Virtual functions part of the same XML. 0001:01:00.X & 0005:09:00.X - are Multifunction PCI cards. 0000:06:12.[5|6] - are SRIOV Virtual functions The next few commits improve on automatically detecting the multifunction cards and auto-assinging the addresses appropriately. Signed-off-by: Shivaprasad G Bhat Signed-off-by: Daniel Henrique Barboza Reviewed-by: Michal Privoznik --- .../hostdev-pci-multifunction.args | 35 ++++++++ .../hostdev-pci-multifunction.xml | 59 ++++++++++++++ tests/qemuxml2argvtest.c | 3 + .../hostdev-pci-multifunction.xml | 79 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 5 files changed, 177 insertions(+) create mode 100644 tests/qemuxml2argvdata/hostdev-pci-multifunction.args create mode 100644 tests/qemuxml2argvdata/hostdev-pci-multifunction.xml create mode 100644 tests/qemuxml2xmloutdata/hostdev-pci-multifunction.xml diff --git a/tests/qemuxml2argvdata/hostdev-pci-multifunction.args b/tests/= qemuxml2argvdata/hostdev-pci-multifunction.args new file mode 100644 index 0000000000..7747cca442 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-pci-multifunction.args @@ -0,0 +1,35 @@ +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=3D0001:01:00.1,id=3Dhostdev1,bus=3Dpci.0,addr=3D0x4 \ +-device vfio-pci,host=3D0001:01:00.0,id=3Dhostdev2,bus=3Dpci.0,addr=3D0x5 \ +-device vfio-pci,host=3D0005:90:01.2,id=3Dhostdev3,bus=3Dpci.0,addr=3D0x6 \ +-device vfio-pci,host=3D0005:90:01.3,id=3Dhostdev4,bus=3Dpci.0,addr=3D0x7 \ +-device vfio-pci,host=3D06:12.1,id=3Dhostdev5,bus=3Dpci.0,addr=3D0x8 \ +-device vfio-pci,host=3D06:12.2,id=3Dhostdev6,bus=3Dpci.0,addr=3D0x9 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0xa diff --git a/tests/qemuxml2argvdata/hostdev-pci-multifunction.xml b/tests/q= emuxml2argvdata/hostdev-pci-multifunction.xml new file mode 100644 index 0000000000..06c889c64d --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-pci-multifunction.xml @@ -0,0 +1,59 @@ + + delete + 583a8e8e-f0ce-4f53-89ab-092862148b25 + 262144 + 4 + + hvm + + + /usr/bin/qemu-system-x86_64 + + + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index d6e6272518..5feb305f41 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1313,6 +1313,9 @@ mymain(void) DO_TEST_FAILURE("net-hostdev-fail", QEMU_CAPS_DEVICE_VFIO_PCI); =20 + DO_TEST("hostdev-pci-multifunction", + QEMU_CAPS_KVM, + QEMU_CAPS_DEVICE_VFIO_PCI); =20 DO_TEST("serial-file-log", QEMU_CAPS_CHARDEV_FILE_APPEND, diff --git a/tests/qemuxml2xmloutdata/hostdev-pci-multifunction.xml b/tests= /qemuxml2xmloutdata/hostdev-pci-multifunction.xml new file mode 100644 index 0000000000..52ed86e305 --- /dev/null +++ b/tests/qemuxml2xmloutdata/hostdev-pci-multifunction.xml @@ -0,0 +1,79 @@ + + delete + 583a8e8e-f0ce-4f53-89ab-092862148b25 + 262144 + 262144 + 4 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + +
+ + +
+ + + + + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + + + +
+ +
+ + +
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 09c86eda2a..b7e1b58887 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -427,6 +427,7 @@ mymain(void) =20 DO_TEST("hostdev-usb-address", NONE); DO_TEST("hostdev-pci-address", NONE); + DO_TEST("hostdev-pci-multifunction", NONE); DO_TEST("hostdev-vfio", NONE); DO_TEST("hostdev-vfio-zpci", QEMU_CAPS_DEVICE_ZPCI, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list