From nobody Sun Feb 8 05:59:10 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=1564078232; cv=none; d=zoho.com; s=zohoarc; b=cizPNW+POu/3RrDc2CDISoxO3RotDUPSpYFYXxTcuF0qM8bejBzji75EGlsA8PfR+nvUNVWdYLL4G1bo+lUVebBz9+YQQdxDLAhC/zyNuTdjO+Zfmpwii91Xf6GRP9traUZtyOv26CDGzlM8vFw9uqgQAsqvzoECPYmNSQrbTVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564078232; 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=HAD/n54qLj0JOhQQ7+/DCNjJKfNxvOa7WVRoKnofiKU=; b=BDKi2K6DwDZ84bn3FajX9MDxA1ahMmFb12TT71M+IJjuH5IViA59e78HekdPKj3Cktsk2v7spXQVhfEbaoU30GAty13CNpmTBhj8cGz+0SxlXlXIgKokOT29ukTuE36Pcbx/ssiqBGD6ra6xR9ToYy8PFN26uD9xnsJ6o+5GRE0= 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 1564078232124848.027315393736; Thu, 25 Jul 2019 11:10:32 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8479330C34D3; Thu, 25 Jul 2019 18:10:30 +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 63591605C3; Thu, 25 Jul 2019 18:10:30 +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 27AC719730; Thu, 25 Jul 2019 18:10:30 +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 x6PIAENr031570 for ; Thu, 25 Jul 2019 14:10:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0DC705DDA2; Thu, 25 Jul 2019 18:10:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 070A25DD92 for ; Thu, 25 Jul 2019 18:10:11 +0000 (UTC) Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) (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 0C35630A7C61 for ; Thu, 25 Jul 2019 18:10:10 +0000 (UTC) Received: by mail-qk1-f193.google.com with SMTP id r21so37184568qke.2 for ; Thu, 25 Jul 2019 11:10:09 -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.07 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 25 Jul 2019 11:10:08 -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=NuGsO70+C0kc4eC+HEydfxVAdPiqLHooTdkv0Le4//4=; b=IMh6lySDNIhdMW2TAYdn1VY4NZCFeAMFweDod6Ioxg3bxP22aHMiOjcSFZ6V1vsI8k VjmDulgANZPHabYr+DfEjLy6mD5WbU14/EciAiB4Ckk3CBegC9VVFkNKY+wRCNaoTuyz vUZCDT+CEWC3twPopdOX0nXYdxAUUZhVOZ4n6ZChaf0D5dRMLy8o9kNGVEPiejRPyJkH DqqP3XAE7IFa3a1OTkrHL4iC0PbP1OyTUBYeH3UfMd0M+xUFdK8iyT0X1DUPNq62lf98 prDqzGhLUPDOJlKqNouVstEG0ujARV1vBp4gLuN26vIWtWH2980cWzLW5unvzvyTRH2S XxgA== 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=NuGsO70+C0kc4eC+HEydfxVAdPiqLHooTdkv0Le4//4=; b=ZhzY/wlUvPWgPxkuFLaKWn9qTynC6AEAZ1qi4u32FcP7xqlnEN2+ZOQKj0vXGKS7c1 oy524lDeDDhw3eC4jwM29lRqEOFXHwgLaJmgP5T7cEgH/alPiipoaf86c4IJ58vrF5Ea t5UHz3WVaG6xIWUiIUfkjxbw/0BYndBXdrTivHxAAKdDBbaei9Lg6EezYl8I97zUOxSf 6htpsdbn2QespXAql9aftlsMpzksPDnsEbOPo/dBATCorXByrKW/cektFzQ8zutoI8CJ ygKQDRlZ3lxt/or+sUyPnj3sgUYsmnoMue+lmrFUll94LenKxnLMk82HeOhhAMPa122B V1Vg== X-Gm-Message-State: APjAAAXpb4LVCvPN4ksa4qHfbepB/SzrSRMRoI8C0Nf0k79bccP05EWs hryzibDTKNx+eRAiSLPuip/INxsL X-Google-Smtp-Source: APXvYqzt7Q0nhnfmeCNKH5V7kajXRhSaRqQieenYWciMCdrccOhlJrXTPCsggA+sR8yYW9BxnYxKLg== X-Received: by 2002:a37:a358:: with SMTP id m85mr36838973qke.190.1564078209098; Thu, 25 Jul 2019 11:10:09 -0700 (PDT) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Thu, 25 Jul 2019 15:09:49 -0300 Message-Id: <20190725180951.8926-6-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.42]); Thu, 25 Jul 2019 18:10:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 25 Jul 2019 18:10:10 +0000 (UTC) for IP:'209.85.222.193' DOMAIN:'mail-qk1-f193.google.com' HELO:'mail-qk1-f193.google.com' FROM:'danielhb413@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.15 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.222.193 mail-qk1-f193.google.com 209.85.222.193 mail-qk1-f193.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v2 5/7] virpcimock: Mock the SRIOV Virtual functions 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 25 Jul 2019 18:10:31 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Shivaprasad G Bhat The softlink to physfn is the way to know if the device is VF or not. So, the patch softlinks 'physfn' to the parent function. The multifunction PCI devices dont have 'physfn' softlinks. The patch adds few Virtual functions to the mock environment and changes the existing VFIO test xmls using the VFs to use the newly added VFs for their use case. Signed-off-by: Shivaprasad G Bhat Signed-off-by: Daniel Henrique Barboza --- .../hostdev-vfio-multidomain.args | 2 +- .../hostdev-vfio-multidomain.xml | 2 +- tests/qemuxml2argvdata/hostdev-vfio.args | 2 +- tests/qemuxml2argvdata/hostdev-vfio.xml | 2 +- tests/qemuxml2argvdata/net-hostdev-fail.xml | 2 +- tests/qemuxml2argvdata/net-hostdev-vfio.args | 2 +- tests/qemuxml2argvdata/net-hostdev-vfio.xml | 2 +- tests/qemuxml2xmloutdata/hostdev-vfio.xml | 2 +- tests/qemuxml2xmloutdata/net-hostdev-vfio.xml | 2 +- tests/virpcimock.c | 16 ++++++++++++++++ tests/virpcitestdata/0000-06-12.0.config | Bin 0 -> 256 bytes tests/virpcitestdata/0000-06-12.1.config | Bin 0 -> 256 bytes tests/virpcitestdata/0000-06-12.2.config | Bin 0 -> 256 bytes 13 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 tests/virpcitestdata/0000-06-12.0.config create mode 100644 tests/virpcitestdata/0000-06-12.1.config create mode 100644 tests/virpcitestdata/0000-06-12.2.config diff --git a/tests/qemuxml2argvdata/hostdev-vfio-multidomain.args b/tests/q= emuxml2argvdata/hostdev-vfio-multidomain.args index d098bff356..959d2a8888 100644 --- a/tests/qemuxml2argvdata/hostdev-vfio-multidomain.args +++ b/tests/qemuxml2argvdata/hostdev-vfio-multidomain.args @@ -27,5 +27,5 @@ server,nowait \ -usb \ -drive file=3D/dev/HostVG/QEMUGuest2,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ --device vfio-pci,host=3D55aa:20:0f.3,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x3 \ +-device vfio-pci,host=3D0021:de:1f.1,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x3 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x4 diff --git a/tests/qemuxml2argvdata/hostdev-vfio-multidomain.xml b/tests/qe= muxml2argvdata/hostdev-vfio-multidomain.xml index 832458125b..7c34b65c7f 100644 --- a/tests/qemuxml2argvdata/hostdev-vfio-multidomain.xml +++ b/tests/qemuxml2argvdata/hostdev-vfio-multidomain.xml @@ -25,7 +25,7 @@ -
+
diff --git a/tests/qemuxml2argvdata/hostdev-vfio.args b/tests/qemuxml2argvd= ata/hostdev-vfio.args index b86181e267..e7456d0e49 100644 --- a/tests/qemuxml2argvdata/hostdev-vfio.args +++ b/tests/qemuxml2argvdata/hostdev-vfio.args @@ -27,5 +27,5 @@ server,nowait \ -usb \ -drive file=3D/dev/HostVG/QEMUGuest2,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ --device vfio-pci,host=3D06:12.5,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x3 \ +-device vfio-pci,host=3D06:12.1,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x3 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x4 diff --git a/tests/qemuxml2argvdata/hostdev-vfio.xml b/tests/qemuxml2argvda= ta/hostdev-vfio.xml index 4d96b9f732..b2e6c62e7e 100644 --- a/tests/qemuxml2argvdata/hostdev-vfio.xml +++ b/tests/qemuxml2argvdata/hostdev-vfio.xml @@ -27,7 +27,7 @@ -
+
diff --git a/tests/qemuxml2argvdata/net-hostdev-fail.xml b/tests/qemuxml2ar= gvdata/net-hostdev-fail.xml index c815d68bd9..50b102c658 100644 --- a/tests/qemuxml2argvdata/net-hostdev-fail.xml +++ b/tests/qemuxml2argvdata/net-hostdev-fail.xml @@ -25,7 +25,7 @@ -
+
diff --git a/tests/qemuxml2argvdata/net-hostdev-vfio.args b/tests/qemuxml2a= rgvdata/net-hostdev-vfio.args index fcc8716fdf..a7fb5819ac 100644 --- a/tests/qemuxml2argvdata/net-hostdev-vfio.args +++ b/tests/qemuxml2argvdata/net-hostdev-vfio.args @@ -27,5 +27,5 @@ server,nowait \ -usb \ -drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ --device vfio-pci,host=3D03:07.1,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x3 \ +-device vfio-pci,host=3D06:12.1,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x3 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x4 diff --git a/tests/qemuxml2argvdata/net-hostdev-vfio.xml b/tests/qemuxml2ar= gvdata/net-hostdev-vfio.xml index 24034cad8b..aff681c0fb 100644 --- a/tests/qemuxml2argvdata/net-hostdev-vfio.xml +++ b/tests/qemuxml2argvdata/net-hostdev-vfio.xml @@ -26,7 +26,7 @@ -
+
diff --git a/tests/qemuxml2xmloutdata/hostdev-vfio.xml b/tests/qemuxml2xmlo= utdata/hostdev-vfio.xml index 77bd62a129..15a845f4d1 100644 --- a/tests/qemuxml2xmloutdata/hostdev-vfio.xml +++ b/tests/qemuxml2xmloutdata/hostdev-vfio.xml @@ -32,7 +32,7 @@ -
+
diff --git a/tests/qemuxml2xmloutdata/net-hostdev-vfio.xml b/tests/qemuxml2= xmloutdata/net-hostdev-vfio.xml index 0523cd8d3b..3f057a8249 100644 --- a/tests/qemuxml2xmloutdata/net-hostdev-vfio.xml +++ b/tests/qemuxml2xmloutdata/net-hostdev-vfio.xml @@ -31,7 +31,7 @@ -
+
diff --git a/tests/virpcimock.c b/tests/virpcimock.c index deb802e860..aa1858c4a6 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -122,6 +122,7 @@ struct pciDevice { int device; int klass; int iommuGroup; + const char *physfn; struct pciDriver *driver; /* Driver attached. NULL if attached to no= driver */ }; =20 @@ -429,6 +430,15 @@ pci_device_new_from_stub(const struct pciDevice *data) } make_symlink(devpath, "iommu_group", tmp); =20 + if (dev->physfn) { + if (snprintf(tmp, sizeof(tmp), + "%s/devices/%s", fakesysfspcidir, dev->physfn) < 0) { + ABORT("@tmp overflow"); + } + make_symlink(devpath, "physfn", tmp); + } + + if (pci_device_autobind(dev) < 0) ABORT("Unable to bind: %s", data->id); =20 @@ -1003,6 +1013,12 @@ init_env(void) MAKE_PCI_DEVICE("0000:0a:01.0", 0x8086, 0x0047, .iommuGroup =3D 8); MAKE_PCI_DEVICE("0000:0a:02.0", 0x8286, 0x0048, .iommuGroup =3D 8); MAKE_PCI_DEVICE("0000:0a:03.0", 0x8386, 0x0048, .iommuGroup =3D 8); + MAKE_PCI_DEVICE("0000:06:12.0", 0x8086, 0x0047, .iommuGroup =3D 9); + MAKE_PCI_DEVICE("0000:06:12.1", 0x8086, 0x0047, .iommuGroup =3D 10, .p= hysfn =3D "0000:06:12.0"); /* Virtual Function */ + MAKE_PCI_DEVICE("0000:06:12.2", 0x8086, 0x0047, .iommuGroup =3D 11, .p= hysfn =3D "0000:06:12.0"); /* Virtual Function */ + MAKE_PCI_DEVICE("0021:de:1f.0", 0x8086, 0x0047, .iommuGroup =3D 12); + MAKE_PCI_DEVICE("0021:de:1f.1", 0x8086, 0x0047, .iommuGroup =3D 13, .p= hysfn =3D "0021:de:1f.0"); /* Virtual Function */ + } =20 =20 diff --git a/tests/virpcitestdata/0000-06-12.0.config b/tests/virpcitestdat= a/0000-06-12.0.config new file mode 100644 index 0000000000000000000000000000000000000000..beee76534041a7020c08ae9ac03= d9a349c6ea12e GIT binary patch literal 256 ycmXpOFlAt45MXi^VCG@qU|?VnU}yr8Sb;H6EeJS(Ng%<*sKv;@R0rb@MH&E<&;s)S literal 0 HcmV?d00001 diff --git a/tests/virpcitestdata/0000-06-12.1.config b/tests/virpcitestdat= a/0000-06-12.1.config new file mode 100644 index 0000000000000000000000000000000000000000..beee76534041a7020c08ae9ac03= d9a349c6ea12e GIT binary patch literal 256 ycmXpOFlAt45MXi^VCG@qU|?VnU}yr8Sb;H6EeJS(Ng%<*sKv;@R0rb@MH&E<&;s)S literal 0 HcmV?d00001 diff --git a/tests/virpcitestdata/0000-06-12.2.config b/tests/virpcitestdat= a/0000-06-12.2.config new file mode 100644 index 0000000000000000000000000000000000000000..beee76534041a7020c08ae9ac03= d9a349c6ea12e GIT binary patch literal 256 ycmXpOFlAt45MXi^VCG@qU|?VnU}yr8Sb;H6EeJS(Ng%<*sKv;@R0rb@MH&E<&;s)S literal 0 HcmV?d00001 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list