]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
x86/setup: finish plumbing in live update path through __start_xen()
authorDavid Woodhouse <dwmw@amazon.co.uk>
Thu, 30 Jan 2020 09:53:28 +0000 (09:53 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Thu, 30 Jan 2020 12:06:56 +0000 (12:06 +0000)
With this we are fairly much done hacking up __start_xen() to support
live update. The live update functions themselves are still stubs,
but now we can start populating those with actual save/restore of
domain information.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
xen/arch/x86/setup.c
xen/common/lu/restore.c
xen/include/xen/lu.h

index ac93965be4b7b3c2eb3f68c4ef679b835d33eac7..53f7b9ced4995062eb70b9360bb8ac0ad9decc96 100644 (file)
@@ -816,7 +816,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     unsigned int initrdidx, num_parked = 0;
     multiboot_info_t *mbi;
     module_t *mod;
-    unsigned long nr_pages, raw_max_page, modules_headroom, module_map[1];
+    unsigned long nr_pages, raw_max_page, modules_headroom = 0, module_map[1];
     int i, j, e820_warn = 0, bytes = 0;
     bool acpi_boot_table_init_done = false, relocated = false, lu_reserved = false;
     int ret;
@@ -992,7 +992,8 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     }
 
     bitmap_fill(module_map, mbi->mods_count);
-    __clear_bit(0, module_map); /* Dom0 kernel is always first */
+    if ( !lu_breadcrumb_phys )
+        __clear_bit(0, module_map); /* Dom0 kernel is always first */
 
     if ( pvh_boot )
     {
@@ -1151,8 +1152,12 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         mod[mbi->mods_count].mod_end = __2M_rwdata_end - _stext;
     }
 
-    modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
-    bootstrap_map(NULL);
+
+    if ( !lu_breadcrumb_phys )
+    {
+        modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
+        bootstrap_map(NULL);
+    }
 
 #ifndef highmem_start
     /* Don't allow split below 4Gb. */
@@ -1976,21 +1981,32 @@ void __init noreturn __start_xen(unsigned long mbi_p)
            cpu_has_nx ? XENLOG_INFO : XENLOG_WARNING "Warning: ",
            cpu_has_nx ? "" : "not ");
 
-    initrdidx = find_first_bit(module_map, mbi->mods_count);
-    if ( bitmap_weight(module_map, mbi->mods_count) > 1 )
-        printk(XENLOG_WARNING
-               "Multiple initrd candidates, picking module #%u\n",
-               initrdidx);
 
-    /*
-     * We're going to setup domain0 using the module(s) that we stashed safely
-     * above our heap. The second module, if present, is an initrd ramdisk.
-     */
-    dom0 = create_dom0(mod, modules_headroom,
-                       (initrdidx > 0) && (initrdidx < mbi->mods_count)
-                       ? mod + initrdidx : NULL, kextra, loader);
-    if ( dom0 == NULL )
-        panic("Could not set up DOM0 guest OS\n");
+    if ( lu_breadcrumb_phys )
+    {
+        dom0 = lu_restore_domains(&lu_stream);
+        if ( dom0 == NULL )
+            panic("No DOM0 found in live update data\n");
+
+        lu_stream_free(&lu_stream);
+    }
+    else
+    {
+        initrdidx = find_first_bit(module_map, mbi->mods_count);
+        if ( bitmap_weight(module_map, mbi->mods_count) > 1 )
+            printk(XENLOG_WARNING
+                   "Multiple initrd candidates, picking module #%u\n",
+                   initrdidx);
+        /*
+         * We're going to setup domain0 using the module(s) that we stashed
+         * safely above our heap. The second module, if present, is an initrd.
+         */
+        dom0 = create_dom0(mod, modules_headroom,
+                           (initrdidx > 0) && (initrdidx < mbi->mods_count)
+                           ? mod + initrdidx : NULL, kextra, loader);
+        if ( dom0 == NULL )
+            panic("Could not set up DOM0 guest OS\n");
+    }
 
     heap_init_late();
 
index f52bb660d2f6cf6a37e27ab477b2e8a8f24b946f..163827f5de80d6dec8c55a2cb52c5c0baa0f1aaf 100644 (file)
@@ -23,6 +23,11 @@ void lu_reserve_pages(struct lu_stream *stream)
     }
 }
 
+struct domain *lu_restore_domains(struct lu_stream *stream)
+{
+    panic("Implement me!\n");
+}
+
 /*
  * Local variables:
  * mode: C
index 588f2dd137aa17afc4709b0da55bbe9f7b019f6a..817a88b77a105c3baa6bcdc48f0caf4a244c7938 100644 (file)
@@ -31,6 +31,8 @@ int lu_save_all(struct kexec_image *image);
 
 void lu_stream_map(struct lu_stream *stream, unsigned long mfns_phys, int nr_pages);
 void lu_reserve_pages(struct lu_stream *stream);
+/* Returns Dom0 in case the architecture needs to do anything special to it */
+struct domain *lu_restore_domains(struct lu_stream *stream);
 
 /* Pointer to the data immediately following a record header */
 #define LU_REC_DATA(hdr) ((void *)&(hdr)[1])