From nobody Wed May 14 16:06:08 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1523462674793951.730963246555; Wed, 11 Apr 2018 09:04:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5F89A313630B; Wed, 11 Apr 2018 16:04:33 +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 4DDAA87054; Wed, 11 Apr 2018 16:01:38 +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 8F543180BADA; Wed, 11 Apr 2018 15:51:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3BFpFVQ024651 for ; Wed, 11 Apr 2018 11:51:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 746FD7E6D1; Wed, 11 Apr 2018 15:51:15 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6612A7E6CA for ; Wed, 11 Apr 2018 15:51:00 +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 643227B12E for ; Wed, 11 Apr 2018 15:50:21 +0000 (UTC) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3BFo29u029817 for ; Wed, 11 Apr 2018 11:50:21 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h9n6hrgf7-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 11 Apr 2018 11:50:15 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 11 Apr 2018 16:50:13 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 11 Apr 2018 16:50:10 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3BFoAUe66388016; Wed, 11 Apr 2018 15:50:10 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4172911C05E; Wed, 11 Apr 2018 16:42:15 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 22EF311C04A; Wed, 11 Apr 2018 16:42:15 +0100 (BST) Received: from s38lp13.boeblingen.de.ibm.com (unknown [9.152.161.13]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 11 Apr 2018 16:42:15 +0100 (BST) From: Shalini Chellathurai Saroja To: Libvirt Mailing List Date: Wed, 11 Apr 2018 17:49:56 +0200 In-Reply-To: <20180411154959.228209-1-shalini@linux.vnet.ibm.com> References: <20180411154959.228209-1-shalini@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041115-0008-0000-0000-000004E95C42 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041115-0009-0000-0000-00001E7D607B Message-Id: <20180411154959.228209-6-shalini@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-11_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804110146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 11 Apr 2018 15:50:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 11 Apr 2018 15:50:21 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'shalini@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (RCVD_IN_DNSWL_LOW) 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.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Shalini Chellathurai Saroja Subject: [libvirt] [PATCH 5/8] qemu: command line generation for vfio-ccw device 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 11 Apr 2018 16:04:33 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Generates the QEMU command line for the vfio-ccw device. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski Reviewed-by: Marc Hartmayer --- src/qemu/qemu_command.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e47f915fc8..ad60a7b433 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5123,11 +5123,17 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *= def, virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &dev->source.subsys.u= .mdev; char *ret =3D NULL; char *mdevPath =3D NULL; + const char *dev_str =3D NULL; =20 if (!(mdevPath =3D virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr))) goto cleanup; =20 - virBufferAddLit(&buf, "vfio-pci"); + dev_str =3D virMediatedDeviceModelTypeToString(mdevsrc->model); + + if (!dev_str) + goto cleanup; + + virBufferAdd(&buf, dev_str, -1); virBufferAsprintf(&buf, ",id=3D%s,sysfsdev=3D%s", dev->info->alias, md= evPath); =20 if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0) @@ -5347,11 +5353,28 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, =20 /* MDEV */ if (virHostdevIsMdevDevice(hostdev)) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("VFIO PCI device assignment is not " - "supported by this version of qemu")); + switch ((virMediatedDeviceModelType) subsys->u.mdev.model) { + case VIR_MDEV_MODEL_TYPE_VFIO_PCI: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("VFIO PCI device assignment is not " + "supported by this version of QEMU")); + return -1; + } + break; + case VIR_MDEV_MODEL_TYPE_VFIO_CCW: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_CCW)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("VFIO CCW device assignment is not " + "supported by this version of QEMU")); + return -1; + } + break; + case VIR_MDEV_MODEL_TYPE_LAST: + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected vfio type '%d'"), subsys->u.m= dev.model); return -1; + break; } =20 virCommandAddArg(cmd, "-device"); --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list