Message ID | 20231026183250.254432-3-akrowiak@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;aposhian.dev@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <akrowiak@linux.ibm.com> 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 <akrowiak@linux.ibm.com> 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 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> 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 |
Series |
a couple of corrections to the IRQ enablement function
|
|
Commit Message
Anthony Krowiak
Oct. 26, 2023, 6:32 p.m. UTC
From: Anthony Krowiak <akrowiak@linux.ibm.com> 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 <akrowiak@linux.ibm.com> Suggested-by: Halil Pasic <pasic@linux.ibm.com> --- drivers/s390/crypto/vfio_ap_ops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On 2023-10-26 20:32, Tony Krowiak wrote: > From: Anthony Krowiak <akrowiak@linux.ibm.com> > > 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 <akrowiak@linux.ibm.com> > Suggested-by: Halil Pasic <pasic@linux.ibm.com> > --- > 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; > } Interesting ... The INVALID_GISA is handled in the default arm of the switch in ap_queue.c but the INVALID_ADDRESS is handled as irq enablement failed. So this change fits more to the current AP bus code. Thanks Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
On Thu, 26 Oct 2023 14:32:44 -0400 Tony Krowiak <akrowiak@linux.ibm.com> wrote: > 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 Again invalid ISC won't happen except for hypervisor messes up. > 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. And more importantly AP_RESPONSE_INVALID_GISA is not valid for G2 in the given scenario, since G2 is not trying to set up interrupts on behalf of the G3 with a G3 GISA, but G2 is trying to set up interrupts for itself. And then AP_RESPONSE_INVALID_GISA is architecturally simply not a valid RC! > > Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> > Suggested-by: Halil Pasic <pasic@linux.ibm.com> Except for the explanation in the commit message, the patch is good. It is up to you if you want to fix the commit message or not. Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
On 10/27/23 07:19, Halil Pasic wrote: > On Thu, 26 Oct 2023 14:32:44 -0400 > Tony Krowiak <akrowiak@linux.ibm.com> wrote: > >> 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 > > Again invalid ISC won't happen except for hypervisor messes up. Again, that is one of the checks performed by the kvm_s390_gisc_register function; however, I get your point and will remove reference in the comment. > >> 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. > > And more importantly AP_RESPONSE_INVALID_GISA is not valid for G2 in > the given scenario, since G2 is not trying to set up interrupts on behalf > of the G3 with a G3 GISA, but G2 is trying to set up interrupts for > itself. And then AP_RESPONSE_INVALID_GISA is architecturally simply not > a valid RC! Got it. > >> >> Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> >> Suggested-by: Halil Pasic <pasic@linux.ibm.com> > > Except for the explanation in the commit message, the patch is good. It > is up to you if you want to fix the commit message or not. > I'll fix the commit message. > Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
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; }