From patchwork Tue Dec 13 15:44:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 32861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp199371wrn; Tue, 13 Dec 2022 07:49:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf4ZtDAvZ9YalSDdMmOFbQywJK+zsiHXNGz1Gt6swj3KzesHT3BnbMpDnWs4Pl5UaFwdsWJW X-Received: by 2002:a17:906:4946:b0:78d:f454:ba4c with SMTP id f6-20020a170906494600b0078df454ba4cmr19193410ejt.75.1670946544063; Tue, 13 Dec 2022 07:49:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670946544; cv=none; d=google.com; s=arc-20160816; b=yp+ImyJrOWKrc+gHDAUUazwa3ILwuK1B74O11qnhFC+UHqPpb/SKhynGh0TrmR+cYq YbpF4XpoDr9cbcidBoKe+M/8Dx3AQCmE8i37LZCfxH+uysP3AgDUTBLM8XvGU7NSPCH1 LSfwumwhiI6oqTjtVuKyMgifzafPk2yE31GeI+/SvzUa27IX+OuBsrPH3FNUC2d8cXo5 J5+51IrIkpNtcn6SFNvFoBVBFsw2R9kT1kWZxH4psftscTx0MwRv6+KYX2OMsyE7OKda kCBWZpBf1WDvbOmIgyk2Bik/z7NDHLfudTn4NpxhkZIZg1bhX7gCt33CmlhrmHEsQh6J TC2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nfH4fN+czCBQMn+335TdKClC5X9kduQW3sBrlTHqqMw=; b=DGnrOb0PjPOQ302G0Dk280XJcHDt24HyJlVckUI/OnJWayid+D0cHhKfKbMnTogoEu f4FTioCOU7JU9vqn4XDTeOnJ8sYcfYxLyGwxuL3MPecfnzI4nX6x7S7nWA1N7inn/t6A ZKlilVCWySuF19Z3/FUIBOCNAau+lt4iymTHBaUMLzX8yk/ZwEQ7hv8I2pDZtT8L6aVk vbDblNvrQxjtn0Z9ShhCGJYWj4sWbl6h7EomEA8h3Z8W/rz6PSx1fFefBjaD7SeJOFpb 9+MYPLqxkrrSvSue08PrpSze71ktGnea+uSn1aczYh9IoUhMTNNDbXIwNdFvC74v7TuE rwFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=NBHAzGzX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht20-20020a170907609400b00791994dfb9esi10055235ejc.491.2022.12.13.07.48.40; Tue, 13 Dec 2022 07:49:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=NBHAzGzX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236246AbiLMPow (ORCPT + 99 others); Tue, 13 Dec 2022 10:44:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236167AbiLMPoo (ORCPT ); Tue, 13 Dec 2022 10:44:44 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09B306368; Tue, 13 Dec 2022 07:44:43 -0800 (PST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDE9ePL011228; Tue, 13 Dec 2022 15:44:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=nfH4fN+czCBQMn+335TdKClC5X9kduQW3sBrlTHqqMw=; b=NBHAzGzXV5mrBLqwDNNK4WB2cAdsn4yCM5kz9qTuA4k8yKhlviawjNHcSnSvvWgfkp/I GjUgQf1fmA8GUPZqJYOTWt5JFOgsyBfRjLlgwIsFru6Q1OWC35clM+y9VgLigjLL7wft yH+K0P+wcXfcGx0mhR8+j5buuxQ11YnPzS6WPHnYVhdARcaIe9GNgR7miaAGYIXd6TZt MRx8EWh7r+nGkF7IGPCigPqwUnK4f0qzMMMBYRcb9dI8bC2bh60uByhTq84Fh/1flbwC 9bS7KvkcpVpDkBYOmZ0/Ib+73XvzviNtLRpzRhTt4N/ms134/ccGnlbgrC6HNTcver/n Bg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3mejre7hfy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:41 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2BDFL2xp017138; Tue, 13 Dec 2022 15:44:41 GMT Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3mejre7hfk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:41 +0000 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDDeVub032045; Tue, 13 Dec 2022 15:44:40 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([9.208.130.102]) by ppma01wdc.us.ibm.com (PPS) with ESMTPS id 3mchr6c9aj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:40 +0000 Received: from smtpav01.dal12v.mail.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2BDFid2w6357532 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Dec 2022 15:44:39 GMT Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6128558057; Tue, 13 Dec 2022 15:44:39 +0000 (GMT) Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F5B858061; Tue, 13 Dec 2022 15:44:38 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.endicott.ibm.com (unknown [9.60.85.43]) by smtpav01.dal12v.mail.com (Postfix) with ESMTP; Tue, 13 Dec 2022 15:44:38 +0000 (GMT) From: Tony Krowiak To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jjherne@linux.ibm.com, freude@linux.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, mjrosato@linux.ibm.com, pasic@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com, fiuczy@linux.ibm.com Subject: [PATCH 1/7] s390/vfio-ap: verify reset complete in separate function Date: Tue, 13 Dec 2022 10:44:31 -0500 Message-Id: <20221213154437.15480-2-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221213154437.15480-1-akrowiak@linux.ibm.com> References: <20221213154437.15480-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: nps-d39EmrNYei5FXUaeSuRmzC8LD-Ui X-Proofpoint-ORIG-GUID: C2hsMtofm9EqD7zVFaKc-zIzQ5T-O5ew X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-13_03,2022-12-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 mlxlogscore=999 clxscore=1015 mlxscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 spamscore=0 impostorscore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212130137 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752114442950069460?= X-GMAIL-MSGID: =?utf-8?q?1752114442950069460?= The vfio_ap_mdev_reset_queue() function contains a loop to verify that the reset successfully completes within 40ms. This patch moves that loop into a separate function. Signed-off-by: Tony Krowiak Reviewed-by: Harald Freudenberger --- drivers/s390/crypto/vfio_ap_ops.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 0b4cc8c597ae..83ff94a38102 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -1587,12 +1587,30 @@ static struct vfio_ap_queue *vfio_ap_find_queue(int apqn) return q; } +static int apq_reset_check(struct vfio_ap_queue *q) +{ + int iters = 2; + struct ap_queue_status status; + + while (iters--) { + msleep(20); + status = ap_tapq(q->apqn, NULL); + if (status.queue_empty && !status.irq_enabled) + return 0; + } + WARN_ONCE(iters <= 0, + "timeout verifying reset of queue %02x.%04x (%u, %u, %u)", + AP_QID_CARD(q->apqn), AP_QID_QUEUE(q->apqn), + status.queue_empty, status.irq_enabled, status.response_code); + + return -EBUSY; +} + static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q, unsigned int retry) { struct ap_queue_status status; int ret; - int retry2 = 2; if (!q) return 0; @@ -1629,14 +1647,8 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q, } /* wait for the reset to take effect */ - while (retry2--) { - if (status.queue_empty && !status.irq_enabled) - break; - msleep(20); - status = ap_tapq(q->apqn, NULL); - } - WARN_ONCE(retry2 <= 0, "unable to verify reset of queue %02x.%04x", - AP_QID_CARD(q->apqn), AP_QID_QUEUE(q->apqn)); + if (!status.queue_empty && status.irq_enabled) + ret = apq_reset_check(q); free_resources: vfio_ap_free_aqic_resources(q); From patchwork Tue Dec 13 15:44:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 32862 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp199516wrn; Tue, 13 Dec 2022 07:49:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf4THIz96vHfYWCqUcXf/FJA+myCTU7EG33NhQ8LJbzsfkdteylKr3dYYxl4IK5waOr5ezb/ X-Received: by 2002:a05:6402:1758:b0:46c:8544:42be with SMTP id v24-20020a056402175800b0046c854442bemr16735851edx.5.1670946561094; Tue, 13 Dec 2022 07:49:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670946561; cv=none; d=google.com; s=arc-20160816; b=dA5AVHf5YANdJvcz7R4A7LnPz2sqoVqG3MqfxpGe60ua7LM5he+Pbyn0vAPYceY5Bk BP5uYl+pAuw2eTokKAjYITAFHrNzzC0/uVpXcEmyXQou/97ZCwWxGKHDh2kS+tUftA7M PlxQVB0u/cdyraK2mSWEdZzjniFW8YE3p2YZIo4gNk2591+CYiXEXvfmgV1irwUC8M+o G7Wcn56fxjrHlBId3rthNJU5x846ucojWNR4SHS+hyYSCgJqRBQ10yvkq7TgldKOoD5T NXWJ65swICwpkaGX1uRBIum6mqVuCQvulg6UaEbUJHSssUNOM2ArAQfahgTC7L6ko83f rJzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aY1/43wckUfehCNKdJ6csQL39vDFoxi2MgSI0RBe/Ik=; b=dU2Tnvf9EKfXcX5C5sHOKs6NQ1Pydr3gpY4TtOeF4BuCUQsYQf1tgNsNQNRsJcllEh 0pkqPTJkxzUlcA/CZRXQtlDx0za0lHsN913I/jf6YaFidhzR8V1K1h6Ria4WMtbjx946 QsLiqDF14vom6bM4wnWBKwslGchZMYdy/BF1M2Zkj3dL6eF1ttABVAA5ItI/35hqDwXx 9hLE6VTnAuHESkcM0/RL8hmOkVS5E6dXt+mnLMTPPwFjJ+xr/DOGeMfCBhk82TLdNHim vWuJKAlpyzlYM7DBHoi3lCkcNjo8Mq1GFrp74yb9x0c2yv4zjMJud2s0yP0xmhPCK1Og gqug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=gW9hPSIR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb17-20020a170907961100b007c1600359ecsi6451072ejc.441.2022.12.13.07.48.57; Tue, 13 Dec 2022 07:49:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=gW9hPSIR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236303AbiLMPoz (ORCPT + 99 others); Tue, 13 Dec 2022 10:44:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236232AbiLMPoq (ORCPT ); Tue, 13 Dec 2022 10:44:46 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C570DEE; Tue, 13 Dec 2022 07:44:45 -0800 (PST) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDFdhRW020393; Tue, 13 Dec 2022 15:44:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=aY1/43wckUfehCNKdJ6csQL39vDFoxi2MgSI0RBe/Ik=; b=gW9hPSIRrwOMgsplbH82K2zWm3PCf/7iUCVW9KK2yzPQrcsyEcf729DsDUjyynRQeVJa 6/D9rPX9iwoi1r/PvinkL69eq5ULkhiU9caZj7dVMFOU5lePSx8HRSMGnpeZ+L0otfuT YGuw5bsH75/YXBpm5Rb+/t9iIIuiwMRaqheJqkRpw4Irt6TGiAp9qxqrpWq00vlx7tkU ACtZrdGsVbC3eTyORQSBCkYLw3HGJrkpWMaz3Quq1QXlkTzDugDuTQByTOlMyCePHxXz WJy/Z/nfxJLGJ2exn0pOs1cHKyM3s4T+UHDTNoAOvwmYFu9MuZixo+Hyomxxy7r1ztRy TQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3meuttrpsx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:43 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2BDFeK4c022865; Tue, 13 Dec 2022 15:44:42 GMT Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3meuttrpsh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:42 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDEqSvx014270; Tue, 13 Dec 2022 15:44:41 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([9.208.130.101]) by ppma03dal.us.ibm.com (PPS) with ESMTPS id 3mchr71aqp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:41 +0000 Received: from smtpav01.dal12v.mail.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2BDFie6P6488830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Dec 2022 15:44:40 GMT Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5048C58058; Tue, 13 Dec 2022 15:44:40 +0000 (GMT) Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7EFA45805D; Tue, 13 Dec 2022 15:44:39 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.endicott.ibm.com (unknown [9.60.85.43]) by smtpav01.dal12v.mail.com (Postfix) with ESMTP; Tue, 13 Dec 2022 15:44:39 +0000 (GMT) From: Tony Krowiak To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jjherne@linux.ibm.com, freude@linux.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, mjrosato@linux.ibm.com, pasic@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com, fiuczy@linux.ibm.com Subject: [PATCH 2/7] s390/vfio_ap: check TAPQ response code when waiting for queue reset Date: Tue, 13 Dec 2022 10:44:32 -0500 Message-Id: <20221213154437.15480-3-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221213154437.15480-1-akrowiak@linux.ibm.com> References: <20221213154437.15480-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: fBTCK1OS6ezh9mZvsnQGLfrHTf9eQgcX X-Proofpoint-GUID: Qyahk5nfIPWuFXMCVck2DnXnviXoiKJO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-13_03,2022-12-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 phishscore=0 suspectscore=0 mlxlogscore=999 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212130137 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752114461539976391?= X-GMAIL-MSGID: =?utf-8?q?1752114461539976391?= The vfio_ap_mdev_reset_queue() function does not check the status response code returned form the PQAP(TAPQ) function when verifying the queue's status; consequently, there is no way of knowing whether verification failed because the wait time was exceeded, or because the PQAP(TAPQ) failed. This patch adds a function to check the status response code from the PQAP(TAPQ) instruction and logs an appropriate message if it fails. Signed-off-by: Tony Krowiak Reviewed-by: Harald Freudenberger --- drivers/s390/crypto/vfio_ap_ops.c | 36 ++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 83ff94a38102..a5530a46cf31 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -1587,23 +1587,49 @@ static struct vfio_ap_queue *vfio_ap_find_queue(int apqn) return q; } +static int apq_status_check(int apqn, struct ap_queue_status *status) +{ + switch (status->response_code) { + case AP_RESPONSE_NORMAL: + case AP_RESPONSE_RESET_IN_PROGRESS: + if (status->queue_empty && !status->irq_enabled) + return 0; + return -EBUSY; + case AP_RESPONSE_DECONFIGURED: + /* + * If the AP queue is deconfigured, any subsequent AP command + * targeting the queue will fail with the same response code. On the + * other hand, when an AP adapter is deconfigured, the associated + * queues are reset, so let's return a value indicating the reset + * for which we're waiting completed successfully. + */ + return 0; + default: + WARN(true, + "failed to verify reset of queue %02x.%04x: TAPQ rc=%u\n", + AP_QID_CARD(apqn), AP_QID_QUEUE(apqn), + status->response_code); + return -EIO; + } +} + static int apq_reset_check(struct vfio_ap_queue *q) { - int iters = 2; + int iters = 2, ret; struct ap_queue_status status; while (iters--) { msleep(20); status = ap_tapq(q->apqn, NULL); - if (status.queue_empty && !status.irq_enabled) - return 0; + ret = apq_status_check(q->apqn, &status); + if (ret != -EBUSY) + return ret; } WARN_ONCE(iters <= 0, "timeout verifying reset of queue %02x.%04x (%u, %u, %u)", AP_QID_CARD(q->apqn), AP_QID_QUEUE(q->apqn), status.queue_empty, status.irq_enabled, status.response_code); - - return -EBUSY; + return ret; } static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q, From patchwork Tue Dec 13 15:44:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 32863 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp199934wrn; Tue, 13 Dec 2022 07:50:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf4QPYA5f11LVxl8/gYkUUh9WAPPC+9tNlRNTkicBZORs8xRfHpYr498875m2OTrzw1CYt5x X-Received: by 2002:aa7:c79a:0:b0:467:b851:6057 with SMTP id n26-20020aa7c79a000000b00467b8516057mr16987124eds.18.1670946608163; Tue, 13 Dec 2022 07:50:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670946608; cv=none; d=google.com; s=arc-20160816; b=O0/+rGHKDBlfum3+c/k5eTV4TYaBPXKHnOHBk3nTwHF2mDeVcPXfJm9jgEfdtJGTTU /8SDpmfQcAMOkn7oJRwh7wUv3NJy7T5WmJBOwXWVT94ZwJ8h2dcPHNXRLuRtGPiQCMro ULyhsrbj6xsyfPTi6mXpLD3iFT1G/9ZQFi7O+h/d7RxTKLndDK4m8wOP2iPg2LKf+xTr 5l9BXy0Cj4t1PPQ2yuaA4MZAss6cpVM2dF1LLot+r511xiY1SYLJxLAbmnYBZhVotqfS aysbnNwTOP7pGVoago+61xSG6A9x80rDuLA3icMIvMglMRLXWumTPyP8oGE2lQOZFsxa 3cyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=15/G/vmJBxZeYg70tSxJkS6nwvsvKmMgrgz76AKrT+c=; b=tM4fvRrhvt+nH2Nlcl3646o+/550HUATWfS3xOJ3yLfKBLa4jLQ+b+SLtMc76mxEu8 WOgte2Oj48ACwbgukOnxsQjTD2eA7fWtNblr4hnn4b7pjHKEqf8hHn6dNK7gG8rdZFF9 mfaagLOUmvZSk5XwfV4wjIONWJzTZce01eGcxxidR7M8YI62Fabtecl2ZvzYirW+WLPk RvO1yiOkzrFEBbq24Pjun9DqDvlkVIph5yt7ZQkTrkh3vbxzHqiCp3EbwJyyFncN4MOK B3S1ZWFxHlByYNf9OenygbrflyLVCvqh4BVdZiLP758TSvnbjYCYMDHNB0RroVqeLJ6f gCbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=p57ZPW9c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z29-20020a50cd1d000000b00468f6919522si9177108edi.564.2022.12.13.07.49.43; Tue, 13 Dec 2022 07:50:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=p57ZPW9c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236264AbiLMPpD (ORCPT + 99 others); Tue, 13 Dec 2022 10:45:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236258AbiLMPor (ORCPT ); Tue, 13 Dec 2022 10:44:47 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5068E6586; Tue, 13 Dec 2022 07:44:46 -0800 (PST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDFR7jU031180; Tue, 13 Dec 2022 15:44:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=15/G/vmJBxZeYg70tSxJkS6nwvsvKmMgrgz76AKrT+c=; b=p57ZPW9cUHwI1JT7Lfe3LF6k5NzolBsOy4shEhYFHma258122KoJhHyxuOVQRAPPxy2Q hbYVqbz0W3Ow+bcvUudSfi29WPqbFSl9FWThkfkL2PT6iMEhdjxLKF/N4HtpO6AkgH1T 3MvEIT/WwoRG+lLxP4/C8qXaYbEVj+jIgCmY26jPJuX6IhIZm8MA9a2m6kOuEs1NtwBU pNI8KHFBW5lyv64/RcDcjcCCZw8Z5saFjR/YZGiRevyrDkWuetGgvD/4Q4hhRHx+T2X1 6BvxY57//S2cdWFs1YvDhP1tAxmEj6HjxJ4h5iWtVaUhkXuhIzlD0fkZq2pET8cjgxkV pQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3mev20ghhd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:44 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2BDFRNoF031576; Tue, 13 Dec 2022 15:44:43 GMT Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3mev20ghh1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:43 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDF01Fo014276; Tue, 13 Dec 2022 15:44:42 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([9.208.130.100]) by ppma03dal.us.ibm.com (PPS) with ESMTPS id 3mchr71aqt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:42 +0000 Received: from smtpav01.dal12v.mail.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2BDFifTa53674472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Dec 2022 15:44:41 GMT Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3B52358057; Tue, 13 Dec 2022 15:44:41 +0000 (GMT) Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6AFF45805D; Tue, 13 Dec 2022 15:44:40 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.endicott.ibm.com (unknown [9.60.85.43]) by smtpav01.dal12v.mail.com (Postfix) with ESMTP; Tue, 13 Dec 2022 15:44:40 +0000 (GMT) From: Tony Krowiak To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jjherne@linux.ibm.com, freude@linux.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, mjrosato@linux.ibm.com, pasic@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com, fiuczy@linux.ibm.com Subject: [PATCH 3/7] s390/vfio_ap: use TAPQ to verify reset in progress completes Date: Tue, 13 Dec 2022 10:44:33 -0500 Message-Id: <20221213154437.15480-4-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221213154437.15480-1-akrowiak@linux.ibm.com> References: <20221213154437.15480-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Gq0kmsOSed9vtqKp1dAXQNDz5l_ohQCv X-Proofpoint-ORIG-GUID: Vuv56c3rfqBjdwcTwHFqEDmtgVYBCyde X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-13_03,2022-12-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 impostorscore=0 clxscore=1011 mlxscore=0 suspectscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212130137 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752114510905665708?= X-GMAIL-MSGID: =?utf-8?q?1752114510905665708?= To eliminate the repeated calls to the PQAP(ZAPQ) function to verify that a reset in progress completed successfully and ensure that error response codes get appropriately logged, let's call the apq_reset_check() function when the ZAPQ response code indicates that a reset that is already in progress. Signed-off-by: Tony Krowiak Reviewed-by: Harald Freudenberger --- drivers/s390/crypto/vfio_ap_ops.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index a5530a46cf31..5bf2d93ae8af 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -33,7 +33,7 @@ static int vfio_ap_mdev_reset_queues(struct ap_queue_table *qtable); static struct vfio_ap_queue *vfio_ap_find_queue(int apqn); static const struct vfio_device_ops vfio_ap_matrix_dev_ops; -static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q, unsigned int retry); +static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q); /** * get_update_locks_for_kvm: Acquire the locks required to dynamically update a @@ -1632,8 +1632,7 @@ static int apq_reset_check(struct vfio_ap_queue *q) return ret; } -static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q, - unsigned int retry) +static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q) { struct ap_queue_status status; int ret; @@ -1648,12 +1647,15 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q, ret = 0; break; case AP_RESPONSE_RESET_IN_PROGRESS: - if (retry--) { - msleep(20); - goto retry_zapq; - } - ret = -EBUSY; - break; + /* + * There is a reset issued by another process in progress. Let's wait + * for that to complete. Since we have no idea whether it was a RAPQ or + * ZAPQ, then if it completes successfully, let's issue the ZAPQ. + */ + ret = apq_reset_check(q); + if (ret) + break; + goto retry_zapq; case AP_RESPONSE_Q_NOT_AVAIL: case AP_RESPONSE_DECONFIGURED: case AP_RESPONSE_CHECKSTOPPED: @@ -1688,7 +1690,7 @@ static int vfio_ap_mdev_reset_queues(struct ap_queue_table *qtable) struct vfio_ap_queue *q; hash_for_each(qtable->queues, loop_cursor, q, mdev_qnode) { - ret = vfio_ap_mdev_reset_queue(q, 1); + ret = vfio_ap_mdev_reset_queue(q); /* * Regardless whether a queue turns out to be busy, or * is not operational, we need to continue resetting @@ -1931,7 +1933,7 @@ void vfio_ap_mdev_remove_queue(struct ap_device *apdev) } } - vfio_ap_mdev_reset_queue(q, 1); + vfio_ap_mdev_reset_queue(q); dev_set_drvdata(&apdev->device, NULL); kfree(q); release_update_locks_for_mdev(matrix_mdev); From patchwork Tue Dec 13 15:44:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 32864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp199984wrn; Tue, 13 Dec 2022 07:50:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf7GbvbgBiYI4eV0reJis0fTHhc/uCc3sl9VxXMbujzqG0U3znZKTmkVzInfeGSdi2q2Obo4 X-Received: by 2002:a17:90a:73c5:b0:218:a343:2330 with SMTP id n5-20020a17090a73c500b00218a3432330mr21088401pjk.14.1670946612751; Tue, 13 Dec 2022 07:50:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670946612; cv=none; d=google.com; s=arc-20160816; b=VrNRR2u0qnoo/dGaY0+Du+Ytdt18Q3lyuQUMwaXc3czVXyQ5YYSdFzCj26K1859Vf0 iqBnJQqmjdFK+c3lc0p3lXubs+ZgjZcvHlXZfRHeK71l5VdGyxQuEm2EFvjOCXosLvVT bbIEz4uNlQ+JuKVtIZfGywCyBdrYHa9p+Im36+xHWKCgWC4mS5fZxeueJdvQx/2X1TZD /sq+CqgtUx+UsQzjA2nV6gxdKDRQg9OVkNS+MlWv8qWY7xojbxPq2w8cvUtSlIjDxiux 90WbPZOmrrhecuSmlVFZmI49AmZn/tf/19FUM5EhIA67ktRqEcwdHtxPieN/BMUNtNx7 v9rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GFSkCfdxivE8yosDtk1dQw3AIraT+zbh6YgluqsCQR0=; b=HPdLThWfXOjNMKdO7LTwTFQ9UhG0ckX+Ns8T6Gm1aS2x7mI3lKV6K8c6eg8JNna4CE /D4CWem4l5wDp/FD3UU4bewGMcXdsryLQWgIGI96raO2wvAm1RHZz+7LdNaCfv2LM4Fo yq6gY5vz1LGQysgfJV+w3cFF5bSWqi8OL6pryR3vPojXwYJTl2r4L8UnasnPt23Dyw2f 7J3cBiBPFMmDcaFixWuwVMDWMyIQ+l8BCuRBfgA8pxBgQEdmnUzSq+cuOlXfoL/FvqHJ EXyFBWzBFM9Oe8v0+6Izl2UuITylqGHVfjIeOKR0/PT7Q4Z6jA6pQ7stf6rk4QPsPWRk P//Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=TLSqUFH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b00478a66122a3si13206102pgb.866.2022.12.13.07.49.59; Tue, 13 Dec 2022 07:50:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=TLSqUFH2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236350AbiLMPpT (ORCPT + 99 others); Tue, 13 Dec 2022 10:45:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236291AbiLMPou (ORCPT ); Tue, 13 Dec 2022 10:44:50 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C24820350; Tue, 13 Dec 2022 07:44:48 -0800 (PST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDFPlIW025599; Tue, 13 Dec 2022 15:44:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=GFSkCfdxivE8yosDtk1dQw3AIraT+zbh6YgluqsCQR0=; b=TLSqUFH2jZzonsXhNT6wXHgRPHLo9x16/N734DbW41JIF1mBCX7eLqZcRWm6gIP5PwFK IYMKhPkd0bEVjdqIMRnfvDuqZBzauqO29y46pF6eylW5ZakscU4PqV8fU00xqbeumF+e EWSLMPEpj0T4bUbruzXL/gvPcyejQ/UgvTGymxg25Mvj10BA1AuhhQ/12yDKrFPeTTWn 5aw9LwHQhM0Wx1OJlNTmaVC5z0TU771Mi3CPKYmAtghuaLQMiQ1k0KgEHNFVYVteL5L4 9cc45j53rqsS+ek7DgDfJPJCygM9dozde+CH2u1BxJhswXmqcgMJOTF4GGh857AwiVH3 8w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3mev1drkdb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:45 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2BDFQ5E9027499; Tue, 13 Dec 2022 15:44:44 GMT Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3mev1drkd0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:44 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDF01Fp014276; Tue, 13 Dec 2022 15:44:43 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([9.208.130.99]) by ppma03dal.us.ibm.com (PPS) with ESMTPS id 3mchr71aqx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:43 +0000 Received: from smtpav01.dal12v.mail.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2BDFigl622741296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Dec 2022 15:44:42 GMT Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 260AC58061; Tue, 13 Dec 2022 15:44:42 +0000 (GMT) Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 560185805D; Tue, 13 Dec 2022 15:44:41 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.endicott.ibm.com (unknown [9.60.85.43]) by smtpav01.dal12v.mail.com (Postfix) with ESMTP; Tue, 13 Dec 2022 15:44:41 +0000 (GMT) From: Tony Krowiak To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jjherne@linux.ibm.com, freude@linux.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, mjrosato@linux.ibm.com, pasic@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com, fiuczy@linux.ibm.com Subject: [PATCH 4/7] s390/vfio_ap: verify ZAPQ completion after return of response code zero Date: Tue, 13 Dec 2022 10:44:34 -0500 Message-Id: <20221213154437.15480-5-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221213154437.15480-1-akrowiak@linux.ibm.com> References: <20221213154437.15480-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 8IeQMLPF4NNvS1nQi5WXg3wvjEMHQvNJ X-Proofpoint-GUID: D9nzezPKchQ8PKuPvS2EkdLItehyzK8z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-13_03,2022-12-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 impostorscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 mlxscore=0 phishscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212130137 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752114515278467463?= X-GMAIL-MSGID: =?utf-8?q?1752114515278467463?= Verification that the asynchronous ZAPQ function has completed only needs to be done when the response code indicates the function was successfully initiated; so, let's call the apq_reset_check function immediately after the response code zero is returned from the ZAPQ. Signed-off-by: Tony Krowiak Reviewed-by: Harald Freudenberger --- drivers/s390/crypto/vfio_ap_ops.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 5bf2d93ae8af..c0cf5050be59 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -1645,6 +1645,9 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q) switch (status.response_code) { case AP_RESPONSE_NORMAL: ret = 0; + /* if the reset has not completed, wait for it to take effect */ + if (!status.queue_empty || status.irq_enabled) + ret = apq_reset_check(q); break; case AP_RESPONSE_RESET_IN_PROGRESS: /* @@ -1674,10 +1677,6 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q) return -EIO; } - /* wait for the reset to take effect */ - if (!status.queue_empty && status.irq_enabled) - ret = apq_reset_check(q); - free_resources: vfio_ap_free_aqic_resources(q); From patchwork Tue Dec 13 15:44:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 32865 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp200128wrn; Tue, 13 Dec 2022 07:50:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf6JLRt/HBiHHiww3ObyfoRb7QSIB2MszPhqjv1wLmzONlMudnSL3a5+Y5Z2cQN+AWSRciXf X-Received: by 2002:a05:6a20:d48f:b0:9d:efbe:a0f5 with SMTP id im15-20020a056a20d48f00b0009defbea0f5mr25662556pzb.5.1670946629483; Tue, 13 Dec 2022 07:50:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670946629; cv=none; d=google.com; s=arc-20160816; b=nWqAh1tkaWpmhsku35suix2z+OYIhCgsQq6I8Xs4LuiJvFnXaRaghBL6NT7noh0rBU PvbeinWpbEINJbv/Q6NNVLMFalUV1ZiRD+ixfLSxr4Uyt+pkFSHlaxDRN3w6Bhy7Nc05 uyxDMlqDMCcXoDkJZtwlLQlF1vk1UU21b3pfjTno/8NeVSpSTKb8vwHuHgsZ8r8xQv3m vl1pjKc1vgLZrcUFeX5wobanFUkxW/p41YuJnngdxz7Igr6TUF3x9DkvVCKdTEWEG3Sd IGyUMejBBmDbxWJYXEFRQ8bly+QXLaeXMFyfCAQ0ZorXrHPBZzO72ZFXSz9HW9kmdF+F aJyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/HQeFvFXqFV0XM1oj4U79Hhc3J2Khc8fBjlo8EEXLU0=; b=WwlEr9RbN7XzkA8+Nsnpj6blq0bSBeT992k4zbyFFGPrqsGj2GDQOtc2n6XsqPfkqS asmShj0QwxQscKCy2Yb7PT3Nk4PJvi9BPgwJosbsHM1BxvquT2r5rpwgwbB/15p4A9pL 4LbQW3vmWzVW3U7Gi+VZc3jgAJdRTmLQk4S63/7c9rFpsaA5l1qMDWkbOs+TzqIPsPDN jQUJigND43dq49IJ/RFZ+zbKM46Fuz+Y1V8TV/6NywZQ2Prp2aDT9ZKQBB9tEZlsEsAv RlYDfPLiN9YV8UhfrmSt9gzELxLrpxFU2YcadN6tY2PiFqkZfP3/Uo5SoxsIdj5T+yGj tLSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rCFXxpzE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f67-20020a636a46000000b00476e62744a8si13039130pgc.388.2022.12.13.07.50.15; Tue, 13 Dec 2022 07:50:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=rCFXxpzE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236319AbiLMPpW (ORCPT + 99 others); Tue, 13 Dec 2022 10:45:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236294AbiLMPow (ORCPT ); Tue, 13 Dec 2022 10:44:52 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C7E6DEE; Tue, 13 Dec 2022 07:44:49 -0800 (PST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDFPk3o025564; Tue, 13 Dec 2022 15:44:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=/HQeFvFXqFV0XM1oj4U79Hhc3J2Khc8fBjlo8EEXLU0=; b=rCFXxpzEgJtvIJMvYKEki+51wPlzpD5luGAlc1YzJ9MvfcgSoLEkruEds5Y4gy8TWBVb qjFTciQ5a3UgiDFNQd2zR4ZkzM4lzb8FGxyi9PZylVpXoqJlKRtfuwcXX/f+aZd29jTg 3Q2SiQBybMyNn8Nb6/BEvoTGekgk0uqdIOchm7rl1hgWASp9/XR6hvP3qPGVy7REAh3D 5iH4dJGWD1+ykOKb8bZ6n9mPS1Mbr3F6xNDjMGguaa7BvzvZ6fVkKqTFkBjxZoLAt4XG wnU81njjZw1lHPqHdWjbJFveI//MJRh9kIG1YXNXBHHwWvsQ0qmtvcH4ObSRW/xbSF8M Lg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3mev1drke0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:46 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2BDFRen9004108; Tue, 13 Dec 2022 15:44:46 GMT Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3mev1drkdk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:46 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDDhTav007534; Tue, 13 Dec 2022 15:44:45 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([9.208.129.119]) by ppma04wdc.us.ibm.com (PPS) with ESMTPS id 3mchr6mahp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:45 +0000 Received: from smtpav01.dal12v.mail.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2BDFihEt36831664 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Dec 2022 15:44:43 GMT Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 126AD58061; Tue, 13 Dec 2022 15:44:43 +0000 (GMT) Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 431AC58057; Tue, 13 Dec 2022 15:44:42 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.endicott.ibm.com (unknown [9.60.85.43]) by smtpav01.dal12v.mail.com (Postfix) with ESMTP; Tue, 13 Dec 2022 15:44:42 +0000 (GMT) From: Tony Krowiak To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jjherne@linux.ibm.com, freude@linux.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, mjrosato@linux.ibm.com, pasic@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com, fiuczy@linux.ibm.com Subject: [PATCH 5/7] s390/vfio_ap: fix handling of error response codes Date: Tue, 13 Dec 2022 10:44:35 -0500 Message-Id: <20221213154437.15480-6-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221213154437.15480-1-akrowiak@linux.ibm.com> References: <20221213154437.15480-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 60Bbzj8n0Xmo-tq8yaMQBoTDtDz7-ier X-Proofpoint-GUID: Xk6xYjLMjVrN-0e5DWApVh4e2gRCVC_9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-13_03,2022-12-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 impostorscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 mlxscore=0 phishscore=0 priorityscore=1501 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212130137 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752114532825553823?= X-GMAIL-MSGID: =?utf-8?q?1752114532825553823?= Some response codes returned from the queue reset function are not being handled correctly; this patch fixes them: 1. Response code 3, AP queue deconfigured: Deconfiguring an AP adapter resets all of its queues, so this is handled by indicating the reset verification completed successfully. 2. For all response codes other than 0 (normal reset completion), 2 (queue reset in progress) and 3 (AP deconfigured), the -EIO error will be returned from the vfio_ap_mdev_reset_queue() function. In all cases, all fields of the status word other than the response code will be set to zero, so it makes no sense to check status bits. Signed-off-by: Tony Krowiak Reviewed-by: Harald Freudenberger --- drivers/s390/crypto/vfio_ap_ops.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index c0cf5050be59..dbf681715a6d 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -1659,17 +1659,15 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q) if (ret) break; goto retry_zapq; - case AP_RESPONSE_Q_NOT_AVAIL: case AP_RESPONSE_DECONFIGURED: - case AP_RESPONSE_CHECKSTOPPED: - WARN_ONCE(status.irq_enabled, - "PQAP/ZAPQ for %02x.%04x failed with rc=%u while IRQ enabled", - AP_QID_CARD(q->apqn), AP_QID_QUEUE(q->apqn), - status.response_code); - ret = -EBUSY; - goto free_resources; + /* + * When an AP adapter is deconfigured, the associated + * queues are reset, so let's return a value indicating the reset + * completed successfully. + */ + ret = 0; + break; default: - /* things are really broken, give up */ WARN(true, "PQAP/ZAPQ for %02x.%04x failed with invalid rc=%u\n", AP_QID_CARD(q->apqn), AP_QID_QUEUE(q->apqn), @@ -1677,7 +1675,6 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q) return -EIO; } -free_resources: vfio_ap_free_aqic_resources(q); return ret; From patchwork Tue Dec 13 15:44:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 32867 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp200486wrn; Tue, 13 Dec 2022 07:51:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf42FfAkG+0HwTRA4ao5Rz2LfD3WitW+GFotzdaZerXTBBrrid8o3DWcgnLKX0Au1fJmYsMY X-Received: by 2002:a05:6402:249e:b0:470:174c:4fe with SMTP id q30-20020a056402249e00b00470174c04femr4752114eda.8.1670946675246; Tue, 13 Dec 2022 07:51:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670946675; cv=none; d=google.com; s=arc-20160816; b=D0NP981hgRJhtbihNedX3nxJTs/JcQDWPA0HzVFEHYXyEqYfXtmO2K79E2MasIEtYf ynQB7NCQPLZWA2TqqUj4aYKb903KBWJ6RU9vFJikvhYZYJgfGU3BuK0TeeI6UVNQUKLI DqexFf8DIGWtYqNW0c1sJFqRj6CVfbnPYmt7qyox6YgLha3B+zXmC243qR8zgnoA/Ox5 fROFA7osy15/FzHgmvxIS6VqjfjuR6T+Mlrb3ZLAZ81CTasTKBeq3OKti+o7juZgn/CV eXX/9lnsK8QbKIp3wZZ/aiSpDq+d8i5QZB0hfKeB8qcS0NVFRkNVBsY5GxVKv67mOfoz NncQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dfFEvzxcZTkwSQ/e3MtFp13igO39lEXpwrF8wYyyIak=; b=r+qUXkneuQn3wWlZ63DyK/eeBAT6ml33Q0YNpDsco/m8MlLQYON87Urpep1ZWIbhx+ PeIKGOBAMnbHWlU1i/x+IqaaDnKLMRcBBdjqMlyE066H2BFIFRqk0sXb1Z24pr/bI9OG 0ZHmpIGQIEpbgBOPrPS9zt77Dc5N8W5a5dkUeP/yv00KvUTFavL3iw/edpc5Pb0p+YXi w7flh9DL2QvpPV9VJ3u11bFiDVdYBQjWX2x7qv3XogHcxK7MfxLpAjGa0fUY05Hd5805 7xL3HtCznK5PfX4h3Y8aCAwbLfqkhG5tZUu/BcGAq1mvq3XOwlJLK0X9fwZPZ/GzeOM2 /P9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=TSW4U4fg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn26-20020a1709070d1a00b007c0c0cb9f25si9846546ejc.3.2022.12.13.07.50.48; Tue, 13 Dec 2022 07:51:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=TSW4U4fg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236294AbiLMPp1 (ORCPT + 99 others); Tue, 13 Dec 2022 10:45:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236296AbiLMPow (ORCPT ); Tue, 13 Dec 2022 10:44:52 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24EF3BFE; Tue, 13 Dec 2022 07:44:50 -0800 (PST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDFR2tM030522; Tue, 13 Dec 2022 15:44:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=dfFEvzxcZTkwSQ/e3MtFp13igO39lEXpwrF8wYyyIak=; b=TSW4U4fgkvQjwCVTesfPQy8uo9QNaav5olbP0iucOICbujiI2TkZK1goU7s8nW3AthL7 EIaWHmF5f5avrHWOBL6NB4vl/obAE2ZhTPriqqy3BaZypa9+DPraCNRhGW7c3DsZDyns KL8hkQjytSkYGlCi28H1S44q4Fpybu+0IkLKWgO1h1qrk0l4bLhLmxTSn9Q/AZpPKvAT O1Mh9/X+ip2QNYmFxFjQdrT81kzI+7zApH8R+YhUad2s89tt4ERH0ehqHQ3ow2rm1HBh lOp7gH1J9eVHE8/md2C+x+6awuWUIW49MZaN9Gl8xSn2OivSttIW7OFY0P+T3TeQJxZL rA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3mev20ghjt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:47 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2BDFVlj4019383; Tue, 13 Dec 2022 15:44:47 GMT Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3mev20ghje-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:47 +0000 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.17.1.19/8.16.1.2) with ESMTP id 2BDDl6aV011447; Tue, 13 Dec 2022 15:44:46 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([9.208.129.120]) by ppma05wdc.us.ibm.com (PPS) with ESMTPS id 3mchr6m9a4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:46 +0000 Received: from smtpav01.dal12v.mail.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2BDFii5s6160908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Dec 2022 15:44:44 GMT Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F0BF358058; Tue, 13 Dec 2022 15:44:43 +0000 (GMT) Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2CFCD58063; Tue, 13 Dec 2022 15:44:43 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.endicott.ibm.com (unknown [9.60.85.43]) by smtpav01.dal12v.mail.com (Postfix) with ESMTP; Tue, 13 Dec 2022 15:44:43 +0000 (GMT) From: Tony Krowiak To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jjherne@linux.ibm.com, freude@linux.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, mjrosato@linux.ibm.com, pasic@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com, fiuczy@linux.ibm.com Subject: [PATCH 6/7] s390/vfio_ap: increase max wait time for reset verification Date: Tue, 13 Dec 2022 10:44:36 -0500 Message-Id: <20221213154437.15480-7-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221213154437.15480-1-akrowiak@linux.ibm.com> References: <20221213154437.15480-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 30oDbVs1f4I-rMgOaXNxWr9Kx0pMScRV X-Proofpoint-ORIG-GUID: T08x9ExxlZxzxJTzYMzDH47Yqi95saXt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-13_03,2022-12-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 malwarescore=0 bulkscore=0 impostorscore=0 clxscore=1015 mlxscore=0 suspectscore=0 adultscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212130137 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752114581168570035?= X-GMAIL-MSGID: =?utf-8?q?1752114581168570035?= Increase the maximum time to wait for verification of a queue reset operation to 200ms. Signed-off-by: Tony Krowiak Reviewed-by: Harald Freudenberger --- drivers/s390/crypto/vfio_ap_ops.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index dbf681715a6d..e80c5a6b91be 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -30,6 +30,9 @@ #define AP_QUEUE_UNASSIGNED "unassigned" #define AP_QUEUE_IN_USE "in use" +#define MAX_RESET_CHECK_WAIT 200 /* Sleep max 200ms for reset check */ +#define AP_RESET_INTERVAL 20 /* Reset sleep interval (20ms) */ + static int vfio_ap_mdev_reset_queues(struct ap_queue_table *qtable); static struct vfio_ap_queue *vfio_ap_find_queue(int apqn); static const struct vfio_device_ops vfio_ap_matrix_dev_ops; @@ -1615,11 +1618,12 @@ static int apq_status_check(int apqn, struct ap_queue_status *status) static int apq_reset_check(struct vfio_ap_queue *q) { - int iters = 2, ret; + int ret; + int iters = MAX_RESET_CHECK_WAIT / AP_RESET_INTERVAL; struct ap_queue_status status; - while (iters--) { - msleep(20); + for (; iters > 0; iters--) { + msleep(AP_RESET_INTERVAL); status = ap_tapq(q->apqn, NULL); ret = apq_status_check(q->apqn, &status); if (ret != -EBUSY) From patchwork Tue Dec 13 15:44:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 32866 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp200413wrn; Tue, 13 Dec 2022 07:51:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf6RMa8+tgN8GcCMhtlnjJyJusLBQ7I1nh2yNakCH068CrjTbDW6YaE6nVVnnDoPXsK/8r5b X-Received: by 2002:a17:90a:b38b:b0:219:8e19:6ebf with SMTP id e11-20020a17090ab38b00b002198e196ebfmr21987802pjr.0.1670946664731; Tue, 13 Dec 2022 07:51:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670946664; cv=none; d=google.com; s=arc-20160816; b=wM/au8oto3/zayolSGgc74ydnxZkEXLXCCKFTRm9dTd2hUgBit+gG9oTKbcG5GTHJF 2qzz96vJAmKC1Jb2R8Z5eVrUsLIoNJynTeMz3rZZITuCJihNb4opb3nQz66E9uU3wJ8j YHSmHC+j5+xUdrKX7XgjnzHnTWqIqjVhkjZlQi588vEUcPisUaI6CitLllwg2UCbbaDK kOJvc1Prau7CPG513XA2Aa04PTWXoc3GNkUIzKDt0eG058XUra7y3BV+RmI6ih/kRCEP 278+5cBW3HU5Rx3PiJDyl3vPm/JRnL3iyqEmaiCMpr+yFDECSdvA97Edo+55A7fjz8M4 eW5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dYhjc5kWligafOgB8GuVnFGfTxaEiO4j/8IIwD5XiyY=; b=ay+Q8B9aqavW0hHG0F98r9Diwhvlnvl8nuXZ8bRKKTbJIcRVy0ANXmXxL7d2lLcDap 1qQVjkKYCdDGFP0zQgO16Cr9ugB2dhDMHo06eVM5aQrXeHcR681K37owTE5gNWGP8h7g yPiUlGPypsm5Ei8VK9WlBtGnDF3R6G3yTvOyHIgzwnQ5rCrciw7zTg5puHDwD53jJLeF iSxILZ+GXeUWA/+CGW8NmugCBRMtXhTWu4In1VwtM0zd9dw8xkuBQX4j6AN9co2zWRRW zvO457kLMgY+IbWcDQ1Vf/r/s7h/D5wHICcVvntd2+Pe6/KzHQSQLFX1G74fA0DUTHTH v7ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=kRFtQSZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pq14-20020a17090b3d8e00b0020087bc6415si12420233pjb.16.2022.12.13.07.50.48; Tue, 13 Dec 2022 07:51:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=kRFtQSZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236206AbiLMPpb (ORCPT + 99 others); Tue, 13 Dec 2022 10:45:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236317AbiLMPpA (ORCPT ); Tue, 13 Dec 2022 10:45:00 -0500 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10E0620BF6; Tue, 13 Dec 2022 07:44:51 -0800 (PST) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDE94u7024712; Tue, 13 Dec 2022 15:44:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=dYhjc5kWligafOgB8GuVnFGfTxaEiO4j/8IIwD5XiyY=; b=kRFtQSZVJXvCGvpxfXK0gZgaEBMy625C0R0wvE+6K/UckxoFkOfyz5jkf5kZ6KDi0N4l x80IMvjEdX6W1od2vTYwF6WVMvKgdVYwtwD9X1gxrWkUFWmW9zcKcWqKS2F9lxe1N4CO ks7MnPBor2ffacjvN5QsdXXZWlqehVPqm3Wx9zb1ZKY2klH2BKNoc9tCuuuYqHIgpddv ohPEiL5fhK3IyT/rymossDtQfDsJ7GJNX3hBE8vtrpgiDcaoE8OD2jLerfa8YkGVXWtY j/lNkluZW/4oPWXS0pMdUvrrd8yagGYADL2xZhwLZAx2uMOSeyKklH2f8tk//yC4PFIZ GA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3merrwx62t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:48 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2BDE9Ita025290; Tue, 13 Dec 2022 15:44:47 GMT Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3merrwx62g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:47 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 2BDF0AV9014246; Tue, 13 Dec 2022 15:44:47 GMT Received: from smtprelay03.wdc07v.mail.ibm.com ([9.208.129.113]) by ppma03dal.us.ibm.com (PPS) with ESMTPS id 3mchr71ark-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 13 Dec 2022 15:44:47 +0000 Received: from smtpav01.dal12v.mail.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay03.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2BDFijPL12386904 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Dec 2022 15:44:45 GMT Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E66E458062; Tue, 13 Dec 2022 15:44:44 +0000 (GMT) Received: from smtpav01.dal12v.mail.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1756A58061; Tue, 13 Dec 2022 15:44:44 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.endicott.ibm.com (unknown [9.60.85.43]) by smtpav01.dal12v.mail.com (Postfix) with ESMTP; Tue, 13 Dec 2022 15:44:43 +0000 (GMT) From: Tony Krowiak To: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: jjherne@linux.ibm.com, freude@linux.ibm.com, borntraeger@de.ibm.com, cohuck@redhat.com, mjrosato@linux.ibm.com, pasic@linux.ibm.com, alex.williamson@redhat.com, kwankhede@nvidia.com, fiuczy@linux.ibm.com Subject: [PATCH 7/7] s390/vfio_ap: always clean up IRQ resources Date: Tue, 13 Dec 2022 10:44:37 -0500 Message-Id: <20221213154437.15480-8-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221213154437.15480-1-akrowiak@linux.ibm.com> References: <20221213154437.15480-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 0bc9XSk5zSCN7iKKkVrxs2D9oINrkIKo X-Proofpoint-GUID: jtn6kGRV9ID3adBZ7aPC5x3iDqPs2fcn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-12-13_03,2022-12-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 impostorscore=0 suspectscore=0 adultscore=0 priorityscore=1501 phishscore=0 mlxscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2212130137 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752114570146282147?= X-GMAIL-MSGID: =?utf-8?q?1752114570146282147?= Clean up IRQ resources even when a PQAP(ZAPQ) function fails with an error not handled by a case statement. Signed-off-by: Tony Krowiak Reviewed-by: Harald Freudenberger --- drivers/s390/crypto/vfio_ap_ops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index e80c5a6b91be..2dd8db9ddb39 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -1676,7 +1676,7 @@ static int vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q) "PQAP/ZAPQ for %02x.%04x failed with invalid rc=%u\n", AP_QID_CARD(q->apqn), AP_QID_QUEUE(q->apqn), status.response_code); - return -EIO; + break; } vfio_ap_free_aqic_resources(q);