@@ -331,7 +331,7 @@ static inline lpae_t mfn_to_xen_entry(mfn_t mfn, unsigned attr)
/* Map a 4k page in a fixmap entry */
void set_fixmap(unsigned map, mfn_t mfn, unsigned int flags)
{
- lpae_t pte = mfn_to_xen_entry(mfn, flags);
+ lpae_t pte = mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags));
pte.pt.table = 1; /* 4k mappings always have this bit set */
pte.pt.xn = 1;
write_pte(xen_fixmap + third_table_offset(FIXMAP_ADDR(map)), pte);
@@ -1021,7 +1021,7 @@ static int create_xen_entries(enum xenmap_operation op,
}
if ( op == RESERVE )
break;
- pte = mfn_to_xen_entry(mfn, flags);
+ pte = mfn_to_xen_entry(mfn, PAGE_AI_MASK(flags));
pte.pt.table = 1;
write_pte(entry, pte);
break;
@@ -65,6 +65,13 @@
#define MAIR0VAL (MAIRVAL & 0xffffffff)
#define MAIR1VAL (MAIRVAL >> 32)
+/*
+ * Layout of the flags used for updating the hypervisor page tables
+ *
+ * [0:2] Memory Attribute Index
+ */
+#define PAGE_AI_MASK(x) ((x) & 0x7U)
+
#define PAGE_HYPERVISOR (MT_NORMAL)
#define PAGE_HYPERVISOR_NOCACHE (MT_DEVICE_nGnRE)
#define PAGE_HYPERVISOR_WC (MT_NORMAL_NC)