aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/enlighten.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/xen/enlighten.c')
-rw-r--r--arch/x86/xen/enlighten.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 65d8d79b46a8..3c4da8bee06f 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -97,6 +97,14 @@ struct shared_info *HYPERVISOR_shared_info = (void *)&xen_dummy_shared_info;
97 */ 97 */
98static int have_vcpu_info_placement = 1; 98static int have_vcpu_info_placement = 1;
99 99
100static void clamp_max_cpus(void)
101{
102#ifdef CONFIG_SMP
103 if (setup_max_cpus > MAX_VIRT_CPUS)
104 setup_max_cpus = MAX_VIRT_CPUS;
105#endif
106}
107
100static void xen_vcpu_setup(int cpu) 108static void xen_vcpu_setup(int cpu)
101{ 109{
102 struct vcpu_register_vcpu_info info; 110 struct vcpu_register_vcpu_info info;
@@ -104,13 +112,17 @@ static void xen_vcpu_setup(int cpu)
104 struct vcpu_info *vcpup; 112 struct vcpu_info *vcpup;
105 113
106 BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info); 114 BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info);
107 per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
108 115
109 if (!have_vcpu_info_placement) 116 if (cpu < MAX_VIRT_CPUS)
110 return; /* already tested, not available */ 117 per_cpu(xen_vcpu,cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
111 118
112 vcpup = &per_cpu(xen_vcpu_info, cpu); 119 if (!have_vcpu_info_placement) {
120 if (cpu >= MAX_VIRT_CPUS)
121 clamp_max_cpus();
122 return;
123 }
113 124
125 vcpup = &per_cpu(xen_vcpu_info, cpu);
114 info.mfn = arbitrary_virt_to_mfn(vcpup); 126 info.mfn = arbitrary_virt_to_mfn(vcpup);
115 info.offset = offset_in_page(vcpup); 127 info.offset = offset_in_page(vcpup);
116 128
@@ -125,6 +137,7 @@ static void xen_vcpu_setup(int cpu)
125 if (err) { 137 if (err) {
126 printk(KERN_DEBUG "register_vcpu_info failed: err=%d\n", err); 138 printk(KERN_DEBUG "register_vcpu_info failed: err=%d\n", err);
127 have_vcpu_info_placement = 0; 139 have_vcpu_info_placement = 0;
140 clamp_max_cpus();
128 } else { 141 } else {
129 /* This cpu is using the registered vcpu info, even if 142 /* This cpu is using the registered vcpu info, even if
130 later ones fail to. */ 143 later ones fail to. */
@@ -731,7 +744,6 @@ static void set_xen_basic_apic_ops(void)
731 744
732#endif 745#endif
733 746
734
735static void xen_clts(void) 747static void xen_clts(void)
736{ 748{
737 struct multicall_space mcs; 749 struct multicall_space mcs;
@@ -927,7 +939,7 @@ static const struct pv_init_ops xen_init_ops __initdata = {
927}; 939};
928 940
929static const struct pv_time_ops xen_time_ops __initdata = { 941static const struct pv_time_ops xen_time_ops __initdata = {
930 .sched_clock = xen_sched_clock, 942 .sched_clock = xen_clocksource_read,
931}; 943};
932 944
933static const struct pv_cpu_ops xen_cpu_ops __initdata = { 945static const struct pv_cpu_ops xen_cpu_ops __initdata = {
@@ -1028,6 +1040,23 @@ static void xen_crash_shutdown(struct pt_regs *regs)
1028 xen_reboot(SHUTDOWN_crash); 1040 xen_reboot(SHUTDOWN_crash);
1029} 1041}
1030 1042
1043static int
1044xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
1045{
1046 xen_reboot(SHUTDOWN_crash);
1047 return NOTIFY_DONE;
1048}
1049
1050static struct notifier_block xen_panic_block = {
1051 .notifier_call= xen_panic_event,
1052};
1053
1054int xen_panic_handler_init(void)
1055{
1056 atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block);
1057 return 0;
1058}
1059
1031static const struct machine_ops __initdata xen_machine_ops = { 1060static const struct machine_ops __initdata xen_machine_ops = {
1032 .restart = xen_restart, 1061 .restart = xen_restart,
1033 .halt = xen_machine_halt, 1062 .halt = xen_machine_halt,