The function returns a boolean and its current and target level inputs
are unsigned (which in turn allows simplifying the early-out check).
Also convert a non-standard loop variable to an ordinary function scope
one, at once making it unsigned too.

Signed-off-by: Jan Beulich <jbeul...@suse.com>

--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -266,16 +266,18 @@ static void ept_free_entry(struct p2m_do
     p2m_free_ptp(p2m, mfn_to_page(ept_entry->mfn));
 }
 
-static int ept_split_super_page(struct p2m_domain *p2m, ept_entry_t *ept_entry,
-                                int level, int target)
+static bool_t ept_split_super_page(struct p2m_domain *p2m,
+                                   ept_entry_t *ept_entry,
+                                   unsigned int level, unsigned int target)
 {
     ept_entry_t new_ept, *table;
     uint64_t trunk;
-    int rv = 1;
+    unsigned int i;
+    bool_t rv = 1;
 
     /* End if the entry is a leaf entry or reaches the target level. */
-    if ( level == 0 || level == target )
-        return rv;
+    if ( level <= target )
+        return 1;
 
     ASSERT(is_epte_superpage(ept_entry));
 
@@ -285,7 +287,7 @@ static int ept_split_super_page(struct p
     table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
-    for ( int i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
     {
         ept_entry_t *epte = table + i;
 



x86/EPT: adjust types in ept_split_super_page()

The function returns a boolean and its current and target level inputs
are unsigned (which in turn allows simplifying the early-out check).
Also convert a non-standard loop variable to an ordinary function scope
one, at once making it unsigned too.

Signed-off-by: Jan Beulich <jbeul...@suse.com>

--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -266,16 +266,18 @@ static void ept_free_entry(struct p2m_do
     p2m_free_ptp(p2m, mfn_to_page(ept_entry->mfn));
 }
 
-static int ept_split_super_page(struct p2m_domain *p2m, ept_entry_t *ept_entry,
-                                int level, int target)
+static bool_t ept_split_super_page(struct p2m_domain *p2m,
+                                   ept_entry_t *ept_entry,
+                                   unsigned int level, unsigned int target)
 {
     ept_entry_t new_ept, *table;
     uint64_t trunk;
-    int rv = 1;
+    unsigned int i;
+    bool_t rv = 1;
 
     /* End if the entry is a leaf entry or reaches the target level. */
-    if ( level == 0 || level == target )
-        return rv;
+    if ( level <= target )
+        return 1;
 
     ASSERT(is_epte_superpage(ept_entry));
 
@@ -285,7 +287,7 @@ static int ept_split_super_page(struct p
     table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
-    for ( int i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
     {
         ept_entry_t *epte = table + i;
 
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to