Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2093834ybp; Thu, 10 Oct 2019 02:04:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzwEGejldncPIYPuH08KnjTMCqVlmwsHSSsVCjAKACU7r66nLHtK7tGZBCGX5Yl21JreDg X-Received: by 2002:a05:6402:160f:: with SMTP id f15mr7089408edv.142.1570698292049; Thu, 10 Oct 2019 02:04:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570698292; cv=none; d=google.com; s=arc-20160816; b=Onz/54lxrEDqTc3EX+yl6pittlodClvYfqSvdMeIErJtIJygBpkgFHmQOfTA/TEGcV +VZrsOtqllE6b61ZV6AyFRVV8E050SJdRVk29/C2123umWqaMlBktM29CYNigIIXHc5s RsEThw/njXllZad8RbHpvNVtwJqo3MExrc1BzO2P8+S5Jkb62gFNqqGGu+gmZ/3bazI0 F4vZfAWwnf3fRNlFkbv7xsvfKfIjEbtXIO+FdwhQ7TIKhSDV9LHBONrj41Rcz5VNgFbI j4whdyqoXD9EEtjBxBIejkZo1BjFdmT6KxNM09ExJ2anzvFb2BOzsFJZDtuE4eL/SzTk toaA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sTu4FUKbMDi8c9wRMy0qehxlxOITezaowaNmn9WaH6s=; b=SaJNfgeJ/WrQjVfQbguw8m7F6DlwIE1bVxy2bTZ+xNJBXveNp0I2OTaZBGi6cW7Fxf jsZfT9AHWhibHP9SRfw6IBwtfDeJNDP8KRCGIhwOJnKWE3xijCRHWNiQ9ScS4/pLVSXv nbNR9wOL3bEkZkhr+A4ISf+YmGNmDXkq5KXlwxlmKUL2YUsCT+h4F7SN0UP+/3lck9Kp LYTLN7XC5BBxwL1Z2B+EFtv83yTtfnJmnSXgu4fPqlKOptJYoleLVcYibuKjia1H2JFY 5PeSBwVhJT9+K0g3CSt/ltSTK+BMw65O5aDyK/TljbJNFC5ZWHf4co5seqYOMvmKWl8p yq0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yzEppY5A; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i15si3328942ede.196.2019.10.10.02.04.27; Thu, 10 Oct 2019 02:04:52 -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; dkim=pass header.i=@kernel.org header.s=default header.b=yzEppY5A; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733302AbfJJJCr (ORCPT + 99 others); Thu, 10 Oct 2019 05:02:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:42760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387811AbfJJIjT (ORCPT ); Thu, 10 Oct 2019 04:39:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C938D21D80; Thu, 10 Oct 2019 08:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570696759; bh=c7WJh+EJ+vLVCVWgY959mfZeB3g+LV991TNwgJT3s/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yzEppY5AuX7fvxcH/MpUHcJDdOK6ea5l4K9mfu49PPtcdVO8wRUfxT/XKDBEl5mv8 aGwP6/UY9uac7ecQoq5Y3RYKQ5A4XVkg5mVqk/zBUCpi8bSVmND5d2z1J8yL2geqjC HVhuaL7ET5zDShFdukb7/rDsvRhRy0idNDU2bdKg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Horia=20Geant=C4=83?= , Iuliana Prodan , Herbert Xu Subject: [PATCH 5.3 043/148] crypto: caam/qi - fix error handling in ERN handler Date: Thu, 10 Oct 2019 10:35:04 +0200 Message-Id: <20191010083613.739344414@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Horia Geantă commit 51fab3d73054ca5b06b26e20edac0486b052c6f4 upstream. 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 Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- 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(-) --- 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"}, --- a/drivers/crypto/caam/qi.c +++ b/drivers/crypto/caam/qi.c @@ -163,7 +163,10 @@ static void caam_fq_ern_cb(struct qman_p 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, --- 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