From nobody Wed May 14 09:56:07 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; 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 1525704425238294.90126230556143; Mon, 7 May 2018 07:47:05 -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 4EE5085365; Mon, 7 May 2018 14:47:03 +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 1B83C600D2; Mon, 7 May 2018 14:47:03 +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 A723B180BADC; Mon, 7 May 2018 14:47:02 +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 w47EfYSD001046 for ; Mon, 7 May 2018 10:41:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id C7B4169286; Mon, 7 May 2018 14:41:34 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B229068D99 for ; Mon, 7 May 2018 14:41:32 +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 62BAC30BB7FA for ; Mon, 7 May 2018 14:41:31 +0000 (UTC) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w47Edqh7138047 for ; Mon, 7 May 2018 10:41:31 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2htr7mspen-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 07 May 2018 10:41:30 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 7 May 2018 15:41:28 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 7 May 2018 15:41:25 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w47EfPGr5505338; Mon, 7 May 2018 14:41:25 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 171DBAE055; Mon, 7 May 2018 15:30:55 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA1F3AE04D; Mon, 7 May 2018 15:30:54 +0100 (BST) Received: from localhost.localdomain (unknown [9.152.222.69]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 7 May 2018 15:30:54 +0100 (BST) From: Boris Fiuczynski To: libvir-list@redhat.com Date: Mon, 7 May 2018 16:41:14 +0200 In-Reply-To: <20180507144118.6260-1-fiuczy@linux.ibm.com> References: <20180507144118.6260-1-fiuczy@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050714-0008-0000-0000-000004F3F9ED X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050714-0009-0000-0000-00001E88354C Message-Id: <20180507144118.6260-5-fiuczy@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-07_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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805070150 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.47]); Mon, 07 May 2018 14:41:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 07 May 2018 14:41:31 +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: -0.701 (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.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: shalini@linux.vnet.ibm.com, cohuck@redhat.com Subject: [libvirt] [PATCH v2 4/8] qemu: vfio-ccw device address generation 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 07 May 2018 14:47:04 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Shalini Chellathurai Saroja Introduces the vfio-ccw model for mediated devices and prime vfio-ccw devices such that CCW address will be generated. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski Reviewed-by: Marc Hartmayer Reviewed-by: Stefan Zimmermann Reviewed-by: John Ferlan --- docs/schemas/domaincommon.rng | 5 ++++- src/qemu/qemu_domain_address.c | 20 ++++++++++++++++++++ src/util/virmdev.c | 3 ++- src/util/virmdev.h | 1 + 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 0a6b29b..bea2bc0 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4478,7 +4478,10 @@ mdev - vfio-pci + + vfio-pci + vfio-ccw + diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 50f815c..be0424d 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -282,6 +282,23 @@ qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def) =20 =20 static void +qemuDomainPrimeVfioDeviceAddresses(virDomainDefPtr def, + virDomainDeviceAddressType type) +{ + size_t i; + + for (i =3D 0; i < def->nhostdevs; i++) { + virDomainHostdevSubsysPtr subsys =3D &def->hostdevs[i]->source.sub= sys; + + if (virHostdevIsMdevDevice(def->hostdevs[i]) && + 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; + } +} + + +static void qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def, virDomainDeviceAddressType type) { @@ -397,6 +414,9 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def, =20 if (qemuDomainIsS390CCW(def) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCW)) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_CCW)) + qemuDomainPrimeVfioDeviceAddresses( + def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW); qemuDomainPrimeVirtioDeviceAddresses( def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW); =20 diff --git a/src/util/virmdev.c b/src/util/virmdev.c index 536ddbe..6c51388 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-pci", + "vfio-ccw") =20 static virClassPtr virMediatedDeviceListClass; =20 diff --git a/src/util/virmdev.h b/src/util/virmdev.h index 01ab02e..cfda2ca 100644 --- a/src/util/virmdev.h +++ b/src/util/virmdev.h @@ -25,6 +25,7 @@ =20 typedef enum { VIR_MDEV_MODEL_TYPE_VFIO_PCI =3D 0, + VIR_MDEV_MODEL_TYPE_VFIO_CCW =3D 1, =20 VIR_MDEV_MODEL_TYPE_LAST } virMediatedDeviceModelType; --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list