From nobody Tue Apr 23 11:34:48 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 1539920812514526.6681935338524; Thu, 18 Oct 2018 20:46:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DEF58307D845; Fri, 19 Oct 2018 03:46:49 +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 4721910018F8; Fri, 19 Oct 2018 03:46:48 +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 E7B4F4CA95; Fri, 19 Oct 2018 03:46:45 +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 w9J3eg3V031937 for ; Thu, 18 Oct 2018 23:40:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3D44C6873C; Fri, 19 Oct 2018 03:40:42 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 35BFE7A1B5 for ; Fri, 19 Oct 2018 03:40:39 +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 57D753003762 for ; Fri, 19 Oct 2018 03:40:37 +0000 (UTC) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9J3diM8001027 for ; Thu, 18 Oct 2018 23:40:36 -0400 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0b-001b2d01.pphosted.com with ESMTP id 2n76sm1ppe-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:40:36 -0400 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:40:35 -0600 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e36.co.us.ibm.com (192.168.1.136) 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 21:40:32 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3eVCw40108266 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:40:31 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 25F596E056; Fri, 19 Oct 2018 03:40:31 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E4C8F6E054; Fri, 19 Oct 2018 03:40:28 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:40:28 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:07 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18101903-0020-0000-0000-00000E7C2C70 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571940; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:40:35 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-0021-0000-0000-0000636D210D Message-Id: <20181019034020.4757-2-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , 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-1810190033 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.44]); Fri, 19 Oct 2018 03:40:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 19 Oct 2018 03:40:37 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 1.298 * (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, 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.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 01/14] conf: Add definitions for 'uid' and 'fid' PCI address attributes 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 19 Oct 2018 03:46:50 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Add zPCI definitions in preparation of extending the PCI address with parameters uid (user-defined identifier) and fid (PCI function identifier). Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: Stefan Zimmermann Reviewed-by: Bjoern Walk Reviewed-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- cfg.mk | 1 + src/util/virpci.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/cfg.mk b/cfg.mk index 4790d0b7e7..1fc6a2dabb 100644 --- a/cfg.mk +++ b/cfg.mk @@ -472,6 +472,7 @@ sc_prohibit_canonicalize_file_name: # Insist on correct types for [pug]id. sc_correct_id_types: @prohibit=3D'\<(int|long) *[pug]id\>' \ + exclude=3D'exempt from syntax-check' \ halt=3D'use pid_t for pid, uid_t for uid, gid_t for gid' \ $(_sc_search_regexp) =20 diff --git a/src/util/virpci.h b/src/util/virpci.h index 16c2eded5e..4cc9298d85 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -37,12 +37,20 @@ typedef virPCIDeviceAddress *virPCIDeviceAddressPtr; typedef struct _virPCIDeviceList virPCIDeviceList; typedef virPCIDeviceList *virPCIDeviceListPtr; =20 +typedef struct _virZPCIDeviceAddress virZPCIDeviceAddress; +typedef virZPCIDeviceAddress *virZPCIDeviceAddressPtr; +struct _virZPCIDeviceAddress { + unsigned int uid; /* exempt from syntax-check */ + unsigned int fid; +}; + struct _virPCIDeviceAddress { unsigned int domain; unsigned int bus; unsigned int slot; unsigned int function; int multi; /* virTristateSwitch */ + virZPCIDeviceAddress zpci; }; =20 typedef enum { --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 1539920812514633.0592085457174; Thu, 18 Oct 2018 20:46:52 -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 973CC91C20; Fri, 19 Oct 2018 03:46:49 +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 4879C7A1B5; Fri, 19 Oct 2018 03:46:48 +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 DDAEA18005B0; Fri, 19 Oct 2018 03:46:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9J3ehGh031945 for ; Thu, 18 Oct 2018 23:40:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id E308760C68; Fri, 19 Oct 2018 03:40:43 +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 D9FF460F98 for ; Fri, 19 Oct 2018 03:40:41 +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 A7EC93002F8A for ; Fri, 19 Oct 2018 03:40:40 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9J3dQZS070790 for ; Thu, 18 Oct 2018 23:40:40 -0400 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n740xys0w-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:40:39 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:40:39 -0600 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e34.co.us.ibm.com (192.168.1.134) 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 21:40:36 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3eY3S31522898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:40:34 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CE6296E05E; Fri, 19 Oct 2018 03:40:34 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F8286E05F; Fri, 19 Oct 2018 03:40:32 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:40:32 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:08 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18101903-0016-0000-0000-000009454A44 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571939; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:40:38 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-0017-0000-0000-000040C2809A Message-Id: <20181019034020.4757-3-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , 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=991 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810190033 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.47]); Fri, 19 Oct 2018 03:40:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 19 Oct 2018 03:40:40 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 1.298 * (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, 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.47 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 02/14] qemu: Introduce zPCI capability 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-Type: text/plain; charset="utf-8" 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.26]); Fri, 19 Oct 2018 03:46:50 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Let's introduce zPCI capability. Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: Stefan Zimmermann Reviewed-by: Bjoern Walk Reviewed-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml | 1 + tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml | 1 + 9 files changed, 10 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index e228f52ec0..ee6a7462f6 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -508,6 +508,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, /* 315 */ "vfio-pci.display", "blockdev", + "zpci", ); =20 =20 @@ -1092,6 +1093,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[= ] =3D { { "vhost-vsock-device", QEMU_CAPS_DEVICE_VHOST_VSOCK }, { "mch", QEMU_CAPS_DEVICE_MCH }, { "sev-guest", QEMU_CAPS_SEV_GUEST }, + { "zpci", QEMU_CAPS_DEVICE_ZPCI }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[]= =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 934620ed31..cd417c9062 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -492,6 +492,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ /* 315 */ QEMU_CAPS_VFIO_PCI_DISPLAY, /* -device vfio-pci.display */ QEMU_CAPS_BLOCKDEV, /* -blockdev and blockdev-add are supported */ + QEMU_CAPS_DEVICE_ZPCI, /* -device zpci */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml b/tests/qemuc= apabilitiesdata/caps_2.10.0.s390x.xml index e000aac384..3c311042f3 100644 --- a/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml @@ -113,6 +113,7 @@ + 2010000 0 306247 diff --git a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml b/tests/qemuc= apabilitiesdata/caps_2.11.0.s390x.xml index 4eb8a39d94..48db1dbf2d 100644 --- a/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml @@ -120,6 +120,7 @@ + 2011000 0 345099 diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml b/tests/qemuc= apabilitiesdata/caps_2.12.0.s390x.xml index 79320d5229..4c561f6214 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml @@ -128,6 +128,7 @@ + 2012000 0 374287 diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_2.7.0.s390x.xml index b30c31cafc..de87692857 100644 --- a/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml @@ -100,6 +100,7 @@ + 2007000 0 219140 diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_2.8.0.s390x.xml index b010f731a5..f3a32ad376 100644 --- a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml @@ -103,6 +103,7 @@ + 2007093 0 244554 diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_2.9.0.s390x.xml index 5a4371ab83..f1e05ab1c4 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml @@ -107,6 +107,7 @@ + 2009000 0 267973 diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_3.0.0.s390x.xml index 3b5f9818a5..c841030b2b 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.s390x.xml @@ -130,6 +130,7 @@ + 3000000 0 387601 --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 15399219821001011.7012192484651; Thu, 18 Oct 2018 21:06:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B520F7D0F4; Fri, 19 Oct 2018 04:06:19 +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 D7736194AB; Fri, 19 Oct 2018 04:06:18 +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 D3D9418005B1; Fri, 19 Oct 2018 04:06:17 +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 w9J3elJx031958 for ; Thu, 18 Oct 2018 23:40:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id D429E19940; Fri, 19 Oct 2018 03:40:47 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C9A3F194AF for ; Fri, 19 Oct 2018 03:40:45 +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 E2AC330F8BE5 for ; Fri, 19 Oct 2018 03:40:44 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9J3e4v9129871 for ; Thu, 18 Oct 2018 23:40:44 -0400 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0b-001b2d01.pphosted.com with ESMTP id 2n77ex09m5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:40:44 -0400 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:40:43 -0600 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e36.co.us.ibm.com (192.168.1.136) 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 21:40:39 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3ecmK63635508 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:40:38 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 686946E052; Fri, 19 Oct 2018 03:40:38 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4B3A36E053; Fri, 19 Oct 2018 03:40:36 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:40:36 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:09 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18101903-0020-0000-0000-00000E7C2C75 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571940; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:40:42 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-0021-0000-0000-0000636D211E Message-Id: <20181019034020.4757-4-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , 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-1810190033 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.46]); Fri, 19 Oct 2018 03:40:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 19 Oct 2018 03:40:45 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 1.298 * (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, 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.46 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 03/14] conf: Introduce a new PCI address extension flag 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 19 Oct 2018 04:06:20 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 This patch introduces PCI address extension flag for virDomainDeviceInfo and virPCIDeviceAddress. The extension flag in virDomainDeviceInfo is used internally during calculating PCI extension flag. The one in virPCIDeviceAddress is the duplicate to indicate extension address is being used. Currently only zPCI extension address is introduced to deal with 'uid' and 'fid' on the S390 platform. Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- src/conf/device_conf.h | 4 + src/conf/domain_addr.h | 5 ++ src/qemu/qemu_domain_address.c | 140 ++++++++++++++++++++++++++++++++- src/util/virpci.h | 1 + 4 files changed, 148 insertions(+), 2 deletions(-) diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h index 407956bd02..2366e03607 100644 --- a/src/conf/device_conf.h +++ b/src/conf/device_conf.h @@ -166,6 +166,10 @@ struct _virDomainDeviceInfo { * assignment, never saved and never reported. */ int pciConnectFlags; /* enum virDomainPCIConnectFlags */ + /* pciAddrExtFlags is only used internally to calculate PCI + * address extension flags during address assignment. + */ + int pciAddrExtFlags; /* enum virDomainPCIAddressExtensionFlags */ char *loadparm; =20 /* PCI devices will only be automatically placed on a PCI bus diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h index 2a9af9c00b..435b3c5d7f 100644 --- a/src/conf/domain_addr.h +++ b/src/conf/domain_addr.h @@ -29,6 +29,11 @@ # define VIR_PCI_ADDRESS_SLOT_LAST 31 # define VIR_PCI_ADDRESS_FUNCTION_LAST 7 =20 +typedef enum { + VIR_PCI_ADDRESS_EXTENSION_NONE =3D 0, /* no extension */ + VIR_PCI_ADDRESS_EXTENSION_ZPCI =3D 1 << 0, /* zPCI support */ +} virPCIDeviceAddressExtensionFlags; + typedef enum { VIR_PCI_CONNECT_HOTPLUGGABLE =3D 1 << 0, /* is hotplug needed/supported= */ =20 diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 8a8764cff5..c0374ccaf3 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -509,6 +509,64 @@ qemuDomainAssignVirtioMMIOAddresses(virDomainDefPtr de= f, } =20 =20 +static bool +qemuDomainDeviceSupportZPCI(virDomainDeviceDefPtr device) +{ + switch ((virDomainDeviceType)device->type) { + case VIR_DOMAIN_DEVICE_CHR: + return false; + + case VIR_DOMAIN_DEVICE_CONTROLLER: + case VIR_DOMAIN_DEVICE_DISK: + case VIR_DOMAIN_DEVICE_LEASE: + case VIR_DOMAIN_DEVICE_FS: + case VIR_DOMAIN_DEVICE_NET: + case VIR_DOMAIN_DEVICE_INPUT: + case VIR_DOMAIN_DEVICE_SOUND: + case VIR_DOMAIN_DEVICE_VIDEO: + case VIR_DOMAIN_DEVICE_HOSTDEV: + case VIR_DOMAIN_DEVICE_WATCHDOG: + case VIR_DOMAIN_DEVICE_GRAPHICS: + case VIR_DOMAIN_DEVICE_HUB: + case VIR_DOMAIN_DEVICE_REDIRDEV: + case VIR_DOMAIN_DEVICE_SMARTCARD: + case VIR_DOMAIN_DEVICE_MEMBALLOON: + case VIR_DOMAIN_DEVICE_NVRAM: + case VIR_DOMAIN_DEVICE_RNG: + case VIR_DOMAIN_DEVICE_SHMEM: + case VIR_DOMAIN_DEVICE_TPM: + case VIR_DOMAIN_DEVICE_PANIC: + case VIR_DOMAIN_DEVICE_MEMORY: + case VIR_DOMAIN_DEVICE_IOMMU: + case VIR_DOMAIN_DEVICE_VSOCK: + break; + + case VIR_DOMAIN_DEVICE_NONE: + case VIR_DOMAIN_DEVICE_LAST: + default: + virReportEnumRangeError(virDomainDeviceType, device->type); + return false; + } + + return true; +} + + +static virPCIDeviceAddressExtensionFlags +qemuDomainDeviceCalculatePCIAddressExtensionFlags(virQEMUCapsPtr qemuCaps, + virDomainDeviceDefPtr de= v) +{ + virPCIDeviceAddressExtensionFlags extFlags =3D 0; + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ZPCI) && + qemuDomainDeviceSupportZPCI(dev)) { + extFlags |=3D VIR_PCI_ADDRESS_EXTENSION_ZPCI; + } + + return extFlags; +} + + /** * qemuDomainDeviceCalculatePCIConnectFlags: * @@ -990,6 +1048,56 @@ qemuDomainFillAllPCIConnectFlags(virDomainDefPtr def, } =20 =20 +/** + * qemuDomainFillDevicePCIExtensionFlagsIter: + * + * @def: the entire DomainDef + * @dev: The device to be checked + * @info: virDomainDeviceInfo within the device + * @opaque: qemu capabilities + * + * Sets the pciAddressExtFlags for a single device's info. Has properly + * formatted arguments to be called by virDomainDeviceInfoIterate(). + * + * Always returns 0 - there is no failure. + */ +static int +qemuDomainFillDevicePCIExtensionFlagsIter(virDomainDefPtr def ATTRIBUTE_UN= USED, + virDomainDeviceDefPtr dev, + virDomainDeviceInfoPtr info, + void *opaque) +{ + virQEMUCapsPtr qemuCaps =3D opaque; + + info->pciAddrExtFlags =3D + qemuDomainDeviceCalculatePCIAddressExtensionFlags(qemuCaps, dev); + + return 0; +} + + +/** + * qemuDomainFillAllPCIExtensionFlags: + * + * @def: the entire DomainDef + * @qemuCaps: as you'd expect + * + * Set the info->pciAddressExtFlags for all devices in the domain. + * + * Returns 0 on success or -1 on failure (the only possibility of + * failure would be some internal problem with + * virDomainDeviceInfoIterate()) + */ +static int +qemuDomainFillAllPCIExtensionFlags(virDomainDefPtr def, + virQEMUCapsPtr qemuCaps) +{ + return virDomainDeviceInfoIterate(def, + qemuDomainFillDevicePCIExtensionFlag= sIter, + qemuCaps); +} + + /** * qemuDomainFindUnusedIsolationGroupIter: * @def: domain definition @@ -1264,6 +1372,27 @@ qemuDomainFillDevicePCIConnectFlags(virDomainDefPtr = def, } =20 =20 +/** + * qemuDomainFillDevicePCIExtensionFlags: + * + * @dev: The device to be checked + * @info: virDomainDeviceInfo within the device + * @qemuCaps: as you'd expect + * + * Set the info->pciAddressExtFlags for a single device. + * + * No return value. + */ +static void +qemuDomainFillDevicePCIExtensionFlags(virDomainDeviceDefPtr dev, + virDomainDeviceInfoPtr info, + virQEMUCapsPtr qemuCaps) +{ + info->pciAddrExtFlags =3D + qemuDomainDeviceCalculatePCIAddressExtensionFlags(qemuCaps, dev); +} + + static int qemuDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs, virDomainDeviceInfoPtr dev) @@ -2400,6 +2529,9 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, if (qemuDomainFillAllPCIConnectFlags(def, qemuCaps, driver) < 0) goto cleanup; =20 + if (qemuDomainFillAllPCIExtensionFlags(def, qemuCaps) < 0) + goto cleanup; + if (qemuDomainSetupIsolationGroups(def) < 0) goto cleanup; =20 @@ -2435,7 +2567,8 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, */ virDomainDeviceInfo info =3D { .pciConnectFlags =3D (VIR_PCI_CONNECT_HOTPLUGGABLE | - VIR_PCI_CONNECT_TYPE_PCI_DEVICE) + VIR_PCI_CONNECT_TYPE_PCI_DEVICE), + .pciAddrExtFlags =3D VIR_PCI_ADDRESS_EXTENSION_NONE }; bool buses_reserved =3D true; =20 @@ -2472,7 +2605,8 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, qemuDomainHasPCIeRoot(def)) { virDomainDeviceInfo info =3D { .pciConnectFlags =3D (VIR_PCI_CONNECT_HOTPLUGGABLE | - VIR_PCI_CONNECT_TYPE_PCIE_DEVICE) + VIR_PCI_CONNECT_TYPE_PCIE_DEVICE), + .pciAddrExtFlags =3D VIR_PCI_ADDRESS_EXTENSION_NONE }; =20 /* if there isn't an empty pcie-root-port, this will @@ -2989,6 +3123,8 @@ qemuDomainEnsurePCIAddress(virDomainObjPtr obj, =20 qemuDomainFillDevicePCIConnectFlags(obj->def, dev, priv->qemuCaps, dri= ver); =20 + qemuDomainFillDevicePCIExtensionFlags(dev, info, priv->qemuCaps); + return virDomainPCIAddressEnsureAddr(priv->pciaddrs, info, info->pciConnectFlags); } diff --git a/src/util/virpci.h b/src/util/virpci.h index 4cc9298d85..0e40d86b97 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -50,6 +50,7 @@ struct _virPCIDeviceAddress { unsigned int slot; unsigned int function; int multi; /* virTristateSwitch */ + int extFlags; /* enum virPCIDeviceAddressExtensionFlags */ virZPCIDeviceAddress zpci; }; =20 --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 1539920846021494.0232731810323; Thu, 18 Oct 2018 20:47:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 00F1530024D8; Fri, 19 Oct 2018 03:47:24 +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 C0EEE884E4; Fri, 19 Oct 2018 03:47:23 +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 7B2F34CAA7; Fri, 19 Oct 2018 03:47:23 +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 w9J3f654032006 for ; Thu, 18 Oct 2018 23:41:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 050BF3793; Fri, 19 Oct 2018 03:41:06 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F10195C69A for ; Fri, 19 Oct 2018 03:41:02 +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 CE3E230020BF for ; Fri, 19 Oct 2018 03:41:01 +0000 (UTC) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9J3f1kW116026 for ; Thu, 18 Oct 2018 23:41:01 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0b-001b2d01.pphosted.com with ESMTP id 2n7489pgxf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:40:54 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:40:46 -0600 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e32.co.us.ibm.com (192.168.1.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 21:40:43 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3egYk33685512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:40:42 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EEFE06E05B; Fri, 19 Oct 2018 03:40:41 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C89036E050; Fri, 19 Oct 2018 03:40:39 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:40:39 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:10 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18101903-0004-0000-0000-000014A11620 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571940; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:40:45 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-0005-0000-0000-00008935768B Message-Id: <20181019034020.4757-5-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , 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-1810190033 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.44]); Fri, 19 Oct 2018 03:41:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 19 Oct 2018 03:41:02 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 1.298 * (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, 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.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 04/14] qemu: Enable PCI multi bus for S390 guests 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-Type: text/plain; charset="utf-8" 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 19 Oct 2018 03:47:24 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 QEMU on s390 supports PCI multibus since forever. Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: Stefan Zimmermann Reviewed-by: Bjoern Walk Reviewed-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ee6a7462f6..bf1b90875b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1700,6 +1700,10 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCa= ps, return false; } =20 + /* S390 supports PCI-multibus. */ + if (ARCH_IS_S390(def->os.arch)) + return true; + /* If ARM 'virt' supports PCI, it supports multibus. * No extra conditions here for simplicity. */ --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 1539920835666313.7081768959406; Thu, 18 Oct 2018 20:47:15 -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 6132180F7D; Fri, 19 Oct 2018 03:47:13 +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 2BC1B5C69A; Fri, 19 Oct 2018 03:47:13 +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 BF74F4BB79; Fri, 19 Oct 2018 03:47:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9J3etPW031971 for ; Thu, 18 Oct 2018 23:40:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id D55E480313; Fri, 19 Oct 2018 03:40:55 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA09480303 for ; Fri, 19 Oct 2018 03:40:53 +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 2B04F3DE31 for ; Fri, 19 Oct 2018 03:40:52 +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 w9J3dNbX117857 for ; Thu, 18 Oct 2018 23:40:51 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n747pqa8c-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:40:51 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:40:50 -0600 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e32.co.us.ibm.com (192.168.1.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 21:40:47 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3ejZM42205280 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:40:45 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A1A006E050; Fri, 19 Oct 2018 03:40:45 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 873B66E04E; Fri, 19 Oct 2018 03:40:43 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:40:43 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:11 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18101903-0004-0000-0000-000014A11622 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571940; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:40:49 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-0005-0000-0000-000089357694 Message-Id: <20181019034020.4757-6-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , 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=967 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810190033 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.29]); Fri, 19 Oct 2018 03:40:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 19 Oct 2018 03:40:52 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@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.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 05/14] qemu: Auto add pci-root for s390/s390x guests 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-Type: text/plain; charset="utf-8" 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.27]); Fri, 19 Oct 2018 03:47:14 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 The pci-root depends on zpci capability. So autogenerate pci-root if zpci exists. Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: Stefan Zimmermann Reviewed-by: Bjoern Walk Reviewed-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f00f1b3fdb..961755ef84 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3287,6 +3287,7 @@ qemuDomainDefAddDefaultDevices(virDomainDefPtr def, case VIR_ARCH_S390X: addDefaultUSB =3D false; addPanicDevice =3D true; + addPCIRoot =3D virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ZPCI); break; =20 case VIR_ARCH_SPARC: --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 1539920836230393.5011849590867; Thu, 18 Oct 2018 20:47:16 -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 2C4D9C03D466; Fri, 19 Oct 2018 03:47:14 +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 D87775C72E; Fri, 19 Oct 2018 03:47:13 +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 91CF318005B2; Fri, 19 Oct 2018 03:47:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9J3evl5031982 for ; Thu, 18 Oct 2018 23:40:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id EC01B884E4; Fri, 19 Oct 2018 03:40:57 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E20C6884E1 for ; Fri, 19 Oct 2018 03:40:56 +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 ECFF13084294 for ; Fri, 19 Oct 2018 03:40:54 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9J3dOU8110499 for ; Thu, 18 Oct 2018 23:40:54 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n70g074cg-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:40:54 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:40:53 -0600 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e32.co.us.ibm.com (192.168.1.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 21:40:50 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3enLh29098040 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:40:49 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 205656E054; Fri, 19 Oct 2018 03:40:49 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 065876E04E; Fri, 19 Oct 2018 03:40:47 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:40:46 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:12 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18101903-0004-0000-0000-000014A11626 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571940; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:40:52 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-0005-0000-0000-00008935769D Message-Id: <20181019034020.4757-7-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=895 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810190033 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.40]); Fri, 19 Oct 2018 03:40:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 19 Oct 2018 03:40:55 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@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.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 06/14] conf: Introduce address caching for PCI extensions 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-Type: text/plain; charset="utf-8" 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.31]); Fri, 19 Oct 2018 03:47:14 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 This patch provides a caching mechanism for the device address extensions uid and fid on S390. For efficient sparse address allocation, we introduce two hash tables for uid/fid which hold the address set information per domain. Also in order to improve performance of searching available value, we introduce our own callbacks for the two hashtables. In this way, uid/fid is saved in hash key and hash value could be any non-NULL pointer due to no operation on hash value. That is also the reason why we don't introduce hash value free callback. Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: Bjoern Walk Reviewed-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- src/bhyve/bhyve_device.c | 3 +- src/conf/domain_addr.c | 93 +++++++++++++++++++++++++++++++++- src/conf/domain_addr.h | 10 +++- src/qemu/qemu_domain_address.c | 6 ++- 4 files changed, 108 insertions(+), 4 deletions(-) diff --git a/src/bhyve/bhyve_device.c b/src/bhyve/bhyve_device.c index 207ac6a2dd..a59dfe4519 100644 --- a/src/bhyve/bhyve_device.c +++ b/src/bhyve/bhyve_device.c @@ -71,7 +71,8 @@ bhyveDomainPCIAddressSetCreate(virDomainDefPtr def, unsig= ned int nbuses) { virDomainPCIAddressSetPtr addrs; =20 - if ((addrs =3D virDomainPCIAddressSetAlloc(nbuses)) =3D=3D NULL) + if ((addrs =3D virDomainPCIAddressSetAlloc(nbuses, + VIR_PCI_ADDRESS_EXTENSION_NON= E)) =3D=3D NULL) return NULL; =20 if (virDomainPCIAddressBusSetModel(&addrs->buses[0], diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 442e6aab94..902837d4ee 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -27,6 +27,7 @@ #include "virlog.h" #include "virstring.h" #include "domain_addr.h" +#include "virhashcode.h" =20 #define VIR_FROM_THIS VIR_FROM_DOMAIN =20 @@ -727,8 +728,93 @@ virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetP= tr addrs, addrs->buses[addr->bus].slot[addr->slot].functions &=3D ~(1 << addr->f= unction); } =20 + +static uint32_t +virZPCIAddrKeyCode(const void *name, + uint32_t seed) +{ + unsigned int value =3D *((unsigned int *)name); + return virHashCodeGen(&value, sizeof(value), seed); +} + + +static bool +virZPCIAddrKeyEqual(const void *namea, + const void *nameb) +{ + return *((unsigned int *)namea) =3D=3D *((unsigned int *)nameb); +} + + +static void * +virZPCIAddrKeyCopy(const void *name) +{ + unsigned int *copy; + + if (VIR_ALLOC(copy) < 0) + return NULL; + + *copy =3D *((unsigned int *)name); + return (void *)copy; +} + + +static void +virZPCIAddrKeyFree(void *name) +{ + VIR_FREE(name); +} + + +static void +virDomainPCIAddressSetExtensionFree(virDomainPCIAddressSetPtr addrs) +{ + if (!addrs || !addrs->zpciIds) + return; + + virHashFree(addrs->zpciIds->uids); + virHashFree(addrs->zpciIds->fids); + VIR_FREE(addrs->zpciIds); +} + + +static int +virDomainPCIAddressSetExtensionAlloc(virDomainPCIAddressSetPtr addrs, + virPCIDeviceAddressExtensionFlags ext= Flags) +{ + if (extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) { + if (addrs->zpciIds) + return 0; + + if (VIR_ALLOC(addrs->zpciIds) < 0) + return -1; + + if (!(addrs->zpciIds->uids =3D virHashCreateFull(10, NULL, + virZPCIAddrKeyCode, + virZPCIAddrKeyEqual, + virZPCIAddrKeyCopy, + virZPCIAddrKeyFree)= )) + goto error; + + if (!(addrs->zpciIds->fids =3D virHashCreateFull(10, NULL, + virZPCIAddrKeyCode, + virZPCIAddrKeyEqual, + virZPCIAddrKeyCopy, + virZPCIAddrKeyFree)= )) + goto error; + } + + return 0; + + error: + virDomainPCIAddressSetExtensionFree(addrs); + return -1; +} + + virDomainPCIAddressSetPtr -virDomainPCIAddressSetAlloc(unsigned int nbuses) +virDomainPCIAddressSetAlloc(unsigned int nbuses, + virPCIDeviceAddressExtensionFlags extFlags) { virDomainPCIAddressSetPtr addrs; =20 @@ -739,6 +825,10 @@ virDomainPCIAddressSetAlloc(unsigned int nbuses) goto error; =20 addrs->nbuses =3D nbuses; + + if (virDomainPCIAddressSetExtensionAlloc(addrs, extFlags) < 0) + goto error; + return addrs; =20 error: @@ -753,6 +843,7 @@ virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr ad= drs) if (!addrs) return; =20 + virDomainPCIAddressSetExtensionFree(addrs); VIR_FREE(addrs->buses); VIR_FREE(addrs); } diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h index 435b3c5d7f..8d64d6b795 100644 --- a/src/conf/domain_addr.h +++ b/src/conf/domain_addr.h @@ -116,6 +116,12 @@ typedef struct { } virDomainPCIAddressBus; typedef virDomainPCIAddressBus *virDomainPCIAddressBusPtr; =20 +typedef struct { + virHashTablePtr uids; + virHashTablePtr fids; +} virDomainZPCIAddressIds; +typedef virDomainZPCIAddressIds *virDomainZPCIAddressIdsPtr; + struct _virDomainPCIAddressSet { virDomainPCIAddressBus *buses; size_t nbuses; @@ -125,11 +131,13 @@ struct _virDomainPCIAddressSet { bool areMultipleRootsSupported; /* If true, the guest can use the pcie-to-pci-bridge controller */ bool isPCIeToPCIBridgeSupported; + virDomainZPCIAddressIdsPtr zpciIds; }; typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet; typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr; =20 -virDomainPCIAddressSetPtr virDomainPCIAddressSetAlloc(unsigned int nbuses); +virDomainPCIAddressSetPtr virDomainPCIAddressSetAlloc(unsigned int nbuses, + virPCIDeviceAddressE= xtensionFlags extFlags); =20 void virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs); =20 diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index c0374ccaf3..665f6c1445 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1505,8 +1505,12 @@ qemuDomainPCIAddressSetCreate(virDomainDefPtr def, size_t i; bool hasPCIeRoot =3D false; virDomainControllerModelPCI defaultModel; + virPCIDeviceAddressExtensionFlags extFlags =3D VIR_PCI_ADDRESS_EXTENSI= ON_NONE; =20 - if ((addrs =3D virDomainPCIAddressSetAlloc(nbuses)) =3D=3D NULL) + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ZPCI)) + extFlags |=3D VIR_PCI_ADDRESS_EXTENSION_ZPCI; + + if ((addrs =3D virDomainPCIAddressSetAlloc(nbuses, extFlags)) =3D=3D N= ULL) return NULL; =20 addrs->dryRun =3D dryRun; --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 1539921999232751.5056674313367; Thu, 18 Oct 2018 21:06:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2ABBD3084294; Fri, 19 Oct 2018 04:06:37 +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 A70A6884E1; Fri, 19 Oct 2018 04:06:36 +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 33DD8180B5B7; Fri, 19 Oct 2018 04:06:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9J3f2V5031993 for ; Thu, 18 Oct 2018 23:41:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 035FC60CD6; Fri, 19 Oct 2018 03:41:02 +0000 (UTC) Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF01A60C68 for ; Fri, 19 Oct 2018 03:41:00 +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 34EB230F5589 for ; Fri, 19 Oct 2018 03:40:59 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9J3dr1b187694 for ; Thu, 18 Oct 2018 23:40:58 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0b-001b2d01.pphosted.com with ESMTP id 2n73y2qkp8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:40:58 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:40:57 -0600 Received: from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16) by e33.co.us.ibm.com (192.168.1.133) 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 21:40:54 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3eqwB47710370 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:40:52 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A36C66E05B; Fri, 19 Oct 2018 03:40:52 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 771456E053; Fri, 19 Oct 2018 03:40:50 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:40:50 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:13 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18101903-0036-0000-0000-00000A4D1864 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571940; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:40:55 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-0037-0000-0000-0000495643BD Message-Id: <20181019034020.4757-8-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , 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=810 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810190033 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.45]); Fri, 19 Oct 2018 03:40:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 19 Oct 2018 03:40:59 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 1.298 * (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, 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.45 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 07/14] conf: use virXMLFormatElement() in virDomainDeviceInfoFormat() 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 19 Oct 2018 04:06:37 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In order to add zPCI child element for PCI address, we update virDomainDeviceInfoFormat() to format device info by helper function virXMLFormatElement(). Then we could simply format zPCI address into child buffer later. Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: Andrea Bolognani --- src/conf/domain_conf.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e8e0adc819..88964f10c6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6400,6 +6400,8 @@ virDomainDeviceInfoFormat(virBufferPtr buf, virDomainDeviceInfoPtr info, unsigned int flags) { + virBuffer attrBuf =3D VIR_BUFFER_INITIALIZER; + if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) && info->bootIndex) { virBufferAsprintf(buf, "bootIndex); =20 @@ -6444,13 +6446,13 @@ virDomainDeviceInfoFormat(virBufferPtr buf, info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) return; =20 - virBufferAsprintf(buf, "
type)); =20 switch ((virDomainDeviceAddressType) info->type) { case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI: if (!virPCIDeviceAddressIsEmpty(&info->addr.pci)) { - virBufferAsprintf(buf, " domain=3D'0x%.4x' bus=3D'0x%.2x' " + virBufferAsprintf(&attrBuf, " domain=3D'0x%.4x' bus=3D'0x%.2x'= " "slot=3D'0x%.2x' function=3D'0x%.1x'", info->addr.pci.domain, info->addr.pci.bus, @@ -6458,13 +6460,13 @@ virDomainDeviceInfoFormat(virBufferPtr buf, info->addr.pci.function); } if (info->addr.pci.multi) { - virBufferAsprintf(buf, " multifunction=3D'%s'", - virTristateSwitchTypeToString(info->addr.pci.= multi)); + virBufferAsprintf(&attrBuf, " multifunction=3D'%s'", + virTristateSwitchTypeToString(info->addr.pci= .multi)); } break; =20 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE: - virBufferAsprintf(buf, " controller=3D'%d' bus=3D'%d' target=3D'%d= ' unit=3D'%d'", + virBufferAsprintf(&attrBuf, " controller=3D'%d' bus=3D'%d' target= =3D'%d' unit=3D'%d'", info->addr.drive.controller, info->addr.drive.bus, info->addr.drive.target, @@ -6472,34 +6474,34 @@ virDomainDeviceInfoFormat(virBufferPtr buf, break; =20 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL: - virBufferAsprintf(buf, " controller=3D'%d' bus=3D'%d' port=3D'%d'", + virBufferAsprintf(&attrBuf, " controller=3D'%d' bus=3D'%d' port=3D= '%d'", info->addr.vioserial.controller, info->addr.vioserial.bus, info->addr.vioserial.port); break; =20 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID: - virBufferAsprintf(buf, " controller=3D'%d' slot=3D'%d'", + virBufferAsprintf(&attrBuf, " controller=3D'%d' slot=3D'%d'", info->addr.ccid.controller, info->addr.ccid.slot); break; =20 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB: - virBufferAsprintf(buf, " bus=3D'%d'", info->addr.usb.bus); + virBufferAsprintf(&attrBuf, " bus=3D'%d'", info->addr.usb.bus); if (virDomainUSBAddressPortIsValid(info->addr.usb.port)) { - virBufferAddLit(buf, " port=3D'"); - virDomainUSBAddressPortFormatBuf(buf, info->addr.usb.port); - virBufferAddLit(buf, "'"); + virBufferAddLit(&attrBuf, " port=3D'"); + virDomainUSBAddressPortFormatBuf(&attrBuf, info->addr.usb.port= ); + virBufferAddLit(&attrBuf, "'"); } break; =20 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO: if (info->addr.spaprvio.has_reg) - virBufferAsprintf(buf, " reg=3D'0x%llx'", info->addr.spaprvio.= reg); + virBufferAsprintf(&attrBuf, " reg=3D'0x%llx'", info->addr.spap= rvio.reg); break; =20 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW: - virBufferAsprintf(buf, " cssid=3D'0x%x' ssid=3D'0x%x' devno=3D'0x%= 04x'", + virBufferAsprintf(&attrBuf, " cssid=3D'0x%x' ssid=3D'0x%x' devno= =3D'0x%04x'", info->addr.ccw.cssid, info->addr.ccw.ssid, info->addr.ccw.devno); @@ -6510,15 +6512,15 @@ virDomainDeviceInfoFormat(virBufferPtr buf, =20 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA: if (info->addr.isa.iobase > 0) - virBufferAsprintf(buf, " iobase=3D'0x%x'", info->addr.isa.ioba= se); + virBufferAsprintf(&attrBuf, " iobase=3D'0x%x'", info->addr.isa= .iobase); if (info->addr.isa.irq > 0) - virBufferAsprintf(buf, " irq=3D'0x%x'", info->addr.isa.irq); + virBufferAsprintf(&attrBuf, " irq=3D'0x%x'", info->addr.isa.ir= q); break; =20 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM: - virBufferAsprintf(buf, " slot=3D'%u'", info->addr.dimm.slot); + virBufferAsprintf(&attrBuf, " slot=3D'%u'", info->addr.dimm.slot); if (info->addr.dimm.base) - virBufferAsprintf(buf, " base=3D'0x%llx'", info->addr.dimm.bas= e); + virBufferAsprintf(&attrBuf, " base=3D'0x%llx'", info->addr.dim= m.base); =20 break; =20 @@ -6528,7 +6530,9 @@ virDomainDeviceInfoFormat(virBufferPtr buf, break; } =20 - virBufferAddLit(buf, "/>\n"); + virXMLFormatElement(buf, "address", &attrBuf, NULL); + + virBufferFreeAndReset(&attrBuf); } =20 static int --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 1539922011257898.4157164628791; Thu, 18 Oct 2018 21:06:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0774B3002F71; Fri, 19 Oct 2018 04:06:49 +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 8C7B7105704D; Fri, 19 Oct 2018 04:06:48 +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 E50F6180B5B7; Fri, 19 Oct 2018 04:06:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9J3fB1o032031 for ; Thu, 18 Oct 2018 23:41:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 300D21057051; Fri, 19 Oct 2018 03:41:11 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 22F08105704D for ; Fri, 19 Oct 2018 03:41:04 +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 E88B8CA1E7 for ; Fri, 19 Oct 2018 03:41:02 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9J3ds18187736 for ; Thu, 18 Oct 2018 23:41:02 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0b-001b2d01.pphosted.com with ESMTP id 2n73y2qkrb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:41:02 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:41:01 -0600 Received: from b03cxnp08026.gho.boulder.ibm.com (9.17.130.18) by e33.co.us.ibm.com (192.168.1.133) 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 21:40:57 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3euQg43647172 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:40:56 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4A1156E059; Fri, 19 Oct 2018 03:40:56 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 18E3D6E05D; Fri, 19 Oct 2018 03:40:54 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:40:53 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:14 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18101903-0036-0000-0000-00000A4D1866 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571940; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:40:59 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-0037-0000-0000-0000495643C3 Message-Id: <20181019034020.4757-9-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 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-1810190033 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.38]); Fri, 19 Oct 2018 03:41:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 19 Oct 2018 03:41:03 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 1.298 * (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 08/14] conf: Introduce parser, formatter for uid and fid 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 19 Oct 2018 04:06:49 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 This patch introduces new XML parser/formatter functions. Uid is 16-bit and non-zero. Fid is 32-bit. They are the two attributes of zpci which is introduced as PCI address element. Zpci element is parsed and formatted along with PCI address. And add the related test cases. Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: Stefan Zimmermann Reviewed-by: Bjoern Walk Reviewed-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- docs/schemas/basictypes.rng | 27 ++++++++++ docs/schemas/domaincommon.rng | 1 + src/conf/device_conf.c | 53 +++++++++++++++++++ src/conf/domain_addr.c | 3 ++ src/conf/domain_conf.c | 12 ++++- src/libvirt_private.syms | 2 + src/util/virpci.c | 26 +++++++++ src/util/virpci.h | 6 +++ .../disk-virtio-s390-zpci.args | 25 +++++++++ .../disk-virtio-s390-zpci.xml | 19 +++++++ tests/qemuxml2argvdata/hostdev-vfio-zpci.args | 23 ++++++++ tests/qemuxml2argvdata/hostdev-vfio-zpci.xml | 21 ++++++++ tests/qemuxml2argvtest.c | 7 +++ .../disk-virtio-s390-zpci.xml | 31 +++++++++++ .../qemuxml2xmloutdata/hostdev-vfio-zpci.xml | 32 +++++++++++ tests/qemuxml2xmltest.c | 6 +++ 16 files changed, 293 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/disk-virtio-s390-zpci.args create mode 100644 tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci.args create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci.xml create mode 100644 tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 14a3670e5c..71a6db3bb4 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -65,6 +65,17 @@ + + + + (0x)?[0-9a-fA-F]{1,8} + + + 0 + 4294967295 + + + =20 @@ -111,6 +122,22 @@ + + + + + + + + + + + + + + + + =20 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 099a949cf8..9eeae80452 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5220,6 +5220,7 @@ pci + diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 98a419f40f..f9f6b6e38f 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -47,6 +47,45 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_= ADDRESS_TYPE_LAST, "dimm", ); =20 +static int +virZPCIDeviceAddressParseXML(xmlNodePtr node, + virPCIDeviceAddressPtr addr) +{ + virZPCIDeviceAddress def =3D { 0 }; + char *uid; + char *fid; + int ret =3D -1; + + uid =3D virXMLPropString(node, "uid"); + fid =3D virXMLPropString(node, "fid"); + + if (uid && + virStrToLong_uip(uid, NULL, 0, &def.uid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse
'uid' attribute")); + goto cleanup; + } + + if (fid && + virStrToLong_uip(fid, NULL, 0, &def.fid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse
'fid' attribute")); + goto cleanup; + } + + if (!virZPCIDeviceAddressIsEmpty(&def) && + !virZPCIDeviceAddressIsValid(&def)) + goto cleanup; + + addr->zpci =3D def; + ret =3D 0; + + cleanup: + VIR_FREE(uid); + VIR_FREE(fid); + return ret; +} + int virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst, virDomainDeviceInfoPtr src) @@ -181,6 +220,8 @@ virPCIDeviceAddressParseXML(xmlNodePtr node, virPCIDeviceAddressPtr addr) { char *domain, *slot, *bus, *function, *multi; + xmlNodePtr cur; + xmlNodePtr zpci =3D NULL; int ret =3D -1; =20 memset(addr, 0, sizeof(*addr)); @@ -230,6 +271,18 @@ virPCIDeviceAddressParseXML(xmlNodePtr node, if (!virPCIDeviceAddressIsEmpty(addr) && !virPCIDeviceAddressIsValid(a= ddr, true)) goto cleanup; =20 + cur =3D node->children; + while (cur) { + if (cur->type =3D=3D XML_ELEMENT_NODE && + virXMLNodeNameEqual(cur, "zpci")) { + zpci =3D cur; + } + cur =3D cur->next; + } + + if (zpci && virZPCIDeviceAddressParseXML(zpci, addr) < 0) + goto cleanup; + ret =3D 0; =20 cleanup: diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 902837d4ee..c307d85ee1 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -1040,6 +1040,9 @@ virDomainPCIAddressReserveNextAddr(virDomainPCIAddres= sSetPtr addrs, dev->isolationGroup, false)= < 0) return -1; =20 + addr.extFlags =3D dev->addr.pci.extFlags; + addr.zpci =3D dev->addr.pci.zpci; + if (!addrs->dryRun) { dev->type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; dev->addr.pci =3D addr; diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 88964f10c6..7193cbd84a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6401,6 +6401,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf, unsigned int flags) { virBuffer attrBuf =3D VIR_BUFFER_INITIALIZER; + virBuffer childBuf =3D VIR_BUFFER_INITIALIZER; =20 if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) && info->bootIndex) { virBufferAsprintf(buf, "bootIndex); @@ -6463,6 +6464,14 @@ virDomainDeviceInfoFormat(virBufferPtr buf, virBufferAsprintf(&attrBuf, " multifunction=3D'%s'", virTristateSwitchTypeToString(info->addr.pci= .multi)); } + + if (!virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci)) { + virBufferSetChildIndent(&childBuf, buf); + virBufferAsprintf(&childBuf, + "\n", + info->addr.pci.zpci.uid, + info->addr.pci.zpci.fid); + } break; =20 case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE: @@ -6530,9 +6539,10 @@ virDomainDeviceInfoFormat(virBufferPtr buf, break; } =20 - virXMLFormatElement(buf, "address", &attrBuf, NULL); + virXMLFormatElement(buf, "address", &attrBuf, &childBuf); =20 virBufferFreeAndReset(&attrBuf); + virBufferFreeAndReset(&childBuf); } =20 static int diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 335210c31d..7daf52bc0a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2568,6 +2568,8 @@ virPCIHeaderTypeToString; virPCIIsVirtualFunction; virPCIStubDriverTypeFromString; virPCIStubDriverTypeToString; +virZPCIDeviceAddressIsEmpty; +virZPCIDeviceAddressIsValid; =20 =20 # util/virperf.h diff --git a/src/util/virpci.c b/src/util/virpci.c index 0f680efbe6..efa2d1662a 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2563,6 +2563,32 @@ virPCIDeviceAddressParse(char *address, =20 #ifdef __linux__ =20 +bool +virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr zpci) +{ + /* We don't need to check fid because fid covers + * all range of uint32 type. + */ + if (zpci->uid > VIR_DOMAIN_DEVICE_ZPCI_MAX_UID || + zpci->uid =3D=3D 0) { + virReportError(VIR_ERR_XML_ERROR, + _("Invalid PCI address uid=3D'0x%.4x', " + "must be > 0x0000 and <=3D 0x%.4x"), + zpci->uid, + VIR_DOMAIN_DEVICE_ZPCI_MAX_UID); + return false; + } + + return true; +} + +bool +virZPCIDeviceAddressIsEmpty(const virZPCIDeviceAddress *addr) +{ + return !(addr->uid || addr->fid); +} + + /* * returns true if equal */ diff --git a/src/util/virpci.h b/src/util/virpci.h index 0e40d86b97..a2e795eff9 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -37,6 +37,9 @@ typedef virPCIDeviceAddress *virPCIDeviceAddressPtr; typedef struct _virPCIDeviceList virPCIDeviceList; typedef virPCIDeviceList *virPCIDeviceListPtr; =20 +# define VIR_DOMAIN_DEVICE_ZPCI_MAX_UID UINT16_MAX +# define VIR_DOMAIN_DEVICE_ZPCI_MAX_FID UINT32_MAX + typedef struct _virZPCIDeviceAddress virZPCIDeviceAddress; typedef virZPCIDeviceAddress *virZPCIDeviceAddressPtr; struct _virZPCIDeviceAddress { @@ -239,6 +242,9 @@ char *virPCIDeviceAddressAsString(virPCIDeviceAddressPt= r addr) =20 int virPCIDeviceAddressParse(char *address, virPCIDeviceAddressPtr bdf); =20 +bool virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr zpci); +bool virZPCIDeviceAddressIsEmpty(const virZPCIDeviceAddress *addr); + int virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path, int pfNetDevIdx, char **pfname, diff --git a/tests/qemuxml2argvdata/disk-virtio-s390-zpci.args b/tests/qemu= xml2argvdata/disk-virtio-s390-zpci.args new file mode 100644 index 0000000000..8ac435cb3e --- /dev/null +++ b/tests/qemuxml2argvdata/disk-virtio-s390-zpci.args @@ -0,0 +1,25 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +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 214 \ +-smp 1,sockets=3D1,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 \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir= tio-disk0 \ +-device virtio-blk-pci,bus=3Dpci.0,addr=3D0x8,drive=3Ddrive-virtio-disk0,\ +id=3Dvirtio-disk0,bootindex=3D1 \ +-device virtio-balloon-ccw,id=3Dballoon0,devno=3Dfe.0.0000 diff --git a/tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml b/tests/qemux= ml2argvdata/disk-virtio-s390-zpci.xml new file mode 100644 index 0000000000..8bf4a23670 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-virtio-s390-zpci.xml @@ -0,0 +1,19 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 1 + + hvm + + + /usr/bin/qemu-system-s390x + + + +
+ +
+
+
+
diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci.args b/tests/qemuxml2= argvdata/hostdev-vfio-zpci.args new file mode 100644 index 0000000000..d6b1520c47 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci.args @@ -0,0 +1,23 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +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 214 \ +-smp 1,sockets=3D1,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-pci,host=3D00:00.0,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x8 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x1 diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci.xml b/tests/qemuxml2a= rgvdata/hostdev-vfio-zpci.xml new file mode 100644 index 0000000000..002b99c52d --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci.xml @@ -0,0 +1,21 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + + hvm + + + /usr/bin/qemu-system-s390x + + + + +
+ +
+ +
+ + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 39a7f1f53c..7b9e6bf2be 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1076,6 +1076,10 @@ mymain(void) QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390); DO_TEST("disk-virtio-scsi-ccw", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_S390); + DO_TEST("disk-virtio-s390-zpci", + QEMU_CAPS_DEVICE_ZPCI, + QEMU_CAPS_CCW, + QEMU_CAPS_VIRTIO_S390); DO_TEST("disk-order", QEMU_CAPS_VIRTIO_BLK_SCSI); DO_TEST("disk-virtio-queues", QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES); @@ -1679,6 +1683,9 @@ mymain(void) DO_TEST_PARSE_ERROR("hostdev-mdev-display-missing-graphics", QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_VFIO_PCI_DISPLAY); + DO_TEST("hostdev-vfio-zpci", + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_ZPCI); DO_TEST("pci-rom", NONE); DO_TEST("pci-rom-disabled", NONE); DO_TEST("pci-rom-disabled-invalid", NONE); diff --git a/tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml b/tests/qem= uxml2xmloutdata/disk-virtio-s390-zpci.xml new file mode 100644 index 0000000000..37684c82b1 --- /dev/null +++ b/tests/qemuxml2xmloutdata/disk-virtio-s390-zpci.xml @@ -0,0 +1,31 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + + + +
+ +
+
+ + +
+ + + + diff --git a/tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml b/tests/qemuxml= 2xmloutdata/hostdev-vfio-zpci.xml new file mode 100644 index 0000000000..fc8c38ab66 --- /dev/null +++ b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci.xml @@ -0,0 +1,32 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + + + +
+ +
+ +
+ + +
+ + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 89640f641a..53de9726f4 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -376,6 +376,9 @@ mymain(void) QEMU_CAPS_VIRTIO_SCSI); DO_TEST("disk-virtio-scsi-ioeventfd", QEMU_CAPS_VIRTIO_SCSI); + DO_TEST("disk-virtio-s390-zpci", + QEMU_CAPS_DEVICE_ZPCI, + QEMU_CAPS_CCW); DO_TEST("disk-scsi-megasas", QEMU_CAPS_SCSI_MEGASAS); DO_TEST("disk-scsi-mptsas1068", @@ -458,6 +461,9 @@ mymain(void) DO_TEST("hostdev-usb-address", NONE); DO_TEST("hostdev-pci-address", NONE); DO_TEST("hostdev-vfio", NONE); + DO_TEST("hostdev-vfio-zpci", + QEMU_CAPS_DEVICE_ZPCI, + QEMU_CAPS_CCW); DO_TEST("hostdev-mdev-precreated", NONE); DO_TEST("hostdev-mdev-display", QEMU_CAPS_VFIO_PCI_DISPLAY); DO_TEST("pci-rom", NONE); --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 1539920847120211.83213363188247; Thu, 18 Oct 2018 20:47:27 -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 42F0030026D9; Fri, 19 Oct 2018 03:47:25 +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 0ECCF6873C; Fri, 19 Oct 2018 03:47:25 +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 BEA0C18005B3; Fri, 19 Oct 2018 03:47:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9J3f9cQ032018 for ; Thu, 18 Oct 2018 23:41:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9339360150; Fri, 19 Oct 2018 03:41:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C53C50F91 for ; Fri, 19 Oct 2018 03:41:06 +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 C75CC30F8C03 for ; Fri, 19 Oct 2018 03:41:05 +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 w9J3eaBi100464 for ; Thu, 18 Oct 2018 23:41:05 -0400 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n77jm80ds-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:41:05 -0400 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:41:04 -0600 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e31.co.us.ibm.com (192.168.1.131) 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 21:41:01 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3exQv51511358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:40:59 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CB41C6E04E; Fri, 19 Oct 2018 03:40:59 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A0CE16E05D; Fri, 19 Oct 2018 03:40:57 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:40:57 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:15 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18101903-8235-0000-0000-00000E184ABD X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571939; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:41:03 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-8236-0000-0000-0000430D7EB8 Message-Id: <20181019034020.4757-10-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , 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-1810190033 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.46]); Fri, 19 Oct 2018 03:41:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 19 Oct 2018 03:41:06 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@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.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 09/14] qemu: Add zPCI address definition check 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 19 Oct 2018 03:47:25 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We should ensure that QEMU supports zPCI when a zPCI address is defined in XML and otherwise report an error. This patch introduces a generic validation function qemuDomainDeviceDefValidateAddress() which calls qemuDomainDeviceDefValidateZPCIAddress() if address type is PCI address. Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 36 +++++++++++++++++++ .../hostdev-vfio-zpci-wrong-arch.xml | 34 ++++++++++++++++++ tests/qemuxml2argvtest.c | 2 ++ 3 files changed, 72 insertions(+) create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-wrong-arch.xml diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 961755ef84..8bdc3f58e8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5797,6 +5797,38 @@ qemuDomainDeviceDefValidateInput(const virDomainInpu= tDef *input, } =20 =20 +static int +qemuDomainDeviceDefValidateZPCIAddress(virDomainDeviceInfoPtr info, + virQEMUCapsPtr qemuCaps) +{ + if (!virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ZPCI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", + _("This QEMU binary doesn't support zPCI")); + return -1; + } + + return 0; +} + + +static int +qemuDomainDeviceDefValidateAddress(const virDomainDeviceDef *dev, + virQEMUCapsPtr qemuCaps) +{ + virDomainDeviceInfoPtr info; + + if (!(info =3D virDomainDeviceGetInfo((virDomainDeviceDef *)dev))) + return 0; + + if (info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) + return qemuDomainDeviceDefValidateZPCIAddress(info, qemuCaps); + + return 0; +} + + static int qemuDomainDeviceDefValidate(const virDomainDeviceDef *dev, const virDomainDef *def, @@ -5810,6 +5842,9 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, def->emulator))) return -1; =20 + if ((ret =3D qemuDomainDeviceDefValidateAddress(dev, qemuCaps)) < 0) + goto cleanup; + switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_NET: ret =3D qemuDomainDeviceDefValidateNetwork(dev->data.net); @@ -5885,6 +5920,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, break; } =20 + cleanup: virObjectUnref(qemuCaps); return ret; } diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-wrong-arch.xml b/test= s/qemuxml2argvdata/hostdev-vfio-zpci-wrong-arch.xml new file mode 100644 index 0000000000..bfb2f83a3b --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-wrong-arch.xml @@ -0,0 +1,34 @@ + + QEMUGuest2 + c7a5fdbd-edaf-9466-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + +
+ + + + + +
+ +
+ +
+ + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 7b9e6bf2be..09c52f5f38 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1683,6 +1683,8 @@ mymain(void) DO_TEST_PARSE_ERROR("hostdev-mdev-display-missing-graphics", QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_VFIO_PCI_DISPLAY); + DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-wrong-arch", + QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("hostdev-vfio-zpci", QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_DEVICE_ZPCI); --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 1539920858099257.4706400649984; Thu, 18 Oct 2018 20:47:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D4C0ACA386; Fri, 19 Oct 2018 03:47:35 +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 9044A19940; Fri, 19 Oct 2018 03:47:35 +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 46C914CAA7; Fri, 19 Oct 2018 03:47:35 +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 w9J3fAks032023 for ; Thu, 18 Oct 2018 23:41:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 707823793; Fri, 19 Oct 2018 03:41:10 +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 6819717501 for ; Fri, 19 Oct 2018 03:41:10 +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 D4AF3307B962 for ; Fri, 19 Oct 2018 03:41:08 +0000 (UTC) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9J3dkDM001207 for ; Thu, 18 Oct 2018 23:41:08 -0400 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0b-001b2d01.pphosted.com with ESMTP id 2n76sm1qbu-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:41:08 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:41:07 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e34.co.us.ibm.com (192.168.1.134) 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 21:41:04 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3f34n10879076 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:41:03 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5AA296E062; Fri, 19 Oct 2018 03:41:03 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 579206E054; Fri, 19 Oct 2018 03:41:01 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:41:00 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:16 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18101903-0016-0000-0000-000009454A51 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571939; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:41:06 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-0017-0000-0000-000040C280CC Message-Id: <20181019034020.4757-11-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 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-1810190033 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.47]); Fri, 19 Oct 2018 03:41:09 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 19 Oct 2018 03:41:09 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 1.298 * (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, 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.47 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 10/14] conf: Allocate/release 'uid' and 'fid' in PCI address 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 19 Oct 2018 03:47:36 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch adds new functions for reservation, assignment and release to handle the uid/fid. If the uid/fid is defined in the domain XML, they will be reserved directly in the collecting phase. If any of them is not defined, we will find out an available value for them from the zPCI address hashtable, and reserve them. For the hotplug case there might not be a zPCI definition. So allocate and reserve uid/fid the case. Assign if needed and reserve uid/fid for the defined case. Signed-off-by: Yi Min Zhao Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- src/conf/device_conf.c | 16 +++ src/conf/device_conf.h | 3 + src/conf/domain_addr.c | 244 +++++++++++++++++++++++++++++++++ src/conf/domain_addr.h | 12 ++ src/libvirt_private.syms | 5 + src/qemu/qemu_domain_address.c | 59 +++++++- 6 files changed, 338 insertions(+), 1 deletion(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index f9f6b6e38f..44b210d5ec 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -28,6 +28,7 @@ #include "viruuid.h" #include "virbuffer.h" #include "device_conf.h" +#include "domain_addr.h" #include "virstring.h" =20 #define VIR_FROM_THIS VIR_FROM_DEVICE @@ -215,6 +216,21 @@ virDeviceInfoPCIAddressIsPresent(const virDomainDevice= Info *info) } =20 =20 +bool +virDeviceInfoPCIAddressExtensionIsWanted(const virDomainDeviceInfo *info) +{ + return (info->addr.pci.extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) && + virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci); +} + +bool +virDeviceInfoPCIAddressExtensionIsPresent(const virDomainDeviceInfo *info) +{ + return (info->addr.pci.extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) && + !virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci); +} + + int virPCIDeviceAddressParseXML(xmlNodePtr node, virPCIDeviceAddressPtr addr) diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h index 2366e03607..867b633903 100644 --- a/src/conf/device_conf.h +++ b/src/conf/device_conf.h @@ -198,6 +198,9 @@ bool virDomainDeviceAddressIsValid(virDomainDeviceInfoP= tr info, bool virDeviceInfoPCIAddressIsWanted(const virDomainDeviceInfo *info); bool virDeviceInfoPCIAddressIsPresent(const virDomainDeviceInfo *info); =20 +bool virDeviceInfoPCIAddressExtensionIsWanted(const virDomainDeviceInfo *i= nfo); +bool virDeviceInfoPCIAddressExtensionIsPresent(const virDomainDeviceInfo *= info); + int virPCIDeviceAddressParseXML(xmlNodePtr node, virPCIDeviceAddressPtr addr); =20 diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index c307d85ee1..d174558282 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -33,6 +33,238 @@ =20 VIR_LOG_INIT("conf.domain_addr"); =20 +static int +virDomainZPCIAddressReserveId(virHashTablePtr set, + unsigned int id, + const char *name) +{ + if (virHashLookup(set, &id)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("zPCI %s %o is already reserved"), + name, id); + return -1; + } + + if (virHashAddEntry(set, &id, (void*)1) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to reserve %s %o"), + name, id); + return -1; + } + + return 0; +} + + +static int +virDomainZPCIAddressReserveUid(virHashTablePtr set, + virZPCIDeviceAddressPtr addr) +{ + return virDomainZPCIAddressReserveId(set, addr->uid, "uid"); +} + + +static int +virDomainZPCIAddressReserveFid(virHashTablePtr set, + virZPCIDeviceAddressPtr addr) +{ + return virDomainZPCIAddressReserveId(set, addr->fid, "fid"); +} + + +static int +virDomainZPCIAddressAssignId(virHashTablePtr set, + unsigned int *id, + unsigned int min, + unsigned int max, + const char *name) +{ + while (virHashLookup(set, &min)) { + if (min =3D=3D max) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("There is no more free %s."), + name); + return -1; + } + ++min; + } + *id =3D min; + + return 0; +} + + +static int +virDomainZPCIAddressAssignUid(virHashTablePtr set, + virZPCIDeviceAddressPtr addr) +{ + return virDomainZPCIAddressAssignId(set, &addr->uid, 1, + VIR_DOMAIN_DEVICE_ZPCI_MAX_UID, "u= id"); +} + + +static int +virDomainZPCIAddressAssignFid(virHashTablePtr set, + virZPCIDeviceAddressPtr addr) +{ + return virDomainZPCIAddressAssignId(set, &addr->fid, 0, + VIR_DOMAIN_DEVICE_ZPCI_MAX_FID, "f= id"); +} + + +static void +virDomainZPCIAddressReleaseId(virHashTablePtr set, + unsigned int *id, + const char *name) +{ + if (virHashRemoveEntry(set, id) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Release %s %o failed"), + name, *id); + } + + *id =3D 0; +} + + +static void +virDomainZPCIAddressReleaseUid(virHashTablePtr set, + virZPCIDeviceAddressPtr addr) +{ + virDomainZPCIAddressReleaseId(set, &addr->uid, "uid"); +} + + +static void +virDomainZPCIAddressReleaseFid(virHashTablePtr set, + virZPCIDeviceAddressPtr addr) +{ + virDomainZPCIAddressReleaseId(set, &addr->fid, "fid"); +} + + +static void +virDomainZPCIAddressReleaseIds(virDomainZPCIAddressIdsPtr zpciIds, + virZPCIDeviceAddressPtr addr) +{ + if (!zpciIds || virZPCIDeviceAddressIsEmpty(addr)) + return; + + virDomainZPCIAddressReleaseUid(zpciIds->uids, addr); + + virDomainZPCIAddressReleaseFid(zpciIds->fids, addr); +} + + +static int +virDomainZPCIAddressReserveNextUid(virHashTablePtr uids, + virZPCIDeviceAddressPtr zpci) +{ + if (virDomainZPCIAddressAssignUid(uids, zpci) < 0) + return -1; + + if (virDomainZPCIAddressReserveUid(uids, zpci) < 0) + return -1; + + return 0; +} + + +static int +virDomainZPCIAddressReserveNextFid(virHashTablePtr fids, + virZPCIDeviceAddressPtr zpci) +{ + if (virDomainZPCIAddressAssignFid(fids, zpci) < 0) + return -1; + + if (virDomainZPCIAddressReserveFid(fids, zpci) < 0) + return -1; + + return 0; +} + + +static int +virDomainZPCIAddressReserveAddr(virDomainZPCIAddressIdsPtr zpciIds, + virZPCIDeviceAddressPtr addr) +{ + if (virDomainZPCIAddressReserveUid(zpciIds->uids, addr) < 0) + return -1; + + if (virDomainZPCIAddressReserveFid(zpciIds->fids, addr) < 0) { + virDomainZPCIAddressReleaseUid(zpciIds->uids, addr); + return -1; + } + + return 0; +} + + +static int +virDomainZPCIAddressReserveNextAddr(virDomainZPCIAddressIdsPtr zpciIds, + virZPCIDeviceAddressPtr addr) +{ + if (virDomainZPCIAddressReserveNextUid(zpciIds->uids, addr) < 0) + return -1; + + if (virDomainZPCIAddressReserveNextFid(zpciIds->fids, addr) < 0) { + virDomainZPCIAddressReleaseUid(zpciIds->uids, addr); + return -1; + } + + return 0; +} + + +int +virDomainPCIAddressExtensionReserveAddr(virDomainPCIAddressSetPtr addrs, + virPCIDeviceAddressPtr addr) +{ + if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) { + /* Reserve uid/fid to ZPCI device which has defined uid/fid + * in the domain. + */ + return virDomainZPCIAddressReserveAddr(addrs->zpciIds, &addr->zpci= ); + } + + return 0; +} + + +int +virDomainPCIAddressExtensionReserveNextAddr(virDomainPCIAddressSetPtr addr= s, + virPCIDeviceAddressPtr addr) +{ + if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) { + virZPCIDeviceAddress zpci =3D { 0 }; + + if (virDomainZPCIAddressReserveNextAddr(addrs->zpciIds, &zpci) < 0) + return -1; + + if (!addrs->dryRun) + addr->zpci =3D zpci; + } + + return 0; +} + +static int +virDomainPCIAddressExtensionEnsureAddr(virDomainPCIAddressSetPtr addrs, + virPCIDeviceAddressPtr addr) +{ + if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) { + virZPCIDeviceAddressPtr zpci =3D &addr->zpci; + + if (virZPCIDeviceAddressIsEmpty(zpci)) + return virDomainZPCIAddressReserveNextAddr(addrs->zpciIds, zpc= i); + else + return virDomainZPCIAddressReserveAddr(addrs->zpciIds, zpci); + } + + return 0; +} + + virDomainPCIConnectFlags virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model) { @@ -715,12 +947,24 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetP= tr addrs, ret =3D virDomainPCIAddressReserveNextAddr(addrs, dev, flags, -1); } =20 + dev->addr.pci.extFlags =3D dev->pciAddrExtFlags; + ret =3D virDomainPCIAddressExtensionEnsureAddr(addrs, &dev->addr.pci); + cleanup: VIR_FREE(addrStr); return ret; } =20 =20 +void +virDomainPCIAddressExtensionReleaseAddr(virDomainPCIAddressSetPtr addrs, + virPCIDeviceAddressPtr addr) +{ + if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) + virDomainZPCIAddressReleaseIds(addrs->zpciIds, &addr->zpci); +} + + void virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs, virPCIDeviceAddressPtr addr) diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h index 8d64d6b795..183235309b 100644 --- a/src/conf/domain_addr.h +++ b/src/conf/domain_addr.h @@ -160,6 +160,14 @@ bool virDomainPCIAddressSlotInUse(virDomainPCIAddressS= etPtr addrs, virPCIDeviceAddressPtr addr) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); =20 +int virDomainPCIAddressExtensionReserveAddr(virDomainPCIAddressSetPtr addr= s, + virPCIDeviceAddressPtr addr) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + +int virDomainPCIAddressExtensionReserveNextAddr(virDomainPCIAddressSetPtr = addrs, + virPCIDeviceAddressPtr add= r) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + int virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs, virPCIDeviceAddressPtr addr, virDomainPCIConnectFlags flags, @@ -181,6 +189,10 @@ void virDomainPCIAddressReleaseAddr(virDomainPCIAddres= sSetPtr addrs, virPCIDeviceAddressPtr addr) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); =20 +void virDomainPCIAddressExtensionReleaseAddr(virDomainPCIAddressSetPtr add= rs, + virPCIDeviceAddressPtr addr) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); + void virDomainPCIAddressSetAllMulti(virDomainDefPtr def) ATTRIBUTE_NONNULL(1); =20 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 7daf52bc0a..1f365f451e 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -93,6 +93,8 @@ virCPUModeTypeToString; =20 =20 # conf/device_conf.h +virDeviceInfoPCIAddressExtensionIsPresent; +virDeviceInfoPCIAddressExtensionIsWanted; virDeviceInfoPCIAddressIsPresent; virDeviceInfoPCIAddressIsWanted; virDomainDeviceAddressIsValid; @@ -119,6 +121,9 @@ virDomainCCWAddressSetFree; virDomainPCIAddressBusIsFullyReserved; virDomainPCIAddressBusSetModel; virDomainPCIAddressEnsureAddr; +virDomainPCIAddressExtensionReleaseAddr; +virDomainPCIAddressExtensionReserveAddr; +virDomainPCIAddressExtensionReserveNextAddr; virDomainPCIAddressReleaseAddr; virDomainPCIAddressReserveAddr; virDomainPCIAddressReserveNextAddr; diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 665f6c1445..a10194794a 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1402,6 +1402,24 @@ qemuDomainPCIAddressReserveNextAddr(virDomainPCIAddr= essSetPtr addrs, } =20 =20 +static int +qemuDomainAssignPCIAddressExtension(virDomainDefPtr def ATTRIBUTE_UNUSED, + virDomainDeviceDefPtr device ATTRIBUTE= _UNUSED, + virDomainDeviceInfoPtr info, + void *opaque) +{ + virDomainPCIAddressSetPtr addrs =3D opaque; + virPCIDeviceAddressPtr addr =3D &info->addr.pci; + + if (info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) + addr->extFlags =3D info->pciAddrExtFlags; + + if (virDeviceInfoPCIAddressExtensionIsWanted(info)) + return virDomainPCIAddressExtensionReserveNextAddr(addrs, addr); + + return 0; +} + static int qemuDomainCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, virDomainDeviceDefPtr device, @@ -1495,6 +1513,31 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def ATTR= IBUTE_UNUSED, return ret; } =20 +static int +qemuDomainCollectPCIAddressExtension(virDomainDefPtr def ATTRIBUTE_UNUSED, + virDomainDeviceDefPtr device, + virDomainDeviceInfoPtr info, + void *opaque) +{ + virDomainPCIAddressSetPtr addrs =3D opaque; + virPCIDeviceAddressPtr addr =3D &info->addr.pci; + + if (info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) + addr->extFlags =3D info->pciAddrExtFlags; + + if (!virDeviceInfoPCIAddressExtensionIsPresent(info) || + ((device->type =3D=3D VIR_DOMAIN_DEVICE_HOSTDEV) && + (device->data.hostdev->parent.type !=3D VIR_DOMAIN_DEVICE_NONE)))= { + /* If a hostdev has a parent, its info will be a part of the + * parent, and will have its address collected during the scan + * of the parent's device type. + */ + return 0; + } + + return virDomainPCIAddressExtensionReserveAddr(addrs, addr); +} + static virDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def, virQEMUCapsPtr qemuCaps, @@ -1586,6 +1629,12 @@ qemuDomainPCIAddressSetCreate(virDomainDefPtr def, if (virDomainDeviceInfoIterate(def, qemuDomainCollectPCIAddress, addrs= ) < 0) goto error; =20 + if (virDomainDeviceInfoIterate(def, + qemuDomainCollectPCIAddressExtension, + addrs) < 0) { + goto error; + } + return addrs; =20 error: @@ -2590,6 +2639,9 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, if (qemuDomainAssignDevicePCISlots(def, qemuCaps, addrs) < 0) goto cleanup; =20 + if (virDomainDeviceInfoIterate(def, qemuDomainAssignPCIAddressExte= nsion, addrs) < 0) + goto cleanup; + /* Only for *new* domains with pcie-root (and no other * manually specified PCI controllers in the definition): If, * after assigning addresses/reserving slots for all devices, @@ -2684,6 +2736,9 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, if (qemuDomainAssignDevicePCISlots(def, qemuCaps, addrs) < 0) goto cleanup; =20 + if (virDomainDeviceInfoIterate(def, qemuDomainAssignPCIAddressExte= nsion, addrs) < 0) + goto cleanup; + /* set multi attribute for devices at function 0 of * any slot that has multiple functions in use */ @@ -3143,8 +3198,10 @@ qemuDomainReleaseDeviceAddress(virDomainObjPtr vm, if (!devstr) devstr =3D info->alias; =20 - if (virDeviceInfoPCIAddressIsPresent(info)) + if (virDeviceInfoPCIAddressIsPresent(info)) { virDomainPCIAddressReleaseAddr(priv->pciaddrs, &info->addr.pci); + virDomainPCIAddressExtensionReleaseAddr(priv->pciaddrs, &info->add= r.pci); + } =20 if (virDomainUSBAddressRelease(priv->usbaddrs, info) < 0) VIR_WARN("Unable to release USB address on %s", NULLSTR(devstr)); --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 1539922024918596.0023888902076; Thu, 18 Oct 2018 21:07:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DD46F308FB8A; Fri, 19 Oct 2018 04:07:02 +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 A3CE8194AB; Fri, 19 Oct 2018 04:07:02 +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 47D5E180BAD1; Fri, 19 Oct 2018 04:07:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9J3fGxZ032048 for ; Thu, 18 Oct 2018 23:41:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 18A5260CD6; Fri, 19 Oct 2018 03:41:16 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0E96960C68 for ; Fri, 19 Oct 2018 03:41:16 +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 26D5688304 for ; Fri, 19 Oct 2018 03:41:14 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9J3dQbO070791 for ; Thu, 18 Oct 2018 23:41:13 -0400 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n740xyst5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:41:13 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:41:12 -0600 Received: from b03cxnp08028.gho.boulder.ibm.com (9.17.130.20) by e34.co.us.ibm.com (192.168.1.134) 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 21:41:08 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3f7fE21823550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:41:07 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E8CAD6E050; Fri, 19 Oct 2018 03:41:06 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CFA806E04E; Fri, 19 Oct 2018 03:41:04 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:41:04 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:17 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18101903-0016-0000-0000-000009454A54 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571939; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:41:10 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-0017-0000-0000-000040C280D3 Message-Id: <20181019034020.4757-12-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 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-1810190033 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.28]); Fri, 19 Oct 2018 03:41:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 19 Oct 2018 03:41:14 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 1.298 * (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 11/14] qemu: Generate and use zPCI device in QEMU command line 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 19 Oct 2018 04:07:03 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Add new functions to generate zPCI command string and append it to QEMU command line. And the related tests are added. Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: Stefan Zimmermann Reviewed-by: Bjoern Walk Reviewed-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- src/qemu/qemu_command.c | 104 ++++++++++++++++++ src/qemu/qemu_command.h | 2 + .../disk-virtio-s390-zpci.args | 1 + .../hostdev-vfio-zpci-autogenerate.args | 25 +++++ .../hostdev-vfio-zpci-autogenerate.xml | 18 +++ .../hostdev-vfio-zpci-boundaries.args | 29 +++++ .../hostdev-vfio-zpci-boundaries.xml | 30 +++++ .../hostdev-vfio-zpci-multidomain-many.args | 39 +++++++ .../hostdev-vfio-zpci-multidomain-many.xml | 79 +++++++++++++ tests/qemuxml2argvdata/hostdev-vfio-zpci.args | 2 + tests/qemuxml2argvtest.c | 13 +++ .../hostdev-vfio-zpci-autogenerate.xml | 34 ++++++ .../hostdev-vfio-zpci-boundaries.xml | 48 ++++++++ .../hostdev-vfio-zpci-multidomain-many.xml | 97 ++++++++++++++++ tests/qemuxml2xmltest.c | 11 ++ 15 files changed, 532 insertions(+) create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.a= rgs create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.x= ml create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.args create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.xml create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-ma= ny.args create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-ma= ny.xml create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate= .xml create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-boundaries.x= ml create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-multidomain-= many.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 269276f2f9..817cb6fddb 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -2195,6 +2195,57 @@ qemuBuildDiskDeviceStr(const virDomainDef *def, return NULL; } =20 +char * +qemuBuildZPCIDevStr(virDomainDeviceInfoPtr dev) +{ + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + + virBufferAsprintf(&buf, + "zpci,uid=3D%u,fid=3D%u,target=3D%s,id=3Dzpci%u", + dev->addr.pci.zpci.uid, + dev->addr.pci.zpci.fid, + dev->alias, + dev->addr.pci.zpci.uid); + + if (virBufferCheckError(&buf) < 0) { + virBufferFreeAndReset(&buf); + return NULL; + } + + return virBufferContentAndReset(&buf); +} + +static int +qemuCommandAddZPCIDevice(virCommandPtr cmd, + virDomainDeviceInfoPtr dev) +{ + char *devstr =3D NULL; + + virCommandAddArg(cmd, "-device"); + + if (!(devstr =3D qemuBuildZPCIDevStr(dev))) + return -1; + + virCommandAddArg(cmd, devstr); + + VIR_FREE(devstr); + return 0; +} + +static int +qemuCommandAddExtDevice(virCommandPtr cmd, + virDomainDeviceInfoPtr dev) +{ + if (dev->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI || + dev->addr.pci.extFlags =3D=3D VIR_PCI_ADDRESS_EXTENSION_NONE) { + return 0; + } + + if (dev->addr.pci.extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) + return qemuCommandAddZPCIDevice(cmd, dev); + + return 0; +} =20 static int qemuBuildFloppyCommandLineControllerOptions(virCommandPtr cmd, @@ -2431,6 +2482,9 @@ qemuBuildDiskCommandLine(virCommandPtr cmd, if (!qemuDiskBusNeedsDriveArg(disk->bus)) { if (disk->bus !=3D VIR_DOMAIN_DISK_BUS_FDC || virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (qemuCommandAddExtDevice(cmd, &disk->info) < 0) + return -1; + virCommandAddArg(cmd, "-device"); =20 if (!(optstr =3D qemuBuildDiskDeviceStr(def, disk, bootindex, @@ -2629,6 +2683,9 @@ qemuBuildFSDevCommandLine(virCommandPtr cmd, virCommandAddArg(cmd, optstr); VIR_FREE(optstr); =20 + if (qemuCommandAddExtDevice(cmd, &fs->info) < 0) + return -1; + virCommandAddArg(cmd, "-device"); if (!(optstr =3D qemuBuildFSDevStr(def, fs, qemuCaps))) return -1; @@ -3089,6 +3146,11 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd, goto cleanup; =20 if (devstr) { + if (qemuCommandAddExtDevice(cmd, &cont->info) < 0) { + VIR_FREE(devstr); + goto cleanup; + } + virCommandAddArg(cmd, "-device"); virCommandAddArg(cmd, devstr); VIR_FREE(devstr); @@ -3887,6 +3949,9 @@ qemuBuildWatchdogCommandLine(virCommandPtr cmd, if (!def->watchdog) return 0; =20 + if (qemuCommandAddExtDevice(cmd, &def->watchdog->info) < 0) + return -1; + virCommandAddArg(cmd, "-device"); =20 optstr =3D qemuBuildWatchdogDevStr(def, watchdog, qemuCaps); @@ -3959,6 +4024,9 @@ qemuBuildMemballoonCommandLine(virCommandPtr cmd, if (qemuBuildVirtioOptionsStr(&buf, def->memballoon->virtio, qemuCaps)= < 0) goto error; =20 + if (qemuCommandAddExtDevice(cmd, &def->memballoon->info) < 0) + goto error; + virCommandAddArg(cmd, "-device"); virCommandAddArgBuffer(cmd, &buf); return 0; @@ -4153,6 +4221,9 @@ qemuBuildInputCommandLine(virCommandPtr cmd, virDomainInputDefPtr input =3D def->inputs[i]; char *devstr =3D NULL; =20 + if (qemuCommandAddExtDevice(cmd, &input->info) < 0) + return -1; + if (qemuBuildInputDevStr(&devstr, def, input, qemuCaps) < 0) return -1; =20 @@ -4294,6 +4365,9 @@ qemuBuildSoundCommandLine(virCommandPtr cmd, if (sound->model =3D=3D VIR_DOMAIN_SOUND_MODEL_PCSPK) { virCommandAddArgList(cmd, "-soundhw", "pcspk", NULL); } else { + if (qemuCommandAddExtDevice(cmd, &sound->info) < 0) + return -1; + virCommandAddArg(cmd, "-device"); if (!(str =3D qemuBuildSoundDevStr(def, sound, qemuCaps))) return -1; @@ -4531,6 +4605,10 @@ qemuBuildVideoCommandLine(virCommandPtr cmd, if (video->primary) { if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY)) { =20 + if (qemuCommandAddExtDevice(cmd, + &def->videos[i]->info) < 0) + return -1; + virCommandAddArg(cmd, "-device"); =20 if (!(str =3D qemuBuildDeviceVideoStr(def, video, qemuCaps= ))) @@ -4543,6 +4621,9 @@ qemuBuildVideoCommandLine(virCommandPtr cmd, return -1; } } else { + if (qemuCommandAddExtDevice(cmd, &def->videos[i]->info) < 0) + return -1; + virCommandAddArg(cmd, "-device"); =20 if (!(str =3D qemuBuildDeviceVideoStr(def, video, qemuCaps))) @@ -5378,6 +5459,10 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); } } + + if (qemuCommandAddExtDevice(cmd, hostdev->info) < 0) + return -1; + virCommandAddArg(cmd, "-device"); devstr =3D qemuBuildPCIHostdevDevStr(def, hostdev, bootIndex, configfd_name, qemuCaps); @@ -5824,6 +5909,9 @@ qemuBuildRNGCommandLine(virLogManagerPtr logManager, virCommandAddArgBuffer(cmd, &buf); =20 /* add the device */ + if (qemuCommandAddExtDevice(cmd, &rng->info) < 0) + return -1; + if (!(tmp =3D qemuBuildRNGDevStr(def, rng, qemuCaps))) return -1; virCommandAddArgList(cmd, "-device", tmp, NULL); @@ -8288,6 +8376,9 @@ qemuBuildVhostuserCommandLine(virQEMUDriverPtr driver, virCommandAddArg(cmd, "-netdev"); virCommandAddArg(cmd, netdev); =20 + if (qemuCommandAddExtDevice(cmd, &net->info) < 0) + goto cleanup; + if (!(nic =3D qemuBuildNicDevStr(def, net, bootindex, queues, qemuCaps))) { goto cleanup; @@ -8569,6 +8660,9 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, * New way: -netdev type=3Dtap,id=3Dnetdev1 -device e1000,id=3Dnetde= v1 */ if (qemuDomainSupportsNicdev(def, net)) { + if (qemuCommandAddExtDevice(cmd, &net->info) < 0) + goto cleanup; + if (!(nic =3D qemuBuildNicDevStr(def, net, bootindex, vhostfdSize, qemuCaps))) goto cleanup; @@ -9016,6 +9110,12 @@ qemuBuildShmemCommandLine(virLogManagerPtr logManage= r, =20 if (!devstr) return -1; + + if (qemuCommandAddExtDevice(cmd, &shmem->info) < 0) { + VIR_FREE(devstr); + return -1; + } + virCommandAddArgList(cmd, "-device", devstr, NULL); VIR_FREE(devstr); =20 @@ -10183,6 +10283,10 @@ qemuBuildVsockCommandLine(virCommandPtr cmd, =20 virCommandPassFD(cmd, priv->vhostfd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); priv->vhostfd =3D -1; + + if (qemuCommandAddExtDevice(cmd, &vsock->info) < 0) + goto cleanup; + virCommandAddArgList(cmd, "-device", devstr, NULL); =20 ret =3D 0; diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 98d4ac90b5..d382cd592a 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -174,6 +174,8 @@ char *qemuBuildRedirdevDevStr(const virDomainDef *def, virDomainRedirdevDefPtr dev, virQEMUCapsPtr qemuCaps); =20 +char *qemuBuildZPCIDevStr(virDomainDeviceInfoPtr dev); + int qemuNetworkPrepareDevices(virDomainDefPtr def); =20 int qemuGetDriveSourceString(virStorageSourcePtr src, diff --git a/tests/qemuxml2argvdata/disk-virtio-s390-zpci.args b/tests/qemu= xml2argvdata/disk-virtio-s390-zpci.args index 8ac435cb3e..3daa8316b6 100644 --- a/tests/qemuxml2argvdata/disk-virtio-s390-zpci.args +++ b/tests/qemuxml2argvdata/disk-virtio-s390-zpci.args @@ -20,6 +20,7 @@ server,nowait \ -rtc base=3Dutc \ -no-shutdown \ -drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-vir= tio-disk0 \ +-device zpci,uid=3D25,fid=3D31,target=3Dvirtio-disk0,id=3Dzpci25 \ -device virtio-blk-pci,bus=3Dpci.0,addr=3D0x8,drive=3Ddrive-virtio-disk0,\ id=3Dvirtio-disk0,bootindex=3D1 \ -device virtio-balloon-ccw,id=3Dballoon0,devno=3Dfe.0.0000 diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.args b/t= ests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.args new file mode 100644 index 0000000000..4309cdf2be --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.args @@ -0,0 +1,25 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +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 214 \ +-smp 1,sockets=3D1,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 zpci,uid=3D1,fid=3D0,target=3Dhostdev0,id=3Dzpci1 \ +-device vfio-pci,host=3D00:00.0,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x1 \ +-device zpci,uid=3D2,fid=3D1,target=3Dballoon0,id=3Dzpci2 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x2 diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.xml b/te= sts/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.xml new file mode 100644 index 0000000000..36161006ab --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate.xml @@ -0,0 +1,18 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + + hvm + + + /usr/bin/qemu-system-s390x + + + +
+ +
+ + + diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.args b/tes= ts/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.args new file mode 100644 index 0000000000..01b06837c8 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.args @@ -0,0 +1,29 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +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 214 \ +-smp 1,sockets=3D1,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 zpci,uid=3D3,fid=3D2,target=3Dpci.1,id=3Dzpci3 \ +-device pci-bridge,chassis_nr=3D1,id=3Dpci.1,bus=3Dpci.0,addr=3D0x1 \ +-device zpci,uid=3D65535,fid=3D4294967295,target=3Dhostdev0,id=3Dzpci65535= \ +-device vfio-pci,host=3Dffff:00:00.0,id=3Dhostdev0,bus=3Dpci.1,addr=3D0x1f= \ +-device zpci,uid=3D1,fid=3D0,target=3Dhostdev1,id=3Dzpci1 \ +-device vfio-pci,host=3D00:00.0,id=3Dhostdev1,bus=3Dpci.0,addr=3D0x2 \ +-device zpci,uid=3D2,fid=3D1,target=3Dballoon0,id=3Dzpci2 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.xml b/test= s/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.xml new file mode 100644 index 0000000000..1e6060345b --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-boundaries.xml @@ -0,0 +1,30 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + + hvm + + + /usr/bin/qemu-system-s390x + + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.args= b/tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.args new file mode 100644 index 0000000000..60b6a2e0d2 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.args @@ -0,0 +1,39 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +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 214 \ +-smp 1,sockets=3D1,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 zpci,uid=3D35,fid=3D63,target=3Dhostdev0,id=3Dzpci35 \ +-device vfio-pci,host=3D0001:00:00.0,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x3 \ +-device zpci,uid=3D53,fid=3D104,target=3Dhostdev1,id=3Dzpci53 \ +-device vfio-pci,host=3D0002:00:00.0,id=3Dhostdev1,bus=3Dpci.0,addr=3D0x1 \ +-device zpci,uid=3D1,fid=3D1,target=3Dhostdev2,id=3Dzpci1 \ +-device vfio-pci,host=3D0003:00:00.0,id=3Dhostdev2,bus=3Dpci.0,addr=3D0x2 \ +-device zpci,uid=3D2,fid=3D2,target=3Dhostdev3,id=3Dzpci2 \ +-device vfio-pci,host=3D0004:00:00.0,id=3Dhostdev3,bus=3Dpci.0,addr=3D0x5 \ +-device zpci,uid=3D83,fid=3D0,target=3Dhostdev4,id=3Dzpci83 \ +-device vfio-pci,host=3D0005:00:00.0,id=3Dhostdev4,bus=3Dpci.0,addr=3D0x7 \ +-device zpci,uid=3D3,fid=3D114,target=3Dhostdev5,id=3Dzpci3 \ +-device vfio-pci,host=3D0006:00:00.0,id=3Dhostdev5,bus=3Dpci.0,addr=3D0x9 \ +-device zpci,uid=3D23,fid=3D3,target=3Dhostdev6,id=3Dzpci23 \ +-device vfio-pci,host=3D0007:00:00.0,id=3Dhostdev6,bus=3Dpci.0,addr=3D0x4 \ +-device zpci,uid=3D4,fid=3D40,target=3Dhostdev7,id=3Dzpci4 \ +-device vfio-pci,host=3D0008:00:00.0,id=3Dhostdev7,bus=3Dpci.0,addr=3D0x6 \ +-device zpci,uid=3D5,fid=3D4,target=3Dballoon0,id=3Dzpci5 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x8 diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.xml = b/tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.xml new file mode 100644 index 0000000000..da8305dd6d --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.xml @@ -0,0 +1,79 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + + hvm + + + /usr/bin/qemu-system-s390x + + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + +
+ + + + + +
+ +
+ + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci.args b/tests/qemuxml2= argvdata/hostdev-vfio-zpci.args index d6b1520c47..7ca4257a34 100644 --- a/tests/qemuxml2argvdata/hostdev-vfio-zpci.args +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci.args @@ -19,5 +19,7 @@ server,nowait \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc \ -no-shutdown \ +-device zpci,uid=3D25,fid=3D31,target=3Dhostdev0,id=3Dzpci25 \ -device vfio-pci,host=3D00:00.0,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x8 \ +-device zpci,uid=3D1,fid=3D0,target=3Dballoon0,id=3Dzpci1 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x1 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 09c52f5f38..bf164f5f8d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1688,6 +1688,19 @@ mymain(void) DO_TEST("hostdev-vfio-zpci", QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_DEVICE_ZPCI); + DO_TEST("hostdev-vfio-zpci-multidomain-many", + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_ZPCI); + DO_TEST("hostdev-vfio-zpci-autogenerate", + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_ZPCI); + DO_TEST("hostdev-vfio-zpci-boundaries", + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_ZPCI); + DO_TEST_PARSE_ERROR("hostdev-vfio-zpci", + QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("pci-rom", NONE); DO_TEST("pci-rom-disabled", NONE); DO_TEST("pci-rom-disabled-invalid", NONE); diff --git a/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate.xml b/= tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate.xml new file mode 100644 index 0000000000..e94e63bd0a --- /dev/null +++ b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate.xml @@ -0,0 +1,34 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + + + +
+ +
+ +
+ + +
+ +
+
+ + + diff --git a/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-boundaries.xml b/te= sts/qemuxml2xmloutdata/hostdev-vfio-zpci-boundaries.xml new file mode 100644 index 0000000000..81d2146188 --- /dev/null +++ b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-boundaries.xml @@ -0,0 +1,48 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + + + +
+ + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + +
+ +
+
+ + + diff --git a/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-multidomain-many.xm= l b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-multidomain-many.xml new file mode 100644 index 0000000000..e56106d103 --- /dev/null +++ b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-multidomain-many.xml @@ -0,0 +1,97 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-s390x + + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + +
+ +
+
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 53de9726f4..4d1a3610ef 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -464,6 +464,17 @@ mymain(void) DO_TEST("hostdev-vfio-zpci", QEMU_CAPS_DEVICE_ZPCI, QEMU_CAPS_CCW); + DO_TEST("hostdev-vfio-zpci-multidomain-many", + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_ZPCI); + DO_TEST("hostdev-vfio-zpci-autogenerate", + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_ZPCI); + DO_TEST("hostdev-vfio-zpci-boundaries", + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_PCI_BRIDGE, + QEMU_CAPS_DEVICE_ZPCI); DO_TEST("hostdev-mdev-precreated", NONE); DO_TEST("hostdev-mdev-display", QEMU_CAPS_VFIO_PCI_DISPLAY); DO_TEST("pci-rom", NONE); --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 1539920860554368.2273177335775; Thu, 18 Oct 2018 20:47:40 -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 C4A97A6E1E; Fri, 19 Oct 2018 03:47:38 +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 8F6945C207; Fri, 19 Oct 2018 03:47: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 463104CAAD; Fri, 19 Oct 2018 03:47: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 w9J3fcv1032391 for ; Thu, 18 Oct 2018 23:41:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1411C17799; Fri, 19 Oct 2018 03:41:38 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0B5CB19940 for ; Fri, 19 Oct 2018 03:41:36 +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 F15173084294 for ; Fri, 19 Oct 2018 03:41:34 +0000 (UTC) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9J3esw4115976 for ; Thu, 18 Oct 2018 23:41:34 -0400 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0b-001b2d01.pphosted.com with ESMTP id 2n7489ph40-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:41:15 -0400 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:41:14 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e31.co.us.ibm.com (192.168.1.131) 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 21:41:11 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3fA3V18415642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:41:10 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 77DF46E050; Fri, 19 Oct 2018 03:41:10 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 54FC16E056; Fri, 19 Oct 2018 03:41:08 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:41:08 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:18 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18101903-8235-0000-0000-00000E184AC1 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571939; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:41:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-8236-0000-0000-0000430D7ED3 Message-Id: <20181019034020.4757-13-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 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-1810190033 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.40]); Fri, 19 Oct 2018 03:41:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 19 Oct 2018 03:41:35 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 1.298 * (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, 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.40 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 12/14] qemu: Add hotpluging support for PCI devices on S390 guests 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-Type: text/plain; charset="utf-8" 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.38]); Fri, 19 Oct 2018 03:47:39 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 This commit adds hotplug support for PCI devices on S390 guests. There's no need to implement hot unplug for zPCI as QEMU implements an unplug callback which will unplug both PCI and zPCI device in a cascaded way. Currently, the following PCI devices are supported: virtio-blk-pci virtio-net-pci virtio-rng-pci virtio-input-host-pci virtio-keyboard-pci virtio-mouse-pci virtio-tablet-pci vfio-pci SCSIVhost device Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: Stefan Zimmermann Reviewed-by: Bjoern Walk Reviewed-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- src/qemu/qemu_hotplug.c | 160 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 151 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 0a63741b9e..5f756b7267 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -154,6 +154,80 @@ qemuHotplugPrepareDiskAccess(virQEMUDriverPtr driver, } =20 =20 +static int +qemuDomainAttachZPCIDevice(qemuMonitorPtr mon, + virDomainDeviceInfoPtr info) +{ + char *devstr_zpci =3D NULL; + int ret =3D -1; + + if (!(devstr_zpci =3D qemuBuildZPCIDevStr(info))) + goto cleanup; + + if (qemuMonitorAddDevice(mon, devstr_zpci) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + VIR_FREE(devstr_zpci); + return ret; +} + + +static int +qemuDomainDetachZPCIDevice(qemuMonitorPtr mon, + virDomainDeviceInfoPtr info) +{ + char *zpciAlias =3D NULL; + int ret =3D -1; + + if (virAsprintf(&zpciAlias, "zpci%d", info->addr.pci.zpci.uid) < 0) + goto cleanup; + + if (qemuMonitorDelDevice(mon, zpciAlias) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + VIR_FREE(zpciAlias); + return ret; +} + + +static int +qemuDomainAttachExtensionDevice(qemuMonitorPtr mon, + virDomainDeviceInfoPtr info) +{ + if (info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI || + info->addr.pci.extFlags =3D=3D VIR_PCI_ADDRESS_EXTENSION_NONE) { + return 0; + } + + if (info->addr.pci.extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) + return qemuDomainAttachZPCIDevice(mon, info); + + return 0; +} + + +static int +qemuDomainDetachExtensionDevice(qemuMonitorPtr mon, + virDomainDeviceInfoPtr info) +{ + if (info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI || + info->addr.pci.extFlags =3D=3D VIR_PCI_ADDRESS_EXTENSION_NONE) { + return 0; + } + + if (info->addr.pci.extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) + return qemuDomainDetachZPCIDevice(mon, info); + + return 0; +} + + static int qemuHotplugWaitForTrayEject(virDomainObjPtr vm, virDomainDiskDefPtr disk) @@ -845,8 +919,13 @@ qemuDomainAttachDiskGeneric(virQEMUDriverPtr driver, if (qemuHotplugDiskSourceAttach(priv->mon, diskdata) < 0) goto exit_monitor; =20 - if (qemuMonitorAddDevice(priv->mon, devstr) < 0) + if (qemuDomainAttachExtensionDevice(priv->mon, &disk->info) < 0) + goto exit_monitor; + + if (qemuMonitorAddDevice(priv->mon, devstr) < 0) { + ignore_value(qemuDomainDetachExtensionDevice(priv->mon, &disk->inf= o)); goto exit_monitor; + } =20 if (qemuDomainObjExitMonitor(driver, vm) < 0) { ret =3D -2; @@ -954,7 +1033,16 @@ int qemuDomainAttachControllerDevice(virQEMUDriverPtr= driver, goto cleanup; =20 qemuDomainObjEnterMonitor(driver, vm); - ret =3D qemuMonitorAddDevice(priv->mon, devstr); + + if ((ret =3D qemuDomainAttachExtensionDevice(priv->mon, + &controller->info)) < 0) { + goto exit_monitor; + } + + if ((ret =3D qemuMonitorAddDevice(priv->mon, devstr)) < 0) + ignore_value(qemuDomainDetachExtensionDevice(priv->mon, &controlle= r->info)); + + exit_monitor: if (qemuDomainObjExitMonitor(driver, vm) < 0) { releaseaddr =3D false; ret =3D -1; @@ -1417,6 +1505,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, } =20 if (qemuDomainIsS390CCW(vm->def) && + net->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CCW)) { net->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW; if (!(ccwaddrs =3D virDomainCCWAddressSetCreateFromDomain(vm->def)= )) @@ -1486,7 +1575,15 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, goto try_remove; =20 qemuDomainObjEnterMonitor(driver, vm); + + if (qemuDomainAttachExtensionDevice(priv->mon, &net->info) < 0) { + ignore_value(qemuDomainObjExitMonitor(driver, vm)); + virDomainAuditNet(vm, NULL, net, "attach", false); + goto try_remove; + } + if (qemuMonitorAddDevice(priv->mon, nicstr) < 0) { + ignore_value(qemuDomainDetachExtensionDevice(priv->mon, &net->info= )); ignore_value(qemuDomainObjExitMonitor(driver, vm)); virDomainAuditNet(vm, NULL, net, "attach", false); goto try_remove; @@ -1703,8 +1800,16 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr drive= r, goto error; =20 qemuDomainObjEnterMonitor(driver, vm); - ret =3D qemuMonitorAddDeviceWithFd(priv->mon, devstr, - configfd, configfd_name); + + if ((ret =3D qemuDomainAttachExtensionDevice(priv->mon, hostdev->info)= ) < 0) + goto exit_monitor; + + if ((ret =3D qemuMonitorAddDeviceWithFd(priv->mon, devstr, + configfd, configfd_name)) < 0) { + ignore_value(qemuDomainDetachExtensionDevice(priv->mon, hostdev->i= nfo)); + } + + exit_monitor: if (qemuDomainObjExitMonitor(driver, vm) < 0) goto error; =20 @@ -2360,9 +2465,14 @@ qemuDomainAttachRNGDevice(virQEMUDriverPtr driver, if (qemuMonitorAddObject(priv->mon, &props, &objAlias) < 0) goto exit_monitor; =20 - if (qemuMonitorAddDevice(priv->mon, devstr) < 0) + if (qemuDomainAttachExtensionDevice(priv->mon, &rng->info) < 0) goto exit_monitor; =20 + if (qemuMonitorAddDevice(priv->mon, devstr) < 0) { + ignore_value(qemuDomainDetachExtensionDevice(priv->mon, &rng->info= )); + goto exit_monitor; + } + if (qemuDomainObjExitMonitor(driver, vm) < 0) { releaseaddr =3D false; goto cleanup; @@ -2842,8 +2952,16 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr dri= ver, =20 qemuDomainObjEnterMonitor(driver, vm); =20 - ret =3D qemuMonitorAddDeviceWithFd(priv->mon, devstr, vhostfd, vhostfd= Name); + if ((ret =3D qemuDomainAttachExtensionDevice(priv->mon, hostdev->info)= ) < 0) + goto exit_monitor; + + if ((ret =3D qemuMonitorAddDeviceWithFd(priv->mon, devstr, vhostfd, + vhostfdName)) < 0) { + ignore_value(qemuDomainDetachExtensionDevice(priv->mon, hostdev->i= nfo)); + goto exit_monitor; + } =20 + exit_monitor: if (qemuDomainObjExitMonitor(driver, vm) < 0 || ret < 0) goto audit; =20 @@ -3088,8 +3206,13 @@ qemuDomainAttachShmemDevice(virQEMUDriverPtr driver, =20 release_backing =3D true; =20 - if (qemuMonitorAddDevice(priv->mon, shmstr) < 0) + if (qemuDomainAttachExtensionDevice(priv->mon, &shmem->info) < 0) + goto exit_monitor; + + if (qemuMonitorAddDevice(priv->mon, shmstr) < 0) { + ignore_value(qemuDomainDetachExtensionDevice(priv->mon, &shmem->in= fo)); goto exit_monitor; + } =20 if (qemuDomainObjExitMonitor(driver, vm) < 0) { release_address =3D false; @@ -3262,9 +3385,15 @@ qemuDomainAttachInputDevice(virQEMUDriverPtr driver, goto cleanup; =20 qemuDomainObjEnterMonitor(driver, vm); - if (qemuMonitorAddDevice(priv->mon, devstr) < 0) + + if (qemuDomainAttachExtensionDevice(priv->mon, &input->info) < 0) goto exit_monitor; =20 + if (qemuMonitorAddDevice(priv->mon, devstr) < 0) { + ignore_value(qemuDomainDetachExtensionDevice(priv->mon, &input->in= fo)); + goto exit_monitor; + } + if (qemuDomainObjExitMonitor(driver, vm) < 0) { releaseaddr =3D false; goto cleanup; @@ -3341,8 +3470,14 @@ qemuDomainAttachVsockDevice(virQEMUDriverPtr driver, goto cleanup; =20 qemuDomainObjEnterMonitor(driver, vm); - if (qemuMonitorAddDeviceWithFd(priv->mon, devstr, vsockPriv->vhostfd, = fdname) < 0) + + if (qemuDomainAttachExtensionDevice(priv->mon, &vsock->info) < 0) + goto exit_monitor; + + if (qemuMonitorAddDeviceWithFd(priv->mon, devstr, vsockPriv->vhostfd, = fdname) < 0) { + ignore_value(qemuDomainDetachExtensionDevice(priv->mon, &vsock->in= fo)); goto exit_monitor; + } =20 if (qemuDomainObjExitMonitor(driver, vm) < 0) { releaseaddr =3D false; @@ -5328,10 +5463,17 @@ int qemuDomainDetachControllerDevice(virQEMUDriverP= tr driver, qemuDomainMarkDeviceForRemoval(vm, &detach->info); =20 qemuDomainObjEnterMonitor(driver, vm); + if (detach->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI && + qemuDomainDetachExtensionDevice(priv->mon, &detach->info)) { + goto exit_monitor; + } + if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) { ignore_value(qemuDomainObjExitMonitor(driver, vm)); goto cleanup; } + + exit_monitor: if (qemuDomainObjExitMonitor(driver, vm) < 0) goto cleanup; =20 --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 1539922036310225.23702462706046; Thu, 18 Oct 2018 21:07:16 -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 2727C83F93; Fri, 19 Oct 2018 04:07:14 +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 DD1B952FA0; Fri, 19 Oct 2018 04:07:13 +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 871DB180B5B7; Fri, 19 Oct 2018 04:07:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9J3fLhZ032060 for ; Thu, 18 Oct 2018 23:41:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 68727105705F; Fri, 19 Oct 2018 03:41:21 +0000 (UTC) Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5CC88105705D for ; Fri, 19 Oct 2018 03:41:21 +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 67C7830F5589 for ; Fri, 19 Oct 2018 03:41:20 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9J3dsXV187787 for ; Thu, 18 Oct 2018 23:41:19 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0b-001b2d01.pphosted.com with ESMTP id 2n73y2qm7k-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:41:19 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:41:19 -0600 Received: from b03cxnp08028.gho.boulder.ibm.com (9.17.130.20) by e35.co.us.ibm.com (192.168.1.135) 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 21:41:15 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3fEfh21299228 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:41:14 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1FF966E04E; Fri, 19 Oct 2018 03:41:14 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E222F6E056; Fri, 19 Oct 2018 03:41:11 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:41:11 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:19 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18101903-0012-0000-0000-000016CB2142 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571939; IPR=6.00884797; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:41:17 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-0013-0000-0000-000054CEEE42 Message-Id: <20181019034020.4757-14-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , 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-1810190033 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.45]); Fri, 19 Oct 2018 03:41:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 19 Oct 2018 03:41:20 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 1.298 * (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, 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.45 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 13/14] docs: Add 'uid' and 'fid' information 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-Type: text/plain; charset="utf-8" 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.29]); Fri, 19 Oct 2018 04:07:15 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Update 'Device address' section to describe 'zpci' element and its two attributes 'uid' and 'fid'. Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: Stefan Zimmermann Reviewed-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- docs/formatdomain.html.in | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 8189959773..9ca4975d10 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3925,7 +3925,15 @@ (since 0.9.7, requires QEMU 0.13). multifunction defaults to 'off', but should be set to 'on' for function 0 of a slot that will - have multiple functions used.
+ have multiple functions used. + (Since 4.9.0), PCI address extensions + depending on the architecture are supported. For example, PCI + addresses for S390 guests will have a zpci child + element, with two attributes: uid (a hex value + between 0x0001 and 0xffff, inclusive), and fid (a + hex value between 0x00000000 and 0xffffffff, inclusive) used by + PCI devices on S390 for User-defined Identifiers and Function + Identifiers.
Since 1.3.5, some hypervisor drivers may accept an <address type=3D'pci'/> element with no other attributes as an explicit request to --=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Tue Apr 23 11:34:48 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 1539922047245274.46450166118586; Thu, 18 Oct 2018 21:07:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2218EC050004; Fri, 19 Oct 2018 04:07:25 +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 DE6F9105705F; Fri, 19 Oct 2018 04:07:24 +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 95EB3180B5B7; Fri, 19 Oct 2018 04:07:24 +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 w9J3fS0F032377 for ; Thu, 18 Oct 2018 23:41:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2C8827A1B5; Fri, 19 Oct 2018 03:41:28 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2132F6B63C for ; Fri, 19 Oct 2018 03:41:25 +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 835A383F45 for ; Fri, 19 Oct 2018 03:41:24 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w9J3dO56073256 for ; Thu, 18 Oct 2018 23:41:24 -0400 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0a-001b2d01.pphosted.com with ESMTP id 2n76xuh784-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Oct 2018 23:41:23 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 18 Oct 2018 21:41:23 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (9.17.130.17) by e32.co.us.ibm.com (192.168.1.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 21:41:19 -0600 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w9J3fHX416973842 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 Oct 2018 20:41:17 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9573A6E056; Fri, 19 Oct 2018 03:41:17 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7A7736E054; Fri, 19 Oct 2018 03:41:15 +0000 (GMT) Received: from zyimindembp.cn.ibm.com (unknown [9.115.192.238]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Fri, 19 Oct 2018 03:41:15 +0000 (GMT) From: Yi Min Zhao To: libvir-list@redhat.com Date: Fri, 19 Oct 2018 11:40:20 +0800 In-Reply-To: <20181019034020.4757-1-zyimin@linux.ibm.com> References: <20181019034020.4757-1-zyimin@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 18101903-0004-0000-0000-000014A11635 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009898; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000268; SDB=6.01104747; UDB=6.00571940; IPR=6.00884798; MB=3.00023816; MTD=3.00000008; XFM=3.00000015; UTC=2018-10-19 03:41:21 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18101903-0005-0000-0000-0000893576E3 Message-Id: <20181019034020.4757-15-zyimin@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-10-18_11:, , 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-1810190033 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.27]); Fri, 19 Oct 2018 03:41:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 19 Oct 2018 03:41:24 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'zyimin@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.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: fiuczy@linux.ibm.com, cohuck@redhat.com, abologna@redhat.com, bwalk@linux.ibm.com, jtomko@redhat.com, laine@laine.org Subject: [libvirt] [PATCH v7 14/14] news: Update news for PCI address extension attributes 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 19 Oct 2018 04:07:26 +0000 (UTC) X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Signed-off-by: Yi Min Zhao Reviewed-by: Boris Fiuczynski Reviewed-by: Stefan Zimmermann Reviewed-by: J=C3=A1n Tomko Reviewed-by: Andrea Bolognani --- docs/news.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index dc08c96352..6c2e0f27f1 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -35,6 +35,17 @@
+ + + qemu: Added support for PCI device on S390 + + + PCI addresses can now include the new zpci element which contains + uid (user-defined identifier) and fid (PCI function identifier) + attributes and makes the corresponding devices usable by S390 + guests. + +
--=20 Yi Min -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list