From 44222b7dfc55685fd4b7bf9ed1159d4b52a700ee Mon Sep 17 00:00:00 2001 From: Marcin Szkudlinski Date: Tue, 31 Jan 2023 18:24:49 +0100 Subject: [PATCH] mtl: bugfix: tlb driver should allow remapping all unused pages UNUSED_L2_START_ALIGNED is a marker of first page not used by the linker. Starting from this page, the memory may be re-mapped. assertion <= is banning remapping of the first unused page changing to < Signed-off-by: Marcin Szkudlinski --- drivers/mm/mm_drv_intel_adsp_mtl_tlb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c index 0738470bd92..f090c3466c6 100644 --- a/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c +++ b/drivers/mm/mm_drv_intel_adsp_mtl_tlb.c @@ -190,7 +190,7 @@ int sys_mm_drv_map_page(void *virt, uintptr_t phys, uint32_t flags) } /* Check bounds of virtual address space */ - CHECKIF((va <= UNUSED_L2_START_ALIGNED) || + CHECKIF((va < UNUSED_L2_START_ALIGNED) || (va >= (CONFIG_KERNEL_VM_BASE + CONFIG_KERNEL_VM_SIZE))) { ret = -EINVAL; goto out; @@ -336,7 +336,7 @@ int sys_mm_drv_unmap_page(void *virt) uintptr_t va = POINTER_TO_UINT(z_soc_cached_ptr(virt)); /* Check bounds of virtual address space */ - CHECKIF((va <= UNUSED_L2_START_ALIGNED) || + CHECKIF((va < UNUSED_L2_START_ALIGNED) || (va >= (CONFIG_KERNEL_VM_BASE + CONFIG_KERNEL_VM_SIZE))) { ret = -EINVAL; goto out;