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 <yvonne.chen@amlogic.com>
This commit is contained in:
Yvonne Chen
2017-11-17 18:53:03 +08:00
committed by Dongjin Kim
parent 3f8b314661
commit caef1e3328
3 changed files with 29 additions and 7 deletions

View File

@@ -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",

View File

@@ -38,6 +38,7 @@
#include <linux/dma-contiguous.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/amlogic/tee.h>
#include "../../../stream_input/amports/amports_priv.h"
#include <linux/amlogic/media/codec_mm/codec_mm.h>
#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;

View File

@@ -37,6 +37,7 @@
#include <linux/dma-mapping.h>
#include <linux/dma-contiguous.h>
#include <linux/slab.h>
#include <linux/amlogic/tee.h>
#include "../../../stream_input/amports/amports_priv.h"
#include <linux/amlogic/media/codec_mm/codec_mm.h>
#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;