Set present bit in arch_mm_block_pte rather than arch_mm_mode_to_attrs.
This makes more sense, as it is part of the type of entry rather than an attribute of the block entry.
Change-Id: I1154607625fd8a5de5ba5cfb676dbb2fe4cc879a
diff --git a/src/arch/aarch64/inc/hf/arch/mm.h b/src/arch/aarch64/inc/hf/arch/mm.h
index 35278ca..26b11a2 100644
--- a/src/arch/aarch64/inc/hf/arch/mm.h
+++ b/src/arch/aarch64/inc/hf/arch/mm.h
@@ -26,6 +26,11 @@
#define PAGE_LEVEL_BITS 9
+/*
+ * This mask actually includes everything other than the address bits: not just
+ * the attributes but also some ignored bits, reserved bits, and the entry type
+ * bits which distinguish between absent, table, block or page entries.
+ */
#define ARCH_AARCH64_MM_PTE_ATTR_MASK \
(((UINT64_C(1) << PAGE_BITS) - 1) | ~((UINT64_C(1) << 48) - 1))
@@ -57,7 +62,7 @@
*/
static inline pte_t arch_mm_block_pte(int level, paddr_t pa, uint64_t attrs)
{
- pte_t pte = pa_addr(pa) | attrs;
+ pte_t pte = pa_addr(pa) | attrs | 0x1;
if (level == 0) {
/* A level 0 'block' is actually a page entry. */
pte |= 0x2;
diff --git a/src/arch/aarch64/mm.c b/src/arch/aarch64/mm.c
index 32ab115..2867fd9 100644
--- a/src/arch/aarch64/mm.c
+++ b/src/arch/aarch64/mm.c
@@ -90,7 +90,7 @@
uint64_t arch_mm_mode_to_attrs(int mode)
{
- uint64_t attrs = 1; /* Present bit. */
+ uint64_t attrs = 0;
if (mode & MM_MODE_STAGE1) {
attrs |= STAGE1_AF | STAGE1_SH(OUTER_SHAREABLE);