From 59b5ac2a0f156a8a9eed549d35941749be7c4f00 Mon Sep 17 00:00:00 2001 From: Hongjin Li Date: Fri, 25 Apr 2025 17:06:33 +0800 Subject: [PATCH] video: rockchip: mpp: rkvdec2: fix vdec IP stuck issue Platform: RV1126B Err log: mpp_rkvdec2 22140100.rkvdec: session 94 task 47772 timeout 1 abort 0 force_deq0 mpp_rkvdec2 22140100.rkvdec: resetting... mpp_rkvdec2 22140100.rkvdec: reset timeout mpp_rkvdec2 22140100.rkvdec: reset done mpp_rkvdec2 22140100.rkvdec: resend task 47773 mpp_rkvdec2 22140100.rkvdec: resend task 47774 Err case: When the zap mmu is issued, it causes the mmu to issue an additional table fetch command. The data returned by this additional table fetch command happens to fall during the clock-off period of the reset, resulting in an incomplete final bus. Solution: The software should not zap the MMU while the hardware is operating. Instead, the 1126B can rely on its built-in hardware MMU zap functionality. Change-Id: I1d7df42305edf910c1f39686832f856ccc26bc6d Signed-off-by: Hongjin Li --- drivers/video/rockchip/mpp/mpp_rkvdec2_link.c | 8 +++++++- drivers/video/rockchip/mpp/mpp_rkvdec2_link.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/video/rockchip/mpp/mpp_rkvdec2_link.c b/drivers/video/rockchip/mpp/mpp_rkvdec2_link.c index e0cb86fb7be0..20d55f9f9635 100644 --- a/drivers/video/rockchip/mpp/mpp_rkvdec2_link.c +++ b/drivers/video/rockchip/mpp/mpp_rkvdec2_link.c @@ -80,6 +80,7 @@ struct rkvdec_link_info rkvdec_link_v2_hw_info = { .irq_base = 0x00, .next_addr_base = 0x1c, .err_mask = 0xf0, + .en_sw_iommu_zap = 1, }; /* vdpu34x link hw info for rk356x */ @@ -142,6 +143,7 @@ struct rkvdec_link_info rkvdec_link_rk356x_hw_info = { .irq_base = 0x00, .next_addr_base = 0x1c, .err_mask = 0xf0, + .en_sw_iommu_zap = 1, }; /* vdpu382 link hw info */ @@ -204,6 +206,7 @@ struct rkvdec_link_info rkvdec_link_vdpu382_hw_info = { .irq_base = 0x00, .next_addr_base = 0x1c, .err_mask = 0xf0, + .en_sw_iommu_zap = 1, }; /* vdpu383 link hw info */ @@ -264,6 +267,7 @@ struct rkvdec_link_info rkvdec_link_vdpu383_hw_info = { .en_base = 0x40, .ip_en_base = 0x58, .ip_en_val = 0x01000000, + .en_sw_iommu_zap = 1, }; /* vdpu384a link hw info */ @@ -509,7 +513,9 @@ static int rkvdec2_link_enqueue(struct rkvdec_link_dev *link_dec, /* start config before all registers are set */ wmb(); - mpp_iommu_flush_tlb(link_dec->mpp->iommu_info); + /* After rv1126b, hw can execute zap. */ + if (link_info->en_sw_iommu_zap) + mpp_iommu_flush_tlb(link_dec->mpp->iommu_info); mpp_task_run_begin(mpp_task, timing_en, MPP_WORK_TIMEOUT_DELAY); link_dec->task_running++; diff --git a/drivers/video/rockchip/mpp/mpp_rkvdec2_link.h b/drivers/video/rockchip/mpp/mpp_rkvdec2_link.h index f391bddc223e..a8796bf6078b 100644 --- a/drivers/video/rockchip/mpp/mpp_rkvdec2_link.h +++ b/drivers/video/rockchip/mpp/mpp_rkvdec2_link.h @@ -137,6 +137,8 @@ struct rkvdec_link_info { u32 en_base; u32 ip_en_base; u32 ip_en_val; + + u32 en_sw_iommu_zap; }; struct rkvdec_link_dev {