ia64/xen-unstable

changeset 10680:80dbb6c5862b

[IA64] Modify mca.c for Xen/ia64 INIT support

Update mca.c to support INIT on Xen

In ia64_mca_cpu_init(), use alloc_xenheap_pages() for allocation
of ia64_mca_cpu. In linux, alloc_bootmem is used.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
[Ported from stand-alone mca.c]
Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author awilliam@xenbuild.aw
date Thu Jul 06 13:26:27 2006 -0600 (2006-07-06)
parents 7c6c400f5a7d
children 00f20f7c0e23
files xen/arch/ia64/linux-xen/mca.c xen/include/asm-ia64/linux-null/linux/kallsyms.h xen/include/asm-ia64/linux-null/linux/workqueue.h
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/mca.c	Thu Jul 06 11:57:05 2006 -0600
     1.2 +++ b/xen/arch/ia64/linux-xen/mca.c	Thu Jul 06 13:26:27 2006 -0600
     1.3 @@ -77,6 +77,10 @@
     1.4  #include <asm/irq.h>
     1.5  #include <asm/hw_irq.h>
     1.6  
     1.7 +#ifdef XEN
     1.8 +#include <xen/symbols.h>
     1.9 +#endif
    1.10 +
    1.11  #if defined(IA64_MCA_DEBUG_INFO)
    1.12  # define IA64_MCA_DEBUG(fmt...)	printk(fmt)
    1.13  #else
    1.14 @@ -100,6 +104,7 @@ extern void			ia64_slave_init_handler (v
    1.15  
    1.16  static ia64_mc_info_t		ia64_mc_info;
    1.17  
    1.18 +#ifndef XEN
    1.19  #define MAX_CPE_POLL_INTERVAL (15*60*HZ) /* 15 minutes */
    1.20  #define MIN_CPE_POLL_INTERVAL (2*60*HZ)  /* 2 minutes */
    1.21  #define CMC_POLL_INTERVAL     (1*60*HZ)  /* 1 minute */
    1.22 @@ -124,9 +129,11 @@ static int cmc_polling_enabled = 1;
    1.23  static int cpe_poll_enabled = 1;
    1.24  
    1.25  extern void salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe);
    1.26 +#endif /* !XEN */
    1.27  
    1.28  static int mca_init;
    1.29  
    1.30 +#ifndef XEN
    1.31  /*
    1.32   * IA64_MCA log support
    1.33   */
    1.34 @@ -267,7 +274,9 @@ ia64_mca_log_sal_error_record(int sal_in
    1.35  /*
    1.36   * platform dependent error handling
    1.37   */
    1.38 +#endif /* !XEN */
    1.39  #ifndef PLATFORM_MCA_HANDLERS
    1.40 +#ifndef XEN
    1.41  
    1.42  #ifdef CONFIG_ACPI
    1.43  
    1.44 @@ -329,6 +338,7 @@ ia64_mca_cpe_int_handler (int cpe_irq, v
    1.45  }
    1.46  
    1.47  #endif /* CONFIG_ACPI */
    1.48 +#endif /* !XEN */
    1.49  
    1.50  static void
    1.51  show_min_state (pal_min_state_area_t *minstate)
    1.52 @@ -486,11 +496,16 @@ init_handler_platform (pal_min_state_are
    1.53  	udelay(5*1000000);
    1.54  	show_min_state(ms);
    1.55  
    1.56 +#ifndef XEN
    1.57  	printk("Backtrace of current task (pid %d, %s)\n", current->pid, current->comm);
    1.58 +#else
    1.59 +	printk("Backtrace of current vcpu (vcpu_id %d)\n", current->vcpu_id);
    1.60 +#endif
    1.61  	fetch_min_state(ms, pt, sw);
    1.62  	unw_init_from_interruption(&info, current, pt, sw);
    1.63  	ia64_do_show_stack(&info, NULL);
    1.64  
    1.65 +#ifndef XEN
    1.66  #ifdef CONFIG_SMP
    1.67  	/* read_trylock() would be handy... */
    1.68  	if (!tasklist_lock.write_lock)
    1.69 @@ -510,11 +525,13 @@ init_handler_platform (pal_min_state_are
    1.70  	if (!tasklist_lock.write_lock)
    1.71  		read_unlock(&tasklist_lock);
    1.72  #endif
    1.73 +#endif /* !XEN */
    1.74  
    1.75  	printk("\nINIT dump complete.  Please reboot now.\n");
    1.76  	while (1);			/* hang city if no debugger */
    1.77  }
    1.78  
    1.79 +#ifndef XEN
    1.80  #ifdef CONFIG_ACPI
    1.81  /*
    1.82   * ia64_mca_register_cpev
    1.83 @@ -545,7 +562,9 @@ ia64_mca_register_cpev (int cpev)
    1.84  }
    1.85  #endif /* CONFIG_ACPI */
    1.86  
    1.87 +#endif /* !XEN */
    1.88  #endif /* PLATFORM_MCA_HANDLERS */
    1.89 +#ifndef XEN
    1.90  
    1.91  /*
    1.92   * ia64_mca_cmc_vector_setup
    1.93 @@ -1121,6 +1140,7 @@ ia64_mca_cpe_poll (unsigned long dummy)
    1.94  }
    1.95  
    1.96  #endif /* CONFIG_ACPI */
    1.97 +#endif /* !XEN */
    1.98  
    1.99  /*
   1.100   * C portion of the OS INIT handler
   1.101 @@ -1139,22 +1159,30 @@ ia64_init_handler (struct pt_regs *pt, s
   1.102  {
   1.103  	pal_min_state_area_t *ms;
   1.104  
   1.105 +#ifndef XEN
   1.106  	oops_in_progress = 1;	/* avoid deadlock in printk, but it makes recovery dodgy */
   1.107  	console_loglevel = 15;	/* make sure printks make it to console */
   1.108 +#endif
   1.109  
   1.110  	printk(KERN_INFO "Entered OS INIT handler. PSP=%lx\n",
   1.111  		ia64_sal_to_os_handoff_state.proc_state_param);
   1.112  
   1.113 +#ifndef XEN
   1.114  	/*
   1.115  	 * Address of minstate area provided by PAL is physical,
   1.116  	 * uncacheable (bit 63 set). Convert to Linux virtual
   1.117  	 * address in region 6.
   1.118  	 */
   1.119  	ms = (pal_min_state_area_t *)(ia64_sal_to_os_handoff_state.pal_min_state | (6ul<<61));
   1.120 +#else
   1.121 +	/* Xen virtual address in region 7. */
   1.122 +	ms = __va((pal_min_state_area_t *)(ia64_sal_to_os_handoff_state.pal_min_state));
   1.123 +#endif
   1.124  
   1.125  	init_handler_platform(ms, pt, sw);	/* call platform specific routines */
   1.126  }
   1.127  
   1.128 +#ifndef XEN
   1.129  static int __init
   1.130  ia64_mca_disable_cpe_polling(char *str)
   1.131  {
   1.132 @@ -1201,6 +1229,7 @@ static struct irqaction mca_cpep_irqacti
   1.133  	.name =		"cpe_poll"
   1.134  };
   1.135  #endif /* CONFIG_ACPI */
   1.136 +#endif /* !XEN */
   1.137  
   1.138  /* Do per-CPU MCA-related initialization.  */
   1.139  
   1.140 @@ -1213,11 +1242,25 @@ ia64_mca_cpu_init(void *cpu_data)
   1.141  		void *mca_data;
   1.142  		int cpu;
   1.143  
   1.144 +#ifdef XEN
   1.145 +		unsigned int pageorder;
   1.146 +		pageorder  = get_order_from_bytes(sizeof(struct ia64_mca_cpu));
   1.147 +#else
   1.148  		mca_data = alloc_bootmem(sizeof(struct ia64_mca_cpu)
   1.149  					 * NR_CPUS);
   1.150 +#endif
   1.151  		for (cpu = 0; cpu < NR_CPUS; cpu++) {
   1.152 +#ifdef XEN
   1.153 +			mca_data = alloc_xenheap_pages(pageorder);
   1.154 +			__per_cpu_mca[cpu] = __pa(mca_data);
   1.155 +			IA64_MCA_DEBUG("%s: __per_cpu_mca[%d]=%lx"
   1.156 +			               "(mca_data[%d]=%lx)\n",
   1.157 +				       __FUNCTION__, cpu, __per_cpu_mca[cpu],
   1.158 +				       cpu, (u64)mca_data);
   1.159 +#else
   1.160  			__per_cpu_mca[cpu] = __pa(mca_data);
   1.161  			mca_data += sizeof(struct ia64_mca_cpu);
   1.162 +#endif
   1.163  		}
   1.164  	}
   1.165  
   1.166 @@ -1228,6 +1271,10 @@ ia64_mca_cpu_init(void *cpu_data)
   1.167           * variable.
   1.168           */
   1.169  	__get_cpu_var(ia64_mca_data) = __per_cpu_mca[smp_processor_id()];
   1.170 +#ifdef XEN
   1.171 +	IA64_MCA_DEBUG("%s: CPU#%d, ia64_mca_data=%lx\n", __FUNCTION__,
   1.172 +	               smp_processor_id(),__get_cpu_var(ia64_mca_data));
   1.173 +#endif
   1.174  
   1.175  	/*
   1.176  	 * Stash away a copy of the PTE needed to map the per-CPU page.
   1.177 @@ -1275,6 +1322,11 @@ ia64_mca_init(void)
   1.178  	ia64_fptr_t *mon_init_ptr = (ia64_fptr_t *)ia64_monarch_init_handler;
   1.179  	ia64_fptr_t *slave_init_ptr = (ia64_fptr_t *)ia64_slave_init_handler;
   1.180  	ia64_fptr_t *mca_hldlr_ptr = (ia64_fptr_t *)ia64_os_mca_dispatch;
   1.181 +#ifdef XEN
   1.182 +	s64 rc;
   1.183 +
   1.184 +	IA64_MCA_DEBUG("%s: begin\n", __FUNCTION__);
   1.185 +#else
   1.186  	int i;
   1.187  	s64 rc;
   1.188  	struct ia64_sal_retval isrv;
   1.189 @@ -1324,6 +1376,7 @@ ia64_mca_init(void)
   1.190  	}
   1.191  
   1.192  	IA64_MCA_DEBUG("%s: registered MCA rendezvous spinloop and wakeup mech.\n", __FUNCTION__);
   1.193 +#endif /* !XEN */
   1.194  
   1.195  	ia64_mc_info.imi_mca_handler        = ia64_tpa(mca_hldlr_ptr->fp);
   1.196  	/*
   1.197 @@ -1375,6 +1428,7 @@ ia64_mca_init(void)
   1.198  
   1.199  	IA64_MCA_DEBUG("%s: registered OS INIT handler with SAL\n", __FUNCTION__);
   1.200  
   1.201 +#ifndef XEN
   1.202  	/*
   1.203  	 *  Configure the CMCI/P vector and handler. Interrupts for CMC are
   1.204  	 *  per-processor, so AP CMC interrupts are setup in smp_callin() (smpboot.c).
   1.205 @@ -1402,11 +1456,13 @@ ia64_mca_init(void)
   1.206  	ia64_log_init(SAL_INFO_TYPE_INIT);
   1.207  	ia64_log_init(SAL_INFO_TYPE_CMC);
   1.208  	ia64_log_init(SAL_INFO_TYPE_CPE);
   1.209 +#endif /* !XEN */
   1.210  
   1.211  	mca_init = 1;
   1.212  	printk(KERN_INFO "MCA related initialization done\n");
   1.213  }
   1.214  
   1.215 +#ifndef XEN
   1.216  /*
   1.217   * ia64_mca_late_init
   1.218   *
   1.219 @@ -1468,3 +1524,4 @@ ia64_mca_late_init(void)
   1.220  }
   1.221  
   1.222  device_initcall(ia64_mca_late_init);
   1.223 +#endif /* !XEN */