]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm: page: Describe the layout of flags used to update page tables
authorJulien Grall <julien.grall@arm.com>
Mon, 9 Oct 2017 13:23:38 +0000 (14:23 +0100)
committerStefano Stabellini <sstabellini@kernel.org>
Tue, 10 Oct 2017 21:22:19 +0000 (14:22 -0700)
Currently, the flags used to update page tables (i.e PAGE_HYPERVISOR_*)
only contains the memory attribute index. Follow-up patches will add
more information in it. So document the current layout.

At the same time introduce PAGE_AI_MASK to get the memory attribute
index easily.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/mm.c
xen/include/asm-arm/page.h

index 70a03015eca247aca1c1468728c231f01c7872e5..c1dad61a20c7d57a9309050b575df1ec492ad60d 100644 (file)
@@ -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;
index 0ae1a2587bb89d54b6e43dddbd504fa698b73a2a..aa3e83f5b451998c50533fb5fe934cf1b3729d8b 100644 (file)
 #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)