Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4736905rdh; Wed, 29 Nov 2023 09:13:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEBQe6eXcLhOJnbHDck+SrClr0jj8EQv/SV6fRhphWldXr9gqhpMiITKD9FEE0Tp9UEo5JT X-Received: by 2002:a05:6a20:4288:b0:187:be84:38dd with SMTP id o8-20020a056a20428800b00187be8438ddmr22302782pzj.62.1701278027985; Wed, 29 Nov 2023 09:13:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701278027; cv=none; d=google.com; s=arc-20160816; b=hD9wPphdn2cIkKp7jWFd3b0M8PT79RxR65Q2OULsIwEYYcFFyzDmWN28bEGlFOe+Rp aDRO+ZQ8AQm8euvxbHjNrP7Z4mFAsSByzBJgK874QOWLL7kTw0HhhY13oHMjMa/5kgHI sECzG+cDsBv9SegFiDn2CHVJqQtZNG0k4zRqYLrwYbDjasE6pEyT3oNBO1WAJ3JNORoe q/Fp3wGHLmiHLwSTJRMkne7jlKiz602nJ6qQoSgw8Q0rAo10T0NzNGUdxTSWE5E3fx9K J7tnJu/MCO68PwhfeBuCHwSdooYv8v1y+6l1PJ67v0eZaEPhR/3NDXTL8UmKP4tRoe93 3HkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=azPyXhZAO1/LTSGf53Txxbl0DE8jhzL3YiN2cyuqFac=; fh=u7ZQC+CUcAsKXg3/BTsbaqWYmnbwqCQkv7fBJBlL4cg=; b=YjgE8xjkLEvXGU0x3t5UbTjnthjpakR0g6FlqNgog6XEfRc5RNmcbJ3n5ijsMz5wSE F4sxL2jX6faZazgUnWVWFvkT4mRkTqIQ51NkOebAmWgkuTGYET15DPKq2nM3wqc9jA9w h2VDJmDyCmGOUOvx7LQHdACM6zXkwTz6mRt7t88aqlwAQdVqtVeN+3YQeLcwCYw+wxpT hvw70Vu4O5OYFPrSViYaIf20DVABkIJu1UgW5Noq6ad9uuKugRKMKo1NFwg8n1jBdtRh 7WfX63HC2BkL5J/uWg3sWMSCfOfNpOwZbprFr8niaryFeoK16nGEIgrMEWiuFIo9TXRF xEBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=l0EVZnTS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id d20-20020aa78e54000000b006cd84368e8dsi8243553pfr.190.2023.11.29.09.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 09:13:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=l0EVZnTS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 5160C8050FAF; Wed, 29 Nov 2023 09:13:45 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231601AbjK2RNM (ORCPT + 99 others); Wed, 29 Nov 2023 12:13:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231709AbjK2RNJ (ORCPT ); Wed, 29 Nov 2023 12:13:09 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEB8CBC; Wed, 29 Nov 2023 09:13:08 -0800 (PST) Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ATH70Ur005040; Wed, 29 Nov 2023 17:13:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=azPyXhZAO1/LTSGf53Txxbl0DE8jhzL3YiN2cyuqFac=; b=l0EVZnTSphWZ1qGZL+Sqz4tnQM9yZR09wdUK+E/dG2wKs9vTkJooo71/xSntJIGEswgw xkD04Q1WWcWns82lyQ6G0XHQVkmqf2QyVJ8mrk/nAUu1uufgXFrXpC3Evnz6LVHquNVt Ajlbd+JzBPw5rFF6L1ypJdHRG2vbeydfcI1O5ryMvfa47Vkl0fJIFNDYg9ZzK7XWqLiY zCd4jqnpRd4GZ9NO1dPSHQe2f0EMRIlRp1JDhLC4daFIew7PpMZpYpddahkvHgd+32H4 zfawTDpKw666S9YilKWp9jqVI3j2NrSNiPKNqVCoRDrY5nLBwCXYwIkedVP188nL532p xg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3up9ds07hj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 17:13:04 +0000 Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3ATH75Ha005199; Wed, 29 Nov 2023 17:12:50 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 3up9ds06hv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 17:12:50 +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 3ATGnLc7011187; Wed, 29 Nov 2023 17:12:38 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ukwy2041w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Nov 2023 17:12:38 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3ATHCZdT12845702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Nov 2023 17:12:35 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1673020043; Wed, 29 Nov 2023 17:12:35 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8178420040; Wed, 29 Nov 2023 17:12:34 +0000 (GMT) Received: from [9.179.21.219] (unknown [9.179.21.219]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 29 Nov 2023 17:12:34 +0000 (GMT) Message-ID: Date: Wed, 29 Nov 2023 18:12:34 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH] s390/vfio-ap: handle response code 01 on queue reset Content-Language: en-US To: Tony Krowiak , 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, kwankhede@nvidia.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, david@redhat.com References: <20231129143529.260264-1-akrowiak@linux.ibm.com> From: Christian Borntraeger In-Reply-To: <20231129143529.260264-1-akrowiak@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: c0zicIJzmU0dgoEO2gJEoy8knN0XQPTy X-Proofpoint-GUID: MlZMYa1VOAevDuZn0VXzPwp02-1s7FQk 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_15,2023-11-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 mlxscore=0 malwarescore=0 impostorscore=0 spamscore=0 mlxlogscore=999 suspectscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311290131 X-Spam-Status: No, score=-2.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, 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 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]); Wed, 29 Nov 2023 09:13:45 -0800 (PST) Am 29.11.23 um 15:35 schrieb Tony Krowiak: > In the current implementation, response code 01 (AP queue number not valid) > is handled as a default case along with other response codes returned from > a queue reset operation that are not handled specifically. Barring a bug, > response code 01 will occur only when a queue has been externally removed > from the host's AP configuration; nn this case, the queue must > be reset by the machine in order to avoid leaking crypto data if/when the > queue is returned to the host's configuration. The response code 01 case > will be handled specifically by logging a WARN message followed by cleaning > up the IRQ resources. > To me it looks like this can be triggered by the LPAR admin, correct? So it is not desireable but possible. In that case I prefer to not use WARN, maybe use dev_warn or dev_err instead. WARN can be a disruptive event if panic_on_warn is set. > Signed-off-by: Tony Krowiak > --- > drivers/s390/crypto/vfio_ap_ops.c | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c > index 4db538a55192..91d6334574d8 100644 > --- a/drivers/s390/crypto/vfio_ap_ops.c > +++ b/drivers/s390/crypto/vfio_ap_ops.c > @@ -1652,6 +1652,21 @@ static int apq_status_check(int apqn, struct ap_queue_status *status) > * a value indicating a reset needs to be performed again. > */ > return -EAGAIN; > + case AP_RESPONSE_Q_NOT_AVAIL: > + /* > + * This response code indicates the queue is not available. > + * Barring a bug, response code 01 will occur only when a queue > + * has been externally removed from the host's AP configuration; > + * in which case, the queue must be reset by the machine in > + * order to avoid leaking crypto data if/when the queue is > + * returned to the host's configuration. In this case, let's go > + * ahead and log a warning message and return 0 so the AQIC > + * resources get cleaned up by the caller. > + */ > + WARN(true, > + "Unable to reset queue %02x.%04x: not in host AP configuration\n", > + AP_QID_CARD(apqn), AP_QID_QUEUE(apqn)); > + return 0; > default: > WARN(true, > "failed to verify reset of queue %02x.%04x: TAPQ rc=%u\n", > @@ -1736,6 +1751,22 @@ static void vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q) > q->reset_status.response_code = 0; > vfio_ap_free_aqic_resources(q); > break; > + case AP_RESPONSE_Q_NOT_AVAIL: > + /* > + * This response code indicates the queue is not available. > + * Barring a bug, response code 01 will occur only when a queue > + * has been externally removed from the host's AP configuration; > + * in which case, the queue must be reset by the machine in > + * order to avoid leaking crypto data if/when the queue is > + * returned to the host's configuration. In this case, let's go > + * ahead and log a warning message then clean up the AQIC > + * resources. > + */ > + WARN(true, > + "Unable to reset queue %02x.%04x: not in host AP configuration\n", > + AP_QID_CARD(q->apqn), AP_QID_QUEUE(q->apqn)); > + vfio_ap_free_aqic_resources(q); > + break; > default: > WARN(true, > "PQAP/ZAPQ for %02x.%04x failed with invalid rc=%u\n",