Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4809670pxb; Tue, 28 Sep 2021 04:45:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4hKm33Lgwep5wwiSXuHfCBtfcJt2A65DjYQNmLUArrYAwLm8Z3G4HqLxOizkiAAqCacAS X-Received: by 2002:a17:90b:4b47:: with SMTP id mi7mr5073387pjb.198.1632829549929; Tue, 28 Sep 2021 04:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632829549; cv=none; d=google.com; s=arc-20160816; b=Bxk0QQGvVYegU2IP9AcgXU5Lhw65+WwiOyt0cAYGALF+yiRA/BSa1c+euFCadhLHo2 K2lxAdYHtmlP5XB+4YDkwsWS+CIY0RI3viFD5qieewbgmMPE2ztbGyYpIJ+QBr86v9Qw DtiH3uTeEAdTVAv0fQTg6k2w0nwEh03oDR4HvpiBhB3s6LrVYMDbnppfEAqXE5DW48+y 1yWSh8UdQkYuyMk4sfJhIIWr+SsGqr7qEv8fDff4qGRNSFyE7NahWsIvQ6TYZhXy0Wgw Zxpzi/JCj2L9wlzVr2P6kgKPgOdhujwgxY5rhfW1l1O0IWL9qR/+K2c4Ex2/xuy36xqi igjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=sq22u5++zceT0ljuax73qlDpaWzYFrS7FplVgq4SA3Y=; b=h9RTS4sLbtsoCfFF7WBJThKC6rVxoEO97Y7KcMRWOUeTAMefz8tV4NXlebS3u077kL SQiWXc6D3N9YGBFsTOlgO2jkqd9pBFg0ntv+Ow483Vf+WVH5OYZsFuBYPeDriat4/DAE Zwk/ZZaSUR5cZgqGUm5aD3IOhT4lwYpMqwBlYIeB17XV5eMQsZ4VTaKbzGlirrzbNiuI xt0Mh8JqUtPX6OSkzVtqQBCJ2HuzAxnq+Vfvl7YnyggC9Qb7kRAxYNvQqPSSp6Hoox/9 WACutZvwApRkQp4U6WE2ZR9q28ik91nNjCLDFikkdD7MsKwKjc98ku5KotR610aKWWJF NOKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g24si1755642plq.361.2021.09.28.04.45.35; Tue, 28 Sep 2021 04:45:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240389AbhI1Lqb (ORCPT + 99 others); Tue, 28 Sep 2021 07:46:31 -0400 Received: from mga07.intel.com ([134.134.136.100]:37909 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231202AbhI1Lqb (ORCPT ); Tue, 28 Sep 2021 07:46:31 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10120"; a="288339033" X-IronPort-AV: E=Sophos;i="5.85,329,1624345200"; d="scan'208";a="288339033" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2021 04:44:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,329,1624345200"; d="scan'208";a="562224612" Received: from silpixa00400314.ir.intel.com (HELO silpixa00400314.ger.corp.intel.com) ([10.237.222.51]) by fmsmga002.fm.intel.com with ESMTP; 28 Sep 2021 04:44:50 -0700 From: Giovanni Cabiddu To: herbert@gondor.apana.org.au Cc: linux-crypto@vger.kernel.org, qat-linux@intel.com, Giovanni Cabiddu , Marco Chiappero Subject: [PATCH 01/12] crypto: qat - detect PFVF collision after ACK Date: Tue, 28 Sep 2021 12:44:29 +0100 Message-Id: <20210928114440.355368-2-giovanni.cabiddu@intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210928114440.355368-1-giovanni.cabiddu@intel.com> References: <20210928114440.355368-1-giovanni.cabiddu@intel.com> MIME-Version: 1.0 Organization: Intel Research and Development Ireland Ltd - Co. Reg. #308263 - Collinstown Industrial Park, Leixlip, County Kildare - Ireland Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Detect a PFVF collision between the local and the remote function by checking if the message on the PFVF CSR has been overwritten. This is done after the remote function confirms that the message has been received, by clearing the interrupt bit, or the maximum number of attempts (ADF_IOV_MSG_ACK_MAX_RETRY) to check the CSR has been exceeded. Fixes: ed8ccaef52fa ("crypto: qat - Add support for SRIOV") Signed-off-by: Giovanni Cabiddu Co-developed-by: Marco Chiappero Signed-off-by: Marco Chiappero --- drivers/crypto/qat/qat_common/adf_pf2vf_msg.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c index 976b9ab7617c..789a4135e28c 100644 --- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c +++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c @@ -156,6 +156,13 @@ 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_IOV_MSG_ACK_MAX_RETRY)); + if (val != msg) { + dev_dbg(&GET_DEV(accel_dev), + "Collision - PFVF CSR overwritten by remote function\n"); + ret = -EIO; + goto out; + } + if (val & int_bit) { dev_dbg(&GET_DEV(accel_dev), "ACK not received from remote\n"); val &= ~int_bit; -- 2.31.1