libwd/0077-uadk-v1-drv-hisi_zip_udrv-fix-the-wrong-unmapped-add.patch
2023-11-23 10:41:04 +08:00

54 lines
2.1 KiB
Diff

From 51d9d531c5944e66d62f28f738f2f1b5aaf8373b Mon Sep 17 00:00:00 2001
From: Yang Shen <shenyang39@huawei.com>
Date: Mon, 20 Nov 2023 15:21:53 +0800
Subject: [PATCH 77/85] uadk/v1/drv: hisi_zip_udrv - fix the wrong unmapped
address
Some region is reserved for driver data in ctx_buf. So there is
a offset between the hardware ctx_buf and the original ctx_buf.
The unmapped address should be the original ctx_buf rather than
hardware ctx_buf.
Signed-off-by: Yang Shen <shenyang39@huawei.com>
---
v1/drv/hisi_zip_udrv.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/v1/drv/hisi_zip_udrv.c b/v1/drv/hisi_zip_udrv.c
index 470acb9..dfd1fb3 100644
--- a/v1/drv/hisi_zip_udrv.c
+++ b/v1/drv/hisi_zip_udrv.c
@@ -126,6 +126,7 @@ static int qm_fill_zip_sqe_get_phy_addr(struct hisi_zip_sqe_addr *addr,
WD_ERR("Get zip in buf dma address fail!\n");
return -WD_ENOMEM;
}
+
if (!(is_lz77 && msg->data_fmt == WD_SGL_BUF)) {
phy_out = (uintptr_t)drv_iova_map(q, msg->dst, msg->avail_out);
if (!phy_out) {
@@ -296,8 +297,8 @@ int qm_parse_zip_sqe(void *hw_msg, const struct qm_queue_info *info,
phy_out = DMA_ADDR(sqe->dest_addr_h, sqe->dest_addr_l);
drv_iova_unmap(q, recv_msg->dst, (void *)phy_out, recv_msg->avail_out);
if (recv_msg->ctx_buf) {
- phy_ctxbuf = DMA_ADDR(sqe->stream_ctx_addr_h,
- sqe->stream_ctx_addr_l);
+ phy_ctxbuf = DMA_ADDR(sqe->stream_ctx_addr_h, sqe->stream_ctx_addr_l) -
+ CTX_BUFFER_OFFSET;
drv_iova_unmap(q, recv_msg->ctx_buf, (void *)phy_ctxbuf,
MAX_CTX_RSV_SIZE);
}
@@ -727,8 +728,8 @@ int qm_parse_zip_sqe_v3(void *hw_msg, const struct qm_queue_info *info,
phy_out = DMA_ADDR(sqe->dest_addr_h, sqe->dest_addr_l);
drv_iova_unmap(q, recv_msg->dst, (void *)phy_out, recv_msg->avail_out);
if (recv_msg->ctx_buf) {
- phy_ctxbuf = DMA_ADDR(sqe->stream_ctx_addr_h,
- sqe->stream_ctx_addr_l);
+ phy_ctxbuf = DMA_ADDR(sqe->stream_ctx_addr_h, sqe->stream_ctx_addr_l) -
+ CTX_BUFFER_OFFSET;
drv_iova_unmap(q, recv_msg->ctx_buf, (void *)phy_ctxbuf,
MAX_CTX_RSV_SIZE);
}
--
2.25.1