From nobody Sun Apr 28 18:58:55 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 ARC-Seal: i=1; a=rsa-sha256; t=1564752102; cv=none; d=zoho.com; s=zohoarc; b=nOQpZhTre2+2tbLG9CCMdG/IGenfdQbGNErVY102WMD7XYJjWuCf1Ojbtpz5gGDsUJLLRAYVU5VGkFbdYpA0v1QUW2UxmN+0ZUXXRJ+9p9U4hAF2pyTWaw+FRwGzf3Vuut2LeBWiQrbyq7vZ4MLiL9vLjoQDTkVYdncqMkeWD6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564752102; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=2DPiXIU0SWb6T9Qkcd7CpKO6JNy9JS7Co2v5Cv0ZT/M=; b=Q6rMIh/OrWAPqhyAYsjwh5ljmZgBIfTvF+z3fASsrwiswC8ZaDcZLJlb7HsfBiyMKuiEdYmkCiJ1cpduLzGgq2TjFwIC0eGkarUko+HFW1IVnlNvjWiAjTeuGRME1KMtHph6eNvxEfkJLR0bXQPHt5yl0+qAmCUGajvEX/ibF1g= ARC-Authentication-Results: i=1; mx.zoho.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 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 1564752102740149.83688393894386; Fri, 2 Aug 2019 06:21:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D2885CAA8E; Fri, 2 Aug 2019 13:21:40 +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 00A7A5D9E2; Fri, 2 Aug 2019 13:21:40 +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 C7C3F264C9; Fri, 2 Aug 2019 13:21:38 +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 x72DGEVE028103 for ; Fri, 2 Aug 2019 09:16:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8ED1019C79; Fri, 2 Aug 2019 13:16:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 86ABA19C70 for ; Fri, 2 Aug 2019 13:16:12 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 0C2B8307CDEA for ; Fri, 2 Aug 2019 13:16:10 +0000 (UTC) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x72DCV8K132746 for ; Fri, 2 Aug 2019 09:16:09 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2u4jjrr5f4-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 02 Aug 2019 09:16:09 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Aug 2019 14:16:07 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 2 Aug 2019 14:16:05 +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 x72DG3qF54919370 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 2 Aug 2019 13:16:03 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B2834AE051; Fri, 2 Aug 2019 13:16:03 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A28EAE045; Fri, 2 Aug 2019 13:16:03 +0000 (GMT) Received: from localhost.localdomain (unknown [9.152.222.28]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 2 Aug 2019 13:16:03 +0000 (GMT) From: Boris Fiuczynski To: libvir-list@redhat.com Date: Fri, 2 Aug 2019 15:15:59 +0200 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19080213-4275-0000-0000-000003532E2F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19080213-4276-0000-0000-0000386423EB Message-Id: <20190802131559.7181-1-fiuczy@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-08-02_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-1906280000 definitions=main-1908020136 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 02 Aug 2019 13:16:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 02 Aug 2019 13:16:10 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'fiuczy@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: jjherne@linux.ibm.com, bwalk@linux.ibm.com, mhartmay@linux.ibm.com Subject: [libvirt] [PATCH] qemu: support bootindex on vfio-ccw mdev 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: , 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 02 Aug 2019 13:21:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Add support to specify a boot order on vfio-ccw passthrough devices. Signed-off-by: Boris Fiuczynski Acked-by: Jason J. Herne Reviewed-by: Marc Hartmayer --- src/qemu/qemu_command.c | 27 +++++++++++++---- .../hostdev-subsys-mdev-vfio-ccw-boot.args | 29 +++++++++++++++++++ .../hostdev-subsys-mdev-vfio-ccw-boot.xml | 23 +++++++++++++++ tests/qemuxml2argvtest.c | 4 +++ 4 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boo= t.args create mode 100644 tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boo= t.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index fee51158a9..36138e2ccf 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5613,6 +5613,9 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *de= f, if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0) goto cleanup; =20 + if (dev->info->bootIndex) + virBufferAsprintf(&buf, ",bootindex=3D%u", dev->info->bootIndex); + if (virBufferCheckError(&buf) < 0) goto cleanup; =20 @@ -5624,6 +5627,22 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *d= ef, return ret; } =20 +static bool +qemuHostdevSupportsBoot(virDomainHostdevDefPtr hostdev) +{ + if (hostdev->mode =3D=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) { + virDomainHostdevSubsysPtr subsys =3D &hostdev->source.subsys; + if (subsys->type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI || + subsys->type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB || + subsys->type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI || + (subsys->type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV && + subsys->u.mdev.model =3D=3D VIR_MDEV_MODEL_TYPE_VFIO_CCW)) { + return true; + } + } + return false; +} + static int qemuBuildHostdevCommandLine(virCommandPtr cmd, const virDomainDef *def, @@ -5638,13 +5657,11 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, char *devstr; =20 if (hostdev->info->bootIndex) { - if (hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || - (subsys->type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI && - subsys->type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB && - subsys->type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI)) { + if (!qemuHostdevSupportsBoot(hostdev)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("booting from assigned devices is only " - "supported for PCI, USB and SCSI devices"= )); + "supported for PCI, USB, SCSI and MDEV " + "of model vfio-ccw devices")); return -1; } } diff --git a/tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.args = b/tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.args new file mode 100644 index 0000000000..6fb22b3014 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.args @@ -0,0 +1,29 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-s390x \ +-name QEMUGuest1 \ +-S \ +-machine s390-ccw-virtio,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 512 \ +-realtime mlock=3Doff \ +-smp 2,sockets=3D2,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-device vfio-ccw,id=3Dhostdev0,\ +sysfsdev=3D/sys/bus/mdev/devices/90c6c135-ad44-41d0-b1b7-bae47de48627,\ +devno=3Dfe.0.0000,bootindex=3D1 \ +-device virtio-balloon-ccw,id=3Dballoon0,devno=3Dfe.0.0001 diff --git a/tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.xml b= /tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.xml new file mode 100644 index 0000000000..6cca13c33f --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-subsys-mdev-vfio-ccw-boot.xml @@ -0,0 +1,23 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 524288 + 524288 + 2 + + hvm + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + +
+ + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index c166fd18d6..c30a0c74ca 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1621,6 +1621,10 @@ mymain(void) QEMU_CAPS_CCW, QEMU_CAPS_CCW_CSSID_UNRESTRICTED, QEMU_CAPS_DEVICE_VFIO_CCW); + DO_TEST("hostdev-subsys-mdev-vfio-ccw-boot", + QEMU_CAPS_CCW, + QEMU_CAPS_CCW_CSSID_UNRESTRICTED, + QEMU_CAPS_DEVICE_VFIO_CCW); DO_TEST_FAILURE("hostdev-subsys-mdev-vfio-ccw", QEMU_CAPS_CCW, QEMU_CAPS_CCW_CSSID_UNRESTRICTED); --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list