2 * Machine specific setup for generic
6 #include <linux/init.h>
7 #include <linux/interrupt.h>
8 #include <linux/module.h>
10 #include <asm/arch_hooks.h>
12 #include <asm/setup.h>
13 #include <asm/fixmap.h>
15 #include <xen/interface/callback.h>
16 #include <xen/interface/memory.h>
18 #ifdef CONFIG_HOTPLUG_CPU
19 #define DEFAULT_SEND_IPI (1)
21 #define DEFAULT_SEND_IPI (0)
24 int no_broadcast=DEFAULT_SEND_IPI;
26 static __init int no_ipi_broadcast(char *str)
28 get_option(&str, &no_broadcast);
29 printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" :
34 __setup("no_ipi_broadcast", no_ipi_broadcast);
36 static int __init print_ipi_mode(void)
38 printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" :
43 late_initcall(print_ipi_mode);
46 * machine_specific_memory_setup - Hook for machine specific memory setup.
49 * This is included late in kernel/setup.c so that it can make
50 * use of all of the static functions.
53 char * __init machine_specific_memory_setup(void)
56 struct xen_memory_map memmap;
58 * This is rather large for a stack variable but this early in
59 * the boot process we know we have plenty slack space.
61 struct e820entry map[E820MAX];
63 memmap.nr_entries = E820MAX;
64 set_xen_guest_handle(memmap.buffer, map);
66 rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
67 if ( rc == -ENOSYS ) {
68 memmap.nr_entries = 1;
70 map[0].size = PFN_PHYS(xen_start_info->nr_pages);
71 /* 8MB slack (to balance backend allocations). */
72 map[0].size += 8ULL << 20;
73 map[0].type = E820_RAM;
78 sanitize_e820_map(map, (char *)&memmap.nr_entries);
80 BUG_ON(copy_e820_map(map, (char)memmap.nr_entries) < 0);
85 extern void hypervisor_callback(void);
86 extern void failsafe_callback(void);
87 extern void nmi(void);
89 unsigned long *machine_to_phys_mapping;
90 EXPORT_SYMBOL(machine_to_phys_mapping);
91 unsigned int machine_to_phys_order;
92 EXPORT_SYMBOL(machine_to_phys_order);
94 void __init machine_specific_arch_setup(void)
97 struct xen_machphys_mapping mapping;
98 unsigned long machine_to_phys_nr_ents;
99 struct xen_platform_parameters pp;
100 struct callback_register event = {
101 .type = CALLBACKTYPE_event,
102 .address = { __KERNEL_CS, (unsigned long)hypervisor_callback },
104 struct callback_register failsafe = {
105 .type = CALLBACKTYPE_failsafe,
106 .address = { __KERNEL_CS, (unsigned long)failsafe_callback },
108 struct callback_register nmi_cb = {
109 .type = CALLBACKTYPE_nmi,
110 .address = { __KERNEL_CS, (unsigned long)nmi },
113 ret = HYPERVISOR_callback_op(CALLBACKOP_register, &event);
115 ret = HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe);
117 ret = HYPERVISOR_set_callbacks(
118 event.address.cs, event.address.eip,
119 failsafe.address.cs, failsafe.address.eip);
122 ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb);
123 if (ret == -ENOSYS) {
124 struct xennmi_callback cb;
126 cb.handler_address = nmi_cb.address.eip;
127 HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
130 if (HYPERVISOR_xen_version(XENVER_platform_parameters,
132 set_fixaddr_top(pp.virt_start - PAGE_SIZE);
134 machine_to_phys_mapping = (unsigned long *)MACH2PHYS_VIRT_START;
135 machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES;
136 if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) {
137 machine_to_phys_mapping = (unsigned long *)mapping.v_start;
138 machine_to_phys_nr_ents = mapping.max_mfn + 1;
140 while ((1UL << machine_to_phys_order) < machine_to_phys_nr_ents )
141 machine_to_phys_order++;
145 * pre_setup_arch_hook - hook called prior to any setup_arch() execution
148 * generally used to activate any machine specific identification
149 * routines that may be needed before setup_arch() runs. On VISWS
150 * this is used to get the board revision and type.
152 void __init pre_setup_arch_hook(void)