From patchwork Wed Sep 13 13:06:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 139222 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp49067vqi; Wed, 13 Sep 2023 18:41:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYTLAu5FKQaNlR2DnSjEdvwv1fE2M4RTa0I/bBG6Gq38GSvdnGzIKksv5uataS3DaURhk8 X-Received: by 2002:a17:90b:1007:b0:268:10a3:cea8 with SMTP id gm7-20020a17090b100700b0026810a3cea8mr3763641pjb.9.1694655698154; Wed, 13 Sep 2023 18:41:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694655698; cv=none; d=google.com; s=arc-20160816; b=o+TGlvY7JFdd+nu8dD6hS73FDplqRc2SJDKFBt3EXG+/2PM3vfCiHrR6oWdmYs62Gi Nz77BriG74fMFz5IGSkNV8ARM9cIybmqJfLtBWI9HpzWqAr5g1xEx8EhdbaeLCdCg+0M DJrIFSCMsVpS51Y0EZkv2y0jID20tY57/6G/cbVlYrbVW8AkVVfJh8e/iurd0wag5cdA hOjNU9LaqWYcaqsAbYMalknAwn1gANbqg6eI5xSliLtT+sacRpG8zLvvhO726tVB0hLI BhcNhZVbU5YXgxREi4SLtHgP9TtQINX9mQnQ5jsZbAlyLz23bk1lfuHyYetGszhlCPo5 VG0g== 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=+yS4A9C6bDkm88UVUGu+D7xxJ8zAuI4Ip9K+7iZOJkk=; fh=sNagsEwRY2A1GXf/CzjygzPzk1OrfXbRTZcBRQTEQUI=; b=oR99c5t54MigPNbHbWM/Dyn7xaQvKmLk4q/o09vXqmpGfvS8AgphOwp+J/0KKgwYEW SjIMrCkhgU887CzW00SX1dJIII7De4KsdD+zKJYilbIYZIvSGlzYbrICSBwymv6zKocN KbXVzB1F1jC6172jpaVCTrUIJDsHXi9Yz3Dz/UlwzfpXn420GpUsh6PmEOHWKQJW+0Bm 7mELg/5oO4qaLNIM9L1JA/lBFfqXQjLmC8MN/njaqth0/IJtEtG8aG9Oc0q//pwhzmnm 1IEsb7Th7JFQxtid7eoOGsV8N2B6uFvYRN67KlKdSQgdOhxGdFAs43tBkkBloqYsLlyU jTzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Q65SckCt; 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 h23-20020a17090ac39700b00268345e910csi570965pjt.127.2023.09.13.18.41.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 18:41:38 -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=Q65SckCt; 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 1F0EA8108BEB; Wed, 13 Sep 2023 06:06:54 -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 S240189AbjIMNGo (ORCPT + 36 others); Wed, 13 Sep 2023 09:06:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231326AbjIMNGn (ORCPT ); Wed, 13 Sep 2023 09:06:43 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72D9019B1; Wed, 13 Sep 2023 06:06:39 -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 38DCuuJ1031677; Wed, 13 Sep 2023 13:06:37 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=+yS4A9C6bDkm88UVUGu+D7xxJ8zAuI4Ip9K+7iZOJkk=; b=Q65SckCto85+tqnP9QTRrqimdxzZM3ZS7NNwdfMVmZMGhsvy3xW2cFz8tIOVK8Com3VJ grPIxoZ0ImwYtHxHROd7k7e2Q7BwyXaj5b47jW1XSpuJ3Wf04CGFHHAB/OxyJZ+xsTY4 Zmc9m9ayL1kBDk6DV+D/SQhu1Vl/Xs0OLqb5u2Sb/Akdp6JuL1EwPIJAMEY0NXVGyh8Q L+/l1C3ff6U9r2tIG9OsaBXcRteTY+Vt6ALoGcF9qgxaLzi6k3NFEAUFMluLQ72noQvJ uifNVSob3+OKsXQdVD2K1DZmrrQOb4FizzyMM2b4MmqSrxAAFyRlJ+8S7EZ1WKXT86Ug 1w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t3dhggddd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Sep 2023 13:06:36 +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 38DD6W7E028030; Wed, 13 Sep 2023 13:06:34 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 3t3dhggd9c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Sep 2023 13:06:34 +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 38DAxqSm002755; Wed, 13 Sep 2023 13:06:30 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3t14hm32tv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Sep 2023 13:06:30 +0000 Received: from smtpav01.dal12v.mail.ibm.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 38DD6TS113369908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Sep 2023 13:06:29 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3D40558059; Wed, 13 Sep 2023 13:06:29 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4042A58058; Wed, 13 Sep 2023 13:06:28 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.101.13]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 13 Sep 2023 13:06:28 +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 , stable@vger.kernel.org Subject: [PATCH 1/2] s390/vfio-ap: unpin pages on gisc registration failure Date: Wed, 13 Sep 2023 09:06:21 -0400 Message-ID: <20230913130626.217665-2-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230913130626.217665-1-akrowiak@linux.ibm.com> References: <20230913130626.217665-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: wsF5irEh6MPDqm-9JoGtN0h0tWuxxoYU X-Proofpoint-ORIG-GUID: ka6gNPFCTGmE6hlryg6mAw6brf4XiIzB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-13_06,2023-09-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 clxscore=1011 mlxlogscore=999 lowpriorityscore=0 suspectscore=0 priorityscore=1501 impostorscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309130101 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]); Wed, 13 Sep 2023 06:06:54 -0700 (PDT) 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776956177069237519 X-GMAIL-MSGID: 1776975293614085447 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. Fixes: 783f0a3ccd79 ("s390/vfio-ap: add s390dbf logging to the vfio_ap_irq_enable function") Signed-off-by: Janosch Frank Signed-off-by: Anthony Krowiak 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 Wed Sep 13 13:06:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Krowiak X-Patchwork-Id: 138874 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp1138457vqx; Wed, 13 Sep 2023 07:48:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrT+iQdBSs+69TQWka6pln9BTVLVplM7mPdrrbHfpBqrCspILC7qQlPejXX2jZdNEBmxrR X-Received: by 2002:a05:6a00:b91:b0:68a:5773:6319 with SMTP id g17-20020a056a000b9100b0068a57736319mr3166425pfj.11.1694616500700; Wed, 13 Sep 2023 07:48:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694616500; cv=none; d=google.com; s=arc-20160816; b=RnYd3FJvE17+ge43hgWUJU8wf9iu/3fXbQUxNUYy6aPMa5fpzCnCj3NM0hapgc6Osk 5G3nYPsdH2Iwd7UJt06sT/wOIvMcLwfiRaGWOtUwu06jAyaBRwOI25Uc6UTtfLDmNVMi aPNyt9m0VOhd/O8Y57uyN6cts1t5M+vxrDJdgZm0/1m7txeKMTa2a9KY8sJRug/byc87 cKul5dx7o92iCOMtFQIbtASRabgNc0oN+PAxEI9kajSsQKYlxNzzQ4zTYD2NQOU8RiRi MnQv3Wi4uK7lL7E7a6u7LEYTnLaBwDRtz1TOy20IHqNc4EVGjfjhVadIyBJvX9/OGF4t 81pQ== 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=U6m79bn53R80K62WnFpoCyhwSnR4yQVNhqrLWqqZQwk=; fh=I5VSvx7vBSMaWi4TqDG3S+282xkrba7u+ygzTx6eeWA=; b=qAV/DRCuToD1RAqtIes4DZ/7l/TB2teFqQ7Bxz0aHrvS+PPE+gN7+8+TYumfFFcvr1 zPl94McD65bcOm5RGddR1bJk76bY0AlqfC69u5RYsyiRmCag/JAkF4sWDLGMcL4i+S4C HocgAXFAvjoaB2S3o3nWa8ioTAl4qkp0uoUmKpj3UIJ7w5DuLhLiZD3WGJTE84GrjVSs 3QeXqZzQFjhX3TKFDGcVJELuxU/rwlkzWT0RqpIn3iqhqiQrVidZB4G2R2K29JKeOcwa UUUlsJZcbTkTn5dC1Kfu4/f5YYJxQ1xfV6uY709TChplYnzugBdvIBwcUYY6kLrYEQEk /V9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=e96pzpA0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id cw17-20020a056a00451100b0068a6eb3b548si6212614pfb.401.2023.09.13.07.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 07:48:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=e96pzpA0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 6476081D80B7; Wed, 13 Sep 2023 06:07:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240735AbjIMNHM (ORCPT + 36 others); Wed, 13 Sep 2023 09:07:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240711AbjIMNHK (ORCPT ); Wed, 13 Sep 2023 09:07:10 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2099019B6; Wed, 13 Sep 2023 06:07:06 -0700 (PDT) Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38DCRWOI016469; Wed, 13 Sep 2023 13:07:04 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=U6m79bn53R80K62WnFpoCyhwSnR4yQVNhqrLWqqZQwk=; b=e96pzpA0D/LpdPvP69j0Grf4IDP3ysXoivr94YT+362omeS1wFuGjf/Ygv8J3vMJZJDK gq3B5JdYyEeczlYhKJ8RsOevvLti1KP+pC7eLYIhU43sH6iVnmW/PVsUHaD8gOllypV/ BeBs/few4NGfsG9adVArhNt8Kymb6Pcb9qtem5p37UBRyzxSfyPY8UbmrJWbE7I7kBqp qqinfGg9xfR96FMqsT6O3gwtdnfH+/ikzBir9e3QjrnEduv02L94fofnKkns8J8ZOE5Z wpc85/02p7U9YuCrk/mjBR2oq1uIoaz6l0qW3bELb+UooHJGpx/fYhM87L/7GkrHfBnr Lw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t3d3qs6cu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Sep 2023 13:07:03 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38DCc9Gh002970; Wed, 13 Sep 2023 13:06:44 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t3d3qs627-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Sep 2023 13:06:44 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38DC14AA024021; Wed, 13 Sep 2023 13:06:30 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3t131tbka0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 13 Sep 2023 13:06:30 +0000 Received: from smtpav01.dal12v.mail.ibm.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 38DD6UOf2032354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Sep 2023 13:06:30 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3925D58059; Wed, 13 Sep 2023 13:06:30 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B58758058; Wed, 13 Sep 2023 13:06:29 +0000 (GMT) Received: from li-2c1e724c-2c76-11b2-a85c-ae42eaf3cb3d.ibm.com.com (unknown [9.61.101.13]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 13 Sep 2023 13:06:29 +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 Subject: [PATCH 2/2] s390/vfio-ap: set status response code to 06 on gisc registration failure Date: Wed, 13 Sep 2023 09:06:22 -0400 Message-ID: <20230913130626.217665-3-akrowiak@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230913130626.217665-1-akrowiak@linux.ibm.com> References: <20230913130626.217665-1-akrowiak@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: lU2LQRYLG9tuGBlkzrvvtPDdHVoJbi4C X-Proofpoint-ORIG-GUID: q5sFbLFVHWMbtwh9T3ABJjGAKtNL1md0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-13_06,2023-09-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 mlxscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 malwarescore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309130101 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 (snail.vger.email [0.0.0.0]); Wed, 13 Sep 2023 06:07:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776934191588049114 X-GMAIL-MSGID: 1776934191588049114 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 --- drivers/s390/crypto/vfio_ap_ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c index 9cb28978c186..e7e4dbbf5ad3 100644 --- a/drivers/s390/crypto/vfio_ap_ops.c +++ b/drivers/s390/crypto/vfio_ap_ops.c @@ -394,7 +394,7 @@ static int ensure_nib_shared(unsigned long addr, struct gmap *gmap) * 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. + * 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; }