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

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



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.