ia64/linux-2.6.18-xen.hg

changeset 450:b7f980c60a61

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@verge.net.au>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Feb 28 10:54:20 2008 +0000 (2008-02-28)
parents 621ce063ad83
children 11371d0e841b
files arch/i386/kernel/machine_kexec.c arch/ia64/kernel/machine_kexec.c arch/x86_64/kernel/machine_kexec.c drivers/xen/core/machine_kexec.c
line diff
     1.1 --- a/arch/i386/kernel/machine_kexec.c	Thu Feb 28 10:53:42 2008 +0000
     1.2 +++ b/arch/i386/kernel/machine_kexec.c	Thu Feb 28 10:54:20 2008 +0000
     1.3 @@ -64,6 +64,21 @@ void machine_kexec_setup_load_arg(xen_ke
     1.4  
     1.5  }
     1.6  
     1.7 +int __init machine_kexec_setup_resources(struct resource *hypervisor,
     1.8 +					 struct resource *phys_cpus,
     1.9 +					 int nr_phys_cpus)
    1.10 +{
    1.11 +	int k;
    1.12 +
    1.13 +	/* The per-cpu crash note resources belong to the hypervisor resource */
    1.14 +	for (k = 0; k < nr_phys_cpus; k++)
    1.15 +		request_resource(hypervisor, phys_cpus + k);
    1.16 +
    1.17 +	return 0;
    1.18 +}
    1.19 +
    1.20 +void machine_kexec_register_resources(struct resource *res) { ; }
    1.21 +
    1.22  #endif /* CONFIG_XEN */
    1.23  
    1.24  /*
     2.1 --- a/arch/ia64/kernel/machine_kexec.c	Thu Feb 28 10:53:42 2008 +0000
     2.2 +++ b/arch/ia64/kernel/machine_kexec.c	Thu Feb 28 10:54:20 2008 +0000
     2.3 @@ -142,4 +142,19 @@ void machine_kexec_setup_load_arg(xen_ke
     2.4  	xki->reboot_code_buffer =
     2.5  		kexec_page_to_pfn(image->control_code_page) << PAGE_SHIFT;
     2.6  }
     2.7 +
     2.8 +int __init machine_kexec_setup_resources(struct resource *hypervisor,
     2.9 +					 struct resource *phys_cpus,
    2.10 +					 int nr_phys_cpus)
    2.11 +{
    2.12 +	int k;
    2.13 +
    2.14 +	/* The per-cpu crash note resources belong to the hypervisor resource */
    2.15 +	for (k = 0; k < nr_phys_cpus; k++)
    2.16 +		request_resource(hypervisor, phys_cpus + k);
    2.17 +
    2.18 +	return 0;
    2.19 +}
    2.20 +
    2.21 +void machine_kexec_register_resources(struct resource *res) { ; }
    2.22  #endif /* CONFIG_XEN */
     3.1 --- a/arch/x86_64/kernel/machine_kexec.c	Thu Feb 28 10:53:42 2008 +0000
     3.2 +++ b/arch/x86_64/kernel/machine_kexec.c	Thu Feb 28 10:54:20 2008 +0000
     3.3 @@ -104,6 +104,21 @@ void machine_kexec_setup_load_arg(xen_ke
     3.4  	xki->page_list[PA_PTE_1] = __ma(kexec_pte1);
     3.5  }
     3.6  
     3.7 +int __init machine_kexec_setup_resources(struct resource *hypervisor,
     3.8 +					 struct resource *phys_cpus,
     3.9 +					 int nr_phys_cpus)
    3.10 +{
    3.11 +	int k;
    3.12 +
    3.13 +	/* The per-cpu crash note resources belong to the hypervisor resource */
    3.14 +	for (k = 0; k < nr_phys_cpus; k++)
    3.15 +		request_resource(hypervisor, phys_cpus + k);
    3.16 +
    3.17 +	return 0;
    3.18 +}
    3.19 +
    3.20 +void machine_kexec_register_resources(struct resource *res) { ; }
    3.21 +
    3.22  #else /* CONFIG_XEN */
    3.23  
    3.24  #define x__pmd(x) __pmd(x)
     4.1 --- a/drivers/xen/core/machine_kexec.c	Thu Feb 28 10:53:42 2008 +0000
     4.2 +++ b/drivers/xen/core/machine_kexec.c	Thu Feb 28 10:54:20 2008 +0000
     4.3 @@ -10,6 +10,10 @@
     4.4  
     4.5  extern void machine_kexec_setup_load_arg(xen_kexec_image_t *xki, 
     4.6  					 struct kimage *image);
     4.7 +extern int machine_kexec_setup_resources(struct resource *hypervisor,
     4.8 +					 struct resource *phys_cpus,
     4.9 +					 int nr_phys_cpus);
    4.10 +extern void machine_kexec_register_resources(struct resource *res);
    4.11  
    4.12  static int __initdata xen_max_nr_phys_cpus;
    4.13  static struct resource xen_hypervisor_res;
    4.14 @@ -79,10 +83,6 @@ void __init xen_machine_kexec_setup_reso
    4.15  	xen_hypervisor_res.end = range.start + range.size - 1;
    4.16  	xen_hypervisor_res.flags = IORESOURCE_BUSY | IORESOURCE_MEM;
    4.17  
    4.18 -	/* The per-cpu crash note resources belong to the hypervisor resource */
    4.19 -	for (k = 0; k < xen_max_nr_phys_cpus; k++)
    4.20 -		request_resource(&xen_hypervisor_res, xen_phys_cpus + k);
    4.21 -
    4.22  	/* fill in crashk_res if range is reserved by hypervisor */
    4.23  
    4.24  	memset(&range, 0, sizeof(range));
    4.25 @@ -96,6 +96,10 @@ void __init xen_machine_kexec_setup_reso
    4.26  		crashk_res.end = range.start + range.size - 1;
    4.27  	}
    4.28  
    4.29 +	if (machine_kexec_setup_resources(&xen_hypervisor_res, xen_phys_cpus,
    4.30 +					  xen_max_nr_phys_cpus))
    4.31 +		goto err;
    4.32 +
    4.33  	return;
    4.34  
    4.35   err:
    4.36 @@ -111,6 +115,7 @@ void __init xen_machine_kexec_setup_reso
    4.37  void __init xen_machine_kexec_register_resources(struct resource *res)
    4.38  {
    4.39  	request_resource(res, &xen_hypervisor_res);
    4.40 +	machine_kexec_register_resources(res);
    4.41  }
    4.42  
    4.43  static void setup_load_arg(xen_kexec_image_t *xki, struct kimage *image)