From patchwork Thu Jul 28 16:05:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 12931534 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AFD3C04A68 for ; Thu, 28 Jul 2022 16:12:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231796AbiG1QMU (ORCPT ); Thu, 28 Jul 2022 12:12:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231468AbiG1QMQ (ORCPT ); Thu, 28 Jul 2022 12:12:16 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E69E53F33D; Thu, 28 Jul 2022 09:12:14 -0700 (PDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26SG1O2H011481; Thu, 28 Jul 2022 16:12:12 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 : content-transfer-encoding : mime-version; s=pp1; bh=yTzB4wfkcXbSI3ExwsSky3mHTOiWhnZj+EBpYI3UjGw=; b=c+S04RSwc00rsNXdpiCnikz4bpVtKnLLWvNb1GQpkaZxM8cZAsT1aC5m/wUeL50Ju4r3 FGycBuJYFp7MbLM0D2O7o0DbGVWXCRbXpefKbl2+tv0LNc5qS8rvLb3Al+ZJXoAfsFRO atlkugt8g6OYRB6JhC/hJkw6DZKQZAM9HySGaATfAddLeFWsepsHnqtziylGlogH4HEs aSw9PYMzq9pvtYDjq0RMo3YIYbe+b1xSqCP5KmY/HH5j99g1lsoIvCzjGlVCQVH0RIom BJDlVUVF4mvjv24EbpBxUjyH7atZg78ad7m3OdMU1LKEe3pcxzGLGQq/SCuwmKkPLJtw eA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hkwm40e3b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Jul 2022 16:12:11 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 26SG8FDE012494; Thu, 28 Jul 2022 16:12:11 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hkwm40e1y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Jul 2022 16:12:11 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 26SG5S2X012035; Thu, 28 Jul 2022 16:12:08 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma01fra.de.ibm.com with ESMTP id 3hg98nemhq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Jul 2022 16:12:08 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 26SGC5Fr29163888 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Jul 2022 16:12:05 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 51318AE056; Thu, 28 Jul 2022 16:12:05 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3F65DAE053; Thu, 28 Jul 2022 16:12:05 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 28 Jul 2022 16:12:05 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id 10E03E092A; Thu, 28 Jul 2022 18:05:52 +0200 (CEST) From: Eric Farman To: Matthew Rosato , Alex Williamson Cc: Jason Gunthorpe , Cornelia Huck , Halil Pasic , Christian Borntraeger , Nicolin Chen , linux-s390@vger.kernel.org, kvm@vger.kernel.org, Eric Farman Subject: [PATCH v2 1/3] vfio/ccw: Add length to DMA_UNMAP checks Date: Thu, 28 Jul 2022 18:05:48 +0200 Message-Id: <20220728160550.2119289-2-farman@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220728160550.2119289-1-farman@linux.ibm.com> References: <20220728160550.2119289-1-farman@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ctUzsi586fiOJZf0TvQ3iOScW6jVvz5v X-Proofpoint-ORIG-GUID: 1whFYETBTlxpamFNMP9DtmiN7nsjXM_A X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-28_06,2022-07-28_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 spamscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207280073 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org As pointed out with the simplification of the VFIO_IOMMU_NOTIFY_DMA_UNMAP notifier [1], the length parameter was never used to check against the pinned pages. Let's correct that, and see if a page is within the affected range instead of simply the first page of the range. [1] https://lore.kernel.org/kvm/20220720170457.39cda0d0.alex.williamson@redhat.com/ Signed-off-by: Eric Farman Reviewed-by: Matthew Rosato --- drivers/s390/cio/vfio_ccw_cp.c | 14 ++++++++++---- drivers/s390/cio/vfio_ccw_cp.h | 2 +- drivers/s390/cio/vfio_ccw_ops.c | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index 8963f452f963..6202f1e3e792 100644 --- a/drivers/s390/cio/vfio_ccw_cp.c +++ b/drivers/s390/cio/vfio_ccw_cp.c @@ -170,12 +170,17 @@ static void page_array_unpin_free(struct page_array *pa, struct vfio_device *vde kfree(pa->pa_iova); } -static bool page_array_iova_pinned(struct page_array *pa, unsigned long iova) +static bool page_array_iova_pinned(struct page_array *pa, unsigned long iova, + unsigned long length) { + unsigned long iova_pfn_start = iova >> PAGE_SHIFT; + unsigned long iova_pfn_end = (iova + length - 1) >> PAGE_SHIFT; + unsigned long pfn; int i; for (i = 0; i < pa->pa_nr; i++) - if (pa->pa_iova[i] == iova) + pfn = pa->pa_iova[i] >> PAGE_SHIFT; + if (pfn >= iova_pfn_start && pfn <= iova_pfn_end) return true; return false; @@ -899,11 +904,12 @@ void cp_update_scsw(struct channel_program *cp, union scsw *scsw) * cp_iova_pinned() - check if an iova is pinned for a ccw chain. * @cp: channel_program on which to perform the operation * @iova: the iova to check + * @length: the length to check from @iova * * If the @iova is currently pinned for the ccw chain, return true; * else return false. */ -bool cp_iova_pinned(struct channel_program *cp, u64 iova) +bool cp_iova_pinned(struct channel_program *cp, u64 iova, u64 length) { struct ccwchain *chain; int i; @@ -913,7 +919,7 @@ bool cp_iova_pinned(struct channel_program *cp, u64 iova) list_for_each_entry(chain, &cp->ccwchain_list, next) { for (i = 0; i < chain->ch_len; i++) - if (page_array_iova_pinned(chain->ch_pa + i, iova)) + if (page_array_iova_pinned(chain->ch_pa + i, iova, length)) return true; } diff --git a/drivers/s390/cio/vfio_ccw_cp.h b/drivers/s390/cio/vfio_ccw_cp.h index 3194d887e08e..54d26e242533 100644 --- a/drivers/s390/cio/vfio_ccw_cp.h +++ b/drivers/s390/cio/vfio_ccw_cp.h @@ -46,6 +46,6 @@ void cp_free(struct channel_program *cp); int cp_prefetch(struct channel_program *cp); union orb *cp_get_orb(struct channel_program *cp, u32 intparm, u8 lpm); void cp_update_scsw(struct channel_program *cp, union scsw *scsw); -bool cp_iova_pinned(struct channel_program *cp, u64 iova); +bool cp_iova_pinned(struct channel_program *cp, u64 iova, u64 length); #endif diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c index 0047fd88f938..3f67fa103c7f 100644 --- a/drivers/s390/cio/vfio_ccw_ops.c +++ b/drivers/s390/cio/vfio_ccw_ops.c @@ -39,7 +39,7 @@ static void vfio_ccw_dma_unmap(struct vfio_device *vdev, u64 iova, u64 length) container_of(vdev, struct vfio_ccw_private, vdev); /* Drivers MUST unpin pages in response to an invalidation. */ - if (!cp_iova_pinned(&private->cp, iova)) + if (!cp_iova_pinned(&private->cp, iova, length)) return; vfio_ccw_mdev_reset(private); From patchwork Thu Jul 28 16:05:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 12931531 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25F26C19F2B for ; Thu, 28 Jul 2022 16:12:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231461AbiG1QMQ (ORCPT ); Thu, 28 Jul 2022 12:12:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229774AbiG1QMP (ORCPT ); Thu, 28 Jul 2022 12:12:15 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9B3E1037; Thu, 28 Jul 2022 09:12:13 -0700 (PDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26SG1Mh3011311; Thu, 28 Jul 2022 16:12:11 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=qB68A5QY/wbdDNHTOiddBzK7bcdlG86Y2WXVCoS+teg=; b=VQj0fG+FnxcI5UCZXEF+0JFRh1V3tuRahF/a+0PP0FBfZrGwc8sVKDro8LKQOxKGofho 3gcp5RJTvYYAiK1Zv5mhOQkSAOxfqxiLO/rwAmg2P+C1msyWEj5PIeQvgCxsHY3zCoel tOQ3YdIV7O7Gxq3I7u3epEmMqdGGqB+UF+9fRrppCZ8wZDkfa8jhb86P49O8VXQIFkx7 ofW8XsxoIhce+ZF0EKM5lmHB8EnemJbh2UyqYCThMNrX/WyZ9X1swXb33QlwGy7Kjaoa 7D8+R2nHg1iGs90hNZOaH1jKloiOTeCbExbVm078WAIfJwFfgEMhCY0Ojtavl1XMV6bb Aw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hkwm40e34-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Jul 2022 16:12:11 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 26SG1fl2012332; Thu, 28 Jul 2022 16:12:11 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hkwm40e1v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Jul 2022 16:12:10 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 26SG5ZSO011786; Thu, 28 Jul 2022 16:12:08 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 3hg96wpk9p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Jul 2022 16:12:08 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 26SGCJDv32768506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Jul 2022 16:12:19 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 48A5152054; Thu, 28 Jul 2022 16:12:05 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3532252051; Thu, 28 Jul 2022 16:12:05 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id 13DBCE098F; Thu, 28 Jul 2022 18:05:52 +0200 (CEST) From: Eric Farman To: Matthew Rosato , Alex Williamson Cc: Jason Gunthorpe , Cornelia Huck , Halil Pasic , Christian Borntraeger , Nicolin Chen , linux-s390@vger.kernel.org, kvm@vger.kernel.org, Eric Farman Subject: [PATCH v2 2/3] vfio/ccw: Remove FSM Close from remove handlers Date: Thu, 28 Jul 2022 18:05:49 +0200 Message-Id: <20220728160550.2119289-3-farman@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220728160550.2119289-1-farman@linux.ibm.com> References: <20220728160550.2119289-1-farman@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: AmmRkiLdjZUoZMTMhAb5-HN-2s4vuUyJ X-Proofpoint-ORIG-GUID: ofz9oaBMLa2SZNpyeWkFsme_3xzrSHry X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-28_06,2022-07-28_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 spamscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207280073 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Now that neither vfio_ccw_sch_probe() nor vfio_ccw_mdev_probe() affect the FSM state, it doesn't make sense for their _remove() counterparts try to revert things in this way. Since the FSM open and close are handled alongside MDEV open/close, these are unnecessary. Signed-off-by: Eric Farman Reviewed-by: Matthew Rosato --- drivers/s390/cio/vfio_ccw_drv.c | 1 - drivers/s390/cio/vfio_ccw_ops.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c index 4804101ccb0f..86d9e428357b 100644 --- a/drivers/s390/cio/vfio_ccw_drv.c +++ b/drivers/s390/cio/vfio_ccw_drv.c @@ -241,7 +241,6 @@ static void vfio_ccw_sch_remove(struct subchannel *sch) { struct vfio_ccw_private *private = dev_get_drvdata(&sch->dev); - vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_CLOSE); mdev_unregister_device(&sch->dev); dev_set_drvdata(&sch->dev, NULL); diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c index 3f67fa103c7f..4a806a2273b5 100644 --- a/drivers/s390/cio/vfio_ccw_ops.c +++ b/drivers/s390/cio/vfio_ccw_ops.c @@ -130,8 +130,6 @@ static void vfio_ccw_mdev_remove(struct mdev_device *mdev) vfio_unregister_group_dev(&private->vdev); - vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_CLOSE); - vfio_uninit_group_dev(&private->vdev); atomic_inc(&private->avail); } From patchwork Thu Jul 28 16:05:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Farman X-Patchwork-Id: 12931532 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6C28C3F6B0 for ; Thu, 28 Jul 2022 16:12:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231674AbiG1QMR (ORCPT ); Thu, 28 Jul 2022 12:12:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbiG1QMP (ORCPT ); Thu, 28 Jul 2022 12:12:15 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1DCB3DF2C; Thu, 28 Jul 2022 09:12:14 -0700 (PDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26SFlLPf024645; Thu, 28 Jul 2022 16:12:11 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=g0+JB1nWC1+o1YMbiG5nEyLpot84x3ty03qwELNs8ig=; b=nmQ6rn8dyaYWglNvOdFu5WPl6K57qOEoLgxIOxJOEn+yXKNcMUCFxtuqrigDtbwX9eK/ wB26dvwuAuZb7NjLcEQCDpiBj9JEMxc1e6AMkzoJou+1kHMuN7/Sx5cKWHykWbbgjbRN o94XbufLTWMgflGq31Aq54i3EINubtspZlVtgkEQWFNiWH049lSd9SniaXmKA9/BxC6L URPTfyrAtZLwnri7rZ/NiZgkb8Ryz7SpijfYnR+4ON9EGVJsUeJEU4lQOsXPWHXpOtVZ QiJuizKtYzjZAX5rEhMlLTrgkkFz1gCB3EcSXbgplgdTnFGmNPmKRrwyYI9lyDeVqLIm 9w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hkwdhgvxb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Jul 2022 16:12:11 +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 26SForGQ020666; Thu, 28 Jul 2022 16:12:11 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3hkwdhgvw4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Jul 2022 16:12:10 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 26SG5DA4018637; Thu, 28 Jul 2022 16:12:08 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma03ams.nl.ibm.com with ESMTP id 3hh6eun8wm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 28 Jul 2022 16:12:08 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 26SGCJ2030605784 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Jul 2022 16:12:19 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D87952057; Thu, 28 Jul 2022 16:12:05 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3918552052; Thu, 28 Jul 2022 16:12:05 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 4958) id 16A3FE1231; Thu, 28 Jul 2022 18:05:52 +0200 (CEST) From: Eric Farman To: Matthew Rosato , Alex Williamson Cc: Jason Gunthorpe , Cornelia Huck , Halil Pasic , Christian Borntraeger , Nicolin Chen , linux-s390@vger.kernel.org, kvm@vger.kernel.org, Eric Farman Subject: [PATCH v2 3/3] vfio/ccw: Check return code from subchannel quiesce Date: Thu, 28 Jul 2022 18:05:50 +0200 Message-Id: <20220728160550.2119289-4-farman@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220728160550.2119289-1-farman@linux.ibm.com> References: <20220728160550.2119289-1-farman@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 7G8umVfg8CDtee2lXC5RMHsirOPbTvpg X-Proofpoint-ORIG-GUID: htO8ObBA130TTcxVW84U9O-GPiUSsy7I X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-28_06,2022-07-28_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 spamscore=0 priorityscore=1501 bulkscore=0 mlxscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207280073 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org If a subchannel is busy when a close is performed, the subchannel needs to be quiesced and left nice and tidy, so nothing unexpected (like a solicited interrupt) shows up while in the closed state. Unfortunately, the return code from this call isn't checked, so any busy subchannel is treated as a failing one. Fix that, so that the close on a busy subchannel happens normally. Signed-off-by: Eric Farman Reviewed-by: Matthew Rosato --- drivers/s390/cio/vfio_ccw_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/s390/cio/vfio_ccw_fsm.c b/drivers/s390/cio/vfio_ccw_fsm.c index 4b8b623df24f..a59c758869f8 100644 --- a/drivers/s390/cio/vfio_ccw_fsm.c +++ b/drivers/s390/cio/vfio_ccw_fsm.c @@ -407,7 +407,7 @@ static void fsm_close(struct vfio_ccw_private *private, ret = cio_disable_subchannel(sch); if (ret == -EBUSY) - vfio_ccw_sch_quiesce(sch); + ret = vfio_ccw_sch_quiesce(sch); if (ret) goto err_unlock;