2 * Machine specific setup for xen
4 * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
7 #include <linux/module.h>
8 #include <linux/sched.h>
14 #include <asm/setup.h>
15 #include <asm/xen/hypervisor.h>
16 #include <asm/xen/hypercall.h>
18 #include <xen/interface/physdev.h>
19 #include <xen/features.h>
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[];
27 static __initdata struct shared_info init_shared;
30 * Point at some empty memory to start with. We map the real shared_info
31 * page as soon as fixmap is up and running.
33 struct shared_info *HYPERVISOR_shared_info = &init_shared;
35 unsigned long *phys_to_machine_mapping;
36 EXPORT_SYMBOL(phys_to_machine_mapping);
39 * machine_specific_memory_setup - Hook for machine specific memory setup.
42 char * __init xen_memory_setup(void)
44 unsigned long max_pfn = xen_start_info->nr_pages;
47 add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM);
52 static void xen_idle(void)
59 current_thread_info()->status &= ~TS_POLLING;
60 smp_mb__after_clear_bit();
62 current_thread_info()->status |= TS_POLLING;
66 void __init xen_arch_setup(void)
68 struct physdev_set_iopl set_iopl;
71 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
72 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
74 if (!xen_feature(XENFEAT_auto_translated_physmap))
75 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_pae_extended_cr3);
77 HYPERVISOR_set_callbacks(__KERNEL_CS, (unsigned long)xen_hypervisor_callback,
78 __KERNEL_CS, (unsigned long)xen_failsafe_callback);
81 rc = HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
83 printk(KERN_INFO "physdev_op failed %d\n", rc);
86 if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
87 printk(KERN_INFO "ACPI in unprivileged domain disabled\n");
92 memcpy(boot_command_line, xen_start_info->cmd_line,
93 MAX_GUEST_CMDLINE > COMMAND_LINE_SIZE ?
94 COMMAND_LINE_SIZE : MAX_GUEST_CMDLINE);
99 /* fill cpus_possible with all available cpus */
100 xen_fill_possible_map();