From patchwork Thu Oct 26 18:32:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 158636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp86054vqb; Thu, 26 Oct 2023 11:33:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELBGdHjTaSYT+c1FD+nT2/Tvyz6425bIjA3AR+Ff9GUCQzYh8mK340B40Rsd+n4rvHrF6F X-Received: by 2002:a05:6808:147:b0:3af:66e5:5d3c with SMTP id h7-20020a056808014700b003af66e55d3cmr200980oie.26.1698345207163; Thu, 26 Oct 2023 11:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698345207; cv=none; d=google.com; s=arc-20160816; b=lcBHrC1c8TPH5lr/GDy4BEto25CQOiWaFl1iIPLfnyuSFmkJbu5W49B0fmAZl5HdSP f47TdlCuSzLh1iRLBWrTEs7+AXKbh9eIPltqpJd04uvm6KbKsQjxXin6tX2qsv1Wu0nc ZL60SJYyEACfm78LybOhFZZOkgRW9BIQG0mrDU545+DdhnkZqbUZQBNTpSHttNbcmGBE 55TLrD2xcg+TlfFJNQsVZM5tlG8Zhm7z2dQUykDbBO4z32NaRuwow1c6S4yoC2Ugjpck YpJE0TaZNyl/EjpTIfreqJ1LbUA7KD7+6M5TlRS3d6OktoNRl/TwUE5yVZC/VgSvtWw3 QI3Q== 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=iFaWF8FCOc7YfwCAX8anca9OSiPloKaSBVEYC+fasnw=; b=CkHeiigImpsIGfUjydUcsffG4Xlet80aRJldj3kaN0PBWBASYusruqwCWLLKsJOq36 bg2a8bj4PQY0zobHwyMth2zfrKWYy8O+eoztvm0hYINVSzBYlXunvHM7hCKf9z2P97ZA hYd6W1j84Sd3Ntlp/DmV6fWBiv4aCY6fjdTkJCLsKnDfg7ONiqBcpeoL6jQRln9YNb0E Na1ABY6rUa8EXjxWf+Biq1e5OpDMo+IH2GcoX8445NHTtPwwE5Cw1OxoGsh8T2UfD+4y eD+TxIG//TxXZ14HbqaJq0h8/TNMYDfY+eC2PFsr0Aod6jhdjzpFZz6pIc2CXvPmbf5f EbDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=YK3VTpki; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id u68-20020a25ab4a000000b00d9a6b331944si16045075ybi.304.2023.10.26.11.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 11:33:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=YK3VTpki; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 47ED6808AB99; Thu, 26 Oct 2023 11:33:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231442AbjJZSdH (ORCPT + 26 others); Thu, 26 Oct 2023 14:33:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231326AbjJZSdA (ORCPT ); Thu, 26 Oct 2023 14:33:00 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54B4CD43; Thu, 26 Oct 2023 11:32:58 -0700 (PDT) Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39QIHbEx026280; Thu, 26 Oct 2023 18:32:58 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=YK3VTpki9ANsmjP6giXZQAxLc5BY+4hv3arAR1PN0WeyawMcSk/jxDPsmIz538oDfvjE AmF0SfhWa7ov3EZMeO+j4buwPm+APx56tBUsld6q67Ogcca2KbIvlkM//EZ9jX8PavSV 1e7HTfXoaoZ5qsa6MZKQdypsUdivOTkHtiyTzv0yJDDnLlZhmbyNse0D9u7VVIBgAgWV PdFNpKE/v1mie1ld4dIbif7m9ScArpX5/rXOo9SpoIt0q3cll1zTm91llrxABAhLRP2P +B6hgrJrgHLxXFRn6xB1G9XohUzElIazOc1WRZoEnRd8f73hOgn/AWrGFtcdXxEdG5qM ow== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tyw8t0gb1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 18:32:56 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39QIHTbU025880; Thu, 26 Oct 2023 18:32:56 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tyw8t0g9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 18:32:56 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 39QGji2w010250; Thu, 26 Oct 2023 18:32:54 GMT Received: from smtprelay02.wdc07v.mail.ibm.com ([172.16.1.69]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3tvsc009v1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 18:32:54 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay02.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 39QIWrCK20054754 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Oct 2023 18:32:54 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9A01358067; Thu, 26 Oct 2023 18:32:53 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC9485805D; Thu, 26 Oct 2023 18:32:52 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.161.121]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 26 Oct 2023 18:32:52 +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, borntraeger@linux.ibm.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@redhat.com, mjrosato@linux.ibm.com, Anthony Krowiak , stable@vger.kernel.org Subject: [PATCH v3 1/3] s390/vfio-ap: unpin pages on gisc registration failure Date: Thu, 26 Oct 2023 14:32:43 -0400 Message-ID: <20231026183250.254432-2-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231026183250.254432-1-akrowiak@linux.ibm.com> References: <20231026183250.254432-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ZO-baTWAQ9ZVCyMps38H84NclRGND2B1 X-Proofpoint-GUID: ZDZnBZsp1pfebqUmF319uO9llNTfH-SI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-26_17,2023-10-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 spamscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310260161 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Thu, 26 Oct 2023 11:33:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780844024084237610 X-GMAIL-MSGID: 1780844024084237610 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: --- 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 Thu Oct 26 18:32:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 158637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp86061vqb; Thu, 26 Oct 2023 11:33:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IETcjUVIxAojybAUloALUC7IPW7JYfsFgjDt9MsqLZQrWU4HovP0hwnSEOWS0whWMxHndpx X-Received: by 2002:a25:d855:0:b0:d9a:d7b6:708a with SMTP id p82-20020a25d855000000b00d9ad7b6708amr187664ybg.37.1698345207806; Thu, 26 Oct 2023 11:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698345207; cv=none; d=google.com; s=arc-20160816; b=S0CD+ZmbCjNjlB9dAScpKiVKYwn+uwCeoWXVAy5G8imbQVrvD9D9ZIcbZzSblTJl8F hiOiTBVcMYsIz96W/TG6cH/V1GhK2cv1F8UBfPhQPvqjbrj74lcFINgiVvcgiSlrYs7A 97Mho0Rv26sKEQ4PRGOSO1SE+irGgY5Ra7HhA5fyKjd1Y+ajP6k3lzVN3yr1skxE0w2y kJjnC09dOx14n4gE7PDXQdApeBeVjWbYcZb4TLEA7Ysgzi+mzav+rrAA1AJalQEYnYCE FUIevUCPU9PS2RvVyn81KTkDUJMfzISH6h4hkJwgzRvvcMUPVbhNeec8/hTWlPSuka5V C8yw== 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=X8kIrslWDOXWhoHJov+e3SPTeZxOhaqsDjB2N84baz0=; fh=T2IXlbWp1IM3LIeAukdTosoRi63nxZ7pXBDdKsXBaIE=; b=wh0MjQvS9Q1Dq8czw9gOSP3R7GhQ5Cld+4L8B7LoTg2wcDKF3uHi4CUr/YtetX5oyU R9HvuAFe+lhIA2DjuVJQ27lE+NT3PuJ4QoJYaYcUyvSjIltGmcGB5vXgkLkcHozxM1IU WrGNXThljX+1C+vOGmSCjy8eVpXKrj2W70WHqroSSZmgWJOrd9s0WpwHrFCqVFBGVwSS PL+VJU9yu/tUfs7S1c7jJVLlg3wamf3JzQfIx161kTIjXr8V8kZiYpTvK+O2vSlRP+7x KXpcukkK9bJ/OpuF34Zwess4PjNax7IA+ETwxpm3X5mGva/K0foM11nD5COVkTnKacgO G6WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Ix0rOd7H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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. [23.128.96.33]) by mx.google.com with ESMTPS id b39-20020a25aea7000000b00d58cbf36ce2si8533227ybj.411.2023.10.26.11.33.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 11:33:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Ix0rOd7H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 35064828C492; Thu, 26 Oct 2023 11:33:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231532AbjJZSdE (ORCPT + 26 others); Thu, 26 Oct 2023 14:33:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231186AbjJZSc7 (ORCPT ); Thu, 26 Oct 2023 14:32:59 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74E8D1BE; Thu, 26 Oct 2023 11:32:57 -0700 (PDT) Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39QIFQKP015661; Thu, 26 Oct 2023 18:32:56 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=X8kIrslWDOXWhoHJov+e3SPTeZxOhaqsDjB2N84baz0=; b=Ix0rOd7H4tJ0ZdJAOOuwTKKHYFnGP/qcHUG1mvoIGcRhsiPNgc91WEca7k6bTB3qSW8p UdgtuOvTWbGM10sm7ricY43N0R9hUp2xVlb7VfC3v45NbzyxEygq0yWteA0CiEeHf9zx 1yx2hwtpgJMATJQqKbcerlRb8l/Ae9g3VkFZeMY2i8O8fPaFNH09RLNRRmr06O9poiYy V6rHSEEGAxJwg6zQ+3KGe0SLs+zr0PkjnnDCgmX5xK/DrX1dGW7BkaJiwNgU4KBga/bC TARKeBYRtfpp3hruhc1I1g1m6xSNmffGfHhOA/Rnx+S4cXG2rRcGvHbKYrzCga1ZRkxv Ug== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tyw7m0f1e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 18:32:56 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39QIFMuk015541; Thu, 26 Oct 2023 18:32:56 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 3tyw7m0f13-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 18:32:56 +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 39QGBP2n012349; Thu, 26 Oct 2023 18:32:55 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3tvup27kj1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 18:32:55 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 39QIWsYu13894290 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Oct 2023 18:32:54 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8E30D58056; Thu, 26 Oct 2023 18:32:54 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B8DAC58069; Thu, 26 Oct 2023 18:32:53 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.161.121]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 26 Oct 2023 18:32:53 +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, borntraeger@linux.ibm.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@redhat.com, mjrosato@linux.ibm.com, Anthony Krowiak Subject: [PATCH v3 2/3] s390/vfio-ap: set status response code to 06 on gisc registration failure Date: Thu, 26 Oct 2023 14:32:44 -0400 Message-ID: <20231026183250.254432-3-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231026183250.254432-1-akrowiak@linux.ibm.com> References: <20231026183250.254432-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: FkXHtCBuRdeQsOfG9hp5LjZDNcL2H5w8 X-Proofpoint-GUID: pUlLq3ALkDV2hTItK4KMHKfbdQDwlZbt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-26_16,2023-10-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 adultscore=0 suspectscore=0 bulkscore=0 mlxscore=0 clxscore=1015 spamscore=0 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310260158 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 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]); Thu, 26 Oct 2023 11:33:24 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780844024120242642 X-GMAIL-MSGID: 1780844024120242642 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 does not make sense because the non-zero return code from the kvm_s390_gisc_register function can be due one of two things: Either the ISC passed as a parameter by the guest to the PQAP(AQIC) command is greater than the maximum ISC value allowed, or the guest is not using a GISA. Since this scenario is very unlikely to happen and there is no status response code to indicate an invalid ISC value, 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 indicating that the ZONE/GISA designation is invalid which is something the guest can do nothing about since those values are set by the hypervisor. Signed-off-by: Anthony Krowiak Suggested-by: Halil Pasic Reviewed-by: Harald Freudenberger Reviewed-by: Halil Pasic --- 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 Thu Oct 26 18:32:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 158638 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp86907vqb; Thu, 26 Oct 2023 11:35:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFyvQ5RJ1F3Frt/Q/CHU7EJb0Y2qKGFmrmNvintN2qqa7kho4f1M+C1PZ+aCWhlBN2bYaP8 X-Received: by 2002:a81:410c:0:b0:56d:43cb:da98 with SMTP id o12-20020a81410c000000b0056d43cbda98mr256953ywa.29.1698345300215; Thu, 26 Oct 2023 11:35:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698345300; cv=none; d=google.com; s=arc-20160816; b=ffuGVc5J1/zCjuLtKUgw0rNEZKM0hKnMOLA6W0ESUksfLS1lGXqagdEYP+uNPAenyJ eO+Tp9vi2OlWLTwIkPxVXe7T/wb359geS31/u/Ped+IWRhZ/9Aa+I21M/NAO9dTF+KqW 4RTMJ2WMkO05BOBGLXfa6OM3ZJUgkUBH4TMclGNAA2/S3FEtWQmawff0wMqr2r9kWhtB qP7DFYo80py9xfCOmwZa7s9uJG0PZD0ftoyc2NMD3zlThqInVyESy+JirQu5ucSb+i1g hqEHE8yLnU0c2fjS911ad2GnHB9GoAMDIkYAHSpxQv2FTWrXteOrRhiXeY1lRZBo4hRw xkZw== 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=EXv1FFXPs0SiLWbsxQI1ahpgiWnS571pNxC5iYeQ95Q=; b=eCX8GysOkIlKaPWhT2lb+GWhAULwDnhpcRJ2yWkfgZGkya04//C127GPIwhydRPUqd OwxsG0vHG8JLHJckIsUInPi+pG3gNYqMKo+/y1va8pcb6gRxmMxFnl0IuRnT/vU0fuYL ojnmLt7UDgcwL/edKLoRLNcmQAYPVGlbbutDEr+wSU9Al1AVgHvEl78DUoc4MXiC76IM l33eRmddUm7zlKMoX4K8ghBVj563RzbayC6efbTKDz4lUXI4rYvorDGDxb19u7IlCLdh OIEXlzlt8qO6o4OBOPS7pT6SBJnlIKlQTozYTCT775qJX3Wkwu+P37N6LUeLJaBbO8V+ TLAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=EgVUcjX9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id k66-20020a0dfa45000000b005a204618ad3si15021411ywf.505.2023.10.26.11.34.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 11:35:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=EgVUcjX9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id CFD4780EE819; Thu, 26 Oct 2023 11:34:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231442AbjJZSee (ORCPT + 26 others); Thu, 26 Oct 2023 14:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231171AbjJZSec (ORCPT ); Thu, 26 Oct 2023 14:34:32 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36A4410A; Thu, 26 Oct 2023 11:34:30 -0700 (PDT) Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39QIFPS4016599; Thu, 26 Oct 2023 18:34:29 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=EgVUcjX9gi5iKuUPgzZMJ956/81pwB9PdPSavzxkHS42FGQbSWRFPyDuuoMMum0bghbb Sa5oHo06guwl7qQvyH3F+kJCZdDbMwGm28wpSyTOvh8OqoWiw3k1gDXloRli1gNhbtjP dYagM/5NI/eK+GSx0TXWra9OCxRFOHyx+OZsyDjfRBqPg5NAB6v6b3jkcyvvrfUuGk12 ZtuGS8JU19rNw1cKan3uJ2KWadvv78ybiLo1K8YbdOr6V68isGqGKwMx0qxyZPFsiIZS 7sk8DomBKNbYFVQOA8uAQkub7HZB1EfxSSNHbogf+NiTh4PJ+H0GnVCoywtwn3BtT16+ 9w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tyw7krgse-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 18:34:29 +0000 Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39QIT3Ic025190; Thu, 26 Oct 2023 18:34:28 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3tyw7krg80-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 18:34:28 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 39QIFMTx024368; Thu, 26 Oct 2023 18:32:56 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3tvu6kfs1u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 18:32:56 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 39QIWtlL17039888 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Oct 2023 18:32:55 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 907BC5805D; Thu, 26 Oct 2023 18:32:55 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ADEAD58052; Thu, 26 Oct 2023 18:32:54 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.161.121]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 26 Oct 2023 18:32:54 +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, borntraeger@linux.ibm.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@redhat.com, mjrosato@linux.ibm.com Subject: [PATCH v3 3/3] s390/vfio-ap: improve reaction to response code 07 from PQAP(AQIC) command Date: Thu, 26 Oct 2023 14:32:45 -0400 Message-ID: <20231026183250.254432-4-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231026183250.254432-1-akrowiak@linux.ibm.com> References: <20231026183250.254432-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: TJipFceDFR5kCmyg1yT6h1FStixvQRRh X-Proofpoint-ORIG-GUID: 739f-32r0wmHfLB-1r0tH6qa8w9zbLEw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-26_17,2023-10-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 adultscore=0 clxscore=1015 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 impostorscore=0 phishscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310260160 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Thu, 26 Oct 2023 11:34:57 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780844121471795036 X-GMAIL-MSGID: 1780844121471795036 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 --- 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,