From nobody Sun Feb 8 12:38:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1586429692; cv=none; d=zohomail.com; s=zohoarc; b=YvmpkKHZBs8J3mREnfui1y/3G4BGlKZ7SbXxmEJNS3ATHZ5kuDvuMs7EFEHOYDWpMyq/cGDk7T/o+9MudhAIelZLUuQr0MdyLAr7xrBAJCS4AapjyVKvLfGGBJSp1bWnvnv32P9dX9UxSYj5H2tWGT7Iml2g498QrzgmkyPrL5s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586429692; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N0QIG7YSYNR7Huc1w8c4kYS7/+WavX3TjX6OdNBOjEY=; b=RDKImo8Du/VvmRAZA5+yHHJ+LI65ioxqSCa4/DZPGRbo4CCXZI9z1U2u0NFCtQh1uFnwS/WrkocHHI5SkySkcQJ0dUeCkQDxYbdyYCJELhSlFIpiyzG7njHTPBOByDGxVA+RrHIYOJKHsI03GNrfpXipmLC5MBEjjcHcdzGDVvA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1586429692917483.3172410038744; Thu, 9 Apr 2020 03:54:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-159-2c9i6Z4FNHmyKd-ZALfXWA-1; Thu, 09 Apr 2020 06:54:49 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 57EE08018A7; Thu, 9 Apr 2020 10:54:44 +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 D5852C0D8D; Thu, 9 Apr 2020 10:54:43 +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 559131803C42; Thu, 9 Apr 2020 10:54:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 039AVRuU017124 for ; Thu, 9 Apr 2020 06:31:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id BD202117C19; Thu, 9 Apr 2020 10:31:27 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8F4A117C1A for ; Thu, 9 Apr 2020 10:31:25 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 114961019E0F for ; Thu, 9 Apr 2020 10:31:25 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-373-hUrN-FNHOo6uzgnL8pfTEQ-1; Thu, 09 Apr 2020 06:31:22 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 039AUvTu063776 for ; Thu, 9 Apr 2020 06:31:22 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 30920x9seb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 09 Apr 2020 06:31:21 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Apr 2020 11:31:06 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 9 Apr 2020 11:31:04 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 039AVGIM56295600 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Apr 2020 10:31:16 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EE707A4082; Thu, 9 Apr 2020 10:31:15 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CCFC0A406D; Thu, 9 Apr 2020 10:31:15 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 9 Apr 2020 10:31:15 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586429691; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=N0QIG7YSYNR7Huc1w8c4kYS7/+WavX3TjX6OdNBOjEY=; b=SjqYU5unHSwjrUEWTU0N3ITM8Q2encJLGv0cNy8ywYOSM58/yApf8FlCleQrYaSwz0k8PP T2853Bc8Mco2wAjLFBbzlqW7i5FKoFi9khfwPYsmcaT2V7yNQbeQjWTEoEXyqAqbKDtgb+ GEMFpzibDiMdEAijcODC5gYz+xFQpUo= X-MC-Unique: 2c9i6Z4FNHmyKd-ZALfXWA-1 X-MC-Unique: hUrN-FNHOo6uzgnL8pfTEQ-1 From: Shalini Chellathurai Saroja To: libvir-list@redhat.com Subject: [PATCH libvirt v1 1/6] conf: fix ZPCI address validation on s390 Date: Thu, 9 Apr 2020 12:31:00 +0200 In-Reply-To: <20200409103105.45606-1-shalini@linux.ibm.com> References: <20200409103105.45606-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20040910-0012-0000-0000-000003A14C50 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040910-0013-0000-0000-000021DE75AE Message-Id: <20200409103105.45606-2-shalini@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-09_03:2020-04-07, 2020-04-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 adultscore=0 impostorscore=0 spamscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 clxscore=1015 suspectscore=3 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004090076 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 039AVRuU017124 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Thu, 09 Apr 2020 06:54:38 -0400 Cc: Shalini Chellathurai Saroja 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Currently, there are two issues with handling the ZPCI address extension. Firstly, when the uid is to be auto-generated with a specified fid, .i.e.: ...
... we expect uid=3D'0x0001' (or the next available uid for the domain). However, we get a parsing error: $ virsh define zpci.xml error: XML error: Invalid PCI address uid=3D'0x0000', must be > 0x0000 and <=3D 0xffff Secondly, when the uid is specified explicitly with the invalid numerical value '0x0000', we actually expect the parsing error above. However, the domain is being defined and the uid value is silently changed to a valid value. The first issue is a bug and the second one is undesired behaviour, and both issues are related to how we (in-band) signal invalid values for uid and fid. So let's fix the XML parsing to do validation based on what is actually specified in the XML and in later code assume that invalid numerical values mean that they have been unspecified. Signed-off-by: Bjoern Walk Signed-off-by: Boris Fiuczynski Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- src/conf/device_conf.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 4dbd5c1a..001ed929 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -53,38 +53,34 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node, virPCIDeviceAddressPtr addr) { virZPCIDeviceAddress def =3D { 0 }; - char *uid; - char *fid; - int ret =3D -1; + g_autofree char *uid =3D NULL; + g_autofree char *fid =3D NULL; =20 uid =3D virXMLPropString(node, "uid"); fid =3D virXMLPropString(node, "fid"); =20 - if (uid && - virStrToLong_uip(uid, NULL, 0, &def.uid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'uid' attribute")); - goto cleanup; + if (uid) { + if (virStrToLong_uip(uid, NULL, 0, &def.uid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse
'uid' attribute")); + return -1; + } + if (!virZPCIDeviceAddressIsValid(&def)) + return -1; } =20 - if (fid && - virStrToLong_uip(fid, NULL, 0, &def.fid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'fid' attribute")); - goto cleanup; + if (fid) { + if (virStrToLong_uip(fid, NULL, 0, &def.fid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse
'fid' attribute")); + return -1; + } } =20 - if (!virZPCIDeviceAddressIsEmpty(&def) && - !virZPCIDeviceAddressIsValid(&def)) - goto cleanup; =20 addr->zpci =3D def; - ret =3D 0; =20 - cleanup: - VIR_FREE(uid); - VIR_FREE(fid); - return ret; + return 0; } =20 void --=20 2.21.1 From nobody Sun Feb 8 12:38:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1586429697; cv=none; d=zohomail.com; s=zohoarc; b=eqeaWo78GlM1TVfpNhDO8szxBDYarObmiF421FbM9HQ7Zi70FC3OKVj1WBQjK4FjS3X6eycpHxJQAGUglxchHgepibd0l/JLEwgHglARoyEKwlYsq6XguF/ogeiZSmjmWvTMy04GUAQGsJMhcukwToBGoEYs2jDq26I/jvF1XKg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586429697; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wGWflSEkY7eTwstDLSIE8Kd6rG7mcErOgjQj6G0209U=; b=ElVlXkzpSbL5QguViAyH+WCdu8iKkoK37SOZMbDjVV+1jEVWJAAK5TNtXV/Eh0sNPVwZwi81lKA+qdThBdkYr027LIKf09m/T0Z/ZpCOGBDKCQ0V59TplLS5bgErM+++OkhX5+aiuL09un2ku3JHyN/hGH/6FsBJQWh80tFn6tA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586429697359140.44528055630883; Thu, 9 Apr 2020 03:54:57 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-61-Q8qVF4eePcGa8YgL9ubToQ-1; Thu, 09 Apr 2020 06:54:54 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 302A2107B274; Thu, 9 Apr 2020 10:54:48 +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 071CE5C296; Thu, 9 Apr 2020 10:54: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 B247418037CD; Thu, 9 Apr 2020 10:54:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 039AVVki017142 for ; Thu, 9 Apr 2020 06:31:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id C00EA202A940; Thu, 9 Apr 2020 10:31:31 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC4E32024517 for ; Thu, 9 Apr 2020 10:31:27 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 613C38F7A2E for ; Thu, 9 Apr 2020 10:31:27 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-379-oRLKxNwNPpmVhzVdLjGXpw-1; Thu, 09 Apr 2020 06:31:25 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 039A3OT9106372 for ; Thu, 9 Apr 2020 06:31:24 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 309209tq92-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 09 Apr 2020 06:31:23 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Apr 2020 11:31:08 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 9 Apr 2020 11:31:06 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 039AVIWl60424412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Apr 2020 10:31:18 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0D7AFA4088; Thu, 9 Apr 2020 10:31:18 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EA8B4A4082; Thu, 9 Apr 2020 10:31:17 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 9 Apr 2020 10:31:17 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586429696; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wGWflSEkY7eTwstDLSIE8Kd6rG7mcErOgjQj6G0209U=; b=NS9gVfP/gb/FNHdxvWal1Ofx0MjBcr/0+GQ7axOqyq6xByBbcCu9/RRWC8OF+j0ifTVbd6 DcEwuTLpNwRRCu8iiwyvJ2gniUETH0iF2tRPu5D7mCDTBpUs2J7/Nd0hUOn+/+SAmMhl9G 8XR3Mp3Qz9enqR2broKD6n/eFZCy854= X-MC-Unique: Q8qVF4eePcGa8YgL9ubToQ-1 X-MC-Unique: oRLKxNwNPpmVhzVdLjGXpw-1 From: Shalini Chellathurai Saroja To: libvir-list@redhat.com Subject: [PATCH libvirt v1 2/6] tests: qemu: add tests for ZPCI on s390 Date: Thu, 9 Apr 2020 12:31:01 +0200 In-Reply-To: <20200409103105.45606-1-shalini@linux.ibm.com> References: <20200409103105.45606-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20040910-0012-0000-0000-000003A14C51 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040910-0013-0000-0000-000021DE75AF Message-Id: <20200409103105.45606-3-shalini@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-09_03:2020-04-07, 2020-04-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 mlxlogscore=853 lowpriorityscore=0 mlxscore=0 suspectscore=1 clxscore=1015 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004090075 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 039AVVki017142 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Thu, 09 Apr 2020 06:54:38 -0400 Cc: Shalini Chellathurai Saroja 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add test to verify ZPCI address validation with uid set to 0x0 Signed-off-by: Bjoern Walk Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- .../hostdev-vfio-zpci-uid-set-zero.xml | 20 +++++++++++++++++++ tests/qemuxml2argvtest.c | 3 +++ 2 files changed, 23 insertions(+) create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-uid-set-zero.x= ml diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-uid-set-zero.xml b/te= sts/qemuxml2argvdata/hostdev-vfio-zpci-uid-set-zero.xml new file mode 100644 index 00000000..6bfbfe61 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-uid-set-zero.xml @@ -0,0 +1,20 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + + hvm + + + /usr/bin/qemu-system-s390x + + + +
+ +
+ +
+ + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 405227fd..dd467cb3 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1650,6 +1650,9 @@ mymain(void) DO_TEST("hostdev-vfio-zpci-autogenerate", QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_DEVICE_ZPCI); + DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-uid-set-zero", + 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, --=20 2.21.1 From nobody Sun Feb 8 12:38:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1586429692; cv=none; d=zohomail.com; s=zohoarc; b=coPovLebAuw8jxpHliHnqNT/9UtQUjPsNOnP1ixnQIMCHiCdrpE5wQYmHAP6SGdueD3BjpSNqp+2XgspGRENuuHrHAmPDLdQ+zP2EZDKQbHhOo0ryE/H8WEO5OKQwK9Dkl9VLx+V8spGcyeAA0QTRRaSdXqlrvHriGSGh6SIZac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586429692; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=H7I+u9x4O0jV3Qt/FSHM5tW02LqwUCfee4XLFD26fy8=; b=kUAvuSmrPrcDrrJrjGcmqTGHUfk9AYSVH/btj+ynJJFq7NwV/+izhVUl2/3sTyMIeDCT8+KdjxJV6cYspOGG/8aB14qz2Qehtns3Ok+6EhTZOOLpH0vpDauviXTo+PHly5RRL+UkHp7e/jkRkoGipIE0G4roPUDAEFPz4sLmm64= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586429692878378.32471358606074; Thu, 9 Apr 2020 03:54:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-_x7LXe6dMG6DBkj_5UfWbQ-1; Thu, 09 Apr 2020 06:54:50 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id A05928010EB; Thu, 9 Apr 2020 10:54:44 +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 73E9910027B3; Thu, 9 Apr 2020 10:54:44 +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 2749A1803C43; Thu, 9 Apr 2020 10:54:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 039AVVw3017138 for ; Thu, 9 Apr 2020 06:31:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 87EF11005E2C; Thu, 9 Apr 2020 10:31:31 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 835DA10054EE for ; Thu, 9 Apr 2020 10:31:31 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6592A800297 for ; Thu, 9 Apr 2020 10:31:31 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-233-FI2x6u5nMcSP7s0ZEpcMog-1; Thu, 09 Apr 2020 06:31:28 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 039A3MWf178867 for ; Thu, 9 Apr 2020 06:31:27 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 309206afdf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 09 Apr 2020 06:31:27 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Apr 2020 11:30:59 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 9 Apr 2020 11:30:56 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 039AVL1P53215302 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Apr 2020 10:31:21 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D6BC4A40AC; Thu, 9 Apr 2020 10:31:19 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B807EA4060; Thu, 9 Apr 2020 10:31:19 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 9 Apr 2020 10:31:19 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586429691; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=H7I+u9x4O0jV3Qt/FSHM5tW02LqwUCfee4XLFD26fy8=; b=LxwzrwtK6lg8+UINN7BojqBRxKs4xOrdHDwJJH8hPqk6DcW77VGtjVHOfh+Od7f+5N7Jy8 LDfgsEwbKCATOc5YcGQbQbhILljW7X+qsVYop2u/q5hS509sr3mRklRAIqT89dAHw4ML1M 9i84pSyC8a0acslxpthS+9wbDNVGwE8= X-MC-Unique: _x7LXe6dMG6DBkj_5UfWbQ-1 X-MC-Unique: FI2x6u5nMcSP7s0ZEpcMog-1 From: Shalini Chellathurai Saroja To: libvir-list@redhat.com Subject: [PATCH libvirt v1 3/6] conf: fix ZPCI address auto-generation on s390 Date: Thu, 9 Apr 2020 12:31:02 +0200 In-Reply-To: <20200409103105.45606-1-shalini@linux.ibm.com> References: <20200409103105.45606-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20040910-4275-0000-0000-000003BCA383 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040910-4276-0000-0000-000038D20B6F Message-Id: <20200409103105.45606-4-shalini@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-09_03:2020-04-07, 2020-04-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 phishscore=0 spamscore=0 suspectscore=1 mlxscore=0 adultscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004090075 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 039AVVw3017138 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Thu, 09 Apr 2020 06:54:38 -0400 Cc: Shalini Chellathurai Saroja 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Currently, if uid/fid is specified as zero by the user, it is treated as if the value is not specified. This bug is fixed by introducing two boolean values to identify if uid and fid are specified by the user. Also, if either uid or fid is specified by the user, it is incorrectly assumed that both uid and fid are specified. This bug is fixed by identifying when the user specified ZPCI address is incomplete and auto-generating the missing ZPCI address. Signed-off-by: Boris Fiuczynski Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- src/conf/device_conf.c | 12 ++-- src/conf/domain_addr.c | 59 +++++++++++++------ src/conf/domain_conf.c | 2 +- src/libvirt_private.syms | 3 +- src/qemu/qemu_validate.c | 2 +- src/util/virpci.c | 17 ++++-- src/util/virpci.h | 5 +- .../hostdev-vfio-zpci-multidomain-many.args | 6 +- .../hostdev-vfio-zpci-multidomain-many.xml | 6 +- 9 files changed, 75 insertions(+), 37 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 001ed929..c03356e7 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -65,8 +65,7 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node, _("Cannot parse
'uid' attribute")); return -1; } - if (!virZPCIDeviceAddressIsValid(&def)) - return -1; + def.uid_set =3D true; } =20 if (fid) { @@ -75,8 +74,11 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node, _("Cannot parse
'fid' attribute")); return -1; } + def.fid_set =3D true; } =20 + if (!virZPCIDeviceAddressIsValid(&def)) + return -1; =20 addr->zpci =3D def; =20 @@ -191,22 +193,20 @@ virDeviceInfoPCIAddressIsPresent(const virDomainDevic= eInfo *info) !virPCIDeviceAddressIsEmpty(&info->addr.pci); } =20 - bool virDeviceInfoPCIAddressExtensionIsWanted(const virDomainDeviceInfo *info) { return (info->addr.pci.extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) && - virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci); + virZPCIDeviceAddressIsIncomplete(&info->addr.pci.zpci); } =20 bool virDeviceInfoPCIAddressExtensionIsPresent(const virDomainDeviceInfo *info) { return (info->addr.pci.extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) && - !virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci); + virZPCIDeviceAddressIsPresent(&info->addr.pci.zpci); } =20 - int virPCIDeviceAddressParseXML(xmlNodePtr node, virPCIDeviceAddressPtr addr) diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index e8629b3e..d1cd0804 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -145,12 +145,18 @@ static void virDomainZPCIAddressReleaseIds(virDomainZPCIAddressIdsPtr zpciIds, virZPCIDeviceAddressPtr addr) { - if (!zpciIds || virZPCIDeviceAddressIsEmpty(addr)) + if (!zpciIds) return; =20 - virDomainZPCIAddressReleaseUid(zpciIds->uids, addr); + if (addr->uid_set) { + virDomainZPCIAddressReleaseUid(zpciIds->uids, addr); + addr->uid_set =3D false; + } =20 - virDomainZPCIAddressReleaseFid(zpciIds->fids, addr); + if (addr->fid_set) { + virDomainZPCIAddressReleaseFid(zpciIds->fids, addr); + addr->fid_set =3D false; + } } =20 =20 @@ -186,12 +192,16 @@ static int virDomainZPCIAddressReserveAddr(virDomainZPCIAddressIdsPtr zpciIds, virZPCIDeviceAddressPtr addr) { - if (virDomainZPCIAddressReserveUid(zpciIds->uids, addr) < 0) + if (addr->uid_set && + virDomainZPCIAddressReserveUid(zpciIds->uids, addr) < 0) return -1; =20 - if (virDomainZPCIAddressReserveFid(zpciIds->fids, addr) < 0) { - virDomainZPCIAddressReleaseUid(zpciIds->uids, addr); - return -1; + if (addr->fid_set) { + if (virDomainZPCIAddressReserveFid(zpciIds->fids, addr) < 0) { + if (addr->uid_set) + virDomainZPCIAddressReleaseUid(zpciIds->uids, addr); + return -1; + } } =20 return 0; @@ -202,14 +212,28 @@ static int virDomainZPCIAddressReserveNextAddr(virDomainZPCIAddressIdsPtr zpciIds, virZPCIDeviceAddressPtr addr) { - if (virDomainZPCIAddressReserveNextUid(zpciIds->uids, addr) < 0) - return -1; + bool uid_set, fid_set =3D false; =20 - if (virDomainZPCIAddressReserveNextFid(zpciIds->fids, addr) < 0) { - virDomainZPCIAddressReleaseUid(zpciIds->uids, addr); - return -1; + if (!addr->uid_set) { + if (virDomainZPCIAddressReserveNextUid(zpciIds->uids, addr) < 0) + return -1; + uid_set =3D true; + } + + if (!addr->fid_set) { + if (virDomainZPCIAddressReserveNextFid(zpciIds->fids, addr) < 0) { + if (uid_set) + virDomainZPCIAddressReleaseUid(zpciIds->uids, addr); + return -1; + } + fid_set =3D true; } =20 + if (uid_set) + addr->uid_set =3D true; + if (fid_set) + addr->fid_set =3D true; + return 0; } =20 @@ -234,7 +258,7 @@ virDomainPCIAddressExtensionReserveNextAddr(virDomainPC= IAddressSetPtr addrs, virPCIDeviceAddressPtr addr) { if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) { - virZPCIDeviceAddress zpci =3D { 0 }; + virZPCIDeviceAddress zpci =3D addr->zpci; =20 if (virDomainZPCIAddressReserveNextAddr(addrs->zpciIds, &zpci) < 0) return -1; @@ -246,6 +270,7 @@ virDomainPCIAddressExtensionReserveNextAddr(virDomainPC= IAddressSetPtr addrs, return 0; } =20 + static int virDomainPCIAddressExtensionEnsureAddr(virDomainPCIAddressSetPtr addrs, virPCIDeviceAddressPtr addr) @@ -253,10 +278,10 @@ virDomainPCIAddressExtensionEnsureAddr(virDomainPCIAd= dressSetPtr addrs, if (addr->extFlags & VIR_PCI_ADDRESS_EXTENSION_ZPCI) { virZPCIDeviceAddressPtr zpci =3D &addr->zpci; =20 - if (virZPCIDeviceAddressIsEmpty(zpci)) - return virDomainZPCIAddressReserveNextAddr(addrs->zpciIds, zpc= i); - else - return virDomainZPCIAddressReserveAddr(addrs->zpciIds, zpci); + if (virDomainZPCIAddressReserveAddr(addrs->zpciIds, zpci) < 0) + return -1; + + return virDomainZPCIAddressReserveNextAddr(addrs->zpciIds, zpci); } =20 return 0; diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c478d795..5df80cae 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7471,7 +7471,7 @@ virDomainDeviceInfoFormat(virBufferPtr buf, virTristateSwitchTypeToString(info->addr.pci= .multi)); } =20 - if (!virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci)) { + if (!virZPCIDeviceAddressIsIncomplete(&info->addr.pci.zpci)) { virBufferAsprintf(&childBuf, "\n", info->addr.pci.zpci.uid, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ec367653..18687563 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2821,7 +2821,8 @@ virPCIHeaderTypeToString; virPCIIsVirtualFunction; virPCIStubDriverTypeFromString; virPCIStubDriverTypeToString; -virZPCIDeviceAddressIsEmpty; +virZPCIDeviceAddressIsIncomplete; +virZPCIDeviceAddressIsPresent; virZPCIDeviceAddressIsValid; =20 =20 diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 149b9e73..22fdfd11 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -952,7 +952,7 @@ static int qemuValidateDomainDeviceDefZPCIAddress(virDomainDeviceInfoPtr info, virQEMUCapsPtr qemuCaps) { - if (!virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci) && + if (virZPCIDeviceAddressIsPresent(&info->addr.pci.zpci) && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ZPCI)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", diff --git a/src/util/virpci.c b/src/util/virpci.c index 6c7e6bbc..b38f717c 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2172,8 +2172,9 @@ virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr z= pci) /* 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) { + if (zpci->uid_set && + (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"), @@ -2186,11 +2187,19 @@ virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr= zpci) } =20 bool -virZPCIDeviceAddressIsEmpty(const virZPCIDeviceAddress *addr) +virZPCIDeviceAddressIsIncomplete(const virZPCIDeviceAddress *addr) { - return !(addr->uid || addr->fid); + return !addr->uid_set || !addr->fid_set; } =20 + +bool +virZPCIDeviceAddressIsPresent(const virZPCIDeviceAddress *addr) +{ + return addr->uid_set || addr->fid_set; +} + + #ifdef __linux__ =20 virPCIDeviceAddressPtr diff --git a/src/util/virpci.h b/src/util/virpci.h index f16d2361..e937348f 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -43,6 +43,8 @@ typedef virZPCIDeviceAddress *virZPCIDeviceAddressPtr; struct _virZPCIDeviceAddress { unsigned int uid; /* exempt from syntax-check */ unsigned int fid; + bool uid_set; + bool fid_set; /* Don't forget to update virPCIDeviceAddressCopy if needed. */ }; =20 @@ -245,8 +247,9 @@ char *virPCIDeviceAddressAsString(const virPCIDeviceAdd= ress *addr) =20 int virPCIDeviceAddressParse(char *address, virPCIDeviceAddressPtr bdf); =20 +bool virZPCIDeviceAddressIsIncomplete(const virZPCIDeviceAddress *addr); +bool virZPCIDeviceAddressIsPresent(const virZPCIDeviceAddress *addr); bool virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr zpci); -bool virZPCIDeviceAddressIsEmpty(const virZPCIDeviceAddress *addr); =20 int virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path, int pfNetDevIdx, diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.args= b/tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.args index 3dd9a25f..0fae78db 100644 --- a/tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.args +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-multidomain-many.args @@ -27,11 +27,11 @@ server,nowait \ -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 zpci,uid=3D1,fid=3D0,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 zpci,uid=3D2,fid=3D1,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 zpci,uid=3D83,fid=3D2,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 \ diff --git a/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-multidomain-many.xm= l b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-multidomain-many.xml index e56106d1..ecfc15c4 100644 --- a/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-multidomain-many.xml +++ b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-multidomain-many.xml @@ -39,7 +39,7 @@
- +
@@ -48,7 +48,7 @@
- +
@@ -57,7 +57,7 @@
- +
--=20 2.21.1 From nobody Sun Feb 8 12:38:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1586429689; cv=none; d=zohomail.com; s=zohoarc; b=R1y7zslnreg/yb1sp3gc5IGNe9MmSer/pAYX/5hkaTNFD9IkltNrB+NkCfhkKfCCakp+9K8p27Z8ZcbQdfGDvr+BKv+NEyVvI6yxUXyi/zep7KF/qhz1shjFtqOEEiXSvxI2IjRwbJO7YVbyDhfqZPAs+KBtt6D41oPq0JNleL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586429689; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VloNXe3UX7JdcME8dzf801AEFa/SpKdAezOFYhU9QqA=; b=defRXFwQ3U+By+l+1Vmubdf+v+ILOQkk4s4bMrrXXjryZeGaUB8cYhEzizfqJtNuqhdA8pTXyN1gBi8KoBm2NLVk7d/etckwcEGXcHgtpL2vf3RD1w6XgiGXAW4ueeydwmQP0Afsd5N3qXIBEWZbgKrX5uXtMLG3tiDsSz2FpsY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1586429689803730.1756351457673; Thu, 9 Apr 2020 03:54:49 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-324-TYAU3OrYPKy-oT3-s95pNw-1; Thu, 09 Apr 2020 06:54:46 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B41818017F3; Thu, 9 Apr 2020 10:54:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 64E0ECDBF5; Thu, 9 Apr 2020 10:54:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 19F9F9306D; Thu, 9 Apr 2020 10:54:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 039AVVT3017131 for ; Thu, 9 Apr 2020 06:31:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 159D810054EE; Thu, 9 Apr 2020 10:31:31 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 117E91005E2C for ; Thu, 9 Apr 2020 10:31:31 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED2BB185A791 for ; Thu, 9 Apr 2020 10:31:30 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36-qza7hnJrOm2RU95r6TAugQ-1; Thu, 09 Apr 2020 06:31:26 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 039A3dQt080715 for ; Thu, 9 Apr 2020 06:31:26 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 30921hk0mv-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 09 Apr 2020 06:31:26 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Apr 2020 11:30:57 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 9 Apr 2020 11:30:55 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 039AUGbq33948078 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Apr 2020 10:30:16 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DBCEA4088; Thu, 9 Apr 2020 10:31:21 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15DF1A409F; Thu, 9 Apr 2020 10:31:21 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 9 Apr 2020 10:31:21 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586429688; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VloNXe3UX7JdcME8dzf801AEFa/SpKdAezOFYhU9QqA=; b=Swa201zNblE6SzOr9nMudIoba7W/ku5su3VYM7NDXJ6CASbZZGFGeRgEF6rqEa7C5YCrIJ De+8k3CAqqyZxM5HrMfRKLxz5IZatd7yVvuELhf2LarLCpE2H6Afo+oM+Rjw1a7iEgTfSC zWdCoUNpV+L4dIxahzkIvJJPeB30whY= X-MC-Unique: TYAU3OrYPKy-oT3-s95pNw-1 X-MC-Unique: qza7hnJrOm2RU95r6TAugQ-1 From: Shalini Chellathurai Saroja To: libvir-list@redhat.com Subject: [PATCH libvirt v1 4/6] qemu: move ZPCI uid validation into device validation Date: Thu, 9 Apr 2020 12:31:03 +0200 In-Reply-To: <20200409103105.45606-1-shalini@linux.ibm.com> References: <20200409103105.45606-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20040910-0016-0000-0000-0000030156DF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040910-0017-0000-0000-000033653BB1 Message-Id: <20200409103105.45606-5-shalini@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-09_03:2020-04-07, 2020-04-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 suspectscore=1 bulkscore=0 adultscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 phishscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004090073 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 039AVVT3017131 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Thu, 09 Apr 2020 06:54:38 -0400 Cc: Shalini Chellathurai Saroja 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The ZPCI device validation is specific to qemu. So, let us move the ZPCI uid validation out of domain xml parsing into qemu domain device validation. Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- src/conf/device_conf.c | 3 --- src/libvirt_private.syms | 1 - src/qemu/qemu_validate.c | 24 ++++++++++++++++++++++++ src/util/virpci.c | 20 -------------------- src/util/virpci.h | 1 - 5 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index c03356e7..048d2b16 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -77,9 +77,6 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node, def.fid_set =3D true; } =20 - if (!virZPCIDeviceAddressIsValid(&def)) - return -1; - addr->zpci =3D def; =20 return 0; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 18687563..a4c888bb 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2823,7 +2823,6 @@ virPCIStubDriverTypeFromString; virPCIStubDriverTypeToString; virZPCIDeviceAddressIsIncomplete; virZPCIDeviceAddressIsPresent; -virZPCIDeviceAddressIsValid; =20 =20 # util/virperf.h diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 22fdfd11..d85d8321 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -948,6 +948,24 @@ qemuValidateDomainDef(const virDomainDef *def, } =20 =20 +static bool +qemuDomainDeviceDefValidateZPCIUid(virZPCIDeviceAddressPtr zpci) +{ + if (zpci->uid_set && + (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; +} + + static int qemuValidateDomainDeviceDefZPCIAddress(virDomainDeviceInfoPtr info, virQEMUCapsPtr qemuCaps) @@ -960,6 +978,12 @@ qemuValidateDomainDeviceDefZPCIAddress(virDomainDevice= InfoPtr info, return -1; } =20 + /* We don't need to check fid because fid covers + * all range of uint32 type. + */ + if (!qemuDomainDeviceDefValidateZPCIUid(&info->addr.pci.zpci)) + return -1; + return 0; } =20 diff --git a/src/util/virpci.c b/src/util/virpci.c index b38f717c..349f313c 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2166,26 +2166,6 @@ virPCIDeviceAddressParse(char *address, } =20 =20 -bool -virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr zpci) -{ - /* We don't need to check fid because fid covers - * all range of uint32 type. - */ - if (zpci->uid_set && - (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 virZPCIDeviceAddressIsIncomplete(const virZPCIDeviceAddress *addr) { diff --git a/src/util/virpci.h b/src/util/virpci.h index e937348f..e9c49716 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -249,7 +249,6 @@ int virPCIDeviceAddressParse(char *address, virPCIDevic= eAddressPtr bdf); =20 bool virZPCIDeviceAddressIsIncomplete(const virZPCIDeviceAddress *addr); bool virZPCIDeviceAddressIsPresent(const virZPCIDeviceAddress *addr); -bool virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr zpci); =20 int virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path, int pfNetDevIdx, --=20 2.21.1 From nobody Sun Feb 8 12:38:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1586429698; cv=none; d=zohomail.com; s=zohoarc; b=YSHvusfAjgShgJiofQjGquN3dYaqcHn0GxLMtJjAyxSyFWxcll5DvKklm6jsWEWozT1VJ//Rijh6HibL3X4qHNgObeohGFDydyHZa4cIj49ncT2rjzteIsFGGDQ/db6snZqTEyQPi8LdkTDvXq+jqhZRmUrdBDlWNaoyPdtwst8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586429698; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DeklHn+zpV3PbqkB9+mmLe4ngr0y1wnsoIEFi7b61z4=; b=e/Qf02oVP2Z37bnWu/YFlHi4ZmdIuvZK4+3A5R9U9xvkzeJTKXNhgOG3CMMaG/rjPgfWQ/1ttYzEIhjH2rv99C/7ZMg2CW3Pr1BLNSWCTL9/CACqjQcJi71K0xMWSwB0HkUMjtCo2BYZV44GZvt8ChNxXgCjYFJpVGUlvjWAz7Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586429698798129.85646224745085; Thu, 9 Apr 2020 03:54:58 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-183-fGVDzWTCPpqM75_OBHuYow-1; Thu, 09 Apr 2020 06:54:55 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B19E1926DB0; Thu, 9 Apr 2020 10:54:50 +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 1CD3BC0D89; Thu, 9 Apr 2020 10:54:50 +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 C280893071; Thu, 9 Apr 2020 10:54:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 039AVkGR017187 for ; Thu, 9 Apr 2020 06:31:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id C401F2028DCB; Thu, 9 Apr 2020 10:31:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C00E62026D66 for ; Thu, 9 Apr 2020 10:31:46 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A12168F7A27 for ; Thu, 9 Apr 2020 10:31:46 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-492-A4r8qIRAP0aVdHR2mzskpA-1; Thu, 09 Apr 2020 06:31:44 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 039AVgov033380 for ; Thu, 9 Apr 2020 06:31:43 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 30920bjnkx-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 09 Apr 2020 06:31:42 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Apr 2020 11:31:12 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 9 Apr 2020 11:31:10 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 039AVMN662390478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Apr 2020 10:31:22 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E412A4067; Thu, 9 Apr 2020 10:31:22 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 28B73A4060; Thu, 9 Apr 2020 10:31:22 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 9 Apr 2020 10:31:22 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586429697; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=DeklHn+zpV3PbqkB9+mmLe4ngr0y1wnsoIEFi7b61z4=; b=BAkvCufQXrm53K3zWMyjlO5zh+JSX2gRTv9usASV5NT+8ECiV0R8qiAdLK1B0qymxU7hwF UC29DXocMLgAg/EncKg/vAuujJLQ+kF6ZdhYN3GBDHwgs0QQvixmWqTf4PUc9YEHXvCz58 6HHXvn1hIr59qNaP5mBVt7SNLP8k4JA= X-MC-Unique: fGVDzWTCPpqM75_OBHuYow-1 X-MC-Unique: A4r8qIRAP0aVdHR2mzskpA-1 From: Shalini Chellathurai Saroja To: libvir-list@redhat.com Subject: [PATCH libvirt v1 5/6] tests: qemu: add more tests for ZPCI on S390 Date: Thu, 9 Apr 2020 12:31:04 +0200 In-Reply-To: <20200409103105.45606-1-shalini@linux.ibm.com> References: <20200409103105.45606-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20040910-0012-0000-0000-000003A14C57 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040910-0013-0000-0000-000021DE75B5 Message-Id: <20200409103105.45606-6-shalini@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-09_03:2020-04-07, 2020-04-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=1 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004090076 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 039AVkGR017187 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Thu, 09 Apr 2020 06:54:38 -0400 Cc: Shalini Chellathurai Saroja 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" 1. Test for auto-generating uids while specifying valid fids 2. Test for auto-generating fids while specifying valid uids 3. Test for parse error while specifying a valid fid and an invalid uid 4. Test for parse error while specifying two ZPCI devices with same uid and fid addresses 5. Test for parse error when both uid and fid are set to zero 6. Test for error while specifying uid and not providing ZPCI capability. Signed-off-by: Boris Fiuczynski Signed-off-by: Bjoern Walk Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- .../hostdev-vfio-zpci-autogenerate-fids.args | 31 +++++++++++++++++++ .../hostdev-vfio-zpci-autogenerate-fids.xml | 29 +++++++++++++++++ .../hostdev-vfio-zpci-autogenerate-uids.args | 31 +++++++++++++++++++ .../hostdev-vfio-zpci-autogenerate-uids.xml | 29 +++++++++++++++++ .../hostdev-vfio-zpci-duplicate.xml | 30 ++++++++++++++++++ ...ostdev-vfio-zpci-invalid-uid-valid-fid.xml | 21 +++++++++++++ .../hostdev-vfio-zpci-set-zero.xml | 21 +++++++++++++ tests/qemuxml2argvtest.c | 18 +++++++++++ 8 files changed, 210 insertions(+) create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-f= ids.args create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-f= ids.xml create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-u= ids.args create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-u= ids.xml create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-duplicate.xml create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-invalid-uid-va= lid-fid.xml create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-set-zero.xml diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-fids.arg= s b/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-fids.args new file mode 100644 index 00000000..6485433a --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-fids.args @@ -0,0 +1,31 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-s390x \ +-name QEMUGuest1 \ +-S \ +-machine s390-ccw-virtio,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-realtime mlock=3Doff \ +-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=3D0000:00:00.0,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x1 \ +-device zpci,uid=3D5,fid=3D1,target=3Dhostdev1,id=3Dzpci5 \ +-device vfio-pci,host=3D0001:00:00.0,id=3Dhostdev1,bus=3Dpci.0,addr=3D0x2 \ +-device zpci,uid=3D2,fid=3D2,target=3Dballoon0,id=3Dzpci2 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-fids.xml= b/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-fids.xml new file mode 100644 index 00000000..49c26e24 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-fids.xml @@ -0,0 +1,29 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + + hvm + + + /usr/bin/qemu-system-s390x + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-uids.arg= s b/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-uids.args new file mode 100644 index 00000000..181652cc --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-uids.args @@ -0,0 +1,31 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-s390x \ +-name QEMUGuest1 \ +-S \ +-machine s390-ccw-virtio,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-realtime mlock=3Doff \ +-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=3D0000:00:00.0,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x1 \ +-device zpci,uid=3D2,fid=3D31,target=3Dhostdev1,id=3Dzpci2 \ +-device vfio-pci,host=3D0000:00:01.0,id=3Dhostdev1,bus=3Dpci.0,addr=3D0x2 \ +-device zpci,uid=3D3,fid=3D1,target=3Dballoon0,id=3Dzpci3 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-uids.xml= b/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-uids.xml new file mode 100644 index 00000000..e74e0116 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-autogenerate-uids.xml @@ -0,0 +1,29 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + + hvm + + + /usr/bin/qemu-system-s390x + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-duplicate.xml b/tests= /qemuxml2argvdata/hostdev-vfio-zpci-duplicate.xml new file mode 100644 index 00000000..6062ae49 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-duplicate.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-invalid-uid-valid-fid= .xml b/tests/qemuxml2argvdata/hostdev-vfio-zpci-invalid-uid-valid-fid.xml new file mode 100644 index 00000000..6e710148 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-invalid-uid-valid-fid.xml @@ -0,0 +1,21 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + + hvm + + + /usr/bin/qemu-system-s390x + + + + +
+ +
+ +
+ + + diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-set-zero.xml b/tests/= qemuxml2argvdata/hostdev-vfio-zpci-set-zero.xml new file mode 100644 index 00000000..fd3d1193 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-set-zero.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 dd467cb3..6d723675 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1643,6 +1643,11 @@ mymain(void) DO_TEST("hostdev-vfio-zpci", QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_DEVICE_ZPCI); + DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-autogenerate-fids", + QEMU_CAPS_DEVICE_VFIO_PCI); + DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-invalid-uid-valid-fid", + 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, @@ -1650,6 +1655,12 @@ mymain(void) DO_TEST("hostdev-vfio-zpci-autogenerate", QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_DEVICE_ZPCI); + DO_TEST("hostdev-vfio-zpci-autogenerate-uids", + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_ZPCI); + DO_TEST("hostdev-vfio-zpci-autogenerate-fids", + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_ZPCI); DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-uid-set-zero", QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_DEVICE_ZPCI); @@ -1659,6 +1670,13 @@ mymain(void) QEMU_CAPS_DEVICE_ZPCI); DO_TEST_PARSE_ERROR("hostdev-vfio-zpci", QEMU_CAPS_DEVICE_VFIO_PCI); + DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-duplicate", + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_ZPCI); + DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-set-zero", + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_ZPCI); + DO_TEST("pci-rom", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("pci-rom-disabled", NONE); DO_TEST("pci-rom-disabled-invalid", NONE); --=20 2.21.1 From nobody Sun Feb 8 12:38:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1586429690; cv=none; d=zohomail.com; s=zohoarc; b=D3X+0Zz1ypQPrWNxjZaGlv/QUYTROifIHO3Lt6AcgfmT0Bbp0NnMHs75cqvfRrRSBFxNoDmq4xVLXIVvRtf/bASWJmzTk1lsmyAPbBHB3x+sxwbh3lG9hyhZibTTHe1oevSzqzN7Gc3IbwYZ6j0gKIbecQo/T8Uwx7/h371TWNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586429690; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4zo9AvkulonXrkCXSNMc5lyh9sUkNtVOJJkUy1yBiCU=; b=gBchSu9CqOSRC53gj2e3C16iR//z6JIn5p69zxQvnaZI6FeuEZKP8XU/90fZ/d8tyS92KU0+UrM7YLFrCqb92gun5qQ7YcMlPmvJJcDtxHY/+G8HjD/X3gyV0FRwlMQQ2xrVJgieuWl5S+qVArUZoGpGsHSeWDGkTcWg6tzVrZY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1586429690007494.16534357491867; Thu, 9 Apr 2020 03:54:50 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-477-xW9VEbTnPBuGFNJy41IBQA-1; Thu, 09 Apr 2020 06:54:46 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2C101005513; Thu, 9 Apr 2020 10:54:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76083C0D89; Thu, 9 Apr 2020 10:54:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1FF0D9306E; Thu, 9 Apr 2020 10:54:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 039AVWOg017151 for ; Thu, 9 Apr 2020 06:31:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E9952093CF3; Thu, 9 Apr 2020 10:31:32 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1A9372026D66 for ; Thu, 9 Apr 2020 10:31:32 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 01115185A793 for ; Thu, 9 Apr 2020 10:31:32 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-286-m_K9gUBlPuqwG6bR3qES7g-1; Thu, 09 Apr 2020 06:31:29 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 039A4EQw163740 for ; Thu, 9 Apr 2020 06:31:29 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 30920sj9ga-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 09 Apr 2020 06:31:28 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Apr 2020 11:31:24 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 9 Apr 2020 11:31:21 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 039AVN3g53542996 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 9 Apr 2020 10:31:23 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56709A406D; Thu, 9 Apr 2020 10:31:23 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3544EA4069; Thu, 9 Apr 2020 10:31:23 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 9 Apr 2020 10:31:23 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586429688; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4zo9AvkulonXrkCXSNMc5lyh9sUkNtVOJJkUy1yBiCU=; b=RlOzhV/J1q1ALlnGAD0rhEVxLhUmbUpwutMXD9y4Pt27R3f80B64NFxd2iWKXH6USUgD+4 +BMwfNgELlpQC9IstmiPFTvrM9iBZHnzLEdzUlcpTDGxqmqsbBj3u0M2o5ZxUjHx8W0i4Q FtOEpNrmjs8TywvbY1cLhRzuocVPgko= X-MC-Unique: xW9VEbTnPBuGFNJy41IBQA-1 X-MC-Unique: m_K9gUBlPuqwG6bR3qES7g-1 From: Shalini Chellathurai Saroja To: libvir-list@redhat.com Subject: [PATCH libvirt v1 6/6] tests: add test with PCI and CCW device Date: Thu, 9 Apr 2020 12:31:05 +0200 In-Reply-To: <20200409103105.45606-1-shalini@linux.ibm.com> References: <20200409103105.45606-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 20040910-0028-0000-0000-000003F50968 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040910-0029-0000-0000-000024BAA8F5 Message-Id: <20200409103105.45606-7-shalini@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-09_03:2020-04-07, 2020-04-09 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 priorityscore=1501 impostorscore=0 adultscore=0 mlxscore=0 spamscore=0 suspectscore=1 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004090073 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 039AVWOg017151 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Thu, 09 Apr 2020 06:54:38 -0400 Cc: Shalini Chellathurai Saroja 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add test with a ZPCI host device and a CCW memballoon device to ensure that CCW address remains the default address assigned. Signed-off-by: Boris Fiuczynski Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- .../hostdev-vfio-zpci-ccw-memballoon.args | 28 +++++++++++++++++++ .../hostdev-vfio-zpci-ccw-memballoon.xml | 17 +++++++++++ tests/qemuxml2argvtest.c | 4 +++ 3 files changed, 49 insertions(+) create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon= .args create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon= .xml diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.args b= /tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.args new file mode 100644 index 00000000..103c4f72 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.args @@ -0,0 +1,28 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-KVMGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-KVMGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-KVMGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-KVMGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-s390x \ +-name KVMGuest1 \ +-S \ +-machine s390-ccw-virtio,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-realtime mlock=3Doff \ +-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-KVMGuest1/monit= or.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=3D0000:00:00.0,id=3Dhostdev0,bus=3Dpci.0,addr=3D0x1 \ +-device virtio-balloon-ccw,id=3Dballoon0,devno=3Dfe.0.0000 diff --git a/tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.xml b/= tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.xml new file mode 100644 index 00000000..ef5e97fc --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon.xml @@ -0,0 +1,17 @@ + + KVMGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + + hvm + + + /usr/bin/qemu-system-s390x + + + +
+ + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 6d723675..1f087e62 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1676,6 +1676,10 @@ mymain(void) DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-set-zero", QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_DEVICE_ZPCI); + DO_TEST("hostdev-vfio-zpci-ccw-memballoon", + QEMU_CAPS_CCW, + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_ZPCI); =20 DO_TEST("pci-rom", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("pci-rom-disabled", NONE); --=20 2.21.1