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

[Xen-devel] [RFC PATCH v3 08/22] Add kimage_add_live_update_data()



From: David Woodhouse <dwmw@xxxxxxxxxxxx>

Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
---
 xen/common/kimage.c      | 34 ++++++++++++++++++++++++++++++++++
 xen/include/xen/kimage.h |  3 +++
 xen/include/xen/lu.h     |  3 +++
 3 files changed, 40 insertions(+)

diff --git a/xen/common/kimage.c b/xen/common/kimage.c
index 210241dfb7..86d2797cbc 100644
--- a/xen/common/kimage.c
+++ b/xen/common/kimage.c
@@ -20,6 +20,7 @@
 #include <xen/mm.h>
 #include <xen/kexec.h>
 #include <xen/kimage.h>
+#include <xen/lu.h>
 
 #include <asm/page.h>
 
@@ -938,6 +939,39 @@ done:
     return ret;
 }
 
+int kimage_add_live_update_data(struct kexec_image *image, mfn_t data, int 
nr_mfns)
+{
+    int ret;
+
+    /*
+     * For live update, we place the physical location of 'data'
+     * into the first 64 bits of the reserved live update bootmem
+     * region. At 'data' is an MFN list of pages containing the
+     * actual live update stream, which the new Xen can vmap().
+     *
+     * Append IND_WRITE64 operations to the end of the kimage stream
+     * to store the live update magic and the address of 'data' for
+     * the new Xen to see.
+     */
+    if (!lu_bootmem_start || kimage_dst_used(image, lu_bootmem_start))
+        return -EINVAL;
+
+    ret = machine_kexec_add_page(image, lu_bootmem_start, lu_bootmem_start);
+    if ( ret < 0 )
+        return ret;
+
+    ret = kimage_set_destination(image, lu_bootmem_start);
+    if (!ret)
+        ret = kimage_add_entry(image, LIVE_UPDATE_MAGIC | IND_WRITE64);
+    if (!ret)
+        ret = kimage_add_entry(image, mfn_to_maddr(data) | IND_WRITE64);
+    if (!ret)
+        ret = kimage_add_entry(image, (nr_mfns << PAGE_SHIFT) | IND_WRITE64);
+
+    kimage_terminate(image);
+
+    return ret;
+}
 /*
  * Local variables:
  * mode: C
diff --git a/xen/include/xen/kimage.h b/xen/include/xen/kimage.h
index e94839d7c3..1e0e378afd 100644
--- a/xen/include/xen/kimage.h
+++ b/xen/include/xen/kimage.h
@@ -54,6 +54,9 @@ unsigned long kimage_entry_ind(kimage_entry_t *entry, bool_t 
compat);
 int kimage_build_ind(struct kexec_image *image, mfn_t ind_mfn,
                      bool_t compat);
 
+int kimage_add_live_update_data(struct kexec_image *image, mfn_t data,
+                                int nr_mfns);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* __XEN_KIMAGE_H__ */
diff --git a/xen/include/xen/lu.h b/xen/include/xen/lu.h
index abb30545fe..21ee1825d3 100644
--- a/xen/include/xen/lu.h
+++ b/xen/include/xen/lu.h
@@ -1,9 +1,12 @@
 #ifndef __XEN_LU_H__
 #define __XEN_LU_H__
 
+
 #include <xen/types.h>
 #include <xen/mm.h>
 
+#define LIVE_UPDATE_MAGIC        (0x4c69766555706461UL & PAGE_MASK)
+
 struct lu_stream {
     mfn_t *pagelist;
     size_t len;
-- 
2.21.0


_______________________________________________
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®.