From 62eca6d27b21e11261515ccb9dbc3bb991036aeb Mon Sep 17 00:00:00 2001 From: Akhil Karuturi Date: Fri, 13 Nov 2020 18:00:24 -0800 Subject: [PATCH] dsp: unmap cma memory before hyp unassign during adm close unmap memory before hyp unassign during adm close for handset/speaker FNN usecase. Change-Id: I1d4d335c5179e42af4dcf7cf8e82e48669b32830 Signed-off-by: Akhil Karuturi --- dsp/q6adm.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/dsp/q6adm.c b/dsp/q6adm.c index ed97c1f5091d..b3c2c62f8db1 100644 --- a/dsp/q6adm.c +++ b/dsp/q6adm.c @@ -4005,6 +4005,20 @@ int adm_close(int port_id, int perf_mode, int copp_idx) ret = -EINVAL; goto fail; } + /** + * call unmap CMA before hyp unassign during + * end of handset/speaker usecase. + */ + if (cal_block->map_data.q6map_handle != 0) { + atomic_set(&this_adm.mem_map_handles[cal_index], + cal_block->map_data.q6map_handle); + atomic_set(&this_adm.mem_map_index, cal_index); + ret = adm_memory_unmap_regions(); + if (ret < 0) + pr_err("%s: unmap did not work! cal_type %i ret %d\n", + __func__, cal_index, ret); + cal_block->map_data.q6map_handle = 0; + } ret = hyp_assign_phys( cal_block->cal_data.paddr, cal_block->map_data.map_size, @@ -4076,6 +4090,17 @@ int adm_close(int port_id, int perf_mode, int copp_idx) ret = -EINVAL; goto fail; } + /* call unmap CMA before hyp unassign during end of handset/speaker usecase */ + if (cal_block->map_data.q6map_handle != 0) { + atomic_set(&this_adm.mem_map_handles[cal_index], + cal_block->map_data.q6map_handle); + atomic_set(&this_adm.mem_map_index, cal_index); + ret = adm_memory_unmap_regions(); + if (ret < 0) + pr_err("%s: unmap did not work! cal_type %i ret %d\n", + __func__, cal_index, ret); + cal_block->map_data.q6map_handle = 0; + } ret = hyp_assign_phys(cal_block->cal_data.paddr, cal_block->map_data.map_size, source_vm, 2, dest_vm,