xen/arm: Rework lpae_table
authorJulien Grall <julien.grall@arm.com>
Mon, 16 Jul 2018 17:27:04 +0000 (18:27 +0100)
committerJulien Grall <julien.grall@arm.com>
Wed, 22 Aug 2018 15:34:34 +0000 (16:34 +0100)
Currently, lpae_table can only work on entry from any level other than
3. Make it work with any level by extending the prototype to pass the
level.

At the same time, rename the function to lpae_is_mapping so naming stay
consistent accross all lpae_* helpers.

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

index d234c46e41ad89ee13f8e5e9baf047dc4eeeae58..b7f2dabd05cbdce88b2bfa6540968ce23c5db8d6 100644 (file)
@@ -996,7 +996,7 @@ static int create_xen_entries(enum xenmap_operation op,
     for(; addr < addr_end; addr += PAGE_SIZE, mfn = mfn_add(mfn, 1))
     {
         entry = &xen_second[second_linear_offset(addr)];
-        if ( !lpae_table(*entry) )
+        if ( !lpae_is_table(*entry, 2) )
         {
             rc = create_xen_table(entry);
             if ( rc < 0 ) {
index 4cf188ff8276b295ef48d1b4e323db1924684fb4..c803569c2d8e2356497006bfa20941c25f5efd22 100644 (file)
@@ -133,14 +133,9 @@ static inline bool lpae_valid(lpae_t pte)
     return pte.walk.valid;
 }
 
-/*
- * This one can only be used on L0..L2 ptes because L3 mappings set
- * the table bit and therefore these would return the opposite to what
- * you would expect.
- */
-static inline bool lpae_table(lpae_t pte)
+static inline bool lpae_is_table(lpae_t pte, unsigned int level)
 {
-    return lpae_valid(pte) && pte.walk.table;
+    return (level < 3) && lpae_valid(pte) && pte.walk.table;
 }
 
 static inline bool lpae_is_mapping(lpae_t pte, unsigned int level)