Skip to contentSkip to conversation

x86/pv: Fold adjacent paths in dom0_construct_pv()

PATCH In review Andrew Cooper 2 participants 2 messages Apr 19, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/pv: Fold adjacent paths in dom0_construct_pv()

This removes a visually-werid layout of conditionals.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Wei Liu <[email protected]>

---
 xen/arch/x86/pv/dom0_build.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
xen/arch/x86/pv/dom0_build.c +7 -10
index e0801a9e6d..0ea906d6f8 100644
@@ -615,9 +615,14 @@ int __init dom0_construct_pv(struct domain *d,
     {
         v->arch.pv.failsafe_callback_cs = FLAT_COMPAT_KERNEL_CS;
         v->arch.pv.event_callback_cs    = FLAT_COMPAT_KERNEL_CS;
-    }
 
-    if ( !compat )
+        /* Monitor table already created by switch_compat(). */
+        l4start = l4tab = __va(pagetable_get_paddr(v->arch.guest_table));
+        /* See public/xen.h on why the following is needed. */
+        maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l3_page_table;
+        l3start = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
+    }
+    else
     {
         maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l4_page_table;
         l4start = l4tab = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
@@ -626,14 +631,6 @@ int __init dom0_construct_pv(struct domain *d,
                           d, INVALID_MFN, true);
         v->arch.guest_table = pagetable_from_paddr(__pa(l4start));
     }
-    else
-    {
-        /* Monitor table already created by switch_compat(). */
-        l4start = l4tab = __va(pagetable_get_paddr(v->arch.guest_table));
-        /* See public/xen.h on why the following is needed. */
-        maddr_to_page(mpt_alloc)->u.inuse.type_info = PGT_l3_page_table;
-        l3start = __va(mpt_alloc); mpt_alloc += PAGE_SIZE;
-    }
 
     l4tab += l4_table_offset(v_start);
     pfn = alloc_spfn;
Signature · 1 line
2.11.0