PD#172483
Problem:
To avoid A73 core speculative data loading from protected
memory, which triggers SError fault, the mapping of the
protected region should be cleared. In codec_mm driver, the
page structure pointer used to clear the mapping is wrong.
Although the memory is allocated from CMA, because we are
using CMA_res mode the address from CMA_res_pool is actually
a physical address, similar as reserved memory case. As a
result, the mapping to protected address is not cleared.
Solution:
1.Add "mem->from_flags ==
AMPORTS_MEM_FLAGS_FROM_GET_FROM_CMA_RES" case processing.
Verify:
Run YTTV and there is no SError crash after the fix.
Change-Id: Ia912337c1d7d5a55800fc55ad1d61016f9710f4d
Signed-off-by: Kai Song <kai.song@amlogic.com>
CODEC_MM_FLAGS_FOR_LOCAL_MGR |
CODEC_MM_FLAGS_CMA);
if (mem) {
+ struct page *mm = mem->mem_handle;
+
+ if (mem->from_flags ==
+ AMPORTS_MEM_FLAGS_FROM_GET_FROM_CMA_RES)
+ mm = phys_to_page(
+ (unsigned long)mm);
if (for_tvp) {
- cma_mmu_op(mem->mem_handle,
+ cma_mmu_op(mm,
mem->page_count,
0);
}
mem);
if (ret < 0) {
if (for_tvp) {
- cma_mmu_op(mem->mem_handle,
+ cma_mmu_op(mm,
mem->page_count,
1);
}
slot_mem_size = gen_pool_size(gpool);
gen_pool_destroy(tvp_pool->gen_pool[i]);
if (tvp_pool->mm[i]) {
- cma_mmu_op(tvp_pool->mm[i]->mem_handle,
+ struct page *mm = tvp_pool->mm[i]->mem_handle;
+
+ if (tvp_pool->mm[i]->from_flags ==
+ AMPORTS_MEM_FLAGS_FROM_GET_FROM_CMA_RES)
+ mm = phys_to_page(
+ (unsigned long)mm);
+ cma_mmu_op(mm,
tvp_pool->mm[i]->page_count,
1);
codec_mm_release(tvp_pool->mm[i],