Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp282414ybk; Sat, 9 May 2020 02:46:03 -0700 (PDT) X-Google-Smtp-Source: APiQypILYVwbNmOEVxvcO4/4TvZtl7/ZpbMYQg2grpVeZfjUgB1O57oQjPQiPVmIbiFd+p5e8oaS X-Received: by 2002:a17:906:4e8a:: with SMTP id v10mr5229052eju.63.1589017563227; Sat, 09 May 2020 02:46:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589017563; cv=none; d=google.com; s=arc-20160816; b=MtoSVGUAhCH9MMilfuSDPOCX/an7/7oGB4J0MzI6Chx93GYJMSO+EarMchoNniKWu6 Irieh31oCG4akrZjAdoFt5Yf/0AJn3h7fA00Igh3Qd13V7635QAPMYSAGAwOhkJQAgp+ rwszTUUFytcH55n3GuCDFizUwNgicyJ8TdWEwioQ4CxprITS0dtE74mJr7HEG9QO/Iud 1Ye3VrRy/mf1eNRbqGwNflKGP5XCEb7ssgNL4oWsCjcStj6cvaePpSV7GOA9gffsbVcI bNrT97vPp/kPcyS++1hoCpKKjuiLeFfsN/98ID8ytpUS8Kd2ZjqGtGBtwl5VrmSXMwsy VzqA== 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=I7T4DVGa/cR47teL7SY1Vyfl8eMKIkCmOHPghEW5HydM6+9ZeTZf5tVUTw9GP+Eb9Q 1MlXru5Hx33sA4X6k8xn03moozmHWthfY02Ia1xLLxHw/+cZLwmrReY48P3zUY2uTXzm FhZVmqDxmFIlRywf0EyMgCuHHIDTBniPSqiG8DhCudEtu2ozCjB4kK1/JdevSFK039N8 cGN1F41sS9YNXqDIpDlL71Woiymsb9NkJ3SLTgOuWYA9xw1jz2+lRlN4OQDR0R9NZRwE 9z+JfBHIYu2O1Ud8zzhNZl+Iqcc6At9B+2mCYLtNUYvNEmpLyzroTFm3NUqBYCL9Oyo7 ysrA== 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 v28si2409035edd.176.2020.05.09.02.45.33; Sat, 09 May 2020 02:46:03 -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 S1726946AbgEIJpY (ORCPT + 99 others); Sat, 9 May 2020 05:45:24 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:58018 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728172AbgEIJpW (ORCPT ); Sat, 9 May 2020 05:45:22 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 403CB63452CDB3DB2E73; Sat, 9 May 2020 17:45:19 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Sat, 9 May 2020 17:45:12 +0800 From: Shukun Tan To: , CC: , , Subject: [PATCH v2 12/12] crypto: hisilicon/zip - Use temporary sqe when doing work Date: Sat, 9 May 2020 17:44:05 +0800 Message-ID: <1589017445-15514-13-git-send-email-tanshukun1@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589017445-15514-1-git-send-email-tanshukun1@huawei.com> References: <1589017445-15514-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