Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4610922ybi; Tue, 30 Jul 2019 05:09:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSdcNKAM/mI4mQSP5IENl4TnHb0sAv6Jvykdt4OgBPpvNESqLIqEq9qYUWfpXIwe8Jt21x X-Received: by 2002:a17:90a:380d:: with SMTP id w13mr114555965pjb.138.1564488597072; Tue, 30 Jul 2019 05:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564488597; cv=none; d=google.com; s=arc-20160816; b=NzF8xW3AnrQboqZqcTU0JYynGo7nbVzdhNALXBc3dOWrR2p15UdkR+iccKZiIY5wY8 1J4meT8LGywNLevdfpBc/Q0kQHxT29h8iZjLs2ZkPmc45EzX53MswAiQNhtBaglALr/2 4dBnRquQ2uObhe9mNHPAaAVnIo2t7z4P89C1zxzKQWd0tJAEjJx6xuIV6BN26by1WNZE YlZ7FezszQG94a9QVwpI5QaZgaI6u83IcNbCh/MHp9e9NiZRGiRFz9LrVNZwKJSNrLAv qoN4ZzwFawD5WuMz9ZIN/MuLOQOaqYug5Mokcl4EX/aQP8zABf6J/1OlzMumtT2LNc9d INoQ== 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=DxEJHh1Bk88KFS3Vyov5lVRLADezW2AGwsEsAEl/C+g=; b=ZjBi2YIF+k1ADLFElnKlgP4uEVQtsAwE8V2pSL2yfSGVTsDOnd6PBFm7xOGHGHQ9Yt 2V1wda2XkQpGL0JKjSlGLvEl5Jd/GhTPnAU8U2QUZCnxiB1WXlvpp7c6hjXb2XUmBz/p DzBW4zYkm+d1ImaXyfzzoXoOtStj1aMEBOwqcJF8yHgbe7s6Pl1kUA09KhYaTdi6LTvZ EHzI8sUHarWvwAjnUIY90/CFEwflE6fYWFL+ByW3Ow8wMiBjOgEWj3jN3Gd3zQTwTzQk mFvloKTR2+FjpUR8ms4B/Mqn5pmOC3rQZPBddD8SzHftsGeTWuEsxNlFFRnpe+pLiWCn 8Gqw== 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=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k22si30156290pfi.289.2019.07.30.05.09.41; Tue, 30 Jul 2019 05:09:57 -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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730277AbfG3LGv (ORCPT + 99 others); Tue, 30 Jul 2019 07:06:51 -0400 Received: from inva021.nxp.com ([92.121.34.21]:55504 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726713AbfG3LGv (ORCPT ); Tue, 30 Jul 2019 07:06:51 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 3FAC2200669; Tue, 30 Jul 2019 13:06:49 +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 32F9F200186; Tue, 30 Jul 2019 13:06:49 +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 CB95C204D6; Tue, 30 Jul 2019 13:06:48 +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 v4 01/14] crypto: caam/qi - fix error handling in ERN handler Date: Tue, 30 Jul 2019 14:06:32 +0300 Message-Id: <1564484805-28735-2-git-send-email-iuliana.prodan@nxp.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1564484805-28735-1-git-send-email-iuliana.prodan@nxp.com> References: <1564484805-28735-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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ă --- 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