Skip to content

Commit

Permalink
lib_manager: Set target memory flags after data loading from storage
Browse files Browse the repository at this point in the history
Memory region must first be mapped as writable to allow data to be placed
there. Then the target access flags are set, e.g. read-only and executable.

Signed-off-by: Adrian Warecki <[email protected]>
  • Loading branch information
softwarecki committed Feb 26, 2024
1 parent a9a05e2 commit bb83ed0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/library_manager/lib_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static int lib_manager_load_data_from_storage(void __sparse_cache *vma, void *s_
{
/* Region must be first mapped as writable in order to initialize its contents. */
int ret = sys_mm_drv_map_region((__sparse_force void *)vma, POINTER_TO_UINT(NULL), size,
flags | SYS_MM_MEM_PERM_RW);
SYS_MM_MEM_PERM_RW);
if (ret < 0)
return ret;

Expand All @@ -139,10 +139,7 @@ static int lib_manager_load_data_from_storage(void __sparse_cache *vma, void *s_

dcache_writeback_region(vma, size);

/* TODO: Change attributes for memory to FLAGS. Implementation of required function in tlb
* driver is in progress.
* sys_mm_drv_update_region_flags(vma, size, flags);
*/
sys_mm_drv_update_region_flags(vma, size, flags);
return 0;
}

Expand Down Expand Up @@ -521,6 +518,13 @@ int lib_manager_register_module(struct sof_man_fw_desc *desc, int module_id)
mod = (struct sof_man_module *)((uint8_t *)desc + SOF_MAN_MODULE_OFFSET(entry_index));
struct sof_uuid *uid = (struct sof_uuid *)&mod->uuid[0];








declare_dynamic_module_adapter(drv, SOF_COMP_MODULE_ADAPTER, uid, &lib_manager_tr);

new_drv_info->drv = drv;
Expand Down

0 comments on commit bb83ed0

Please sign in to comment.