Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3624208pxb; Mon, 24 Jan 2022 13:47:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGr4vjjv8Nh3i3O09Gj20jBhBOKYKSXAo9IgxYaJJCLxMs9D90zObL+L0cXA5yuh/SKDAC X-Received: by 2002:a17:90b:1b4b:: with SMTP id nv11mr292184pjb.193.1643060828183; Mon, 24 Jan 2022 13:47:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643060828; cv=none; d=google.com; s=arc-20160816; b=sJmVuKOvD3EkeI20/G63F2U4ekDemmMvnnAaOCldATSi54Akt/nGSDC/jC6w/PBycG A0Vo9Y0t6maEuAnaFBmWVeDVFus8BD2nqgEOHi1IJjvsu/FRpQoOUiAfnpx/HdkvOEhs JuuEkUpjTk6RMmLqYlrswV1x5r1n3t/Zm/Nm4jX71n/Exf0nWP5mWXs5c/4mqcDWLKqs aZT1G1ApnOPY3BFVlk04hFF/An53nW+2px7qEnkSGw+7hFXEvYX9krcUyJ/6C5ophC64 0PlKVA0qj9YgT4o0qpEQKt1GjLuFWZ6hgGfB0YXq1ajZ0igoiWmHhYQOEtg5q6fvzzGO qCEw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tO67kpdI3TscbRoixLvrOJhIZk/LB5/OjKV9LfENjmE=; b=juh3w28Pgk5bPlJBmXtaGL/neyBCR8DvAsUgfUVinnTHUjBC7acfwnMJAwRZcJkfuL qJjCBVzuiuoTimG8q6jtzj8mRSveBgr9ukqq61uVjKBymxpONI2KfaZ5g65pLQBSljOT JAqj+OEP4xYVhTN5oxyDSd2/jGMHYFn4mLVr1XWPVWmprqS/zRva1ULUQ9M+XnTrRlHH oqGWZijn23N+lBuEqaOtyB1kMcKsOfBne3+c2L5lb9nyzTo1Do7TTkj0VSkoiyucl9Ic zQ2fi60x+POcilhtZ0ilC/TO/A9L22Y+rqM0Zo08GXrITmQnVwxFlhK/+xaGft4VPbyN MAIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lBTZk2uP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k5si14213100pgi.223.2022.01.24.13.46.54; Mon, 24 Jan 2022 13:47:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lBTZk2uP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378244AbiAXV2i (ORCPT + 99 others); Mon, 24 Jan 2022 16:28:38 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:49988 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444684AbiAXVBR (ORCPT ); Mon, 24 Jan 2022 16:01:17 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B67FF60907; Mon, 24 Jan 2022 21:01:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95834C340E5; Mon, 24 Jan 2022 21:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058076; bh=hcR7x/2ZV51OMl9iVloZAl/i91VC0EVwFhKJbq5L9UI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lBTZk2uPppCYUN5jIrnauGejT+sNaNFpyOcmYa9EDEgpQajyMR1SAnMtbs2RdiqOB csTecTgv/0Frvo8cxjbiWKLqC04PLJ1jj8lTItbwfHzeCypCHNOLqL05Fqu7XU5OpR djFIPSAkCB/Ke3B2k5nABlkmGfGfW/Cx4wBMk1vI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Giovanni Cabiddu , Marco Chiappero , Herbert Xu , Sasha Levin Subject: [PATCH 5.16 0174/1039] crypto: qat - fix undetected PFVF timeout in ACK loop Date: Mon, 24 Jan 2022 19:32:43 +0100 Message-Id: <20220124184131.103592156@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Giovanni Cabiddu [ Upstream commit 5002200b4fedd7e90e4fbc2e5c42a4b3351df814 ] If the remote function did not ACK the reception of a message, the function __adf_iov_putmsg() could detect it as a collision. This was due to the fact that the collision and the timeout checks after the ACK loop were in the wrong order. The timeout must be checked at the end of the loop, so fix by swapping the order of the two checks. Fixes: 9b768e8a3909 ("crypto: qat - detect PFVF collision after ACK") Signed-off-by: Giovanni Cabiddu Co-developed-by: Marco Chiappero Signed-off-by: Marco Chiappero Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c index 59860bdaedb69..99ee17c3d06bf 100644 --- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c @@ -107,6 +107,12 @@ static int __adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr) val = ADF_CSR_RD(pmisc_bar_addr, pf2vf_offset); } while ((val & int_bit) && (count++ < ADF_PFVF_MSG_ACK_MAX_RETRY)); + if (val & int_bit) { + dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n"); + val &= ~int_bit; + ret = -EIO; + } + if (val != msg) { dev_dbg(&GET_DEV(accel_dev), "Collision - PFVF CSR overwritten by remote function\n"); @@ -114,12 +120,6 @@ static int __adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr) goto out; } - if (val & int_bit) { - dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n"); - val &= ~int_bit; - ret = -EIO; - } - /* Finished with the PFVF CSR; relinquish it and leave msg in CSR */ ADF_CSR_WR(pmisc_bar_addr, pf2vf_offset, val & ~local_in_use_mask); out: -- 2.34.1