[U-Boot] [PATCH] armv8: Fix MMU table page descriptor

York Sun york.sun at nxp.com
Thu Feb 2 17:58:34 UTC 2017


Page descriptor uses different format than block descriptor. Both bit 1
and 0 must be set to indicate a valid page.

Signed-off-by: York Sun <york.sun at nxp.com>
CC: Alexander Graf <agraf at suse.de>
---
This issue didn't reveal itself unless we use MMU tables down to page
size.

 arch/arm/cpu/armv8/cache_v8.c    | 2 +-
 arch/arm/include/asm/armv8/mmu.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c
index 6c5630c..afa76c1 100644
--- a/arch/arm/cpu/armv8/cache_v8.c
+++ b/arch/arm/cpu/armv8/cache_v8.c
@@ -230,7 +230,7 @@ static void add_map(struct mm_region *map)
 				/* Page fits, create block PTE */
 				debug("Setting PTE %p to block virt=%llx\n",
 				      pte, virt);
-				*pte = phys | attrs;
+				*pte = phys | attrs | (level == 3 ? PTE_TYPE_PAGE : 0);
 				virt += blocksize;
 				phys += blocksize;
 				size -= blocksize;
diff --git a/arch/arm/include/asm/armv8/mmu.h b/arch/arm/include/asm/armv8/mmu.h
index aa0f3c4..58aecb9 100644
--- a/arch/arm/include/asm/armv8/mmu.h
+++ b/arch/arm/include/asm/armv8/mmu.h
@@ -60,6 +60,7 @@
 #define PTE_TYPE_MASK		(3 << 0)
 #define PTE_TYPE_FAULT		(0 << 0)
 #define PTE_TYPE_TABLE		(3 << 0)
+#define PTE_TYPE_PAGE		(3 << 0)
 #define PTE_TYPE_BLOCK		(1 << 0)
 
 #define PTE_TABLE_PXN		(1UL << 59)
-- 
2.7.4



More information about the U-Boot mailing list