From caef1e3328e19ecfa64999f09397c8e2ffa8d78a Mon Sep 17 00:00:00 2001 From: Yvonne Chen Date: Fri, 17 Nov 2017 18:53:03 +0800 Subject: [PATCH] media: tee load concurrency cause crash issue[1/1] PD# 154794 tee load concurrency cause crash issue Change-Id: I1666329f423a46b1e2090cb21cc4b62536b3d0f0 Signed-off-by: Yvonne Chen --- .../frame_provider/decoder/h264_multi/vmh264.c | 11 ++++++----- .../frame_provider/decoder/h265/vh265.c | 12 +++++++++++- .../media_modules/frame_provider/decoder/vp9/vvp9.c | 13 ++++++++++++- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c b/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c index bb6dc19f59e9..cb5d128d6b08 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/h264_multi/vmh264.c @@ -4545,11 +4545,6 @@ static s32 vh264_init(struct vdec_h264_hw_s *hw) } if (tee_enabled() && !firmwareloaded) { pr_info("VMH264 start load sec firmware ...\n"); - if (tee_load_video_fw((u32)VIDEO_DEC_H264_MULTI) - != 0) { - amvdec_disable(); - return -1; - } } else { /* -- ucode loading (amrisc and swap code) */ hw->mc_cpu_addr = @@ -4950,6 +4945,9 @@ result_done: READ_VREG(VLD_MEM_VIFIFO_WP), READ_VREG(VLD_MEM_VIFIFO_RP)); vdec_vframe_dirty(hw_to_vdec(hw), hw->chunk); + amvdec_stop(); + if (mmu_enable) + amhevc_stop(); } else if (hw->dec_result == DEC_RESULT_AGAIN) { /* stream base: stream buf empty or timeout @@ -4970,6 +4968,9 @@ result_done: hw->eos = 1; flush_dpb(p_H264_Dpb); vdec_vframe_dirty(hw_to_vdec(hw), hw->chunk); + amvdec_stop(); + if (mmu_enable) + amhevc_stop(); } else if (hw->dec_result == DEC_RESULT_FORCE_EXIT) { dpb_print(DECODE_ID(hw), PRINT_FLAG_VDEC_STATUS, "%s: force exit\n", diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c b/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c index 54d5da6fb109..0be46a44435a 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/h265/vh265.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "../../../stream_input/amports/amports_priv.h" #include #include "../utils/decoder_mmu_box.h" @@ -8663,7 +8664,11 @@ static s32 vh265_init(struct hevc_state_s *hevc) fw = vmalloc(sizeof(struct firmware_s) + fw_size); if (IS_ERR_OR_NULL(fw)) return -ENOMEM; - +#ifdef MULTI_INSTANCE_SUPPORT + if (tee_enabled()) + size = 1; + else +#endif if (mmu_enable && (get_cpu_type() >= MESON_CPU_MAJOR_ID_GXL)) { size = get_firmware_data(VIDEO_DEC_HEVC_MMU, fw->data); hevc_print(hevc, 0, "vh265 mmu ucode loaded!\n"); @@ -9386,6 +9391,11 @@ static void vh265_work(struct work_struct *work) } } + if (hevc->stat & STAT_VDEC_RUN) { + amhevc_stop(); + hevc->stat &= ~STAT_VDEC_RUN; + } + if (hevc->stat & STAT_TIMER_ARM) { del_timer_sync(&hevc->timer); hevc->stat &= ~STAT_TIMER_ARM; diff --git a/drivers/amlogic/media_modules/frame_provider/decoder/vp9/vvp9.c b/drivers/amlogic/media_modules/frame_provider/decoder/vp9/vvp9.c index b1e43ae8b8e7..15622901a8af 100644 --- a/drivers/amlogic/media_modules/frame_provider/decoder/vp9/vvp9.c +++ b/drivers/amlogic/media_modules/frame_provider/decoder/vp9/vvp9.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "../../../stream_input/amports/amports_priv.h" #include #include "../utils/decoder_mmu_box.h" @@ -7260,7 +7261,12 @@ static s32 vvp9_init(struct VP9Decoder_s *pbi) fw = vmalloc(sizeof(struct firmware_s) + fw_size); if (IS_ERR_OR_NULL(fw)) return -ENOMEM; - +#ifdef MULTI_INSTANCE_SUPPORT + if (tee_enabled()) { + size = 1; + pr_debug ("laod\n"); + } else +#endif size = get_firmware_data(VIDEO_DEC_VP9_MMU, fw->data); if (size < 0) { pr_err("get firmware fail.\n"); @@ -7810,6 +7816,11 @@ static void vp9_work(struct work_struct *work) } } + if (pbi->stat & STAT_VDEC_RUN) { + amhevc_stop(); + pbi->stat &= ~STAT_VDEC_RUN; + } + if (pbi->stat & STAT_TIMER_ARM) { del_timer_sync(&pbi->timer); pbi->stat &= ~STAT_TIMER_ARM;