]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - arch/i386/xen/setup.c
Merge branch 'master' of ssh://master.kernel.org/pub/scm/linux/kernel/git/mchehab...
[mirror_ubuntu-artful-kernel.git] / arch / i386 / xen / setup.c
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
23 /* These are code, but not functions. Defined in entry.S */
24 extern const char xen_hypervisor_callback[];
25 extern const char xen_failsafe_callback[];
26
27 unsigned long *phys_to_machine_mapping;
28 EXPORT_SYMBOL(phys_to_machine_mapping);
29
30 /**
31 * machine_specific_memory_setup - Hook for machine specific memory setup.
32 **/
33
34 char * __init xen_memory_setup(void)
35 {
36 unsigned long max_pfn = xen_start_info->nr_pages;
37
38 e820.nr_map = 0;
39 add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM);
40
41 return "Xen";
42 }
43
44 static void xen_idle(void)
45 {
46 local_irq_disable();
47
48 if (need_resched())
49 local_irq_enable();
50 else {
51 current_thread_info()->status &= ~TS_POLLING;
52 smp_mb__after_clear_bit();
53 safe_halt();
54 current_thread_info()->status |= TS_POLLING;
55 }
56 }
57
58 void __init xen_arch_setup(void)
59 {
60 struct physdev_set_iopl set_iopl;
61 int rc;
62
63 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
64 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
65
66 if (!xen_feature(XENFEAT_auto_translated_physmap))
67 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_pae_extended_cr3);
68
69 HYPERVISOR_set_callbacks(__KERNEL_CS, (unsigned long)xen_hypervisor_callback,
70 __KERNEL_CS, (unsigned long)xen_failsafe_callback);
71
72 set_iopl.iopl = 1;
73 rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
74 if (rc != 0)
75 printk(KERN_INFO "physdev_op failed %d\n", rc);
76
77 #ifdef CONFIG_ACPI
78 if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
79 printk(KERN_INFO "ACPI in unprivileged domain disabled\n");
80 disable_acpi();
81 }
82 #endif
83
84 memcpy(boot_command_line, xen_start_info->cmd_line,
85 MAX_GUEST_CMDLINE > COMMAND_LINE_SIZE ?
86 COMMAND_LINE_SIZE : MAX_GUEST_CMDLINE);
87
88 pm_idle = xen_idle;
89
90 #ifdef CONFIG_SMP
91 /* fill cpus_possible with all available cpus */
92 xen_fill_possible_map();
93 #endif
94
95 paravirt_disable_iospace();
96 }