Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp986379imm; Wed, 15 Aug 2018 09:25:25 -0700 (PDT) X-Google-Smtp-Source: AA+uWPydEoQ7AQT7rDq+M4qgLT9tgu5UnP5YO8R4iiKQPtTnNphrqvRwgLMUXfyvqM30HLzUWjmm X-Received: by 2002:a17:902:760b:: with SMTP id k11-v6mr25181882pll.91.1534350325039; Wed, 15 Aug 2018 09:25:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534350325; cv=none; d=google.com; s=arc-20160816; b=VWSFVB7njnZChZA9nmISITx7aEEXKh84Xr1l55Z+TJAchg9C+Z1kJSmMIwuwHTeS0Q asWQeHa9VU7AZERe4KbkfDjHxwXdEeI1iV3igkYraVZpP/rQ1fE0jfDA2VuFglTLL59Q 7rCh7EFHQjRWJeTVsx8ULwGCvhp4BKo3gF9C2KFmNQN7oGQteR23Str722W82382N6M/ UhMwcnJ7Ib1TEqfsQnefOsSMNrOkn/fFgMgqWDkP5/THotKl3NXYTZhPXekxhJKrh/VB leH6ue8pQNGh8/pHXZN0pDzGCRGI8L4kdWBp8S9ZldpifFsPvCwHNuid+NdVMIPel1o/ GxoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=yf5a6bwN0wLhnmDBismcNVgIZ+CxCLGtyfVsmZr2MVU=; b=TRKZMmqBrp/1fUVJDs6tcLx8A3KNpV6fDnaSfWvvN9dkOBqJqMf6aTqGIKmjzesNGB NMtlmXn2G0TH1uopoDi7J3Gru4xu1UYS7F3UJHrpeYFc3LgnoobTSIfTVnJgedeNVBuv VTyCkt8cqM2N6iKAGlmDI6ZHiVC1hdI7wSgW0PLYbWVUf15bJ/7moh/ywEp0Cv3oJvvT BMUDenGThWW2AobuCetRxCVC/cCXRmsOvYPRJjjQtcwAWgIDwMuGgnWqFP2PTgtizb5/ n7Es+Sa1fuA7OEgatIgLaVqHoY+h3NtyfOSybWQ9wjHYTVjgsanSQ+/LEKtSo1hjC1e4 89LA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3-v6si19896370pgv.652.2018.08.15.09.25.08; Wed, 15 Aug 2018 09:25:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729992AbeHOTQ6 (ORCPT + 99 others); Wed, 15 Aug 2018 15:16:58 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38756 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729329AbeHOTQ6 (ORCPT ); Wed, 15 Aug 2018 15:16:58 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7CC1077886; Wed, 15 Aug 2018 16:24:08 +0000 (UTC) Received: from gondolin (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAF2210075C4; Wed, 15 Aug 2018 16:24:03 +0000 (UTC) Date: Wed, 15 Aug 2018 18:24:01 +0200 From: Cornelia Huck To: Tony Krowiak Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, freude@de.ibm.com, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, borntraeger@de.ibm.com, kwankhede@nvidia.com, bjsdjshi@linux.vnet.ibm.com, pbonzini@redhat.com, alex.williamson@redhat.com, pmorel@linux.vnet.ibm.com, alifm@linux.vnet.ibm.com, mjrosato@linux.vnet.ibm.com, jjherne@linux.vnet.ibm.com, thuth@redhat.com, pasic@linux.vnet.ibm.com, berrange@redhat.com, fiuczy@linux.vnet.ibm.com, buendgen@de.ibm.com, frankja@linux.ibm.com, Tony Krowiak Subject: Re: [PATCH v9 17/22] s390: vfio-ap: zeroize the AP queues. Message-ID: <20180815182401.4cfa0a78.cohuck@redhat.com> In-Reply-To: <1534196899-16987-18-git-send-email-akrowiak@linux.vnet.ibm.com> References: <1534196899-16987-1-git-send-email-akrowiak@linux.vnet.ibm.com> <1534196899-16987-18-git-send-email-akrowiak@linux.vnet.ibm.com> Organization: Red Hat GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 15 Aug 2018 16:24:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 15 Aug 2018 16:24:08 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 13 Aug 2018 17:48:14 -0400 Tony Krowiak wrote: Nit: please drop the leading period in the subject. > From: Tony Krowiak > > Let's call PAPQ(ZAPQ) to zeroize a queue: > > * For each queue configured for a mediated matrix device > when it is released. > > Zeroizing a queue resets the queue, clears all pending > messages for the queue entries and disables adapter interruptions > associated with the queue. > > Signed-off-by: Tony Krowiak > Reviewed-by: Halil Pasic > Tested-by: Michael Mueller > Tested-by: Farhan Ali > Signed-off-by: Christian Borntraeger > --- > drivers/s390/crypto/vfio_ap_ops.c | 25 +++++++++++++++++++++++++ > drivers/s390/crypto/vfio_ap_private.h | 25 +++++++++++++++++++++++++ > 2 files changed, 50 insertions(+), 0 deletions(-) > > diff --git a/drivers/s390/crypto/vfio_ap_private.h b/drivers/s390/crypto/vfio_ap_private.h > index 3e8534b..34f982a 100644 > --- a/drivers/s390/crypto/vfio_ap_private.h > +++ b/drivers/s390/crypto/vfio_ap_private.h > @@ -74,4 +74,29 @@ struct ap_matrix_mdev { > extern int vfio_ap_mdev_register(void); > extern void vfio_ap_mdev_unregister(void); > > +static inline int vfio_ap_reset_queue(unsigned int apid, unsigned int apqi, > + unsigned int retry) > +{ > + struct ap_queue_status status; > + > + do { > + status = ap_zapq(AP_MKQID(apid, apqi)); > + switch (status.response_code) { > + case AP_RESPONSE_NORMAL: > + return 0; > + case AP_RESPONSE_RESET_IN_PROGRESS: > + case AP_RESPONSE_BUSY: > + msleep(20); > + break; > + default: > + pr_warn("%s: error zeroizing %02x.%04x: response code %d\n", > + VFIO_AP_MODULE_NAME, apid, apqi, > + status.response_code); How can we end up here? Does this mean that we just don't know what to do with this response, or is this something that should never happen? (How much sense does it make to print an error?) > + return -EIO; > + } > + } while (retry--); > + > + return -EBUSY; > +} > + > #endif /* _VFIO_AP_PRIVATE_H_ */