From c4028fcf86d9c954c4b0081d83798c3085c8d775 Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Thu, 11 Jun 2020 17:51:41 -0700 Subject: [PATCH 1/2] soc: qcom: mem-buf: Avoid clearing transferred memory twice Memory that goes through mem-buf is always transferred back to the owner when the owner invokes hyp_assign() to regain access to the memory. This means that if the owner did not have access to the memory throughout the time the memory was lent to another VMID, hyp_assign() will clear the memory before returning it to the owner. Memory that is hyp_assigned through mem-buf creates a memparcel in the resource manager(RM), when the memory is lent to another VMID, and destroys the memparcel when the memory is reclaimed by the owner. However, during the reclaim step, hyp_assign() is used, which clears the memory, but the RM is unaware of the hyp_assign() policies, so it will only clear the memory if the VM that released the memory asked for it to be cleared, which is what mem-buf does. This results in clearing a memory region twice, which is sub-optimal, so remove the explicit request to sanitize the memory when the mem-buf driver releases a memparcel. Change-Id: I637f2305bf34d839db4f15f152b0bfcbb7b7052e Signed-off-by: Isaac J. Manjarres --- drivers/soc/qcom/mem-buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/qcom/mem-buf.c b/drivers/soc/qcom/mem-buf.c index 35247e729f1f..18d2bcd31b83 100644 --- a/drivers/soc/qcom/mem-buf.c +++ b/drivers/soc/qcom/mem-buf.c @@ -973,7 +973,7 @@ static int mem_buf_unmap_mem_s2(hh_memparcel_handle_t memparcel_hdl) int ret; pr_debug("%s: removing CPU MMU stage 2 mappings\n", __func__); - ret = hh_rm_mem_release(memparcel_hdl, HH_RM_MEM_RELEASE_CLEAR); + ret = hh_rm_mem_release(memparcel_hdl, 0); if (ret < 0) pr_err("%s: Failed to release memparcel hdl: 0x%lx rc: %d\n", From 07b094aef81edc90e8a79a5298bdbad563f490a4 Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Thu, 11 Jun 2020 22:14:56 -0700 Subject: [PATCH 2/2] ion: Add support for the display non-secure CMA heap Add support for the non-secure CMA heap for sharing display configuration information with display hardware. Change-Id: Idcc1a8233872cffe890ccd74c956bc666c34cd82 Signed-off-by: Isaac J. Manjarres --- drivers/staging/android/ion/heaps/msm_ion.c | 4 ++++ drivers/staging/android/ion/heaps/msm_ion_priv.h | 1 + include/uapi/linux/msm_ion_ids.h | 1 + 3 files changed, 6 insertions(+) diff --git a/drivers/staging/android/ion/heaps/msm_ion.c b/drivers/staging/android/ion/heaps/msm_ion.c index 7a32a9caa5f5..034ada0db765 100644 --- a/drivers/staging/android/ion/heaps/msm_ion.c +++ b/drivers/staging/android/ion/heaps/msm_ion.c @@ -83,6 +83,10 @@ static struct ion_heap_desc ion_heap_meta[] = { .id = ION_TUI_CARVEOUT_HEAP_ID, .name = ION_TUI_CARVEOUT_HEAP_NAME, }, + { + .id = ION_DISPLAY_HEAP_ID, + .name = ION_DISPLAY_HEAP_NAME, + }, }; #define MAKE_HEAP_TYPE_MAPPING(h) { .name = #h, \ diff --git a/drivers/staging/android/ion/heaps/msm_ion_priv.h b/drivers/staging/android/ion/heaps/msm_ion_priv.h index 1841ed5c12a2..25ef749ae70d 100644 --- a/drivers/staging/android/ion/heaps/msm_ion_priv.h +++ b/drivers/staging/android/ion/heaps/msm_ion_priv.h @@ -39,6 +39,7 @@ #define ION_SECURE_DISPLAY_HEAP_NAME "secure_display" #define ION_AUDIO_HEAP_NAME "audio" #define ION_TUI_CARVEOUT_HEAP_NAME "tui_carveout" +#define ION_DISPLAY_HEAP_NAME "display" /** * Debug feature. Make ION allocations DMA diff --git a/include/uapi/linux/msm_ion_ids.h b/include/uapi/linux/msm_ion_ids.h index c2e7a4d9546e..30a75bcc63a8 100644 --- a/include/uapi/linux/msm_ion_ids.h +++ b/include/uapi/linux/msm_ion_ids.h @@ -19,6 +19,7 @@ #define ION_SYSTEM_HEAP_ID ION_BIT(0) #define ION_QSECOM_TA_HEAP_ID ION_BIT(1) #define ION_CAMERA_HEAP_ID ION_BIT(2) +#define ION_DISPLAY_HEAP_ID ION_BIT(3) #define ION_ADSP_HEAP_ID ION_BIT(4) #define ION_USER_CONTIG_HEAP_ID ION_BIT(6) #define ION_QSECOM_HEAP_ID ION_BIT(7)