Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5962973ybi; Wed, 31 Jul 2019 06:10:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEgGhmhKpOSTXMZ5fQYwH/jzQVBfk1idWLCHNMmV2yv3DrBq2S2lapKnhcFsubO5mCAV4G X-Received: by 2002:a17:90a:9604:: with SMTP id v4mr2914833pjo.66.1564578622629; Wed, 31 Jul 2019 06:10:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564578622; cv=none; d=google.com; s=arc-20160816; b=hSGKOOTI1X/lJFkuC707adr6zOGVnYAGWi11Stf8F01VqjXKP19Gqtf0bOe6nEOUGL 73klbDBY5Ox1MA0WjhNqt13sAPXrjWVNgUyhDs48W6fLMQsq31D7O7OvZBL8GyOL6C+D J46XQLNrr/Weh+nTUxI059sL1gFGiQuaPYxWE5Q5BNcK7m1Qj8JT+sdXxccbiT8cTjRJ NJeRoFeVgQEdEgAlucjBdYfq6ep40rYDu89621Lioxt/B5IPBltdpYR8/JsXzw8Y3CST So8XgjfaY3ndmjpWKhh3vDe4+GsFm8EP5Es8Vy+90rrz6KpWtEJUVk+0xjVcjAqERJlA Mn/A== 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=HO524lOUjt5vwee3DTp5s/+DJYcIBf6Knm0UIgurCy4=; b=VAJEKZlbOk1W2NwmAGxQv7xoWxsZ3ogHI0R127K0uockr8k6ONFg9PQ+NHeWqJjMR2 +itGrfv0+DJStPJjuKwRZN9jTzVgC0K551pFZvVnD78/UiG+qbTJgHsLnqwFK03q5+Y8 6exnKqBygZhvSalWR6bmtLkUuRjBkMr9FHAsPXffxSkCFbLvDLzybeX1i9i8qJNPwMRK rogwGKsT+Je0iRltYsap1uMCi1SBFNZLO0u2D0xt5pt0uIsINoKFlJ28ihsIp3yLHohI /QVFJjkd+YHqBOOUwRAZFtFLEJLhdVeKngkS2T36GDAJIlIRViDjuchCekilLjQX5tmO Mu3g== 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 n123si15554833pgn.151.2019.07.31.06.10.09; Wed, 31 Jul 2019 06:10:22 -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 S2387862AbfGaNIX (ORCPT + 99 others); Wed, 31 Jul 2019 09:08:23 -0400 Received: from inva020.nxp.com ([92.121.34.13]:35130 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727841AbfGaNIW (ORCPT ); Wed, 31 Jul 2019 09:08:22 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 432411A09D3; Wed, 31 Jul 2019 15:08:21 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 367E51A09CF; Wed, 31 Jul 2019 15:08:21 +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 DFBF9205F3; Wed, 31 Jul 2019 15:08:20 +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 v5 01/14] crypto: caam/qi - fix error handling in ERN handler Date: Wed, 31 Jul 2019 16:08:02 +0300 Message-Id: <1564578495-9883-2-git-send-email-iuliana.prodan@nxp.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1564578495-9883-1-git-send-email-iuliana.prodan@nxp.com> References: <1564578495-9883-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: 67c2315def06 ("crypto: caam - add Queue Interface (QI) backend support") Signed-off-by: Horia Geantă Reviewed-by: Iuliana Prodan --- 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