From nobody Tue May 7 18:16:33 2024 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=1592468752; cv=none; d=zohomail.com; s=zohoarc; b=lLFar4uphkXUnwzCj9tNIugzJGKDjcSFjRwQO0BgGnagasHt4klSJ6JHmXMjI9u9BtSueUwd3nVM4+b+cUH9RaRyLvxLGNVFqoZRClMXHhPyAPv2uXDqKW1YwgVTJqXO+adjFg1JazF8ckevD0Ekuuzn/XocaKrVIMyEES/gyfs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592468752; 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=lWy9fWkIjKDXXZ4n/IHw5XsHvSexvZux6eQUQ0tXHRI=; b=B295rq7IROqWo7GhWyHhYDB0F27A2ZOTmCac7rvP5Z+j3TT/2IPn8944FbUrF9yEf+pEXO2hvuoFTYrXUOIU7aAjGQBsoqONibxwVzi+O3Z3Gdh1LOiCjIhl36OgsT8k+7hsQEkv911GdHjQzDbVgiogy1sGoVyyPONqFaJeJ+o= 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 159246875297537.800811936283026; Thu, 18 Jun 2020 01:25: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-484-4ZDy5MFaOnm0zTqyj6IH6Q-1; Thu, 18 Jun 2020 04:25:48 -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 2F7EC8035E1; Thu, 18 Jun 2020 08:25:42 +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 0D1EF5C1D6; Thu, 18 Jun 2020 08:25:42 +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 A0F1C1809561; Thu, 18 Jun 2020 08:25:41 +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 05I8PdSt022092 for ; Thu, 18 Jun 2020 04:25:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 78452F11FF; Thu, 18 Jun 2020 08:25:39 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72CE6F18BE for ; Thu, 18 Jun 2020 08:25:37 +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 0CE9F811E7A for ; Thu, 18 Jun 2020 08:25:37 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-201-TVrj1tgUNPGRw4B1qR39Tw-1; Thu, 18 Jun 2020 04:25:34 -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 05I82BHU079515 for ; Thu, 18 Jun 2020 04:25:34 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 31qt6h0v9g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Jun 2020 04:25:33 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05I8K0Id029035 for ; Thu, 18 Jun 2020 08:25:32 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04ams.nl.ibm.com with ESMTP id 31qur60nwq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Jun 2020 08:25:32 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05I8PSH412714346 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Jun 2020 08:25:28 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A375EA4040; Thu, 18 Jun 2020 08:25:28 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 81778A4057; Thu, 18 Jun 2020 08:25:28 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 18 Jun 2020 08:25:28 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592468751; 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=lWy9fWkIjKDXXZ4n/IHw5XsHvSexvZux6eQUQ0tXHRI=; b=GHj2elwvJGnDdw5qfqJXMGMKNJXH13Jz8zbH8N9Z9x6oM4IxsbtMWTbxH0fDasqLs0/zpr M4drY5lrcVZ21SpapBJ0gFKeaMm8SvB64RnYbNFzVXSK4HNdxEC3IRn+JCcj2eQdd3fUoB Ho1B2lPIN33zzMQwIHliHCFhoMeI9ag= X-MC-Unique: 4ZDy5MFaOnm0zTqyj6IH6Q-1 X-MC-Unique: TVrj1tgUNPGRw4B1qR39Tw-1 From: Shalini Chellathurai Saroja To: libvir-list@redhat.com Subject: [PATCH libvirt v2 1/5] conf: use g_autofree to ensure automatic cleanup Date: Thu, 18 Jun 2020 10:25:14 +0200 Message-Id: <20200618082518.98780-2-shalini@linux.ibm.com> In-Reply-To: <20200618082518.98780-1-shalini@linux.ibm.com> References: <20200618082518.98780-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-18_04:2020-06-17, 2020-06-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 cotscore=-2147483648 mlxlogscore=937 spamscore=0 adultscore=0 impostorscore=0 phishscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 suspectscore=3 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006180057 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com 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" Signed-off-by: Bjoern Walk Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Boris Fiuczynski Reviewed-by: Andrea Bolognani --- src/conf/device_conf.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 4dbd5c1a..1d06981a 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -53,9 +53,8 @@ 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"); @@ -64,27 +63,23 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node, virStrToLong_uip(uid, NULL, 0, &def.uid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot parse
'uid' attribute")); - goto cleanup; + 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; + return -1; } =20 if (!virZPCIDeviceAddressIsEmpty(&def) && !virZPCIDeviceAddressIsValid(&def)) - goto cleanup; + return -1; =20 addr->zpci =3D def; - ret =3D 0; =20 - cleanup: - VIR_FREE(uid); - VIR_FREE(fid); - return ret; + return 0; } =20 void --=20 2.25.4 From nobody Tue May 7 18:16:33 2024 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=1592468759; cv=none; d=zohomail.com; s=zohoarc; b=i0/a6GsLFyQIey6UiHF5kJFB1dDvsMs8JIsqbyL7EIaVuqGUPLv5h5KRHafZ4n2/LiDNtN1wkYd7ZgBK5xWYSLm/lGDyifZvZ99yLWtzcgH/h+Fzd+zkkKtJBFdgKnFmhfo19CtifMlO6A1KjqjGR3epWZ/WTHBFiCpeaG94+7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592468759; 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=0rFJcENFsvYa9mzTV+HRx/1PDrHH8wc2xDNlUO/k8SM=; b=DpvniXOJrXIFYdUczkGasmKOh2LjgkD//xO5CH3QNcN+TZeXvZl7f0Bej+7/Ppgwi1Reb+bN+CTEH67l15KMaCfLCrpniA+aGqbEQQ1quPH7H7KRHdiOAa4aVTshsu/A8CoS9672nvlZ84GuBaDFBjzzBl1xpZ0ZipPOD/1EgdY= 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 1592468759696262.91508696767517; Thu, 18 Jun 2020 01:25:59 -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-451-1P_6mIihMUuZyhZduazHPw-1; Thu, 18 Jun 2020 04:25:55 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D7DB8035D4; Thu, 18 Jun 2020 08:25:48 +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 D41BF5D9E4; Thu, 18 Jun 2020 08:25:47 +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 8CC5F833CB; Thu, 18 Jun 2020 08:25:47 +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 05I8PjXM022116 for ; Thu, 18 Jun 2020 04:25:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id A8B1D1007385; Thu, 18 Jun 2020 08:25:45 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A299F118DF5B for ; Thu, 18 Jun 2020 08:25:43 +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 9EF49811E77 for ; Thu, 18 Jun 2020 08:25:43 +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-449-9Pxxi2IPNNmodqi6S53M9g-1; Thu, 18 Jun 2020 04:25:41 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05I82R5c097424 for ; Thu, 18 Jun 2020 04:25:40 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 31r2t1k1j4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Jun 2020 04:25:39 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05I8JxsT029027 for ; Thu, 18 Jun 2020 08:25:37 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 31qur60nws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Jun 2020 08:25:36 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05I8PXqi61931898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Jun 2020 08:25:33 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5E9A6A4051; Thu, 18 Jun 2020 08:25:33 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C4A9A4057; Thu, 18 Jun 2020 08:25:33 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 18 Jun 2020 08:25:33 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592468758; 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=0rFJcENFsvYa9mzTV+HRx/1PDrHH8wc2xDNlUO/k8SM=; b=MV9pzeYZfByyK+6ofZTcrrqt+F2roXqjouVGy82VyHU5kkR04GGCZ2/cE3Rwkl6RmxJvUc IH0TDWFoLF/NS6nH9oQtzHKPTfYNmSBwV8wdHntBNR2vUysBo6rw8lmuyk22+XisJsK688 /oz24kjrUWur1m0Ujvt1Wmw+OghnMZ8= X-MC-Unique: 1P_6mIihMUuZyhZduazHPw-1 X-MC-Unique: 9Pxxi2IPNNmodqi6S53M9g-1 From: Shalini Chellathurai Saroja To: libvir-list@redhat.com Subject: [PATCH libvirt v2 2/5] conf: fix zPCI address auto-generation on s390 Date: Thu, 18 Jun 2020 10:25:15 +0200 Message-Id: <20200618082518.98780-3-shalini@linux.ibm.com> In-Reply-To: <20200618082518.98780-1-shalini@linux.ibm.com> References: <20200618082518.98780-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-18_04:2020-06-17, 2020-06-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 adultscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 suspectscore=1 clxscore=1015 mlxlogscore=999 phishscore=0 bulkscore=0 mlxscore=0 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006180057 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com 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.14 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" Let us fix the issues with zPCI address validation and auto-generation on s390. 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. The first issue is also related to the current code behaviour, which is, 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: 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 | 33 ++++---- src/conf/domain_addr.c | 77 ++++++------------- src/conf/domain_conf.c | 10 ++- src/libvirt_private.syms | 3 +- src/qemu/qemu_command.c | 6 +- src/qemu/qemu_hotplug.c | 2 +- src/qemu/qemu_validate.c | 2 +- src/util/virpci.c | 19 +++-- src/util/virpci.h | 14 +++- .../hostdev-vfio-zpci-uid-set-zero.xml | 20 +++++ tests/qemuxml2argvtest.c | 3 + 11 files changed, 101 insertions(+), 88 deletions(-) create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-uid-set-zero.x= ml diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 1d06981a..21398e90 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -59,22 +59,25 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node, 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")); - return -1; + if (uid) { + if (virStrToLong_uip(uid, NULL, 0, &def.uid.value) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse
'uid' attribute")); + return -1; + } + def.uid.isSet =3D true; } =20 - if (fid && - virStrToLong_uip(fid, NULL, 0, &def.fid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'fid' attribute")); - return -1; + if (fid) { + if (virStrToLong_uip(fid, NULL, 0, &def.fid.value) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse
'fid' attribute")); + return -1; + } + def.fid.isSet =3D true; } =20 - if (!virZPCIDeviceAddressIsEmpty(&def) && - !virZPCIDeviceAddressIsValid(&def)) + if (!virZPCIDeviceAddressIsValid(&def)) return -1; =20 addr->zpci =3D def; @@ -190,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 8623e79d..90ed31ef 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -58,7 +58,7 @@ static int virDomainZPCIAddressReserveUid(virHashTablePtr set, virZPCIDeviceAddressPtr addr) { - return virDomainZPCIAddressReserveId(set, addr->uid, "uid"); + return virDomainZPCIAddressReserveId(set, addr->uid.value, "uid"); } =20 =20 @@ -66,7 +66,7 @@ static int virDomainZPCIAddressReserveFid(virHashTablePtr set, virZPCIDeviceAddressPtr addr) { - return virDomainZPCIAddressReserveId(set, addr->fid, "fid"); + return virDomainZPCIAddressReserveId(set, addr->fid.value, "fid"); } =20 =20 @@ -96,7 +96,7 @@ static int virDomainZPCIAddressAssignUid(virHashTablePtr set, virZPCIDeviceAddressPtr addr) { - return virDomainZPCIAddressAssignId(set, &addr->uid, 1, + return virDomainZPCIAddressAssignId(set, &addr->uid.value, 1, VIR_DOMAIN_DEVICE_ZPCI_MAX_UID, "u= id"); } =20 @@ -105,7 +105,7 @@ static int virDomainZPCIAddressAssignFid(virHashTablePtr set, virZPCIDeviceAddressPtr addr) { - return virDomainZPCIAddressAssignId(set, &addr->fid, 0, + return virDomainZPCIAddressAssignId(set, &addr->fid.value, 0, VIR_DOMAIN_DEVICE_ZPCI_MAX_FID, "f= id"); } =20 @@ -129,7 +129,8 @@ static void virDomainZPCIAddressReleaseUid(virHashTablePtr set, virZPCIDeviceAddressPtr addr) { - virDomainZPCIAddressReleaseId(set, &addr->uid, "uid"); + if (addr->uid.isSet) + virDomainZPCIAddressReleaseId(set, &addr->uid.value, "uid"); } =20 =20 @@ -137,7 +138,8 @@ static void virDomainZPCIAddressReleaseFid(virHashTablePtr set, virZPCIDeviceAddressPtr addr) { - virDomainZPCIAddressReleaseId(set, &addr->fid, "fid"); + if (addr->fid.isSet) + virDomainZPCIAddressReleaseId(set, &addr->fid.value, "fid"); } =20 =20 @@ -145,47 +147,26 @@ static void virDomainZPCIAddressReleaseIds(virDomainZPCIAddressIdsPtr zpciIds, virZPCIDeviceAddressPtr addr) { - if (!zpciIds || virZPCIDeviceAddressIsEmpty(addr)) + if (!zpciIds) return; =20 virDomainZPCIAddressReleaseUid(zpciIds->uids, addr); - virDomainZPCIAddressReleaseFid(zpciIds->fids, addr); } =20 =20 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) +virDomainZPCIAddressReserveAddr(virDomainZPCIAddressIdsPtr zpciIds, + virZPCIDeviceAddressPtr addr) { - if (virDomainZPCIAddressAssignFid(fids, zpci) < 0) + if (!addr->uid.isSet && + virDomainZPCIAddressAssignUid(zpciIds->uids, addr) < 0) return -1; =20 - if (virDomainZPCIAddressReserveFid(fids, zpci) < 0) + if (!addr->fid.isSet && + virDomainZPCIAddressAssignFid(zpciIds->fids, addr) < 0) return -1; =20 - return 0; -} - - -static int -virDomainZPCIAddressReserveAddr(virDomainZPCIAddressIdsPtr zpciIds, - virZPCIDeviceAddressPtr addr) -{ if (virDomainZPCIAddressReserveUid(zpciIds->uids, addr) < 0) return -1; =20 @@ -194,21 +175,8 @@ virDomainZPCIAddressReserveAddr(virDomainZPCIAddressId= sPtr zpciIds, return -1; } =20 - 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; - } + addr->uid.isSet =3D true; + addr->fid.isSet =3D true; =20 return 0; } @@ -234,9 +202,9 @@ 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) + if (virDomainZPCIAddressReserveAddr(addrs->zpciIds, &zpci) < 0) return -1; =20 if (!addrs->dryRun) @@ -246,6 +214,7 @@ virDomainPCIAddressExtensionReserveNextAddr(virDomainPC= IAddressSetPtr addrs, return 0; } =20 + static int virDomainPCIAddressExtensionEnsureAddr(virDomainPCIAddressSetPtr addrs, virPCIDeviceAddressPtr addr) @@ -253,10 +222,8 @@ virDomainPCIAddressExtensionEnsureAddr(virDomainPCIAdd= ressSetPtr 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; } =20 return 0; diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e9336fd7..d5594681 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7519,11 +7519,15 @@ virDomainDeviceInfoFormat(virBufferPtr buf, virTristateSwitchTypeToString(info->addr.pci= .multi)); } =20 - if (!virZPCIDeviceAddressIsEmpty(&info->addr.pci.zpci)) { + if (virZPCIDeviceAddressIsIncomplete(&info->addr.pci.zpci)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Missing uid or fid attribute of zPCI address= ")); + } + if (virZPCIDeviceAddressIsPresent(&info->addr.pci.zpci)) { virBufferAsprintf(&childBuf, "\n", - info->addr.pci.zpci.uid, - info->addr.pci.zpci.fid); + info->addr.pci.zpci.uid.value, + info->addr.pci.zpci.fid.value); } break; =20 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index fc7406f2..a4a09cf9 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2837,7 +2837,8 @@ virPCIHeaderTypeToString; virPCIIsVirtualFunction; virPCIStubDriverTypeFromString; virPCIStubDriverTypeToString; -virZPCIDeviceAddressIsEmpty; +virZPCIDeviceAddressIsIncomplete; +virZPCIDeviceAddressIsPresent; virZPCIDeviceAddressIsValid; =20 =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f27246b4..36349870 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1902,10 +1902,10 @@ qemuBuildZPCIDevStr(virDomainDeviceInfoPtr dev) =20 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->addr.pci.zpci.uid.value, + dev->addr.pci.zpci.fid.value, dev->alias, - dev->addr.pci.zpci.uid); + dev->addr.pci.zpci.uid.value); =20 return virBufferContentAndReset(&buf); } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index dc3bd824..3954ad11 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -157,7 +157,7 @@ qemuDomainDetachZPCIDevice(qemuMonitorPtr mon, { g_autofree char *zpciAlias =3D NULL; =20 - zpciAlias =3D g_strdup_printf("zpci%d", info->addr.pci.zpci.uid); + zpciAlias =3D g_strdup_printf("zpci%d", info->addr.pci.zpci.uid.value); =20 if (qemuMonitorDelDevice(mon, zpciAlias) < 0) return -1; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index b1a81ab1..0372ae7d 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1018,7 +1018,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 786b1393..40ae5aec 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2173,12 +2173,13 @@ 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) { + if (zpci->uid.isSet && + (zpci->uid.value > VIR_DOMAIN_DEVICE_ZPCI_MAX_UID || + zpci->uid.value =3D=3D 0)) { virReportError(VIR_ERR_XML_ERROR, _("Invalid PCI address uid=3D'0x%.4x', " "must be > 0x0000 and <=3D 0x%.4x"), - zpci->uid, + zpci->uid.value, VIR_DOMAIN_DEVICE_ZPCI_MAX_UID); return false; } @@ -2187,11 +2188,19 @@ virZPCIDeviceAddressIsValid(virZPCIDeviceAddressPtr= zpci) } =20 bool -virZPCIDeviceAddressIsEmpty(const virZPCIDeviceAddress *addr) +virZPCIDeviceAddressIsIncomplete(const virZPCIDeviceAddress *addr) { - return !(addr->uid || addr->fid); + return !addr->uid.isSet || !addr->fid.isSet; } =20 + +bool +virZPCIDeviceAddressIsPresent(const virZPCIDeviceAddress *addr) +{ + return addr->uid.isSet || addr->fid.isSet; +} + + #ifdef __linux__ =20 virPCIDeviceAddressPtr diff --git a/src/util/virpci.h b/src/util/virpci.h index f16d2361..f198df5d 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -38,11 +38,18 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virPCIDeviceList, virObje= ctUnref); #define VIR_DOMAIN_DEVICE_ZPCI_MAX_UID UINT16_MAX #define VIR_DOMAIN_DEVICE_ZPCI_MAX_FID UINT32_MAX =20 +typedef struct _virZPCIDeviceAddressID virZPCIDeviceAddressID; typedef struct _virZPCIDeviceAddress virZPCIDeviceAddress; typedef virZPCIDeviceAddress *virZPCIDeviceAddressPtr; + +struct _virZPCIDeviceAddressID { + unsigned int value; + bool isSet; +}; + struct _virZPCIDeviceAddress { - unsigned int uid; /* exempt from syntax-check */ - unsigned int fid; + virZPCIDeviceAddressID uid; /* exempt from syntax-check */ + virZPCIDeviceAddressID fid; /* Don't forget to update virPCIDeviceAddressCopy if needed. */ }; =20 @@ -245,8 +252,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-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 d5b2a21b..765e6fdf 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1750,6 +1750,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.25.4 From nobody Tue May 7 18:16:33 2024 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=1592468763; cv=none; d=zohomail.com; s=zohoarc; b=aS6lx3FAWWMBa61ize2yYp+KuTYk6lzxnm5IRtza1HrcGMxD23e6+/2OrvVDzSh2NV5pomtpYz6ZSVN8SsFsxVtLpu7flxjtm63KQw7Fv0meKIGpNeiu2X6fKaUIJI7SJmFNzzsRBEq1s2WqDUdweZcEILMostOgvWynPk/74lA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592468763; 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=VmJC7D+xRhkfQxLKIly/NERbQUGrHxWxRp6aGSf3jZU=; b=ZZA9tfVM0Jjox8w2bqRuuqCnaVakaAp48wHW8VnuwmcR+lrf9foxGxrNjS64x5m8XKYAC+z2EwWrMig27ZgOCAJCOWB+cmn6qHfzWiWjRqa4+di7JthVIwWooq5R2hX7mKgUOJJLjnmtA4jJa/9hQ2O8T+ffdttmZuy+cIMkxR8= 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-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1592468763837614.3929558207692; Thu, 18 Jun 2020 01:26:03 -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-130-EFH2gEDsMTKu2SKJAgpIaQ-1; Thu, 18 Jun 2020 04:25:59 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id EFC11184519D; Thu, 18 Jun 2020 08:25:52 +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 CC7265D9E5; Thu, 18 Jun 2020 08:25:52 +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 9F1DB833CB; Thu, 18 Jun 2020 08:25:52 +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 05I8PodR022131 for ; Thu, 18 Jun 2020 04:25:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5C08E118DF5A; Thu, 18 Jun 2020 08:25:50 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 576F5118DF56 for ; Thu, 18 Jun 2020 08:25:50 +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 3ECB0811768 for ; Thu, 18 Jun 2020 08:25:50 +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-486-e9rwpBMcNpqFrLAT8eWafg-1; Thu, 18 Jun 2020 04:25:48 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05I82LMR007933 for ; Thu, 18 Jun 2020 04:25:47 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 31r338uf03-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Jun 2020 04:25:46 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05I8PiDv001341 for ; Thu, 18 Jun 2020 08:25:44 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03ams.nl.ibm.com with ESMTP id 31quax8q32-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Jun 2020 08:25:44 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05I8ONlv64028934 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Jun 2020 08:24:23 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E5EF5A4057; Thu, 18 Jun 2020 08:25:40 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C46BEA404D; Thu, 18 Jun 2020 08:25:40 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 18 Jun 2020 08:25:40 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592468762; 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=VmJC7D+xRhkfQxLKIly/NERbQUGrHxWxRp6aGSf3jZU=; b=MJOZBobMKP2HqE1pmbHVQRl4OaPX9OuAeO8nadtgOSmIFFj+rMmyYfhAGcHP3DrOglI3GJ lYllu0bUIpneb9r1E3+B0OdFej5MoMY7foPsDgKzGVtfEce5KuRXQXd3CCU3aLsF1noDF9 poiJcZ3A2F/Nb3KNyGwpiOD6GnpzlX0= X-MC-Unique: EFH2gEDsMTKu2SKJAgpIaQ-1 X-MC-Unique: e9rwpBMcNpqFrLAT8eWafg-1 From: Shalini Chellathurai Saroja To: libvir-list@redhat.com Subject: [PATCH libvirt v2 3/5] qemu: move ZPCI uid validation into device validation Date: Thu, 18 Jun 2020 10:25:16 +0200 Message-Id: <20200618082518.98780-4-shalini@linux.ibm.com> In-Reply-To: <20200618082518.98780-1-shalini@linux.ibm.com> References: <20200618082518.98780-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-18_04:2020-06-17, 2020-06-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 impostorscore=0 clxscore=1015 malwarescore=0 phishscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 suspectscore=1 mlxlogscore=999 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006180057 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com 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.14 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 Reviewed-by: Andrea Bolognani --- src/conf/device_conf.c | 3 --- src/libvirt_private.syms | 1 - src/qemu/qemu_validate.c | 18 +++++++++++++++++- src/util/virpci.c | 20 -------------------- src/util/virpci.h | 1 - 5 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 21398e90..a641f3ce 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -77,9 +77,6 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node, def.fid.isSet =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 a4a09cf9..f0543bcc 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2839,7 +2839,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 0372ae7d..37c59416 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1018,7 +1018,9 @@ static int qemuValidateDomainDeviceDefZPCIAddress(virDomainDeviceInfoPtr info, virQEMUCapsPtr qemuCaps) { - if (virZPCIDeviceAddressIsPresent(&info->addr.pci.zpci) && + virZPCIDeviceAddressPtr zpci =3D &info->addr.pci.zpci; + + if (virZPCIDeviceAddressIsPresent(zpci) && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ZPCI)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -1026,6 +1028,20 @@ qemuValidateDomainDeviceDefZPCIAddress(virDomainDevi= ceInfoPtr info, return -1; } =20 + /* We don't need to check fid because fid covers + * all range of uint32 type. + */ + if (zpci->uid.isSet && + (zpci->uid.value > VIR_DOMAIN_DEVICE_ZPCI_MAX_UID || + zpci->uid.value =3D=3D 0)) { + virReportError(VIR_ERR_XML_ERROR, + _("Invalid PCI address uid=3D'0x%.4x', " + "must be > 0x0000 and <=3D 0x%.4x"), + zpci->uid.value, + VIR_DOMAIN_DEVICE_ZPCI_MAX_UID); + return -1; + } + return 0; } =20 diff --git a/src/util/virpci.c b/src/util/virpci.c index 40ae5aec..3685f901 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2167,26 +2167,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.isSet && - (zpci->uid.value > VIR_DOMAIN_DEVICE_ZPCI_MAX_UID || - zpci->uid.value =3D=3D 0)) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid PCI address uid=3D'0x%.4x', " - "must be > 0x0000 and <=3D 0x%.4x"), - zpci->uid.value, - 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 f198df5d..b3322ba6 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -254,7 +254,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.25.4 From nobody Tue May 7 18:16:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1592468775; cv=none; d=zohomail.com; s=zohoarc; b=SAm5R2asLsPJAJNU7fYO7BaCacI12iDUHGD5KPQN0D9/BWIhx3JMw46nwPxmWUgyMlSs3dcw5N0A6bSg3BGlXch/Mxelaz9sdtR39fl+rugumheoKg0wPb+OGMMgRrT2HwtoA+QAuKRaKfkvD2q9TpjRblogxWf8U2WLUnDzj/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592468775; 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=mJ5CbrJ9VhEV+Z+8y/8XLLZ5nz53loJLfEdxoWl7skA=; b=PfZezFj4uezGhh2OJQTwnc2Q68jm01E+iNm7exmFb43Yc3Gwgk4VO59Q3vM3Bw9ijhHsK4zuvDGSxY+aK0iIGxuUtKABRAkyhOZgYAXPLEAyi2JO7UZLsV78Jr/7mFiad2wJf2adWnEDxfatLLz51mlv1rIs7W9amx9Z61+V33o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1592468775129515.0261226002754; Thu, 18 Jun 2020 01:26:15 -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-52-C7B3rXgWPZq3ks1UB-OMwQ-1; Thu, 18 Jun 2020 04:26:09 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB9F3884DE2; Thu, 18 Jun 2020 08:25:59 +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 A08C519934; Thu, 18 Jun 2020 08:25:59 +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 6B29B833CA; Thu, 18 Jun 2020 08:25:59 +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 05I8Pvh3022162 for ; Thu, 18 Jun 2020 04:25:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id D849FF11FD; Thu, 18 Jun 2020 08:25:57 +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 D3224F11D1 for ; Thu, 18 Jun 2020 08:25:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.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 7B94E1049841 for ; Thu, 18 Jun 2020 08:25:55 +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-450-RswjSsRpOS-z3zE3sVRk1g-1; Thu, 18 Jun 2020 04:25:53 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05I83S90061238 for ; Thu, 18 Jun 2020 04:25:52 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 31r44t175g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Jun 2020 04:25:51 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05I8PiE0001341 for ; Thu, 18 Jun 2020 08:25:49 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 31quax8q3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Jun 2020 08:25:49 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05I8PjBg59834558 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Jun 2020 08:25:45 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B2ED5A404D; Thu, 18 Jun 2020 08:25:45 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8313DA4055; Thu, 18 Jun 2020 08:25:45 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 18 Jun 2020 08:25:45 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592468773; 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=mJ5CbrJ9VhEV+Z+8y/8XLLZ5nz53loJLfEdxoWl7skA=; b=AtQsOD+j8QrbQvcPvLLij1r9Jf57hT35e7pThaZvrmvLQMnnsRi1W/TUtKFJ24F1FVYQAR 4PsC2YAqyPDkfua2rwFOAAToP64a3/414b7+ix9peeLJzxjPBv9dgJD6SWUjGIV0UxlHxx idy6rt7yO1OS/qJjgYg8TCW0fRDTeDc= X-MC-Unique: C7B3rXgWPZq3ks1UB-OMwQ-1 X-MC-Unique: RswjSsRpOS-z3zE3sVRk1g-1 From: Shalini Chellathurai Saroja To: libvir-list@redhat.com Subject: [PATCH libvirt v2 4/5] tests: qemu: add more tests for ZPCI on S390 Date: Thu, 18 Jun 2020 10:25:17 +0200 Message-Id: <20200618082518.98780-5-shalini@linux.ibm.com> In-Reply-To: <20200618082518.98780-1-shalini@linux.ibm.com> References: <20200618082518.98780-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-18_04:2020-06-17, 2020-06-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 mlxlogscore=999 clxscore=1015 lowpriorityscore=0 malwarescore=0 suspectscore=1 bulkscore=0 phishscore=0 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006180061 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com 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.23 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 Reviewed-by: Andrea Bolognani --- .../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 ++++++++ .../hostdev-vfio-zpci-autogenerate-fids.xml | 43 +++++++++++++++++++ .../hostdev-vfio-zpci-autogenerate-uids.xml | 43 +++++++++++++++++++ tests/qemuxml2xmltest.c | 6 +++ 11 files changed, 302 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 create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate= -fids.xml create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate= -uids.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 765e6fdf..1aa12693 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1743,6 +1743,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, @@ -1750,6 +1755,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); @@ -1759,6 +1770,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); diff --git a/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate-fids.x= ml b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate-fids.xml new file mode 100644 index 00000000..846b809e --- /dev/null +++ b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate-fids.xml @@ -0,0 +1,43 @@ + + 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-autogenerate-uids.x= ml b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate-uids.xml new file mode 100644 index 00000000..01647550 --- /dev/null +++ b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-autogenerate-uids.xml @@ -0,0 +1,43 @@ + + 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 7fc8a7d6..20243a97 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -519,6 +519,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("hostdev-vfio-zpci-boundaries", QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_DEVICE_PCI_BRIDGE, --=20 2.25.4 From nobody Tue May 7 18:16:33 2024 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-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=1592468775; cv=none; d=zohomail.com; s=zohoarc; b=QaUnRx12kKSuYOl0+vj+aqQvtPGIY6qcGW0m/0Gu5c9VYV4QBsu4TDmVHuC2uZf5Mhuck2fG/q9XlbZiWXoKE+kuuWq/QxdZQUjspcLyNYBJw+0i14p0VOx7YKzFCcN9aA2fuWN2D4FoqCpyEPcnNBg+ZeFK49NHgIbgTbMY9Sk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592468775; 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=Tc7NtQ0uYWCz2bndiw6tdfKzKHJkCAw2WPnunfbL11E=; b=hEdbZS+4eEp3lQaHYMtenQ4H44VIb2F9ZemupKvVI+DvX06kL9n3AFk8b7MzXTFgrKktHWITvtGS/wZ5e/lW/2hvp9RfXqkx54uq61AvDIYoKe6xmYcqHWS5+AxsVvxxkpqYTTFRHGH49OGYJky/yVt5gWCqV2v2JmIOAJTFckM= 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 159246877564484.00186670343248; Thu, 18 Jun 2020 01:26:15 -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-17-CVQryrr0OZOghCNJgUMhSg-1; Thu, 18 Jun 2020 04:26:11 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id EA33539348; Thu, 18 Jun 2020 08:26:01 +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 B15F45D9F5; Thu, 18 Jun 2020 08:26:01 +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 802CD833CC; Thu, 18 Jun 2020 08:26:01 +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 05I8Q0Jv022181 for ; Thu, 18 Jun 2020 04:26:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 11F87F11FF; Thu, 18 Jun 2020 08:26:00 +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 0DC2FF11D1 for ; Thu, 18 Jun 2020 08:26:00 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.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 E785782A6F5 for ; Thu, 18 Jun 2020 08:25:59 +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-194-crSm-PMdPo28Q7qwkCMr-w-1; Thu, 18 Jun 2020 04:25:56 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05I82VgW083406 for ; Thu, 18 Jun 2020 04:25:55 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 31r2whkh47-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Jun 2020 04:25:54 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05I8JxsZ029027 for ; Thu, 18 Jun 2020 08:25:52 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04ams.nl.ibm.com with ESMTP id 31qur60nxb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Jun 2020 08:25:52 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05I8OU4Z59572512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Jun 2020 08:24:30 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 84BADA4059; Thu, 18 Jun 2020 08:25:48 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 63069A404D; Thu, 18 Jun 2020 08:25:48 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 18 Jun 2020 08:25:48 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592468774; 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=Tc7NtQ0uYWCz2bndiw6tdfKzKHJkCAw2WPnunfbL11E=; b=KudL3PD2zylPAjFW+ml7iRtpkg3wnRPgHDQP/9ruz9T/JgXGZB3Jflvkq2fVp48y0HI6MG doKLkY75Q5XMWqyVk8TD1YL1iyjN16nBh9tKVbMDZKvo+5WKtvTlZV4vmOAT+5X7311V6p UXkC16TeOUnvmKcxU+xvUrBz0tii+Fk= X-MC-Unique: CVQryrr0OZOghCNJgUMhSg-1 X-MC-Unique: crSm-PMdPo28Q7qwkCMr-w-1 From: Shalini Chellathurai Saroja To: libvir-list@redhat.com Subject: [PATCH libvirt v2 5/5] tests: add test with PCI and CCW device Date: Thu, 18 Jun 2020 10:25:18 +0200 Message-Id: <20200618082518.98780-6-shalini@linux.ibm.com> In-Reply-To: <20200618082518.98780-1-shalini@linux.ibm.com> References: <20200618082518.98780-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-18_04:2020-06-17, 2020-06-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 cotscore=-2147483648 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 suspectscore=1 malwarescore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006180057 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com 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.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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 Reviewed-by: Andrea Bolognani --- .../hostdev-vfio-zpci-ccw-memballoon.args | 28 ++++++++++++++++ .../hostdev-vfio-zpci-ccw-memballoon.xml | 17 ++++++++++ tests/qemuxml2argvtest.c | 4 +++ .../hostdev-vfio-zpci-ccw-memballoon.xml | 32 +++++++++++++++++++ tests/qemuxml2xmltest.c | 4 +++ 5 files changed, 85 insertions(+) create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon= .args create mode 100644 tests/qemuxml2argvdata/hostdev-vfio-zpci-ccw-memballoon= .xml create mode 100644 tests/qemuxml2xmloutdata/hostdev-vfio-zpci-ccw-memballo= on.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 1aa12693..6f5c52b0 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1776,6 +1776,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); diff --git a/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-ccw-memballoon.xml = b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-ccw-memballoon.xml new file mode 100644 index 00000000..0d18e2d6 --- /dev/null +++ b/tests/qemuxml2xmloutdata/hostdev-vfio-zpci-ccw-memballoon.xml @@ -0,0 +1,32 @@ + + KVMGuest1 + 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 20243a97..c2644a18 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -529,6 +529,10 @@ mymain(void) QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_ZPCI); + DO_TEST("hostdev-vfio-zpci-ccw-memballoon", + QEMU_CAPS_CCW, + QEMU_CAPS_DEVICE_VFIO_PCI, + QEMU_CAPS_DEVICE_ZPCI); DO_TEST("hostdev-mdev-precreated", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("hostdev-mdev-display", QEMU_CAPS_DEVICE_QXL, --=20 2.25.4