Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10943128ybi; Thu, 25 Jul 2019 07:24:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqziCVNvJDGhjx8GYO3XoEmwZOrzLYAGWqR2weO/d1s3jLxxHgZ/cMPFMi3eDAmMHnWxeKTk X-Received: by 2002:a17:902:29a7:: with SMTP id h36mr93559661plb.158.1564064689985; Thu, 25 Jul 2019 07:24:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564064689; cv=none; d=google.com; s=arc-20160816; b=fyrgSeOss8kOfnz3TkyPwKF1dbrGD2dl4JrBiU7d7I/Tc0KPZrudQ8MnEsDKFiUv8e QsFyj5D0ne8BYgdfnZhiKO741JTKL9m+gIm9wFYi/aJLeTY6KSiZxnWNaaS75hV6LmnU XpPpcLnoT7aEUhX5DoWCYEKVQ0q0+qvPvbFul1gFkweWoRXvxs/+KU8FMGp+Vq2HpbfE 86+F7DBPAk0awWiouLkVxT3ce4y7Zjw9Q3I7OZVq3LMAnVaQ1Unq6v1A7WHV9FZslbKR EdS7CMK0lBlK1P2dgQMH93gyf9dN7yNYRClz4SbD1/6x+6Ca/5GU/UQFe8HykK1ksULw TJFQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nG1k9Q5LJ0od/jiUn/jhCQAoWdYZkTNnf8stPZQNB9o=; b=YNm0U69ZsiTRVcq6aZAEQaCMiJX0GfDHooGyXl9V7qJ3M7I1yLxeIffieNoSiL9QW6 nch6AZqcpDxZA06txILi3ymtNOXeWTCO0Qwv/J9on+Gj1WTjROI7MyTp7h473MGacclC digl+NN3uwTMpCrwVQzA1mzy0wIyE32jolc0rNS4m7wUUWa+RiIsrnUJz3LTvUTYBGL1 x9safKhwSVW0lsU3NbXHT3Ty7vwwMdiUcltWdkbRCQi9Q0LT/HmGpFEb3mzgT3fHqP/u j5KJNNjNUBTpJesdUKeLzQhwfHNixBEFJd3I2Gs3gHrhITpoY2zPMXdNTHR6VyBK6+cB znuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g63si17981055plb.362.2019.07.25.07.24.36; Thu, 25 Jul 2019 07:24:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404183AbfGYN6j (ORCPT + 99 others); Thu, 25 Jul 2019 09:58:39 -0400 Received: from inva021.nxp.com ([92.121.34.21]:58250 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404172AbfGYN6j (ORCPT ); Thu, 25 Jul 2019 09:58:39 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id D0706200710; Thu, 25 Jul 2019 15:58:36 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id C3540200053; Thu, 25 Jul 2019 15:58:36 +0200 (CEST) Received: from lorenz.ea.freescale.net (lorenz.ea.freescale.net [10.171.71.5]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 78783205E8; Thu, 25 Jul 2019 15:58:36 +0200 (CEST) From: Iuliana Prodan To: Herbert Xu , Horia Geanta , Aymen Sghaier Cc: "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx Subject: [PATCH v3 01/14] crypto: caam/qi - fix error handling in ERN handler Date: Thu, 25 Jul 2019 16:58:13 +0300 Message-Id: <1564063106-9552-2-git-send-email-iuliana.prodan@nxp.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1564063106-9552-1-git-send-email-iuliana.prodan@nxp.com> References: <1564063106-9552-1-git-send-email-iuliana.prodan@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Horia Geantă ERN handler calls the caam/qi frontend "done" callback with a status of -EIO. This is incorrect, since the callback expects a status value meaningful for the crypto engine - hence the cryptic messages like the one below: platform caam_qi: 15: unknown error source Fix this by providing the callback with: -the status returned by the crypto engine (fd[status]) in case it contains an error, OR -a QI "No error" code otherwise; this will trigger the message: platform caam_qi: 50000000: Queue Manager Interface: No error which is fine, since QMan driver provides details about the cause of failure Cc: # v5.1+ Fixes: 67c2315d ("crypto: caam - add Queue Interface (QI) backend support") Signed-off-by: Horia Geantă --- Changes since v2: -update stable version --- drivers/crypto/caam/error.c | 1 + drivers/crypto/caam/qi.c | 5 ++++- drivers/crypto/caam/regs.h | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam/error.c b/drivers/crypto/caam/error.c index 4f0d458..95da6ae 100644 --- a/drivers/crypto/caam/error.c +++ b/drivers/crypto/caam/error.c @@ -118,6 +118,7 @@ static const struct { u8 value; const char *error_text; } qi_error_list[] = { + { 0x00, "No error" }, { 0x1F, "Job terminated by FQ or ICID flush" }, { 0x20, "FD format error"}, { 0x21, "FD command format error"}, diff --git a/drivers/crypto/caam/qi.c b/drivers/crypto/caam/qi.c index 0fe618e..19a378b 100644 --- a/drivers/crypto/caam/qi.c +++ b/drivers/crypto/caam/qi.c @@ -163,7 +163,10 @@ static void caam_fq_ern_cb(struct qman_portal *qm, struct qman_fq *fq, dma_unmap_single(drv_req->drv_ctx->qidev, qm_fd_addr(fd), sizeof(drv_req->fd_sgt), DMA_BIDIRECTIONAL); - drv_req->cbk(drv_req, -EIO); + if (fd->status) + drv_req->cbk(drv_req, be32_to_cpu(fd->status)); + else + drv_req->cbk(drv_req, JRSTA_SSRC_QI); } static struct qman_fq *create_caam_req_fq(struct device *qidev, diff --git a/drivers/crypto/caam/regs.h b/drivers/crypto/caam/regs.h index 8591914..7c7ea8a 100644 --- a/drivers/crypto/caam/regs.h +++ b/drivers/crypto/caam/regs.h @@ -641,6 +641,7 @@ struct caam_job_ring { #define JRSTA_SSRC_CCB_ERROR 0x20000000 #define JRSTA_SSRC_JUMP_HALT_USER 0x30000000 #define JRSTA_SSRC_DECO 0x40000000 +#define JRSTA_SSRC_QI 0x50000000 #define JRSTA_SSRC_JRERROR 0x60000000 #define JRSTA_SSRC_JUMP_HALT_CC 0x70000000 -- 2.1.0