aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/setup.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2007-10-11 05:16:51 -0400
committerThomas Gleixner <tglx@linutronix.de>2007-10-11 05:16:51 -0400
commit9702785a747aa27baf46ff504beab6528f21f2dd (patch)
treeab69d6f802f5b680c33999dc089e44982c74595d /arch/x86/xen/setup.c
parent334e621a01f86d5bc25e4f742e1eaae6e2d2a97a (diff)
i386: move xen
Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/xen/setup.c')
-rw-r--r--arch/x86/xen/setup.c111
1 files changed, 111 insertions, 0 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
new file mode 100644
index 000000000000..f84e77226646
--- /dev/null
+++ b/arch/x86/xen/setup.c
@@ -0,0 +1,111 @@
1/*
2 * Machine specific setup for xen
3 *
4 * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
5 */
6
7#include <linux/module.h>
8#include <linux/sched.h>
9#include <linux/mm.h>
10#include <linux/pm.h>
11
12#include <asm/elf.h>
13#include <asm/e820.h>
14#include <asm/setup.h>
15#include <asm/xen/hypervisor.h>
16#include <asm/xen/hypercall.h>
17
18#include <xen/interface/physdev.h>
19#include <xen/features.h>
20
21#include "xen-ops.h"
22#include "vdso.h"
23
24/* These are code, but not functions. Defined in entry.S */
25extern const char xen_hypervisor_callback[];
26extern const char xen_failsafe_callback[];
27
28unsigned long *phys_to_machine_mapping;
29EXPORT_SYMBOL(phys_to_machine_mapping);
30
31/**
32 * machine_specific_memory_setup - Hook for machine specific memory setup.
33 **/
34
35char * __init xen_memory_setup(void)
36{
37 unsigned long max_pfn = xen_start_info->nr_pages;
38
39 e820.nr_map = 0;
40 add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM);
41
42 return "Xen";
43}
44
45static void xen_idle(void)
46{
47 local_irq_disable();
48
49 if (need_resched())
50 local_irq_enable();
51 else {
52 current_thread_info()->status &= ~TS_POLLING;
53 smp_mb__after_clear_bit();
54 safe_halt();
55 current_thread_info()->status |= TS_POLLING;
56 }
57}
58
59/*
60 * Set the bit indicating "nosegneg" library variants should be used.
61 */
62static void fiddle_vdso(void)
63{
64 extern u32 VDSO_NOTE_MASK; /* See ../kernel/vsyscall-note.S. */
65 extern char vsyscall_int80_start;
66 u32 *mask = (u32 *) ((unsigned long) &VDSO_NOTE_MASK - VDSO_PRELINK +
67 &vsyscall_int80_start);
68 *mask |= 1 << VDSO_NOTE_NONEGSEG_BIT;
69}
70
71void __init xen_arch_setup(void)
72{
73 struct physdev_set_iopl set_iopl;
74 int rc;
75
76 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
77 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
78
79 if (!xen_feature(XENFEAT_auto_translated_physmap))
80 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_pae_extended_cr3);
81
82 HYPERVISOR_set_callbacks(__KERNEL_CS, (unsigned long)xen_hypervisor_callback,
83 __KERNEL_CS, (unsigned long)xen_failsafe_callback);
84
85 set_iopl.iopl = 1;
86 rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
87 if (rc != 0)
88 printk(KERN_INFO "physdev_op failed %d\n", rc);
89
90#ifdef CONFIG_ACPI
91 if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
92 printk(KERN_INFO "ACPI in unprivileged domain disabled\n");
93 disable_acpi();
94 }
95#endif
96
97 memcpy(boot_command_line, xen_start_info->cmd_line,
98 MAX_GUEST_CMDLINE > COMMAND_LINE_SIZE ?
99 COMMAND_LINE_SIZE : MAX_GUEST_CMDLINE);
100
101 pm_idle = xen_idle;
102
103#ifdef CONFIG_SMP
104 /* fill cpus_possible with all available cpus */
105 xen_fill_possible_map();
106#endif
107
108 paravirt_disable_iospace();
109
110 fiddle_vdso();
111}