dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* media: mediatek: vcodec: fix AV1 decode fail for 36bit iova
@ 2023-06-28  5:41 Xiaoyong Lu
  2023-06-28 16:07 ` Nicolas Dufresne
  2023-06-29  5:09 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Xiaoyong Lu @ 2023-06-28  5:41 UTC (permalink / raw)
  To: Yunfei Dong, Alexandre Courbot, Nicolas Dufresne, Hans Verkuil,
	AngeloGioacchino Del Regno, Benjamin Gaignard, Tiffany Lin,
	Andrew-CT Chen, Mauro Carvalho Chehab, Rob Herring,
	Matthias Brugger, Tomasz Figa
  Cc: Irui Wang, George Sun, Steve Cho, devicetree,
	Project_Global_Chrome_Upstream_Group, linux-kernel, dri-devel,
	Xiaoyong Lu, linux-mediatek, Hsin-Yi Wang, Fritz Koenig,
	linux-arm-kernel, linux-media

Decoder hardware will access incorrect iova address when tile buffer is
36bit, leading to iommu fault when hardware access dram data.

Fixes: 2f5d0aef37c6 ("media: mediatek: vcodec: support stateless AV1 decoder")
Signed-off-by: Xiaoyong Lu<xiaoyong.lu@mediatek.com>
---
- Test ok: mt8195 32bit and mt8188 36bit iova.
---
 .../platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c    | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c
index 404a1a23fd40..420222c8a56d 100644
--- a/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c
+++ b/drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c
@@ -1658,9 +1658,9 @@ static void vdec_av1_slice_setup_tile_buffer(struct vdec_av1_slice_instance *ins
 	u32 allow_update_cdf = 0;
 	u32 sb_boundary_x_m1 = 0, sb_boundary_y_m1 = 0;
 	int tile_info_base;
-	u32 tile_buf_pa;
+	u64 tile_buf_pa;
 	u32 *tile_info_buf = instance->tile.va;
-	u32 pa = (u32)bs->dma_addr;
+	u64 pa = (u64)bs->dma_addr;
 
 	if (uh->disable_cdf_update == 0)
 		allow_update_cdf = 1;
@@ -1673,7 +1673,8 @@ static void vdec_av1_slice_setup_tile_buffer(struct vdec_av1_slice_instance *ins
 		tile_info_buf[tile_info_base + 0] = (tile_group->tile_size[tile_num] << 3);
 		tile_buf_pa = pa + tile_group->tile_start_offset[tile_num];
 
-		tile_info_buf[tile_info_base + 1] = (tile_buf_pa >> 4) << 4;
+		tile_info_buf[tile_info_base + 1] = (unsigned int)(tile_buf_pa >> 4) << 4 +
+			((unsigned int)(tile_buf_pa >> 32) & 0xf);
 		tile_info_buf[tile_info_base + 2] = (tile_buf_pa % 16) << 3;
 
 		sb_boundary_x_m1 =
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-29  5:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-28  5:41 media: mediatek: vcodec: fix AV1 decode fail for 36bit iova Xiaoyong Lu
2023-06-28 16:07 ` Nicolas Dufresne
2023-06-29  5:09 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).