[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 5/6] x86/shadow: Clean up the MMIO fastpath helpers



Use bool when appropraite, remove extranious brackets and fix up comment
style.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Tim Deegan <tim@xxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/mm/shadow/types.h | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/mm/shadow/types.h b/xen/arch/x86/mm/shadow/types.h
index 8c0c802..d509674 100644
--- a/xen/arch/x86/mm/shadow/types.h
+++ b/xen/arch/x86/mm/shadow/types.h
@@ -294,9 +294,9 @@ void sh_destroy_monitor_table(struct vcpu *v, mfn_t mmfn);
  */
 
 #define SH_L1E_MAGIC 0xffffffff00000001ULL
-static inline int sh_l1e_is_magic(shadow_l1e_t sl1e)
+static inline bool sh_l1e_is_magic(shadow_l1e_t sl1e)
 {
-    return ((sl1e.l1 & SH_L1E_MAGIC) == SH_L1E_MAGIC);
+    return (sl1e.l1 & SH_L1E_MAGIC) == SH_L1E_MAGIC;
 }
 
 /* Guest not present: a single magic value */
@@ -305,15 +305,17 @@ static inline shadow_l1e_t sh_l1e_gnp(void)
     return (shadow_l1e_t){ -1ULL };
 }
 
-static inline int sh_l1e_is_gnp(shadow_l1e_t sl1e)
+static inline bool sh_l1e_is_gnp(shadow_l1e_t sl1e)
 {
-    return (sl1e.l1 == sh_l1e_gnp().l1);
+    return sl1e.l1 == sh_l1e_gnp().l1;
 }
 
-/* MMIO: an invalid PTE that contains the GFN of the equivalent guest l1e.
+/*
+ * MMIO: an invalid PTE that contains the GFN of the equivalent guest l1e.
  * We store 28 bits of GFN in bits 4:32 of the entry.
  * The present bit is set, and the U/S and R/W bits are taken from the guest.
- * Bit 3 is always 0, to differentiate from gnp above.  */
+ * Bit 3 is always 0, to differentiate from gnp above.
+ */
 #define SH_L1E_MMIO_MAGIC       0xffffffff00000001ULL
 #define SH_L1E_MMIO_MAGIC_MASK  0xffffffff00000009ULL
 #define SH_L1E_MMIO_GFN_MASK    0x00000000fffffff0ULL
@@ -325,9 +327,9 @@ static inline shadow_l1e_t sh_l1e_mmio(gfn_t gfn, u32 
gflags)
                              | (gflags & (_PAGE_USER|_PAGE_RW))) };
 }
 
-static inline int sh_l1e_is_mmio(shadow_l1e_t sl1e)
+static inline bool sh_l1e_is_mmio(shadow_l1e_t sl1e)
 {
-    return ((sl1e.l1 & SH_L1E_MMIO_MAGIC_MASK) == SH_L1E_MMIO_MAGIC);
+    return (sl1e.l1 & SH_L1E_MMIO_MAGIC_MASK) == SH_L1E_MMIO_MAGIC;
 }
 
 static inline gfn_t sh_l1e_mmio_get_gfn(shadow_l1e_t sl1e)
@@ -335,9 +337,9 @@ static inline gfn_t sh_l1e_mmio_get_gfn(shadow_l1e_t sl1e)
     return _gfn(MASK_EXTR(sl1e.l1, SH_L1E_MMIO_GFN_MASK));
 }
 
-static inline u32 sh_l1e_mmio_get_flags(shadow_l1e_t sl1e)
+static inline uint32_t sh_l1e_mmio_get_flags(shadow_l1e_t sl1e)
 {
-    return (u32)((sl1e.l1 & (_PAGE_USER|_PAGE_RW)));
+    return sl1e.l1 & (_PAGE_USER | _PAGE_RW);
 }
 
 #else
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.