From fbc796cff1a60712b1630c42256f121c2c6cc111 Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Thu, 29 Aug 2024 15:09:16 +0300 Subject: [PATCH] arm64_mmu: Do not set accessed-flag for table descriptors The 12:0 bits in table descriptors are RES0 and AF is the 10th bit, so it is not valid to set it in this case. Fix this by moving AF to the common MMU_MT_NORMAL_FLAGS field --- arch/arm64/src/common/arm64_mmu.c | 4 ---- arch/arm64/src/common/arm64_mmu.h | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/arm64/src/common/arm64_mmu.c b/arch/arm64/src/common/arm64_mmu.c index ec1bb1b98b..a2572850a1 100644 --- a/arch/arm64/src/common/arm64_mmu.c +++ b/arch/arm64/src/common/arm64_mmu.c @@ -707,10 +707,6 @@ void mmu_ln_setentry(uint32_t ptlevel, uintptr_t lnvaddr, uintptr_t paddr, index = XLAT_TABLE_VA_IDX(vaddr, ptlevel); - /* Setup the page descriptor and access flag */ - - mmuflags |= PTE_PAGE_DESC | PTE_BLOCK_DESC_AF; - /* Save it */ lntable[index] = (paddr | mmuflags); diff --git a/arch/arm64/src/common/arm64_mmu.h b/arch/arm64/src/common/arm64_mmu.h index a5c59791a8..1e95232f34 100644 --- a/arch/arm64/src/common/arm64_mmu.h +++ b/arch/arm64/src/common/arm64_mmu.h @@ -223,11 +223,11 @@ /* Flags for user page tables */ -#define MMU_UPGT_FLAGS (0) +#define MMU_UPGT_FLAGS (PTE_TABLE_DESC) /* Flags for normal memory region */ -#define MMU_MT_NORMAL_FLAGS (PTE_BLOCK_DESC_INNER_SHARE | PTE_BLOCK_DESC_MEMTYPE(MT_NORMAL)) +#define MMU_MT_NORMAL_FLAGS (PTE_PAGE_DESC | PTE_BLOCK_DESC_AF | PTE_BLOCK_DESC_INNER_SHARE | PTE_BLOCK_DESC_MEMTYPE(MT_NORMAL)) /* Flags for user FLASH (RX) and user RAM (RW) */ @@ -240,7 +240,7 @@ /* Flags for kernel page tables */ -#define MMU_KPGT_FLAGS (0) +#define MMU_KPGT_FLAGS (PTE_TABLE_DESC) /* Kernel FLASH and RAM are mapped globally */