ia64/xen-unstable

changeset 15999:4108c2589fd1

[IA64] kexec for xen

Basic port of kexec to xen

Signed-Off-By: Simon Horman <horms@verge.net.au>
author Alex Williamson <alex.williamson@hp.com>
date Thu Sep 27 15:08:13 2007 -0600 (2007-09-27)
parents ee498c9af856
children d7c3b12014b3
files xen/arch/ia64/asm-offsets.c xen/arch/ia64/linux-xen/efi.c xen/arch/ia64/linux-xen/entry.S xen/arch/ia64/linux-xen/setup.c xen/arch/ia64/vmx/vmx_vcpu.c xen/arch/ia64/xen/Makefile xen/arch/ia64/xen/crash.c xen/arch/ia64/xen/machine_kexec.c xen/arch/ia64/xen/relocate_kernel.S xen/include/asm-ia64/elf.h xen/include/asm-ia64/kexec.h xen/include/asm-ia64/linux-xen/asm/machvec.h xen/include/asm-ia64/linux-xen/asm/meminit.h xen/include/asm-ia64/linux-xen/linux/efi.h xen/include/public/kexec.h
line diff
     1.1 --- a/xen/arch/ia64/asm-offsets.c	Thu Sep 27 12:22:16 2007 -0600
     1.2 +++ b/xen/arch/ia64/asm-offsets.c	Thu Sep 27 15:08:13 2007 -0600
     1.3 @@ -207,6 +207,8 @@ void foo(void)
     1.4  
     1.5  	BLANK();
     1.6  	DEFINE(IA64_CPUINFO_NSEC_PER_CYC_OFFSET, offsetof (struct cpuinfo_ia64, nsec_per_cyc));
     1.7 +	DEFINE(IA64_CPUINFO_PTCE_BASE_OFFSET, offsetof (struct cpuinfo_ia64, ptce_base));
     1.8 +	DEFINE(IA64_CPUINFO_PTCE_COUNT_OFFSET, offsetof (struct cpuinfo_ia64, ptce_count));
     1.9  	DEFINE(IA64_TIMESPEC_TV_NSEC_OFFSET, offsetof (struct timespec, tv_nsec));
    1.10  
    1.11  
     2.1 --- a/xen/arch/ia64/linux-xen/efi.c	Thu Sep 27 12:22:16 2007 -0600
     2.2 +++ b/xen/arch/ia64/linux-xen/efi.c	Thu Sep 27 15:08:13 2007 -0600
     2.3 @@ -333,8 +333,13 @@ efi_memmap_walk_uc (efi_freemem_callback
     2.4   * Abstraction Layer chapter 11 in ADAG
     2.5   */
     2.6  
     2.7 +#ifdef XEN
     2.8 +static void *
     2.9 +__efi_get_pal_addr (void)
    2.10 +#else
    2.11  void *
    2.12  efi_get_pal_addr (void)
    2.13 +#endif
    2.14  {
    2.15  	void *efi_map_start, *efi_map_end, *p;
    2.16  	efi_memory_desc_t *md;
    2.17 @@ -401,6 +406,14 @@ efi_get_pal_addr (void)
    2.18  
    2.19  #ifdef XEN
    2.20  void *pal_vaddr = 0;
    2.21 +
    2.22 +void *
    2.23 +efi_get_pal_addr(void)
    2.24 +{
    2.25 +	if (!pal_vaddr)
    2.26 +		pal_vaddr = __efi_get_pal_addr();
    2.27 +	return pal_vaddr;
    2.28 +}
    2.29  #endif
    2.30  
    2.31  void
    2.32 @@ -408,9 +421,7 @@ efi_map_pal_code (void)
    2.33  {
    2.34  #ifdef XEN
    2.35  	u64 psr;
    2.36 -	if (!pal_vaddr) {
    2.37 -		pal_vaddr = efi_get_pal_addr ();
    2.38 -	}
    2.39 +	(void)efi_get_pal_addr();
    2.40  #else
    2.41  	void *pal_vaddr = efi_get_pal_addr ();
    2.42  	u64 psr;
    2.43 @@ -1277,3 +1288,49 @@ vmcore_find_descriptor_size (unsigned lo
    2.44  }
    2.45  #endif
    2.46  #endif /* XEN */
    2.47 +
    2.48 +#ifdef XEN
    2.49 +/* find a block of memory aligned to 64M exclude reserved regions
    2.50 + * rsvd_regions are sorted
    2.51 + */
    2.52 +unsigned long
    2.53 +kdump_find_rsvd_region(unsigned long size, struct rsvd_region *r, int n)
    2.54 +{
    2.55 +	int i;
    2.56 +	u64 start, end;
    2.57 +	u64 alignment = 1UL << _PAGE_SIZE_64M;
    2.58 +	void *efi_map_start, *efi_map_end, *p;
    2.59 +	efi_memory_desc_t *md;
    2.60 +	u64 efi_desc_size;
    2.61 +
    2.62 +	efi_map_start = __va(ia64_boot_param->efi_memmap);
    2.63 +	efi_map_end   = efi_map_start + ia64_boot_param->efi_memmap_size;
    2.64 +	efi_desc_size = ia64_boot_param->efi_memdesc_size;
    2.65 +
    2.66 +	for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
    2.67 +		md = p;
    2.68 +		if (!efi_wb(md))
    2.69 +			continue;
    2.70 +		start = ALIGN(md->phys_addr, alignment);
    2.71 +		end = efi_md_end(md);
    2.72 +		for (i = 0; i < n; i++) {
    2.73 +			if (__pa(r[i].start) >= start && __pa(r[i].end) < end) {
    2.74 +				if (__pa(r[i].start) > start + size)
    2.75 +					return start;
    2.76 +				start = ALIGN(__pa(r[i].end), alignment);
    2.77 +				if (i < n - 1
    2.78 +				    && __pa(r[i + 1].start) < start + size)
    2.79 +					continue;
    2.80 +				else
    2.81 +					break;
    2.82 +			}
    2.83 +		}
    2.84 +		if (end > start + size)
    2.85 +			return start;
    2.86 +	}
    2.87 +
    2.88 +	printk(KERN_WARNING
    2.89 +	       "Cannot reserve 0x%lx byte of memory for crashdump\n", size);
    2.90 +	return ~0UL;
    2.91 +}
    2.92 +#endif
     3.1 --- a/xen/arch/ia64/linux-xen/entry.S	Thu Sep 27 12:22:16 2007 -0600
     3.2 +++ b/xen/arch/ia64/linux-xen/entry.S	Thu Sep 27 15:08:13 2007 -0600
     3.3 @@ -1522,7 +1522,7 @@ ia64_hypercall_table:
     3.4  	data8 do_hvm_op			/*  */
     3.5  	data8 do_sysctl			/*  */                  /* 35 */
     3.6  	data8 do_domctl			/*  */
     3.7 -	data8 do_ni_hypercall		/*  */
     3.8 +	data8 do_kexec_op		/*  */
     3.9  	data8 do_ni_hypercall		/*  */
    3.10  	data8 do_ni_hypercall		/*  */
    3.11  	data8 do_ni_hypercall		/*  */                 /* 40 */
     4.1 --- a/xen/arch/ia64/linux-xen/setup.c	Thu Sep 27 12:22:16 2007 -0600
     4.2 +++ b/xen/arch/ia64/linux-xen/setup.c	Thu Sep 27 15:08:13 2007 -0600
     4.3 @@ -64,6 +64,9 @@
     4.4  #ifdef XEN
     4.5  #include <asm/vmx.h>
     4.6  #include <asm/io.h>
     4.7 +#include <asm/kexec.h>
     4.8 +#include <public/kexec.h>
     4.9 +#include <xen/kexec.h>
    4.10  #endif
    4.11  
    4.12  #if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
    4.13 @@ -253,6 +256,39 @@ reserve_memory (void)
    4.14  	efi_memmap_init(&rsvd_region[n].start, &rsvd_region[n].end);
    4.15  	n++;
    4.16  
    4.17 +#ifdef XEN
    4.18 +	/* crashkernel=size@offset specifies the size to reserve for a crash
    4.19 +	 * kernel. If offset is 0, then it is determined automatically.
    4.20 +	 * By reserving this memory we guarantee that linux never set's it
    4.21 +	 * up as a DMA target. Useful for holding code to do something
    4.22 +	 * appropriate after a kernel panic.
    4.23 +	 */
    4.24 +	if (kexec_crash_area.size > 0) {
    4.25 +		if (!kexec_crash_area.start) {
    4.26 +			sort_regions(rsvd_region, n);
    4.27 +			kexec_crash_area.start =
    4.28 +				kdump_find_rsvd_region(kexec_crash_area.size,
    4.29 +						       rsvd_region, n);
    4.30 +		}
    4.31 +		if (kexec_crash_area.start != ~0UL) {
    4.32 +			printk("Kdump: %luMB (%lukB) at 0x%lx\n",
    4.33 +			       kexec_crash_area.size >> 20,
    4.34 +			       kexec_crash_area.size >> 10,
    4.35 +			       kexec_crash_area.start);
    4.36 +			rsvd_region[n].start =
    4.37 +				(unsigned long)__va(kexec_crash_area.start);
    4.38 +			rsvd_region[n].end =
    4.39 +				(unsigned long)__va(kexec_crash_area.start +
    4.40 +						    kexec_crash_area.size);
    4.41 +			n++;
    4.42 +		}
    4.43 +		else {
    4.44 +			kexec_crash_area.size = 0;
    4.45 +			kexec_crash_area.start = 0;
    4.46 +		}
    4.47 +	}
    4.48 +#endif
    4.49 +
    4.50  	/* end of memory marker */
    4.51  	rsvd_region[n].start = ~0UL;
    4.52  	rsvd_region[n].end   = ~0UL;
     5.1 --- a/xen/arch/ia64/vmx/vmx_vcpu.c	Thu Sep 27 12:22:16 2007 -0600
     5.2 +++ b/xen/arch/ia64/vmx/vmx_vcpu.c	Thu Sep 27 15:08:13 2007 -0600
     5.3 @@ -42,6 +42,7 @@
     5.4  #include <asm/hw_irq.h>
     5.5  #include <asm/vmx_pal_vsa.h>
     5.6  #include <asm/kregs.h>
     5.7 +#include <linux/efi.h>
     5.8  //unsigned long last_guest_rsm = 0x0;
     5.9  
    5.10  #ifdef	VTI_DEBUG
    5.11 @@ -161,7 +162,6 @@ IA64FAULT vmx_vcpu_cover(VCPU *vcpu)
    5.12  IA64FAULT vmx_vcpu_set_rr(VCPU *vcpu, u64 reg, u64 val)
    5.13  {
    5.14      ia64_rr oldrr,newrr;
    5.15 -    extern void * pal_vaddr;
    5.16      u64 rrval;
    5.17  
    5.18      vcpu_get_rr(vcpu, reg, &oldrr.rrval);
     6.1 --- a/xen/arch/ia64/xen/Makefile	Thu Sep 27 12:22:16 2007 -0600
     6.2 +++ b/xen/arch/ia64/xen/Makefile	Thu Sep 27 15:08:13 2007 -0600
     6.3 @@ -1,5 +1,6 @@
     6.4  subdir-y += oprofile
     6.5  
     6.6 +obj-y += relocate_kernel.o
     6.7  obj-y += machine_kexec.o
     6.8  obj-y += crash.o
     6.9  obj-y += acpi.o
     7.1 --- a/xen/arch/ia64/xen/crash.c	Thu Sep 27 12:22:16 2007 -0600
     7.2 +++ b/xen/arch/ia64/xen/crash.c	Thu Sep 27 15:08:13 2007 -0600
     7.3 @@ -1,10 +1,33 @@
     7.4 -#include <xen/lib.h>       /* for printk() used in stub */
     7.5 -#include <xen/types.h>
     7.6 -#include <public/kexec.h>
     7.7 +/******************************************************************************
     7.8 + * crash.c
     7.9 + *
    7.10 + * Based heavily on arch/ia64/kernel/crash.c from Linux 2.6.20-rc1
    7.11 + *
    7.12 + * Xen port written by:
    7.13 + * - Simon 'Horms' Horman <horms@verge.net.au>
    7.14 + * - Magnus Damm <magnus@valinux.co.jp>
    7.15 + */
    7.16 +
    7.17 +#include <xen/types.h>         /* Should be included by xen/kexec.h ? */
    7.18 +#include <linux/thread_info.h> /* Should be included by linux/preempt.h ? */
    7.19 +
    7.20 +#include <xen/kexec.h>
    7.21 +#include <linux/hardirq.h>
    7.22 +#include <linux/smp.h>
    7.23 +#include <asm/processor.h>
    7.24  
    7.25  void machine_crash_shutdown(void)
    7.26  {
    7.27 -    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
    7.28 +    //printk("machine_crash_shutdown: %d\n", smp_processor_id());
    7.29 +    if (in_interrupt())
    7.30 +        ia64_eoi();
    7.31 +    kexec_crash_save_info();
    7.32 +    printk(__FILE__ ": %s: save the eqivalent of x86's "
    7.33 +           "dom0->shared_info->arch.pfn_to_mfn_frame_list_list?\n",
    7.34 +           __FUNCTION__);
    7.35 +#ifdef CONFIG_SMP
    7.36 +    smp_send_stop();
    7.37 +#endif
    7.38  }
    7.39  
    7.40  /*
     8.1 --- a/xen/arch/ia64/xen/machine_kexec.c	Thu Sep 27 12:22:16 2007 -0600
     8.2 +++ b/xen/arch/ia64/xen/machine_kexec.c	Thu Sep 27 15:08:13 2007 -0600
     8.3 @@ -1,26 +1,97 @@
     8.4 -#include <xen/lib.h>       /* for printk() used in stubs */
     8.5 +/******************************************************************************
     8.6 + * machine_kexec.c
     8.7 + *
     8.8 + * Based on arch/ia64/kernel/machine_kexec.c from Linux 2.6.20-rc1
     8.9 + *
    8.10 + * Xen port written by:
    8.11 + * - Simon 'Horms' Horman <horms@verge.net.au>
    8.12 + * - Magnus Damm <magnus@valinux.co.jp>
    8.13 + */
    8.14 +
    8.15 +#include <asm/smp.h>
    8.16 +#include <xen/lib.h>
    8.17  #include <xen/types.h>
    8.18 +#include <xen/smp.h>
    8.19  #include <public/kexec.h>
    8.20 +#include <linux/efi.h>
    8.21 +#include <asm/delay.h>
    8.22 +#include <asm/meminit.h>
    8.23 +#include <asm/hw_irq.h>
    8.24 +#include <asm/kexec.h>
    8.25 +
    8.26 +typedef asmlinkage NORET_TYPE void (*relocate_new_kernel_t)(
    8.27 +					unsigned long indirection_page,
    8.28 +					unsigned long start_address,
    8.29 +					struct ia64_boot_param *boot_param,
    8.30 +					unsigned long pal_addr,
    8.31 +					unsigned long cpu_data_pa,
    8.32 +					unsigned long kernel_start,
    8.33 +					unsigned long page_offset)
    8.34 +					ATTRIB_NORET;
    8.35 +
    8.36 +#define kexec_flush_icache_page(page)					\
    8.37 +do {									\
    8.38 +	unsigned long page_addr = (unsigned long)page_address(page);	\
    8.39 +	flush_icache_range(page_addr, page_addr + PAGE_SIZE);		\
    8.40 +} while(0)
    8.41  
    8.42  int machine_kexec_load(int type, int slot, xen_kexec_image_t *image)
    8.43  {
    8.44 -    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
    8.45 -    return -1;
    8.46 +	return 0;
    8.47  }
    8.48  
    8.49  void machine_kexec_unload(int type, int slot, xen_kexec_image_t *image)
    8.50  {
    8.51 -    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
    8.52 +}
    8.53 +
    8.54 +static void ia64_machine_kexec(struct unw_frame_info *info, void *arg)
    8.55 +{
    8.56 +	xen_kexec_image_t *image = arg;
    8.57 +	relocate_new_kernel_t rnk;
    8.58 +	unsigned long code_addr = (unsigned long)
    8.59 +				  __va(image->reboot_code_buffer);
    8.60 +	unsigned long cpu_data_pa = (unsigned long)
    8.61 +				  __pa(cpu_data(smp_processor_id()));
    8.62 +	int ii;
    8.63 +
    8.64 +	/* Interrupts aren't acceptable while we reboot */
    8.65 +	local_irq_disable();
    8.66 +
    8.67 +	/* Mask CMC and Performance Monitor interrupts */
    8.68 +	ia64_setreg(_IA64_REG_CR_PMV, 1 << 16);
    8.69 +	ia64_setreg(_IA64_REG_CR_CMCV, 1 << 16);
    8.70 +
    8.71 +	/* Mask ITV and Local Redirect Registers */
    8.72 +	ia64_set_itv(1 << 16);
    8.73 +	ia64_set_lrr0(1 << 16);
    8.74 +	ia64_set_lrr1(1 << 16);
    8.75 +
    8.76 +	/* terminate possible nested in-service interrupts */
    8.77 +	for (ii = 0; ii < 16; ii++)
    8.78 +		ia64_eoi();
    8.79 +
    8.80 +	/* unmask TPR and clear any pending interrupts */
    8.81 +	ia64_setreg(_IA64_REG_CR_TPR, 0);
    8.82 +	ia64_srlz_d();
    8.83 +	while (ia64_get_ivr() != IA64_SPURIOUS_INT_VECTOR)
    8.84 +		ia64_eoi();
    8.85 +	platform_kernel_launch_event();
    8.86 +	rnk = (relocate_new_kernel_t)&code_addr;
    8.87 +	(*rnk)(image->indirection_page, image->start_address, ia64_boot_param,
    8.88 +	       GRANULEROUNDDOWN((unsigned long) pal_vaddr), cpu_data_pa,
    8.89 +	       KERNEL_START, PAGE_OFFSET);
    8.90 +	BUG();
    8.91  }
    8.92  
    8.93  void machine_kexec(xen_kexec_image_t *image)
    8.94  {
    8.95 -    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
    8.96 +	unw_init_running(ia64_machine_kexec, image);
    8.97 +	for(;;);
    8.98  }
    8.99  
   8.100  void machine_reboot_kexec(xen_kexec_image_t *image)
   8.101  {
   8.102 -    printk("STUB: " __FILE__ ": %s: not implemented\n", __FUNCTION__);
   8.103 +	machine_kexec(image);
   8.104  }
   8.105  
   8.106  /*
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/xen/arch/ia64/xen/relocate_kernel.S	Thu Sep 27 15:08:13 2007 -0600
     9.3 @@ -0,0 +1,155 @@
     9.4 +/*
     9.5 + * arch/ia64/kernel/relocate_kernel.S
     9.6 + *
     9.7 + * Relocate kexec'able kernel and start it
     9.8 + *
     9.9 + * Copyright (C) 2005 Hewlett-Packard Development Company, L.P.
    9.10 + * Copyright (C) 2005 Khalid Aziz  <khalid.aziz@hp.com>
    9.11 + * Copyright (C) 2005 Intel Corp,  Zou Nan hai <nanhai.zou@intel.com>
    9.12 + *
    9.13 + * This source code is licensed under the GNU General Public License,
    9.14 + * Version 2.  See the file COPYING for more details.
    9.15 + */
    9.16 +#include <asm/asmmacro.h>
    9.17 +#include <asm/kregs.h>
    9.18 +#include <asm/page.h>
    9.19 +#include <asm/pgtable.h>
    9.20 +#include <asm/mca_asm.h>
    9.21 +
    9.22 +GLOBAL_ENTRY(ia64_dump_cpu_regs)
    9.23 +        .prologue
    9.24 +        alloc loc0=ar.pfs,1,2,0,0
    9.25 +        .body
    9.26 +        mov     ar.rsc=0                // put RSE in enforced lazy mode
    9.27 +        add     loc1=4*8, in0           // save r4 and r5 first
    9.28 +        ;;
    9.29 +{
    9.30 +        flushrs                         // flush dirty regs to backing store
    9.31 +        srlz.i
    9.32 +}
    9.33 +        st8 [loc1]=r4, 8
    9.34 +        ;;
    9.35 +        st8 [loc1]=r5, 8
    9.36 +        ;;
    9.37 +        add loc1=32*8, in0
    9.38 +        mov r4=ar.rnat
    9.39 +        ;;
    9.40 +        st8 [in0]=r0, 8			// r0
    9.41 +        st8 [loc1]=r4, 8		// rnat
    9.42 +        mov r5=pr
    9.43 +        ;;
    9.44 +        st8 [in0]=r1, 8			// r1
    9.45 +        st8 [loc1]=r5, 8		// pr
    9.46 +        mov r4=b0
    9.47 +        ;;
    9.48 +        st8 [in0]=r2, 8			// r2
    9.49 +        st8 [loc1]=r4, 8		// b0
    9.50 +        mov r5=b1;
    9.51 +        ;;
    9.52 +        st8 [in0]=r3, 24		// r3
    9.53 +        st8 [loc1]=r5, 8		// b1
    9.54 +        mov r4=b2
    9.55 +        ;;
    9.56 +        st8 [in0]=r6, 8			// r6
    9.57 +        st8 [loc1]=r4, 8		// b2
    9.58 +	mov r5=b3
    9.59 +        ;;
    9.60 +        st8 [in0]=r7, 8			// r7
    9.61 +        st8 [loc1]=r5, 8		// b3
    9.62 +        mov r4=b4
    9.63 +        ;;
    9.64 +        st8 [in0]=r8, 8			// r8
    9.65 +        st8 [loc1]=r4, 8		// b4
    9.66 +        mov r5=b5
    9.67 +        ;;
    9.68 +        st8 [in0]=r9, 8			// r9
    9.69 +        st8 [loc1]=r5, 8		// b5
    9.70 +        mov r4=b6
    9.71 +        ;;
    9.72 +        st8 [in0]=r10, 8		// r10
    9.73 +        st8 [loc1]=r5, 8		// b6
    9.74 +        mov r5=b7
    9.75 +        ;;
    9.76 +        st8 [in0]=r11, 8		// r11
    9.77 +        st8 [loc1]=r5, 8		// b7
    9.78 +        mov r4=b0
    9.79 +        ;;
    9.80 +        st8 [in0]=r12, 8		// r12
    9.81 +        st8 [loc1]=r4, 8		// ip
    9.82 +        mov r5=loc0
    9.83 +	;;
    9.84 +        st8 [in0]=r13, 8		// r13
    9.85 +        extr.u r5=r5, 0, 38		// ar.pfs.pfm
    9.86 +	mov r4=r0			// user mask
    9.87 +        ;;
    9.88 +        st8 [in0]=r14, 8		// r14
    9.89 +        st8 [loc1]=r5, 8		// cfm
    9.90 +        ;;
    9.91 +        st8 [in0]=r15, 8		// r15
    9.92 +        st8 [loc1]=r4, 8		// user mask
    9.93 +	mov r5=ar.rsc
    9.94 +        ;;
    9.95 +        st8 [in0]=r16, 8		// r16
    9.96 +        st8 [loc1]=r5, 8		// ar.rsc
    9.97 +        mov r4=ar.bsp
    9.98 +        ;;
    9.99 +        st8 [in0]=r17, 8		// r17
   9.100 +        st8 [loc1]=r4, 8		// ar.bsp
   9.101 +        mov r5=ar.bspstore
   9.102 +        ;;
   9.103 +        st8 [in0]=r18, 8		// r18
   9.104 +        st8 [loc1]=r5, 8		// ar.bspstore
   9.105 +        mov r4=ar.rnat
   9.106 +        ;;
   9.107 +        st8 [in0]=r19, 8		// r19
   9.108 +        st8 [loc1]=r4, 8		// ar.rnat
   9.109 +        mov r5=ar.ccv
   9.110 +        ;;
   9.111 +        st8 [in0]=r20, 8		// r20
   9.112 +	st8 [loc1]=r5, 8		// ar.ccv
   9.113 +        mov r4=ar.unat
   9.114 +        ;;
   9.115 +        st8 [in0]=r21, 8		// r21
   9.116 +        st8 [loc1]=r4, 8		// ar.unat
   9.117 +        mov r5 = ar.fpsr
   9.118 +        ;;
   9.119 +        st8 [in0]=r22, 8		// r22
   9.120 +        st8 [loc1]=r5, 8		// ar.fpsr
   9.121 +        mov r4 = ar.unat
   9.122 +        ;;
   9.123 +        st8 [in0]=r23, 8		// r23
   9.124 +        st8 [loc1]=r4, 8		// unat
   9.125 +        mov r5 = ar.fpsr
   9.126 +        ;;
   9.127 +        st8 [in0]=r24, 8		// r24
   9.128 +        st8 [loc1]=r5, 8		// fpsr
   9.129 +        mov r4 = ar.pfs
   9.130 +        ;;
   9.131 +        st8 [in0]=r25, 8		// r25
   9.132 +        st8 [loc1]=r4, 8		// ar.pfs
   9.133 +        mov r5 = ar.lc
   9.134 +        ;;
   9.135 +        st8 [in0]=r26, 8		// r26
   9.136 +        st8 [loc1]=r5, 8		// ar.lc
   9.137 +        mov r4 = ar.ec
   9.138 +        ;;
   9.139 +        st8 [in0]=r27, 8		// r27
   9.140 +        st8 [loc1]=r4, 8		// ar.ec
   9.141 +        mov r5 = ar.csd
   9.142 +        ;;
   9.143 +        st8 [in0]=r28, 8		// r28
   9.144 +        st8 [loc1]=r5, 8		// ar.csd
   9.145 +        mov r4 = ar.ssd
   9.146 +        ;;
   9.147 +        st8 [in0]=r29, 8		// r29
   9.148 +        st8 [loc1]=r4, 8		// ar.ssd
   9.149 +        ;;
   9.150 +        st8 [in0]=r30, 8		// r30
   9.151 +        ;;
   9.152 +	st8 [in0]=r31, 8		// r31
   9.153 +        mov ar.pfs=loc0
   9.154 +        ;;
   9.155 +        br.ret.sptk.many rp
   9.156 +END(ia64_dump_cpu_regs)
   9.157 +
   9.158 +
    10.1 --- a/xen/include/asm-ia64/elf.h	Thu Sep 27 12:22:16 2007 -0600
    10.2 +++ b/xen/include/asm-ia64/elf.h	Thu Sep 27 15:08:13 2007 -0600
    10.3 @@ -4,7 +4,20 @@
    10.4  #include <xen/lib.h>       /* for printk() used in stub */
    10.5  
    10.6  typedef struct {
    10.7 -    unsigned long dummy;
    10.8 +    unsigned long r1;
    10.9 +    unsigned long r2;
   10.10 +    unsigned long r13;
   10.11 +    unsigned long cr_iip;
   10.12 +    unsigned long ar_rsc;
   10.13 +    unsigned long r30;
   10.14 +    unsigned long ar_bspstore;
   10.15 +    unsigned long ar_rnat;
   10.16 +    unsigned long ar_ccv;
   10.17 +    unsigned long ar_unat;
   10.18 +    unsigned long ar_pfs;
   10.19 +    unsigned long r31;
   10.20 +    unsigned long ar_csd;
   10.21 +    unsigned long ar_ssd;
   10.22  } ELF_Gregset;
   10.23  
   10.24  typedef struct {
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/xen/include/asm-ia64/kexec.h	Thu Sep 27 15:08:13 2007 -0600
    11.3 @@ -0,0 +1,15 @@
    11.4 +#ifndef __IA64_KEXEC_H__
    11.5 +#define __IA64_KEXEC_H__
    11.6 +
    11.7 +#include <xen/types.h>
    11.8 +#include <xen/kexec.h>
    11.9 +
   11.10 +extern const unsigned int relocate_new_kernel_size;
   11.11 +extern void relocate_new_kernel(unsigned long, unsigned long,
   11.12 +                                struct ia64_boot_param *, unsigned long);
   11.13 +void crash_save_xen_notes(void);
   11.14 +void machine_kexec(xen_kexec_image_t *image);
   11.15 +unsigned long kdump_find_rsvd_region(unsigned long size,
   11.16 +                                     struct rsvd_region *rsvd_regions, int n);
   11.17 +
   11.18 +#endif /* __IA64_KEXEC_H__ */
    12.1 --- a/xen/include/asm-ia64/linux-xen/asm/machvec.h	Thu Sep 27 12:22:16 2007 -0600
    12.2 +++ b/xen/include/asm-ia64/linux-xen/asm/machvec.h	Thu Sep 27 15:08:13 2007 -0600
    12.3 @@ -34,6 +34,7 @@ typedef int ia64_mv_pci_legacy_read_t (s
    12.4  				       u8 size);
    12.5  typedef int ia64_mv_pci_legacy_write_t (struct pci_bus *, u16 port, u32 val,
    12.6  					u8 size);
    12.7 +typedef void ia64_mv_kernel_launch_event_t(void);
    12.8  
    12.9  /* DMA-mapping interface: */
   12.10  typedef void ia64_mv_dma_init (void);
   12.11 @@ -263,6 +264,7 @@ extern void machvec_tlb_migrate_finish (
   12.12  #  define platform_readw_relaxed        ia64_mv.readw_relaxed
   12.13  #  define platform_readl_relaxed        ia64_mv.readl_relaxed
   12.14  #  define platform_readq_relaxed        ia64_mv.readq_relaxed
   12.15 +#  define platform_kernel_launch_event  ia64_mv.kernel_launch_event
   12.16  #ifdef XEN
   12.17  #  define platform_fw_init      ia64_mv.fw_init
   12.18  #endif
   12.19 @@ -314,6 +316,7 @@ struct ia64_machine_vector {
   12.20  	ia64_mv_readw_relaxed_t *readw_relaxed;
   12.21  	ia64_mv_readl_relaxed_t *readl_relaxed;
   12.22  	ia64_mv_readq_relaxed_t *readq_relaxed;
   12.23 +	ia64_mv_kernel_launch_event_t *kernel_launch_event;
   12.24  #ifdef XEN
   12.25  	ia64_mv_fw_init_t *fw_init;
   12.26  #endif
   12.27 @@ -362,6 +365,7 @@ struct ia64_machine_vector {
   12.28  	platform_readw_relaxed,			\
   12.29  	platform_readl_relaxed,			\
   12.30  	platform_readq_relaxed,			\
   12.31 +	platform_kernel_launch_event,		\
   12.32  	platform_fw_init,			\
   12.33  }
   12.34  #else
   12.35 @@ -407,6 +411,7 @@ struct ia64_machine_vector {
   12.36  	platform_readw_relaxed,			\
   12.37  	platform_readl_relaxed,			\
   12.38  	platform_readq_relaxed,			\
   12.39 +	platform_kernel_launch_event		\
   12.40  }
   12.41  #endif
   12.42  
   12.43 @@ -460,6 +465,9 @@ extern ia64_mv_dma_supported		swiotlb_dm
   12.44  #ifndef platform_tlb_migrate_finish
   12.45  # define platform_tlb_migrate_finish	machvec_noop_mm
   12.46  #endif
   12.47 +#ifndef platform_kernel_launch_event
   12.48 +# define platform_kernel_launch_event	machvec_noop
   12.49 +#endif
   12.50  #ifndef platform_dma_init
   12.51  # define platform_dma_init		swiotlb_init
   12.52  #endif
    13.1 --- a/xen/include/asm-ia64/linux-xen/asm/meminit.h	Thu Sep 27 12:22:16 2007 -0600
    13.2 +++ b/xen/include/asm-ia64/linux-xen/asm/meminit.h	Thu Sep 27 15:08:13 2007 -0600
    13.3 @@ -23,13 +23,14 @@
    13.4   * 	- initrd (optional)
    13.5  #endif
    13.6   * 	- Kernel memory map built from EFI memory map
    13.7 + * 	- Crash kernel for kdump
    13.8   *
    13.9   * More could be added if necessary
   13.10   */
   13.11  #ifndef XEN
   13.12 -#define IA64_MAX_RSVD_REGIONS 6
   13.13 +#define IA64_MAX_RSVD_REGIONS 7
   13.14  #else
   13.15 -#define IA64_MAX_RSVD_REGIONS 7
   13.16 +#define IA64_MAX_RSVD_REGIONS 8
   13.17  #endif
   13.18  
   13.19  struct rsvd_region {
    14.1 --- a/xen/include/asm-ia64/linux-xen/linux/efi.h	Thu Sep 27 12:22:16 2007 -0600
    14.2 +++ b/xen/include/asm-ia64/linux-xen/linux/efi.h	Thu Sep 27 15:08:13 2007 -0600
    14.3 @@ -22,6 +22,10 @@
    14.4  #include <asm/page.h>
    14.5  #include <asm/system.h>
    14.6  
    14.7 +#ifdef XEN
    14.8 +extern void * pal_vaddr;
    14.9 +#endif
   14.10 +
   14.11  #define EFI_SUCCESS		0
   14.12  #define EFI_LOAD_ERROR          ( 1 | (1UL << (BITS_PER_LONG-1)))
   14.13  #define EFI_INVALID_PARAMETER	( 2 | (1UL << (BITS_PER_LONG-1)))
    15.1 --- a/xen/include/public/kexec.h	Thu Sep 27 12:22:16 2007 -0600
    15.2 +++ b/xen/include/public/kexec.h	Thu Sep 27 15:08:13 2007 -0600
    15.3 @@ -79,6 +79,9 @@ typedef struct xen_kexec_image {
    15.4  #if defined(__i386__) || defined(__x86_64__)
    15.5      unsigned long page_list[KEXEC_XEN_NO_PAGES];
    15.6  #endif
    15.7 +#if defined(__ia64__)
    15.8 +    unsigned long reboot_code_buffer;
    15.9 +#endif
   15.10      unsigned long indirection_page;
   15.11      unsigned long start_address;
   15.12  } xen_kexec_image_t;