Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / arch / x86 / xen / setup.c
blob45d512aa514e55f2a4ed7a29eed1cbdaca49b2eb
1 /*
2 * Machine specific setup for xen
4 * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
5 */
7 #include <linux/module.h>
8 #include <linux/sched.h>
9 #include <linux/mm.h>
10 #include <linux/pm.h>
12 #include <asm/elf.h>
13 #include <asm/vdso.h>
14 #include <asm/e820.h>
15 #include <asm/setup.h>
16 #include <asm/xen/hypervisor.h>
17 #include <asm/xen/hypercall.h>
19 #include <xen/interface/physdev.h>
20 #include <xen/features.h>
22 #include "xen-ops.h"
23 #include "vdso.h"
25 /* These are code, but not functions. Defined in entry.S */
26 extern const char xen_hypervisor_callback[];
27 extern const char xen_failsafe_callback[];
29 unsigned long *phys_to_machine_mapping;
30 EXPORT_SYMBOL(phys_to_machine_mapping);
32 /**
33 * machine_specific_memory_setup - Hook for machine specific memory setup.
34 **/
36 char * __init xen_memory_setup(void)
38 unsigned long max_pfn = xen_start_info->nr_pages;
40 e820.nr_map = 0;
41 <<<<<<< HEAD:arch/x86/xen/setup.c
42 add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM);
43 =======
44 add_memory_region(0, LOWMEMSIZE(), E820_RAM);
45 add_memory_region(HIGH_MEMORY, PFN_PHYS(max_pfn)-HIGH_MEMORY, E820_RAM);
46 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:arch/x86/xen/setup.c
48 return "Xen";
51 static void xen_idle(void)
53 local_irq_disable();
55 if (need_resched())
56 local_irq_enable();
57 else {
58 current_thread_info()->status &= ~TS_POLLING;
59 smp_mb__after_clear_bit();
60 safe_halt();
61 current_thread_info()->status |= TS_POLLING;
66 * Set the bit indicating "nosegneg" library variants should be used.
68 static void __init fiddle_vdso(void)
70 extern const char vdso32_default_start;
71 u32 *mask = VDSO32_SYMBOL(&vdso32_default_start, NOTE_MASK);
72 *mask |= 1 << VDSO_NOTE_NONEGSEG_BIT;
75 void __init xen_arch_setup(void)
77 struct physdev_set_iopl set_iopl;
78 int rc;
80 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
81 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
83 if (!xen_feature(XENFEAT_auto_translated_physmap))
84 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_pae_extended_cr3);
86 HYPERVISOR_set_callbacks(__KERNEL_CS, (unsigned long)xen_hypervisor_callback,
87 __KERNEL_CS, (unsigned long)xen_failsafe_callback);
89 set_iopl.iopl = 1;
90 rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
91 if (rc != 0)
92 printk(KERN_INFO "physdev_op failed %d\n", rc);
94 #ifdef CONFIG_ACPI
95 if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
96 printk(KERN_INFO "ACPI in unprivileged domain disabled\n");
97 disable_acpi();
99 #endif
101 memcpy(boot_command_line, xen_start_info->cmd_line,
102 MAX_GUEST_CMDLINE > COMMAND_LINE_SIZE ?
103 COMMAND_LINE_SIZE : MAX_GUEST_CMDLINE);
105 pm_idle = xen_idle;
107 #ifdef CONFIG_SMP
108 /* fill cpus_possible with all available cpus */
109 xen_fill_possible_map();
110 #endif
112 paravirt_disable_iospace();
114 fiddle_vdso();