ia64/linux-2.6.18-xen.hg

changeset 574:32a80b65ddad

extract vmcoreinfo from /proc/vmcore for Xen

- get the machine address of the vmcoreinfo area of xen
- expose the machine address and the size of the vmcoreinfo area
via /sys/hypervisor/vmcoreinfo so that the kexec-tools looks them.

Signed-off-by: Itsuro Oda <oda@valinux.co.jp>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 13 09:54:50 2008 +0100 (2008-06-13)
parents e01b3a133ddc
children 9829b72f4a99
files drivers/xen/core/machine_kexec.c drivers/xen/core/xen_sysfs.c include/xen/interface/kexec.h
line diff
     1.1 --- a/drivers/xen/core/machine_kexec.c	Wed Jun 11 09:28:01 2008 +0100
     1.2 +++ b/drivers/xen/core/machine_kexec.c	Fri Jun 13 09:54:50 2008 +0100
     1.3 @@ -19,6 +19,9 @@ static int __initdata xen_max_nr_phys_cp
     1.4  static struct resource xen_hypervisor_res;
     1.5  static struct resource *xen_phys_cpus;
     1.6  
     1.7 +size_t vmcoreinfo_size_xen;
     1.8 +unsigned long paddr_vmcoreinfo_xen;
     1.9 +
    1.10  void __init xen_machine_kexec_setup_resources(void)
    1.11  {
    1.12  	xen_kexec_range_t range;
    1.13 @@ -96,6 +99,18 @@ void __init xen_machine_kexec_setup_reso
    1.14  		crashk_res.end = range.start + range.size - 1;
    1.15  	}
    1.16  
    1.17 +	/* get physical address of vmcoreinfo */
    1.18 +	memset(&range, 0, sizeof(range));
    1.19 +	range.range = KEXEC_RANGE_MA_VMCOREINFO;
    1.20 +
    1.21 +	if (HYPERVISOR_kexec_op(KEXEC_CMD_kexec_get_range, &range))
    1.22 +		return;
    1.23 +
    1.24 +	if (range.size) {
    1.25 +		paddr_vmcoreinfo_xen = range.start;
    1.26 +		vmcoreinfo_size_xen = range.size;
    1.27 +	}
    1.28 +
    1.29  	if (machine_kexec_setup_resources(&xen_hypervisor_res, xen_phys_cpus,
    1.30  					  xen_max_nr_phys_cpus))
    1.31  		goto err;
     2.1 --- a/drivers/xen/core/xen_sysfs.c	Wed Jun 11 09:28:01 2008 +0100
     2.2 +++ b/drivers/xen/core/xen_sysfs.c	Fri Jun 13 09:54:50 2008 +0100
     2.3 @@ -15,6 +15,7 @@
     2.4  #include <xen/features.h>
     2.5  #include <xen/hypervisor_sysfs.h>
     2.6  #include <xen/xenbus.h>
     2.7 +#include <xen/interface/kexec.h>
     2.8  
     2.9  MODULE_LICENSE("GPL");
    2.10  MODULE_AUTHOR("Mike D. Day <ncmike@us.ibm.com>");
    2.11 @@ -334,6 +335,24 @@ static void xen_properties_destroy(void)
    2.12  			   &xen_properties_group);
    2.13  }
    2.14  
    2.15 +static ssize_t vmcoreinfo_show(struct hyp_sysfs_attr *attr, char *page)
    2.16 +{
    2.17 +	return sprintf(page, "%lx %zx\n",
    2.18 +		paddr_vmcoreinfo_xen, vmcoreinfo_size_xen);
    2.19 +}
    2.20 +
    2.21 +HYPERVISOR_ATTR_RO(vmcoreinfo);
    2.22 +
    2.23 +static int __init xen_sysfs_vmcoreinfo_init(void)
    2.24 +{
    2.25 +	return sysfs_create_file(&hypervisor_subsys.kset.kobj, &vmcoreinfo_attr.attr);
    2.26 +}
    2.27 +
    2.28 +static void xen_sysfs_vmcoreinfo_destroy(void)
    2.29 +{
    2.30 +	sysfs_remove_file(&hypervisor_subsys.kset.kobj, &vmcoreinfo_attr.attr);
    2.31 +}
    2.32 +
    2.33  static int __init hyper_sysfs_init(void)
    2.34  {
    2.35  	int ret;
    2.36 @@ -354,9 +373,14 @@ static int __init hyper_sysfs_init(void)
    2.37  	if (ret)
    2.38  		goto uuid_out;
    2.39  	ret = xen_properties_init();
    2.40 +	if (ret)
    2.41 +		goto prop_out;
    2.42 +	ret = xen_sysfs_vmcoreinfo_init();
    2.43  	if (!ret)
    2.44  		goto out;
    2.45  
    2.46 +	xen_properties_destroy();
    2.47 +prop_out:
    2.48  	xen_sysfs_uuid_destroy();
    2.49  uuid_out:
    2.50  	xen_compilation_destroy();
    2.51 @@ -370,6 +394,7 @@ out:
    2.52  
    2.53  static void __exit hyper_sysfs_exit(void)
    2.54  {
    2.55 +	xen_sysfs_vmcoreinfo_destroy();
    2.56  	xen_properties_destroy();
    2.57  	xen_compilation_destroy();
    2.58  	xen_sysfs_uuid_destroy();
     3.1 --- a/include/xen/interface/kexec.h	Wed Jun 11 09:28:01 2008 +0100
     3.2 +++ b/include/xen/interface/kexec.h	Fri Jun 13 09:54:50 2008 +0100
     3.3 @@ -138,6 +138,10 @@ typedef struct xen_kexec_load {
     3.4                                       * the ia64_boot_param */
     3.5  #define KEXEC_RANGE_MA_EFI_MEMMAP 5 /* machine address and size of
     3.6                                       * of the EFI Memory Map */
     3.7 +#define KEXEC_RANGE_MA_VMCOREINFO 6 /* machine address and size of vmcoreinfo */
     3.8 +
     3.9 +extern size_t vmcoreinfo_size_xen;
    3.10 +extern unsigned long paddr_vmcoreinfo_xen;
    3.11  
    3.12  /*
    3.13   * Find the address and size of certain memory areas