gpu: ion: Leave fmem in c-state until unsecured
When the last buffer is freed from a heap that uses fmem we call into fmem to transition the memory from c-state to t-state. However, if the heap has been secured for content protection transitioning the memory from c-state to t-state could cause undefined behavior in fmem. Add checks to ensure that a secured heap will not transition to t-state until heap is unsecured. Change-Id: I672274c8bcb9912652e82588941fe840b08b3473 CRs-fixed: 359593 Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
This commit is contained in:
committed by
Stephen Boyd
parent
772ffb6355
commit
7490707829
@@ -247,7 +247,8 @@ ion_phys_addr_t ion_cp_allocate(struct ion_heap *heap,
|
|||||||
cp_heap->total_size -
|
cp_heap->total_size -
|
||||||
cp_heap->allocated_bytes, size);
|
cp_heap->allocated_bytes, size);
|
||||||
|
|
||||||
if (cp_heap->reusable && !cp_heap->allocated_bytes) {
|
if (cp_heap->reusable && !cp_heap->allocated_bytes &&
|
||||||
|
cp_heap->heap_protected == HEAP_NOT_PROTECTED) {
|
||||||
if (fmem_set_state(FMEM_T_STATE) != 0)
|
if (fmem_set_state(FMEM_T_STATE) != 0)
|
||||||
pr_err("%s: unable to transition heap to T-state\n",
|
pr_err("%s: unable to transition heap to T-state\n",
|
||||||
__func__);
|
__func__);
|
||||||
@@ -296,7 +297,8 @@ void ion_cp_free(struct ion_heap *heap, ion_phys_addr_t addr,
|
|||||||
mutex_lock(&cp_heap->lock);
|
mutex_lock(&cp_heap->lock);
|
||||||
cp_heap->allocated_bytes -= size;
|
cp_heap->allocated_bytes -= size;
|
||||||
|
|
||||||
if (cp_heap->reusable && !cp_heap->allocated_bytes) {
|
if (cp_heap->reusable && !cp_heap->allocated_bytes &&
|
||||||
|
cp_heap->heap_protected == HEAP_NOT_PROTECTED) {
|
||||||
if (fmem_set_state(FMEM_T_STATE) != 0)
|
if (fmem_set_state(FMEM_T_STATE) != 0)
|
||||||
pr_err("%s: unable to transition heap to T-state\n",
|
pr_err("%s: unable to transition heap to T-state\n",
|
||||||
__func__);
|
__func__);
|
||||||
|
|||||||
Reference in New Issue
Block a user