From patchwork Wed Nov 29 14:53:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 171409 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp391384vqn; Wed, 29 Nov 2023 06:54:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDHesedQElsmlCyIbk8Z/YrD+OhgyQKPSoT8F7/6FadaOmODqqplGR9WqOkfURfk3W5ef5 X-Received: by 2002:a05:6808:8e8:b0:3ab:38b0:8b84 with SMTP id d8-20020a05680808e800b003ab38b08b84mr18998756oic.17.1701269664351; Wed, 29 Nov 2023 06:54:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701269664; cv=none; d=google.com; s=arc-20160816; b=JM4JtY8FtLaGIQa98ZKdai7t049hzB49phnuYgTiNpl7M07EmwwxqNy3SKM7jbchxH rbNOUcbLaoXd1HE93usb9jHYnbGLa5CfD4o490TQ0mI/cT6hGIFlyp7sylDjUdKRAXw3 wnfJRd5x9olMTOiFOP3uT7Om8PZ+7q8PwFQKrIEGt1/8taHEvInUbjfmOJKkXqLeRLvz NEeFYYrNaO0dufY9G/Xkl/8xeGL3ragU2Bd0rZ8DfP8MUHRaFL4fAWedD5J25wKmIDh+ vyD0PPZz4Q6D+TKaLJs3zS9R/tJwIQe/iJ1A9zwDKjW2Z7DNEzR6IplXk2TorHRgOu97 WHtA== 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=nrvFh2fd1vzzeix+pUFKXs76rwQENYotxEwliyOjHjs=; fh=Q0aZh5A0NyCCYrXoGbdbH6+NKiZKArINP/Zla+a0XpA=; b=w1oow2XjV3U//4ZRMpFb5i68qqAgPHSIDSulVAzhbNaEa3AJ+eCpzSeWhRB9ODdFVA 71gbbW6HCIxhbENbNV8o9fKK0SOq35X4hxoqkt9XhIpg5cl0UUZL5Pf/ZyFYNTuPmjbY R1fm0ljGhwVqmrcsNLxl4ZetWHmu1orYyLGxKliU8XT62eaHpCwQMhpCEXZMnQ5YxWJh huLa8g/nCB/SUm3lxwRDUxBljr02SnHWErHntElU5Qxep3mS6Reay4nyfO8+YaNSVU8f RGv7q06bm/L8aZptrHSvkmMDnYxBjByg1qk8NoazCpLF7sSGh72KE+A9aYq9EhRL3XDy 5cMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=W0h44zok; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id k8-20020a634b48000000b005c603ab4578si1870918pgl.173.2023.11.29.06.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 06:54:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=W0h44zok; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id EBBAE8038B6A; Wed, 29 Nov 2023 06:54:19 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234722AbjK2OyJ (ORCPT + 99 others); Wed, 29 Nov 2023 09:54:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234712AbjK2OyG (ORCPT ); Wed, 29 Nov 2023 09:54:06 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06BFEDD; Wed, 29 Nov 2023 06:54:13 -0800 (PST) Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ATEqbdj016394; Wed, 29 Nov 2023 14:54: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=nrvFh2fd1vzzeix+pUFKXs76rwQENYotxEwliyOjHjs=; b=W0h44zok4PUOY/xdj3QBN8uCKt3+Pxubg5vAGEl2Pd3GBP1n2UaGNxAquZSSBoY0qgQv uI2+gEkLQhUwzDqP6S76sLulWB+6aHKrhYGZtoSfw6JmNM64zaZDW4Sh2D5sOmXcPtUW /W0IBiuGVR1bLUNce8FDN2FvMxmfhO+mVwHPWOPy4WRTs32Tt1FpCXbiCfFG9Db/8zXp rjMSjRtwA5FMGe0i8EihWwNOnnVQ+9pIiLwWczllq0G1RMsFFExHSdiww77rpR/0A5ww U1cXkXmZ+HGLhlKHezD8Vo91wo/xmVcMCPj+8CCKBlEXxONeyXh6QDdurJl9HoTvT3uq Ig== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3up7ekr30h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 14:54:11 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3ATErSgf020936; Wed, 29 Nov 2023 14:54:10 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3up7ekr2yr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 14:54:10 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3ATEDjWZ004747; Wed, 29 Nov 2023 14:54:09 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ukwy1ya5m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 14:54:09 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3ATEs8vw18547410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Nov 2023 14:54:09 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B35285805B; Wed, 29 Nov 2023 14:54:08 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 25C4658058; Wed, 29 Nov 2023 14:54:07 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.149.198]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 29 Nov 2023 14:54:07 +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, pasic@linux.ibm.com, alex.williamson@redhat.com, borntraeger@linux.ibm.com, kwankhede@nvidia.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@redhat.com, Anthony Krowiak , Matthew Rosato , stable@vger.kernel.org Subject: [PATCH v4 1/3] s390/vfio-ap: unpin pages on gisc registration failure Date: Wed, 29 Nov 2023 09:53:59 -0500 Message-ID: <20231129145404.263764-2-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231129145404.263764-1-akrowiak@linux.ibm.com> References: <20231129145404.263764-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: LXohugi0gGmcJIUTLIeUKt2Bnf8iFKtC X-Proofpoint-ORIG-GUID: 7IyvGerT-WH3X_U5MnTHXr5RtDrmZJCk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-29_12,2023-11-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 phishscore=0 spamscore=0 malwarescore=0 clxscore=1011 priorityscore=1501 adultscore=0 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311290113 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 29 Nov 2023 06:54:20 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783910539939358558 X-GMAIL-MSGID: 1783910539939358558 From: Anthony Krowiak In the vfio_ap_irq_enable function, after the page containing the notification indicator byte (NIB) is pinned, the function attempts to register the guest ISC. If registration fails, the function sets the status response code and returns without unpinning the page containing the NIB. In order to avoid a memory leak, the NIB should be unpinned before returning from the vfio_ap_irq_enable function. Co-developed-by: Janosch Frank Signed-off-by: Janosch Frank Signed-off-by: Anthony Krowiak Reviewed-by: Matthew Rosato Fixes: 783f0a3ccd79 ("s390/vfio-ap: add s390dbf logging to the vfio_ap_irq_enable function") Cc: Acked-by: Christian Borntraeger --- drivers/s390/crypto/vfio_ap_ops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 4db538a55192..9cb28978c186 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -457,6 +457,7 @@ static struct ap_queue_status vfio_ap_irq_enable(struct vfio_ap_queue *q, VFIO_AP_DBF_WARN("%s: gisc registration failed: nisc=%d, isc=%d, apqn=%#04x\n", __func__, nisc, isc, q->apqn); + vfio_unpin_pages(&q->matrix_mdev->vdev, nib, 1); status.response_code = AP_RESPONSE_INVALID_GISA; return status; } From patchwork Wed Nov 29 14:54:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 171410 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp391444vqn; Wed, 29 Nov 2023 06:54:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IF9rzKsorb5hGL+AyxxZ9SDjbBJBisDdPlAQqb6RSoGy7wpehRZVl/koX9NyOT9htQ3folk X-Received: by 2002:a17:902:ea0d:b0:1cf:c9c2:5fde with SMTP id s13-20020a170902ea0d00b001cfc9c25fdemr10227735plg.2.1701269671594; Wed, 29 Nov 2023 06:54:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701269671; cv=none; d=google.com; s=arc-20160816; b=Be7jsYsD2Gite9YzLzp0XPhjAhoqaZPxYRrHVApZHzY5BMhJ+ikStdt1aqMN6QtZ3O TwbqUm4Tond6ZpfRH08CNdXSIeXYxJyoHL1vZ0nVqRAs2C0z60nD31jKg9wOroZS+/Tg OvAV1MZvqvOYOJGIESp8yoKsZWXHAnCzuyZKTYCIElEBU3Hiv83LrUFe/j6LtWlM2Hq+ +pL1+PG7lfwk2TFEYj86+cWvZVNTx3TVqjGHbnEVDz8Phm9yTJwbQ/gE7U9ty4fgyyFe TXdbP8lATg133ARDzRK8hxuhJ7Gykf2nM7x1OKe9WhIQTJzTGleUOptf7gBN3QJPiS1l OwGQ== 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=+EpOuQfInHbEJvdxDuaqHuhXP08YQJRjuL00fRbmA0E=; fh=PYriMT7wNBTeDkws9cgbbOWLcget9q0bI/zIn6VaslM=; b=vDj1+eU8gCp26cKGn5pHWLyc9rQCbUF7Fu0Vq5mfnlm1Ut6nnMX2uW0AOj7dtsp9af tLlmcth/dvIzaONV22zEeMB9Wuvq5tp0d0thmiuLJVtF8GUwt9y4h0TeShZIIta9q6Vr OcmQbny7AbXDFwoQnmMMwbrOA1i+lKHmg9LzKIhluy7wlxEQxX+NEwqQfTBauyVL1T1q ybQut0lstPLoP70fHgX7i0TrC31FncybOogZbeOWDbJBi0HIHj7GWQLKynZEbapfbLk8 jVav36EyA5wZNg9+4N3/SJ1t1OnjJeM1HhgR8CeALnBx+osO8701jyEGV2s66hDn8S3o naUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GqmhVTuN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id c10-20020a170902724a00b001cfa573ca16si5001742pll.343.2023.11.29.06.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 06:54:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GqmhVTuN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8915580401A8; Wed, 29 Nov 2023 06:54:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234696AbjK2OyO (ORCPT + 99 others); Wed, 29 Nov 2023 09:54:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234732AbjK2OyJ (ORCPT ); Wed, 29 Nov 2023 09:54:09 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1DC7D63; Wed, 29 Nov 2023 06:54:15 -0800 (PST) Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ATEqY1q016228; Wed, 29 Nov 2023 14:54:14 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=+EpOuQfInHbEJvdxDuaqHuhXP08YQJRjuL00fRbmA0E=; b=GqmhVTuNhOeiIQt2V0vpUMwZrvalvlRW0pqOehMbJ6/9nCUynubK4ej27jo1iEhMNGKx B3m+nddrbvskF5cESljw3zMkh5zZ2LcukpEpf3FHVW0y328gtSjkbTKWPLVKlUaZ7r6f qS+QjINdGQpZ0FQideTF442qUKGgARBttULnIUcryF7Gj0a2Qudl3F/QoLbe9XRbn5xK UycL6OjpIpp975aCv2nkf7BLKGHQl7Y+cHGaWhetKBSJ/OyZ/nVbq1sXLzXNj4g0VR3e j58BTD1eIQEZfeCqLXgnfAgPQpFFjiIk25Ie11dhUmRjWaHUGd8OweQkV0Mc5VVC/Dk1 Tg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3up7ekr33q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 14:54:13 +0000 Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3ATEqokl017256; Wed, 29 Nov 2023 14:54:13 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3up7ekr31x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 14:54:13 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3ATEGmdk001601; Wed, 29 Nov 2023 14:54:11 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ukvrkqpsy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 14:54:11 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3ATEsA9E7144036 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Nov 2023 14:54:10 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 60BD75805B; Wed, 29 Nov 2023 14:54:10 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E04BC58058; Wed, 29 Nov 2023 14:54:08 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.149.198]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 29 Nov 2023 14:54:08 +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, pasic@linux.ibm.com, alex.williamson@redhat.com, borntraeger@linux.ibm.com, kwankhede@nvidia.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@redhat.com, Anthony Krowiak , Harald Freudenberger Subject: [PATCH v4 2/3] s390/vfio-ap: set status response code to 06 on gisc registration failure Date: Wed, 29 Nov 2023 09:54:00 -0500 Message-ID: <20231129145404.263764-3-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231129145404.263764-1-akrowiak@linux.ibm.com> References: <20231129145404.263764-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: dhI5mwr8kUFyWoWLQWXYiL_WS4tDiQ-0 X-Proofpoint-ORIG-GUID: _nCNU8Oatca5MMW-6pr43PRL2zaVCh8G X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-29_12,2023-11-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 phishscore=0 spamscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 adultscore=0 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311290113 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 29 Nov 2023 06:54:28 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783910547308490952 X-GMAIL-MSGID: 1783910547308490952 From: Anthony Krowiak The interception handler for the PQAP(AQIC) command calls the kvm_s390_gisc_register function to register the guest ISC with the channel subsystem. If that call fails, the status response code 08 - indicating Invalid ZONE/GISA designation - is returned to the guest. This response code is not valid because setting the ZONE/GISA values is the responsibility of the hypervisor controlling the guest and there is nothing that can be done from the guest perspective to correct that problem. The likelihood of GISC registration failure is nil and there is no status response code to indicate an invalid ISC value, so let's set the response code to 06 indicating 'Invalid address of AP-queue notification byte'. While this is not entirely accurate, it is better than setting a response code which makes no sense for the guest. Signed-off-by: Anthony Krowiak Suggested-by: Halil Pasic Reviewed-by: Halil Pasic Reviewed-by: Harald Freudenberger Acked-by: Christian Borntraeger --- drivers/s390/crypto/vfio_ap_ops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 9cb28978c186..25d7ce2094f8 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -393,8 +393,8 @@ static int ensure_nib_shared(unsigned long addr, struct gmap *gmap) * Register the guest ISC to GIB interface and retrieve the * host ISC to issue the host side PQAP/AQIC * - * Response.status may be set to AP_RESPONSE_INVALID_ADDRESS in case the - * vfio_pin_pages failed. + * status.response_code may be set to AP_RESPONSE_INVALID_ADDRESS in case the + * vfio_pin_pages or kvm_s390_gisc_register failed. * * Otherwise return the ap_queue_status returned by the ap_aqic(), * all retry handling will be done by the guest. @@ -458,7 +458,7 @@ static struct ap_queue_status vfio_ap_irq_enable(struct vfio_ap_queue *q, __func__, nisc, isc, q->apqn); vfio_unpin_pages(&q->matrix_mdev->vdev, nib, 1); - status.response_code = AP_RESPONSE_INVALID_GISA; + status.response_code = AP_RESPONSE_INVALID_ADDRESS; return status; } From patchwork Wed Nov 29 14:54:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 171411 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp391532vqn; Wed, 29 Nov 2023 06:54:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgJcSyWmpUhWGUilBWZmkWhpSYfcZEUwR+P2rngsvGVOy5am6kWXItBmGBTLUnzHE5SSSF X-Received: by 2002:a05:6a20:daa5:b0:18b:e5e6:576c with SMTP id iy37-20020a056a20daa500b0018be5e6576cmr28626458pzb.3.1701269682435; Wed, 29 Nov 2023 06:54:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701269682; cv=none; d=google.com; s=arc-20160816; b=e7XNPSLbBZxOdyj4DpaGD+3Oc3IQOuX80gqrqCj7UBtYhKAF1C9I1fwhdeltOGgun4 +7Jrm4Bc0h2pxtZJxR8qGuMRZvD7Ak0nmvhhuBGYIEPygdIHZj91U9+drQHLs3WCErrk GGLelOMLjjvDu8eZ2ubff8S1lkthJAeRFZqeiF89q6yUw9ghLP/3XMrAJsC3608FDM3J nwcCxlh6snW+ExPW/UGMzRHABgdTW775xcaX6Ppe8jvVLT5UfCsgjTobu9kx4dDvEs15 GlZID03Kt19efD5p3dYFXIZKDNLDTgGvkKyTV4k3HqqC+O7SvZxCSuFJpn40ERKgXjnE 2laQ== 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=gQ2tRQf+68bvSbGEJ8gu3v6Z8ALX4GNpA2mskZujjWU=; fh=IeFnRiLblwcVoansUalcshR7AJ+eCkE1OGwIufOLcuY=; b=XSuT+JiehwY0zGnaqf8UQEiWKggqPw1FUl7RZ1hUjK3VhuSRKtj1fz3vskV4iS5Wwe vkM8KrHmnsPgGAniFP7KYZonG9wWhunRwbXSLbowMx0YFf+/5vHyEqQgs4D8YjGTT9UQ FlYksKEWeMRJntar88WedtEZwOZnHT7xbCH99o4+fEK+1NCQ9OD4FIjS3/f6qflm/JeL p4ewL7P3BexfwexhkiRyWBACSSyCGCEYdB7N3/MKnh66JU8lvtNhERYjlkSPEJs/NLka fAErbtl1VrcqIotc3lCUW6kTjg/BqARgVCUgNnrdiZkonRpaKDFtG05VVrAmrCW3CK8r m8ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=nfYlBzi8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id u11-20020a056a00124b00b006be3c302801si14524349pfi.397.2023.11.29.06.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 06:54:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=nfYlBzi8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 15BF18038B23; Wed, 29 Nov 2023 06:54:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234756AbjK2OyT (ORCPT + 99 others); Wed, 29 Nov 2023 09:54:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234757AbjK2OyM (ORCPT ); Wed, 29 Nov 2023 09:54:12 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1ECDD71; Wed, 29 Nov 2023 06:54:17 -0800 (PST) Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ATEX54f008058; Wed, 29 Nov 2023 14:54:16 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=gQ2tRQf+68bvSbGEJ8gu3v6Z8ALX4GNpA2mskZujjWU=; b=nfYlBzi8bAXkRCwvs9vFflyH1ujTSl/JFYIWSR1wtKVZmCf00QgPXtgxvwBhKoJE1XrO VHewXDivXK8LHIUvgoqIyszkmEV4G0i9s5C85W/86UPOII6d6MnKJZ2JzTNhRQ9t+LPP T5acEDvqcjyu3dEKtJmVDe4IY+hJnuAh6bcr/LVCjZtt3MDLWJOoTCz4E/zqxZmGY/N6 9A2NIv8s+qGgeOVW2qalwdNx+bjsFjM2zIl6YI0+/EBG1lvmxKmpRO3IblMezmmADe81 uK2j+RxfM/7rgowdwrrUQUcRwZHT3gKNM8hAzpB9y6JL2Va8Xo3McPwlobxIQZjzm7mq yA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3up75k0t8d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 14:54:16 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3ATEX8qJ008266; Wed, 29 Nov 2023 14:54:15 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3up75k0t6p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 14:54:15 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3ATEA4Mc001570; Wed, 29 Nov 2023 14:54:13 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ukvrkqpt6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 14:54:13 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3ATEsC9k60490188 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Nov 2023 14:54:12 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E32BB58059; Wed, 29 Nov 2023 14:54:11 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8E5295805F; Wed, 29 Nov 2023 14:54:10 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.149.198]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 29 Nov 2023 14:54:10 +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, pasic@linux.ibm.com, alex.williamson@redhat.com, borntraeger@linux.ibm.com, kwankhede@nvidia.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@redhat.com, Matthew Rosato Subject: [PATCH v4 3/3] s390/vfio-ap: improve reaction to response code 07 from PQAP(AQIC) command Date: Wed, 29 Nov 2023 09:54:01 -0500 Message-ID: <20231129145404.263764-4-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231129145404.263764-1-akrowiak@linux.ibm.com> References: <20231129145404.263764-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 3PA_vC7PtRSxkly3Ne-XRzauRAhKhgj0 X-Proofpoint-GUID: uAbvgehF6t-bRiDExcW8kfCdpRrcFuKC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-29_12,2023-11-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 malwarescore=0 mlxscore=0 phishscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311290113 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 29 Nov 2023 06:54:40 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783910558363741608 X-GMAIL-MSGID: 1783910558363741608 Let's improve the vfio_ap driver's reaction to reception of response code 07 from the PQAP(AQIC) command when enabling interrupts on behalf of a guest: * Unregister the guest's ISC before the pages containing the notification indicator bytes are unpinned. * Capture the return code from the kvm_s390_gisc_unregister function and log a DBF warning if it fails. Suggested-by: Matthew Rosato Signed-off-by: Tony Krowiak Reviewed-by: Matthew Rosato Acked-by: Christian Borntraeger --- drivers/s390/crypto/vfio_ap_ops.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 25d7ce2094f8..4e80c211ba47 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -476,8 +476,11 @@ static struct ap_queue_status vfio_ap_irq_enable(struct vfio_ap_queue *q, break; case AP_RESPONSE_OTHERWISE_CHANGED: /* We could not modify IRQ settings: clear new configuration */ + ret = kvm_s390_gisc_unregister(kvm, isc); + if (ret) + VFIO_AP_DBF_WARN("%s: kvm_s390_gisc_unregister: rc=%d isc=%d, apqn=%#04x\n", + __func__, ret, isc, q->apqn); vfio_unpin_pages(&q->matrix_mdev->vdev, nib, 1); - kvm_s390_gisc_unregister(kvm, isc); break; default: pr_warn("%s: apqn %04x: response: %02x\n", __func__, q->apqn,