WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [patch 3/4] kexec: read more iomem regions from hypevisor

To: xen-devel@xxxxxxxxxxxxxxxxxxx, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch 3/4] kexec: read more iomem regions from hypevisor
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Wed, 27 Feb 2008 16:10:05 +0900
Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxx>
Delivery-date: Tue, 26 Feb 2008 23:18:34 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20080227071002.966248306@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: quilt/0.46-1
This sets the location of the efi memmap and boot parameter
regions using information provided by the hypervisor,
overriding values derived by dom0 from the virtualised
efi memory regions.

It also creates a xen heap region and uses this as the parent
of per-cpu regions - they belong in hypervisor memory not
dom0 kernel memory.

The xen heap region is inserted into /proc/iomem_machine


* There is also a hypervisor portion of this patch.
* In order for the regions to show up after kexec patches
  to kexec-tools are required. I have posted them
  to the kexec mailing list and intend to merge them.

  http://lists.infradead.org/pipermail/kexec/2008-February/001348.html

Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

--- 

 arch/ia64/kernel/machine_kexec.c |   50 +++++++++++++++++++++++++++++++++++---
 include/xen/interface/kexec.h    |   15 +++++++++--
 2 files changed, 59 insertions(+), 6 deletions(-)
Index: linux-2.6.18-xen.hg/include/xen/interface/kexec.h
===================================================================
--- linux-2.6.18-xen.hg.orig/include/xen/interface/kexec.h      2008-02-26 
13:51:03.000000000 +0900
+++ linux-2.6.18-xen.hg/include/xen/interface/kexec.h   2008-02-26 
13:51:26.000000000 +0900
@@ -108,9 +108,18 @@ typedef struct xen_kexec_load {
     xen_kexec_image_t image;
 } xen_kexec_load_t;
 
-#define KEXEC_RANGE_MA_CRASH 0   /* machine address and size of crash area */
-#define KEXEC_RANGE_MA_XEN   1   /* machine address and size of Xen itself */
-#define KEXEC_RANGE_MA_CPU   2   /* machine address and size of a CPU note */
+#define KEXEC_RANGE_MA_CRASH      0 /* machine address and size of crash area 
*/
+#define KEXEC_RANGE_MA_XEN        1 /* machine address and size of Xen itself 
*/
+#define KEXEC_RANGE_MA_CPU        2 /* machine address and size of a CPU note 
*/
+#define KEXEC_RANGE_MA_XENHEAP    3 /* machine address and size of xenheap
+                                    * Note that although this is adjacent
+                                    * to Xen it exists in a separate EFI
+                                    * region on ia64, and thus needs to be
+                                    * inserted into iomem_machine separately */
+#define KEXEC_RANGE_MA_BOOT_PARAM 4 /* machine address and size of
+                                     * the ia64_boot_param */
+#define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of
+                                     * of the EFI Memory Map */
 
 /*
  * Find the address and size of certain memory areas
Index: linux-2.6.18-xen.hg/arch/ia64/kernel/machine_kexec.c
===================================================================
--- linux-2.6.18-xen.hg.orig/arch/ia64/kernel/machine_kexec.c   2008-02-26 
13:51:26.000000000 +0900
+++ linux-2.6.18-xen.hg/arch/ia64/kernel/machine_kexec.c        2008-02-26 
13:51:26.000000000 +0900
@@ -143,18 +143,62 @@ void machine_kexec_setup_load_arg(xen_ke
                kexec_page_to_pfn(image->control_code_page) << PAGE_SHIFT;
 }
 
+static struct resource xen_hypervisor_heap_res;
+
 int __init machine_kexec_setup_resources(struct resource *hypervisor,
                                         struct resource *phys_cpus,
                                         int nr_phys_cpus)
 {
+       xen_kexec_range_t range;
        int k;
 
-       /* The per-cpu crash note resources belong to the hypervisor resource */
+       /* fill in xen_hypervisor_heap_res with hypervisor heap
+        * machine address range
+        */
+
+       memset(&range, 0, sizeof(range));
+       range.range = KEXEC_RANGE_MA_XENHEAP;
+
+       if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
+               return -1;
+
+       xen_hypervisor_heap_res.name = "Hypervisor heap";
+       xen_hypervisor_heap_res.start = range.start;
+       xen_hypervisor_heap_res.end = range.start + range.size - 1;
+       xen_hypervisor_heap_res.flags = IORESOURCE_BUSY | IORESOURCE_MEM;
+
+       /* The per-cpu crash note  resources belong inside the
+        * hypervisor heap resource */
        for (k = 0; k < nr_phys_cpus; k++)
-               request_resource(hypervisor, phys_cpus + k);
+               request_resource(&xen_hypervisor_heap_res, phys_cpus + k);
+
+       /* fill in efi_memmap_res with EFI memmap machine address range */
+
+       memset(&range, 0, sizeof(range));
+       range.range = KEXEC_RANGE_MA_EFI_MEMMAP;
+
+       if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
+               return -1;
+
+       efi_memmap_res.start = range.start;
+       efi_memmap_res.end = range.start + range.size - 1;
+
+       /* fill in boot_param_res with boot parameter machine address range */
+
+       memset(&range, 0, sizeof(range));
+       range.range = KEXEC_RANGE_MA_BOOT_PARAM;
+
+       if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
+               return -1;
+
+       boot_param_res.start = range.start;
+       boot_param_res.end = range.start + range.size - 1;
 
        return 0;
 }
 
-void machine_kexec_register_resources(struct resource *res) { ; }
+void machine_kexec_register_resources(struct resource *res)
+{
+       request_resource(res, &xen_hypervisor_heap_res);
+}
 #endif /* CONFIG_XEN */

-- 

-- 
Horms


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel