Commit 2c959a33 authored by Zhou Wang's avatar Zhou Wang Committed by Herbert Xu

crypto: hisilicon/zip - Use temporary sqe when doing work

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: default avatarZhou Wang <wangzhou1@hisilicon.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarShukun Tan <tanshukun1@huawei.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent dbdc1ec3
...@@ -64,7 +64,6 @@ struct hisi_zip_req_q { ...@@ -64,7 +64,6 @@ struct hisi_zip_req_q {
struct hisi_zip_qp_ctx { struct hisi_zip_qp_ctx {
struct hisi_qp *qp; struct hisi_qp *qp;
struct hisi_zip_sqe zip_sqe;
struct hisi_zip_req_q req_q; struct hisi_zip_req_q req_q;
struct hisi_acc_sgl_pool *sgl_pool; struct hisi_acc_sgl_pool *sgl_pool;
struct hisi_zip *zip_dev; struct hisi_zip *zip_dev;
...@@ -484,11 +483,11 @@ static struct hisi_zip_req *hisi_zip_create_req(struct acomp_req *req, ...@@ -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, static int hisi_zip_do_work(struct hisi_zip_req *req,
struct hisi_zip_qp_ctx *qp_ctx) 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 acomp_req *a_req = req->req;
struct hisi_qp *qp = qp_ctx->qp; struct hisi_qp *qp = qp_ctx->qp;
struct device *dev = &qp->qm->pdev->dev; struct device *dev = &qp->qm->pdev->dev;
struct hisi_acc_sgl_pool *pool = qp_ctx->sgl_pool; struct hisi_acc_sgl_pool *pool = qp_ctx->sgl_pool;
struct hisi_zip_sqe zip_sqe;
dma_addr_t input; dma_addr_t input;
dma_addr_t output; dma_addr_t output;
int ret; int ret;
...@@ -511,13 +510,13 @@ static int hisi_zip_do_work(struct hisi_zip_req *req, ...@@ -511,13 +510,13 @@ static int hisi_zip_do_work(struct hisi_zip_req *req,
} }
req->dma_dst = output; 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); a_req->dlen, req->sskip, req->dskip);
hisi_zip_config_buf_type(zip_sqe, HZIP_SGL); hisi_zip_config_buf_type(&zip_sqe, HZIP_SGL);
hisi_zip_config_tag(zip_sqe, req->req_id); hisi_zip_config_tag(&zip_sqe, req->req_id);
/* send command to start a task */ /* send command to start a task */
ret = hisi_qp_send(qp, zip_sqe); ret = hisi_qp_send(qp, &zip_sqe);
if (ret < 0) if (ret < 0)
goto err_unmap_output; goto err_unmap_output;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment