]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - arch/x86/xen/setup.c
x86 vDSO: ia32 vdso32-syscall build
[mirror_ubuntu-artful-kernel.git] / arch / x86 / xen / setup.c
CommitLineData
5ead97c8
JF
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>
6c3652ef 13#include <asm/vdso.h>
5ead97c8
JF
14#include <asm/e820.h>
15#include <asm/setup.h>
16#include <asm/xen/hypervisor.h>
17#include <asm/xen/hypercall.h>
18
19#include <xen/interface/physdev.h>
20#include <xen/features.h>
21
22#include "xen-ops.h"
d2eea68e 23#include "vdso.h"
5ead97c8
JF
24
25/* These are code, but not functions. Defined in entry.S */
26extern const char xen_hypervisor_callback[];
27extern const char xen_failsafe_callback[];
28
5ead97c8
JF
29unsigned long *phys_to_machine_mapping;
30EXPORT_SYMBOL(phys_to_machine_mapping);
31
32/**
33 * machine_specific_memory_setup - Hook for machine specific memory setup.
34 **/
35
36char * __init xen_memory_setup(void)
37{
38 unsigned long max_pfn = xen_start_info->nr_pages;
39
40 e820.nr_map = 0;
41 add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM);
42
43 return "Xen";
44}
45
46static void xen_idle(void)
47{
48 local_irq_disable();
49
50 if (need_resched())
51 local_irq_enable();
52 else {
53 current_thread_info()->status &= ~TS_POLLING;
54 smp_mb__after_clear_bit();
55 safe_halt();
56 current_thread_info()->status |= TS_POLLING;
57 }
58}
59
d2eea68e
RM
60/*
61 * Set the bit indicating "nosegneg" library variants should be used.
62 */
63static void fiddle_vdso(void)
64{
d2eea68e 65 extern char vsyscall_int80_start;
6c3652ef 66 u32 *mask = VDSO32_SYMBOL(&vsyscall_int80_start, NOTE_MASK);
d2eea68e
RM
67 *mask |= 1 << VDSO_NOTE_NONEGSEG_BIT;
68}
69
5ead97c8
JF
70void __init xen_arch_setup(void)
71{
72 struct physdev_set_iopl set_iopl;
73 int rc;
74
75 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
76 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
77
78 if (!xen_feature(XENFEAT_auto_translated_physmap))
79 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_pae_extended_cr3);
80
81 HYPERVISOR_set_callbacks(__KERNEL_CS, (unsigned long)xen_hypervisor_callback,
82 __KERNEL_CS, (unsigned long)xen_failsafe_callback);
83
84 set_iopl.iopl = 1;
85 rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
86 if (rc != 0)
87 printk(KERN_INFO "physdev_op failed %d\n", rc);
88
89#ifdef CONFIG_ACPI
90 if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
91 printk(KERN_INFO "ACPI in unprivileged domain disabled\n");
92 disable_acpi();
93 }
94#endif
95
96 memcpy(boot_command_line, xen_start_info->cmd_line,
97 MAX_GUEST_CMDLINE > COMMAND_LINE_SIZE ?
98 COMMAND_LINE_SIZE : MAX_GUEST_CMDLINE);
99
100 pm_idle = xen_idle;
f87e4cac
JF
101
102#ifdef CONFIG_SMP
103 /* fill cpus_possible with all available cpus */
104 xen_fill_possible_map();
105#endif
dfdcdd42
JF
106
107 paravirt_disable_iospace();
d2eea68e
RM
108
109 fiddle_vdso();
5ead97c8 110}