# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1204196060 0
# Node ID b7f980c60a6182740bd03a9d03bff80388669d62
# Parent 621ce063ad83394b25bb63d1684021cf565a94e1
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.
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(-)
diff -r 621ce063ad83 -r b7f980c60a61 arch/i386/kernel/machine_kexec.c
--- a/arch/i386/kernel/machine_kexec.c Thu Feb 28 10:53:42 2008 +0000
+++ b/arch/i386/kernel/machine_kexec.c Thu Feb 28 10:54:20 2008 +0000
@@ -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 */
/*
diff -r 621ce063ad83 -r b7f980c60a61 arch/ia64/kernel/machine_kexec.c
--- a/arch/ia64/kernel/machine_kexec.c Thu Feb 28 10:53:42 2008 +0000
+++ b/arch/ia64/kernel/machine_kexec.c Thu Feb 28 10:54:20 2008 +0000
@@ -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 */
diff -r 621ce063ad83 -r b7f980c60a61 arch/x86_64/kernel/machine_kexec.c
--- a/arch/x86_64/kernel/machine_kexec.c Thu Feb 28 10:53:42 2008 +0000
+++ b/arch/x86_64/kernel/machine_kexec.c Thu Feb 28 10:54:20 2008 +0000
@@ -103,6 +103,21 @@ void machine_kexec_setup_load_arg(xen_ke
xki->page_list[PA_PTE_0] = __ma(kexec_pte0);
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 */
diff -r 621ce063ad83 -r b7f980c60a61 drivers/xen/core/machine_kexec.c
--- a/drivers/xen/core/machine_kexec.c Thu Feb 28 10:53:42 2008 +0000
+++ b/drivers/xen/core/machine_kexec.c Thu Feb 28 10:54:20 2008 +0000
@@ -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));
@@ -95,6 +95,10 @@ void __init xen_machine_kexec_setup_reso
crashk_res.start = range.start;
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;
@@ -111,6 +115,7 @@ void __init xen_machine_kexec_register_r
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)
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|