Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1400779ybj; Fri, 8 May 2020 00:01:22 -0700 (PDT) X-Google-Smtp-Source: APiQypKdsxZCCctyNtXj6DIgPXPr7g7dEoJqGjMAWEn0FqZ8Cf+SDdUpYm5hyIR1ZwWRh5RdtwFT X-Received: by 2002:a17:907:20b5:: with SMTP id pw21mr632425ejb.227.1588921282497; Fri, 08 May 2020 00:01:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588921282; cv=none; d=google.com; s=arc-20160816; b=qJhc5deUtvhxe2ZbxlenJe+oJXUNbOtmJV/iNv8uy3TRlLhK7yJDDuX/7gbboT18rL bOnGc87g7ILapsfnDjr5Do541D7nFLpVF4yn7TXVLJxRN+0L/6I5RkFHp/ySiypTYyoE 2sf2DjG2si5VGu2yagRorRtVdCZKi6eksDX3i+m3VXzS5N6uyWg29OWKpo0HxpPnBLBp wALAZec3olUORXtTkzmUBxUvmElIBHu3/l/72YbfS4LdLsmONWj1/NLFw0si0AqAVyaX jwyqLhhD6biO6ZVBUHtmFLv7tTcLJs7FSnrt9wsnMNAH7Flbah6WIb1tua3QHHBgs9R6 ZTsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=ZUuNFHcWHlZg8rRGVbkZ7pPiSVYqED9XnCjugtZEQ1M=; b=zlaEDEFIF5lmYMzYMN8h07H536vAt6mqHmdVR/efJSt9NokscKv5SzOovjtoW7iw+j igbuG1MxsQLFYGuSaa7/4d1bgmXDFnDp7xOrW1xg6lvNXQsZiZo26JeDsncrlx9wvBwa JxImjeC/L/48cxJW5MLmR/Gol9dDcV0kWOIcOawO4Eq9dpZUq9JgIHIB8xYsEwk1a2j8 z3AdwI6Jud0sWQa31w8g+jw62EOTWVZcJjsrDlHSbCXSJSgQgMTU0wyGawS5I4InXSIx dDRtjXRZJLoitgzrMuPI1J2jevu9PfCZ6Tr737R+hRN034Bs/TOdoBbPljF8STyFwk6P /CpA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si415062ejz.509.2020.05.08.00.00.58; Fri, 08 May 2020 00:01:22 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726761AbgEHG7i (ORCPT + 99 others); Fri, 8 May 2020 02:59:38 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:42846 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726817AbgEHG7h (ORCPT ); Fri, 8 May 2020 02:59:37 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 20F69C91943D8BBAFF13; Fri, 8 May 2020 14:59:05 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.487.0; Fri, 8 May 2020 14:58:54 +0800 From: Shukun Tan To: , CC: , , Subject: [PATCH 12/13] crypto: hisilicon/zip - Use temporary sqe when doing work Date: Fri, 8 May 2020 14:57:47 +0800 Message-ID: <1588921068-20739-13-git-send-email-tanshukun1@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1588921068-20739-1-git-send-email-tanshukun1@huawei.com> References: <1588921068-20739-1-git-send-email-tanshukun1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Zhou Wang Currently zip sqe is stored in hisi_zip_qp_ctx, which will bring corruption with multiple parallel users of the crypto tfm. This patch removes the zip_sqe in hisi_zip_qp_ctx and uses a temporary sqe instead. Signed-off-by: Zhou Wang Signed-off-by: Jonathan Cameron Signed-off-by: Shukun Tan --- drivers/crypto/hisilicon/zip/zip_crypto.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/hisilicon/zip/zip_crypto.c b/drivers/crypto/hisilicon/zip/zip_crypto.c index 369ec32..5fb9d4b 100644 --- a/drivers/crypto/hisilicon/zip/zip_crypto.c +++ b/drivers/crypto/hisilicon/zip/zip_crypto.c @@ -64,7 +64,6 @@ struct hisi_zip_req_q { struct hisi_zip_qp_ctx { struct hisi_qp *qp; - struct hisi_zip_sqe zip_sqe; struct hisi_zip_req_q req_q; struct hisi_acc_sgl_pool *sgl_pool; struct hisi_zip *zip_dev; @@ -484,11 +483,11 @@ static struct hisi_zip_req *hisi_zip_create_req(struct acomp_req *req, static int hisi_zip_do_work(struct hisi_zip_req *req, struct hisi_zip_qp_ctx *qp_ctx) { - struct hisi_zip_sqe *zip_sqe = &qp_ctx->zip_sqe; struct acomp_req *a_req = req->req; struct hisi_qp *qp = qp_ctx->qp; struct device *dev = &qp->qm->pdev->dev; struct hisi_acc_sgl_pool *pool = qp_ctx->sgl_pool; + struct hisi_zip_sqe zip_sqe; dma_addr_t input; dma_addr_t output; int ret; @@ -511,13 +510,13 @@ static int hisi_zip_do_work(struct hisi_zip_req *req, } req->dma_dst = output; - hisi_zip_fill_sqe(zip_sqe, qp->req_type, input, output, a_req->slen, + hisi_zip_fill_sqe(&zip_sqe, qp->req_type, input, output, a_req->slen, a_req->dlen, req->sskip, req->dskip); - hisi_zip_config_buf_type(zip_sqe, HZIP_SGL); - hisi_zip_config_tag(zip_sqe, req->req_id); + hisi_zip_config_buf_type(&zip_sqe, HZIP_SGL); + hisi_zip_config_tag(&zip_sqe, req->req_id); /* send command to start a task */ - ret = hisi_qp_send(qp, zip_sqe); + ret = hisi_qp_send(qp, &zip_sqe); if (ret < 0) goto err_unmap_output; -- 2.7.4