Skip to content

Commit

Permalink
add some fixup
Browse files Browse the repository at this point in the history
Signed-off-by: Rander Wang <[email protected]>
  • Loading branch information
RanderWang committed Oct 11, 2023
1 parent 27e3a45 commit e853b8c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/audio/module_adapter/module/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ static int modules_init(struct processing_module *mod)

mod->sys_service = &native_system_service;
ret = mod_in->init(mod);
mod->priv.ops = mod_in;
} else {
ret = iadk_wrapper_init(md->module_adapter);
}
Expand Down
16 changes: 8 additions & 8 deletions zephyr/lib/regions_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ struct vmh_heap *vmh_init_heap(const struct vmh_heap_config *cfg,
new_heap->physical_blocks_allocators[i] = new_allocator;

/* Fill allocators data based on config and virtual region data */
new_allocator->num_blocks = cfg->block_bundles_table[i].number_of_blocks;
new_allocator->blk_sz_shift = ilog2(cfg->block_bundles_table[i].block_size);
new_allocator->info.num_blocks = cfg->block_bundles_table[i].number_of_blocks;
new_allocator->info.blk_sz_shift = ilog2(cfg->block_bundles_table[i].block_size);
new_allocator->buffer = (uint8_t *)new_heap->virtual_region->addr + offset;

/* Create bit array that is a part of mem_block kept as a ptr */
Expand Down Expand Up @@ -268,11 +268,11 @@ void *vmh_alloc(struct vmh_heap *heap, uint32_t alloc_size)
* mem_block.
*/
block_size =
1 << heap->physical_blocks_allocators[mem_block_iterator]->blk_sz_shift;
1 << heap->physical_blocks_allocators[mem_block_iterator]->info.blk_sz_shift;
block_count = SOF_DIV_ROUND_UP((uint64_t)alloc_size, (uint64_t)block_size);

if (block_count >
heap->physical_blocks_allocators[mem_block_iterator]->num_blocks)
heap->physical_blocks_allocators[mem_block_iterator]->info.num_blocks)
continue;
/* Try span alloc on first available mem_block for non span
* check if block size is sufficient.
Expand Down Expand Up @@ -453,7 +453,7 @@ int vmh_free_heap(struct vmh_heap *heap)
if (!heap->physical_blocks_allocators[i])
continue;
if (!sys_bitarray_is_region_cleared(heap->physical_blocks_allocators[i]->bitmap,
heap->physical_blocks_allocators[i]->num_blocks, 0))
heap->physical_blocks_allocators[i]->info.num_blocks, 0))
return -ENOTEMPTY;
}

Expand Down Expand Up @@ -501,13 +501,13 @@ int vmh_free(struct vmh_heap *heap, void *ptr)
mem_block_iterator < MAX_MEMORY_ALLOCATORS_COUNT;
mem_block_iterator++) {
block_size =
1 << heap->physical_blocks_allocators[mem_block_iterator]->blk_sz_shift;
1 << heap->physical_blocks_allocators[mem_block_iterator]->info.blk_sz_shift;

if (vmh_is_ptr_in_memory_range((uintptr_t)ptr,
(uintptr_t)heap->physical_blocks_allocators
[mem_block_iterator]->buffer,
heap->physical_blocks_allocators
[mem_block_iterator]->num_blocks * block_size)) {
[mem_block_iterator]->info.num_blocks * block_size)) {
ptr_range_found = true;
break;
}
Expand Down Expand Up @@ -554,7 +554,7 @@ int vmh_free(struct vmh_heap *heap, void *ptr)
*/
size_t bits_to_check =
heap->physical_blocks_allocators
[mem_block_iterator]->num_blocks - ptr_bit_array_position;
[mem_block_iterator]->info.num_blocks - ptr_bit_array_position;

/* Neeeeeeeds optimization - thinking how to do it properly
* each set bit in order after another means one allocated block.
Expand Down

0 comments on commit e853b8c

Please sign in to comment.