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-ia64-devel

[Xen-devel] [patch 2/4] kexec: add xen_machine_kexec_register_resources(

To: xen-devel@xxxxxxxxxxxxxxxxxxx, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [patch 2/4] kexec: add xen_machine_kexec_register_resources() and machine_kexec_register_resources()
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Wed, 27 Feb 2008 16:10:04 +0900
Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxx>
Delivery-date: Tue, 26 Feb 2008 23:17:55 -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
Add xen_machine_kexec_register_resources() and
machine_kexec_register_resources() to allow architecture specific handling
of iomem resources.

At this time xen_machine_kexec_register_resources() does the
same parenting of per-cpu resources on all architectures.
And machine_kexec_register_resources does nothing on all architectures.
A subsequent patch will alter the behaviour on ia64.

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

--- 

 arch/i386/kernel/machine_kexec.c   |   15 +++++++++++++++
 arch/ia64/kernel/machine_kexec.c   |   15 +++++++++++++++
 arch/x86_64/kernel/machine_kexec.c |   15 +++++++++++++++
 drivers/xen/core/machine_kexec.c   |   13 +++++++++----
 4 files changed, 54 insertions(+), 4 deletions(-)

Index: linux-2.6.18-xen.hg/arch/i386/kernel/machine_kexec.c
===================================================================
--- linux-2.6.18-xen.hg.orig/arch/i386/kernel/machine_kexec.c   2008-02-25 
14:18:14.000000000 +0900
+++ linux-2.6.18-xen.hg/arch/i386/kernel/machine_kexec.c        2008-02-25 
14:19:19.000000000 +0900
@@ -64,6 +64,21 @@ void machine_kexec_setup_load_arg(xen_ke
 
 }
 
+int __init machine_kexec_setup_resources(struct resource *hypervisor,
+                                        struct resource *phys_cpus,
+                                        int nr_phys_cpus)
+{
+       int k;
+
+       /* The per-cpu crash note resources belong to the hypervisor resource */
+       for (k = 0; k < nr_phys_cpus; k++)
+               request_resource(hypervisor, phys_cpus + k);
+
+       return 0;
+}
+
+void machine_kexec_register_resources(struct resource *res) { ; }
+
 #endif /* CONFIG_XEN */
 
 /*
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-25 
14:18:14.000000000 +0900
+++ linux-2.6.18-xen.hg/arch/ia64/kernel/machine_kexec.c        2008-02-25 
14:33:05.000000000 +0900
@@ -142,4 +142,19 @@ void machine_kexec_setup_load_arg(xen_ke
        xki->reboot_code_buffer =
                kexec_page_to_pfn(image->control_code_page) << PAGE_SHIFT;
 }
+
+int __init machine_kexec_setup_resources(struct resource *hypervisor,
+                                        struct resource *phys_cpus,
+                                        int nr_phys_cpus)
+{
+       int k;
+
+       /* The per-cpu crash note resources belong to the hypervisor resource */
+       for (k = 0; k < nr_phys_cpus; k++)
+               request_resource(hypervisor, phys_cpus + k);
+
+       return 0;
+}
+
+void machine_kexec_register_resources(struct resource *res) { ; }
 #endif /* CONFIG_XEN */
Index: linux-2.6.18-xen.hg/arch/x86_64/kernel/machine_kexec.c
===================================================================
--- linux-2.6.18-xen.hg.orig/arch/x86_64/kernel/machine_kexec.c 2008-02-25 
14:18:14.000000000 +0900
+++ linux-2.6.18-xen.hg/arch/x86_64/kernel/machine_kexec.c      2008-02-25 
14:19:19.000000000 +0900
@@ -104,6 +104,21 @@ void machine_kexec_setup_load_arg(xen_ke
        xki->page_list[PA_PTE_1] = __ma(kexec_pte1);
 }
 
+int __init machine_kexec_setup_resources(struct resource *hypervisor,
+                                        struct resource *phys_cpus,
+                                        int nr_phys_cpus)
+{
+       int k;
+
+       /* The per-cpu crash note resources belong to the hypervisor resource */
+       for (k = 0; k < nr_phys_cpus; k++)
+               request_resource(hypervisor, phys_cpus + k);
+
+       return 0;
+}
+
+void machine_kexec_register_resources(struct resource *res) { ; }
+
 #else /* CONFIG_XEN */
 
 #define x__pmd(x) __pmd(x)
Index: linux-2.6.18-xen.hg/drivers/xen/core/machine_kexec.c
===================================================================
--- linux-2.6.18-xen.hg.orig/drivers/xen/core/machine_kexec.c   2008-02-25 
14:19:06.000000000 +0900
+++ linux-2.6.18-xen.hg/drivers/xen/core/machine_kexec.c        2008-02-25 
14:19:19.000000000 +0900
@@ -10,6 +10,10 @@
 
 extern void machine_kexec_setup_load_arg(xen_kexec_image_t *xki, 
                                         struct kimage *image);
+extern int machine_kexec_setup_resources(struct resource *hypervisor,
+                                        struct resource *phys_cpus,
+                                        int nr_phys_cpus);
+extern void machine_kexec_register_resources(struct resource *res);
 
 static int __initdata xen_max_nr_phys_cpus;
 static struct resource xen_hypervisor_res;
@@ -79,10 +83,6 @@ void __init xen_machine_kexec_setup_reso
        xen_hypervisor_res.end = range.start + range.size - 1;
        xen_hypervisor_res.flags = IORESOURCE_BUSY | IORESOURCE_MEM;
 
-       /* The per-cpu crash note resources belong to the hypervisor resource */
-       for (k = 0; k < xen_max_nr_phys_cpus; k++)
-               request_resource(&xen_hypervisor_res, xen_phys_cpus + k);
-
        /* fill in crashk_res if range is reserved by hypervisor */
 
        memset(&range, 0, sizeof(range));
@@ -96,6 +96,10 @@ void __init xen_machine_kexec_setup_reso
                crashk_res.end = range.start + range.size - 1;
        }
 
+       if (machine_kexec_setup_resources(&xen_hypervisor_res, xen_phys_cpus,
+                                         xen_max_nr_phys_cpus))
+               goto err;
+
        return;
 
  err:
@@ -111,6 +115,7 @@ void __init xen_machine_kexec_setup_reso
 void __init xen_machine_kexec_register_resources(struct resource *res)
 {
        request_resource(res, &xen_hypervisor_res);
+       machine_kexec_register_resources(res);
 }
 
 static void setup_load_arg(xen_kexec_image_t *xki, struct kimage *image)

-- 

-- 
Horms


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