From nobody Sun Dec 22 01:09:00 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=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1539874690443795.3394833035476; Thu, 18 Oct 2018 07:58:10 -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 AE77119D055; Thu, 18 Oct 2018 14:58:07 +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 21FF8790B2; Thu, 18 Oct 2018 14:58: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 6454E4BB79; Thu, 18 Oct 2018 14:58:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9IEsTcO016111 for ; Thu, 18 Oct 2018 10:54:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id D3F35936C7; Thu, 18 Oct 2018 14:54:29 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C8792936C8 for ; Thu, 18 Oct 2018 14:54:26 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10B5DC04B948 for ; Thu, 18 Oct 2018 14:54:25 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9IErD6Z096539 for ; Thu, 18 Oct 2018 10:54:24 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n6v7tgb23-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 10:54:21 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 15:54:15 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 18 Oct 2018 15:54:13 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9IEsCCq6750550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 14:54:12 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 07931A4040; Thu, 18 Oct 2018 14:54:12 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B4CCFA4051; Thu, 18 Oct 2018 14:54:11 +0000 (GMT) Received: from localhost.localdomain (unknown [9.152.222.74]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 18 Oct 2018 14:54:11 +0000 (GMT) From: Boris Fiuczynski To: libvir-list@redhat.com Date: Thu, 18 Oct 2018 16:54:07 +0200 In-Reply-To: <20181018145408.517-1-fiuczy@linux.ibm.com> References: <20181018145408.517-1-fiuczy@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18101814-0008-0000-0000-000002817801 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101814-0009-0000-0000-000021EAE4A4 Message-Id: <20181018145408.517-3-fiuczy@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810180128 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 18 Oct 2018 14:54:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 18 Oct 2018 14:54:25 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'fiuczy@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 1.298 * (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: borntraeger@de.ibm.com, thuth@redhat.com, cohuck@redhat.com, mhartmay@linux.ibm.com, bwalk@linux.ibm.com Subject: [libvirt] [PATCH v2 2/3] qemu: vfio-ap device support 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: , MIME-Version: 1.0 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.29]); Thu, 18 Oct 2018 14:58:08 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Adjusting domain format documentation, adding device address support and adding command line generation for vfio-ap. Since only one mediated hostdev with model vfio-ap is supported a check disallows to define domains with more than one such hostdev device. Signed-off-by: Boris Fiuczynski Reviewed-by: Bjoern Walk Reviewed-by: Chris Venteicher --- docs/formatdomain.html.in | 3 ++- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 28 ++++++++++++++++++++++++++++ src/qemu/qemu_command.c | 8 ++++++++ src/qemu/qemu_domain_address.c | 4 ++++ src/util/virmdev.c | 3 ++- src/util/virmdev.h | 1 + 7 files changed, 46 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 8189959773..269741a690 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4616,8 +4616,9 @@
For mediated devices (Since 3.2.0) the model attribute specifies the device API which determines how the host's vfio driver will expose the device to = the - guest. Currently, model=3D'vfio-pci' and + guest. Currently, model=3D'vfio-pci', model=3D'vfio-ccw' (Since 4.4= .0) + and model=3D'vfio-ap' (Since = 4.9.0) is supported. MDEV section provides more information about mediated devices as well as how = to create mediated devices on the host. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 099a949cf8..b9ac5df479 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4618,6 +4618,7 @@ vfio-pci vfio-ccw + vfio-ap diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e8e0adc819..1f8797f997 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -4275,6 +4275,31 @@ virDomainDefPostParseGraphics(virDomainDef *def) } =20 =20 +static int +virDomainDefPostParseHostdev(virDomainDefPtr def) +{ + size_t i; + bool vfioap_found =3D false; + + /* verify settings of hostdevs vfio-ap */ + for (i =3D 0; i < def->nhostdevs; i++) { + virDomainHostdevDefPtr hostdev =3D def->hostdevs[i]; + + if (virHostdevIsMdevDevice(hostdev) && + hostdev->source.subsys.u.mdev.model =3D=3D VIR_MDEV_MODEL_TYPE= _VFIO_AP) { + if (vfioap_found) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Only one hostdev of model vfio-ap is " + "support")); + return -1; + } + vfioap_found =3D true; + } + } + return 0; +} + + /** * virDomainDriveAddressIsUsedByDisk: * @def: domain definition containing the disks to check @@ -5185,6 +5210,9 @@ virDomainDefPostParseCommon(virDomainDefPtr def, =20 virDomainDefPostParseGraphics(def); =20 + if (virDomainDefPostParseHostdev(def) < 0) + return -1; + if (virDomainDefPostParseCPU(def) < 0) return -1; =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1ff593c657..6e3ff67660 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5476,6 +5476,14 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, return -1; } break; + case VIR_MDEV_MODEL_TYPE_VFIO_AP: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_AP)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("VFIO AP device assignment is not " + "supported by this version of QEMU")); + return -1; + } + break; case VIR_MDEV_MODEL_TYPE_LAST: default: virReportEnumRangeError(virMediatedDeviceModelType, diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 8a8764cff5..24dd7c1a58 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -294,6 +294,10 @@ qemuDomainPrimeVfioDeviceAddresses(virDomainDefPtr def, subsys->u.mdev.model =3D=3D VIR_MDEV_MODEL_TYPE_VFIO_CCW && def->hostdevs[i]->info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_= TYPE_NONE) def->hostdevs[i]->info->type =3D type; + + if (virHostdevIsMdevDevice(def->hostdevs[i]) && + subsys->u.mdev.model =3D=3D VIR_MDEV_MODEL_TYPE_VFIO_AP) + def->hostdevs[i]->info->type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYP= E_NONE; } } =20 diff --git a/src/util/virmdev.c b/src/util/virmdev.c index 10a2b08337..3e11e38802 100644 --- a/src/util/virmdev.c +++ b/src/util/virmdev.c @@ -48,7 +48,8 @@ struct _virMediatedDeviceList { =20 VIR_ENUM_IMPL(virMediatedDeviceModel, VIR_MDEV_MODEL_TYPE_LAST, "vfio-pci", - "vfio-ccw") + "vfio-ccw", + "vfio-ap") =20 static virClassPtr virMediatedDeviceListClass; =20 diff --git a/src/util/virmdev.h b/src/util/virmdev.h index 7c93c4d390..c856ff5bdb 100644 --- a/src/util/virmdev.h +++ b/src/util/virmdev.h @@ -27,6 +27,7 @@ typedef enum { VIR_MDEV_MODEL_TYPE_VFIO_PCI =3D 0, VIR_MDEV_MODEL_TYPE_VFIO_CCW =3D 1, + VIR_MDEV_MODEL_TYPE_VFIO_AP =3D 2, =20 VIR_MDEV_MODEL_TYPE_LAST } virMediatedDeviceModelType; --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list