ia64/xen-unstable

annotate xen/arch/x86/setup.c @ 6721:ec4a3f2d060e

Add more version and capability reporting to Xen. Print the results with 'xm info'.
Signed-off-by: ian@xensource.com
author iap10@freefall.cl.cam.ac.uk
date Fri Sep 09 15:33:32 2005 +0000 (2005-09-09)
parents dd668f7527cb
children b2f4823b6ff0 a5e9a7fcade9
rev   line source
kaf24@1452 1
kaf24@1452 2 #include <xen/config.h>
kaf24@1452 3 #include <xen/init.h>
kaf24@1452 4 #include <xen/lib.h>
kaf24@1452 5 #include <xen/sched.h>
cl349@5247 6 #include <xen/domain.h>
kaf24@1452 7 #include <xen/serial.h>
kaf24@1506 8 #include <xen/softirq.h>
kaf24@1452 9 #include <xen/acpi.h>
kaf24@3338 10 #include <xen/console.h>
iap10@4287 11 #include <xen/serial.h>
kaf24@3338 12 #include <xen/trace.h>
kaf24@3338 13 #include <xen/multiboot.h>
kaf24@5356 14 #include <xen/domain_page.h>
iap10@6721 15 #include <xen/compile.h>
iap10@6721 16 #include <public/version.h>
kaf24@1452 17 #include <asm/bitops.h>
kaf24@1452 18 #include <asm/smp.h>
kaf24@1452 19 #include <asm/processor.h>
kaf24@1452 20 #include <asm/mpspec.h>
kaf24@1452 21 #include <asm/apic.h>
kaf24@1452 22 #include <asm/desc.h>
kaf24@3338 23 #include <asm/shadow.h>
kaf24@3344 24 #include <asm/e820.h>
kaf24@5536 25 #include <acm/acm_hooks.h>
kaf24@3338 26
kaf24@5157 27 extern void dmi_scan_machine(void);
kaf24@5211 28 extern void generic_apic_probe(void);
kaf24@5157 29
kaf24@3338 30 /*
kaf24@3338 31 * opt_xenheap_megabytes: Size of Xen heap in megabytes, excluding the
kaf24@3338 32 * pfn_info table and allocation bitmap.
kaf24@3338 33 */
kaf24@3338 34 static unsigned int opt_xenheap_megabytes = XENHEAP_DEFAULT_MB;
kaf24@4950 35 #if defined(CONFIG_X86_64)
kaf24@3338 36 integer_param("xenheap_megabytes", opt_xenheap_megabytes);
kaf24@3354 37 #endif
kaf24@1452 38
kaf24@5146 39 /* opt_nosmp: If true, secondary processors are ignored. */
kaf24@5900 40 static int opt_nosmp = 0;
kaf24@5146 41 boolean_param("nosmp", opt_nosmp);
kaf24@5146 42
kaf24@5146 43 /* maxcpus: maximum number of CPUs to activate. */
kaf24@5146 44 static unsigned int max_cpus = NR_CPUS;
kaf24@5146 45 integer_param("maxcpus", max_cpus);
kaf24@5146 46
kaf24@3334 47 /* opt_watchdog: If true, run a watchdog NMI on each processor. */
kaf24@3334 48 static int opt_watchdog = 0;
kaf24@3334 49 boolean_param("watchdog", opt_watchdog);
kaf24@3334 50
kaf24@4850 51 /* **** Linux config option: propagated to domain0. */
kaf24@4850 52 /* "acpi=off": Sisables both ACPI table parsing and interpreter. */
kaf24@4850 53 /* "acpi=force": Override the disable blacklist. */
kaf24@4850 54 /* "acpi=strict": Disables out-of-spec workarounds. */
kaf24@4850 55 /* "acpi=ht": Limit ACPI just to boot-time to enable HT. */
kaf24@4850 56 /* "acpi=noirq": Disables ACPI interrupt routing. */
kaf24@4850 57 static void parse_acpi_param(char *s);
kaf24@4850 58 custom_param("acpi", parse_acpi_param);
kaf24@4850 59
kaf24@4850 60 /* **** Linux config option: propagated to domain0. */
kaf24@4850 61 /* acpi_skip_timer_override: Skip IRQ0 overrides. */
kaf24@4850 62 extern int acpi_skip_timer_override;
kaf24@4850 63 boolean_param("acpi_skip_timer_override", acpi_skip_timer_override);
kaf24@4850 64
kaf24@4850 65 /* **** Linux config option: propagated to domain0. */
kaf24@4850 66 /* noapic: Disable IOAPIC setup. */
kaf24@4850 67 extern int skip_ioapic_setup;
kaf24@4850 68 boolean_param("noapic", skip_ioapic_setup);
kaf24@4850 69
kaf24@3594 70 int early_boot = 1;
kaf24@3594 71
kaf24@5146 72 cpumask_t cpu_present_map;
kaf24@5146 73
kaf24@5003 74 /* Limits of Xen heap, used to initialise the allocator. */
kaf24@5003 75 unsigned long xenheap_phys_start, xenheap_phys_end;
kaf24@3338 76
kaf24@2298 77 extern void arch_init_memory(void);
kaf24@1589 78 extern void init_IRQ(void);
kaf24@1589 79 extern void trap_init(void);
kaf24@5604 80 extern void early_time_init(void);
kaf24@1589 81 extern void ac_timer_init(void);
kaf24@5167 82 extern void initialize_keytable(void);
kaf24@5167 83 extern void early_cpu_init(void);
kaf24@1589 84
kaf24@5011 85 extern unsigned long cpu0_stack[];
kaf24@5011 86
kaf24@5214 87 struct cpuinfo_x86 boot_cpu_data = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
kaf24@1452 88
kaf24@5237 89 #if CONFIG_PAGING_LEVELS > 2
kaf24@1670 90 unsigned long mmu_cr4_features = X86_CR4_PSE | X86_CR4_PGE | X86_CR4_PAE;
kaf24@1670 91 #else
kaf24@5593 92 unsigned long mmu_cr4_features = X86_CR4_PSE;
kaf24@1670 93 #endif
kaf24@1452 94 EXPORT_SYMBOL(mmu_cr4_features);
kaf24@1452 95
iap10@6721 96 int hvm_enabled = 0; /* can we run unmodified guests */
iap10@6721 97
kaf24@5289 98 struct vcpu *idle_task[NR_CPUS] = { &idle0_vcpu };
kaf24@1452 99
kaf24@4818 100 int acpi_disabled;
kaf24@1452 101
kaf24@4850 102 int acpi_force;
kaf24@4850 103 char acpi_param[10] = "";
kaf24@4850 104 static void parse_acpi_param(char *s)
kaf24@4850 105 {
kaf24@4850 106 /* Save the parameter so it can be propagated to domain0. */
kaf24@4850 107 strncpy(acpi_param, s, sizeof(acpi_param));
kaf24@4850 108 acpi_param[sizeof(acpi_param)-1] = '\0';
kaf24@4850 109
kaf24@4850 110 /* Interpret the parameter for use within Xen. */
kaf24@4850 111 if ( !strcmp(s, "off") )
kaf24@4850 112 {
kaf24@4850 113 disable_acpi();
kaf24@4850 114 }
kaf24@4850 115 else if ( !strcmp(s, "force") )
kaf24@4850 116 {
kaf24@4850 117 acpi_force = 1;
kaf24@4850 118 acpi_ht = 1;
kaf24@4850 119 acpi_disabled = 0;
kaf24@4850 120 }
kaf24@4850 121 else if ( !strcmp(s, "strict") )
kaf24@4850 122 {
kaf24@4850 123 acpi_strict = 1;
kaf24@4850 124 }
kaf24@4850 125 else if ( !strcmp(s, "ht") )
kaf24@4850 126 {
kaf24@4850 127 if ( !acpi_force )
kaf24@4850 128 disable_acpi();
kaf24@4850 129 acpi_ht = 1;
kaf24@4850 130 }
kaf24@4850 131 else if ( !strcmp(s, "noirq") )
kaf24@4850 132 {
kaf24@4850 133 acpi_noirq_set();
kaf24@4850 134 }
kaf24@4850 135 }
kaf24@4850 136
kaf24@1452 137 static void __init do_initcalls(void)
kaf24@1452 138 {
kaf24@1452 139 initcall_t *call;
kaf24@1452 140 for ( call = &__initcall_start; call < &__initcall_end; call++ )
kaf24@1452 141 (*call)();
kaf24@1452 142 }
kaf24@1452 143
kaf24@3338 144 static void __init start_of_day(void)
kaf24@1452 145 {
kaf24@5146 146 int i;
kaf24@5146 147
kaf24@5214 148 early_cpu_init();
kaf24@5214 149
kaf24@5298 150 paging_init();
kaf24@5298 151
kaf24@1452 152 /* Unmap the first page of CPU0's stack. */
kaf24@3686 153 memguard_guard_stack(cpu0_stack);
kaf24@1452 154
kaf24@1505 155 open_softirq(NEW_TLBFLUSH_CLOCK_PERIOD_SOFTIRQ, new_tlbflush_clock_period);
kaf24@1452 156
kaf24@1452 157 if ( opt_watchdog )
kaf24@1452 158 nmi_watchdog = NMI_LOCAL_APIC;
kaf24@1452 159
kaf24@3120 160 sort_exception_tables();
kaf24@3120 161
kaf24@3272 162 arch_do_createdomain(current);
kaf24@4972 163
kaf24@4972 164 /* Map default GDT into their final position in the idle page table. */
kaf24@5003 165 map_pages_to_xen(
kaf24@4972 166 GDT_VIRT_START(current) + FIRST_RESERVED_GDT_BYTE,
kaf24@5004 167 virt_to_phys(gdt_table) >> PAGE_SHIFT, 1, PAGE_HYPERVISOR);
kaf24@3272 168
kaf24@4850 169 find_smp_config();
kaf24@4850 170
kaf24@4850 171 smp_alloc_memory();
kaf24@4850 172
kaf24@5157 173 dmi_scan_machine();
kaf24@5157 174
kaf24@5211 175 generic_apic_probe();
kaf24@5157 176
kaf24@4850 177 acpi_boot_table_init();
kaf24@4850 178 acpi_boot_init();
kaf24@4850 179
kaf24@1452 180 if ( smp_found_config )
kaf24@1452 181 get_smp_config();
kaf24@4850 182
kaf24@4850 183 init_apic_mappings();
kaf24@4850 184
kaf24@4850 185 init_IRQ();
kaf24@4850 186
kaf24@1452 187 trap_init();
kaf24@4850 188
kaf24@5174 189 ac_timer_init();
kaf24@5174 190
kaf24@5604 191 early_time_init();
kaf24@1452 192
kaf24@2298 193 arch_init_memory();
kaf24@2298 194
kaf24@5536 195 scheduler_init();
kaf24@1452 196
kaf24@5214 197 identify_cpu(&boot_cpu_data);
kaf24@5214 198 if ( cpu_has_fxsr )
kaf24@5214 199 set_in_cr4(X86_CR4_OSFXSR);
kaf24@5214 200 if ( cpu_has_xmm )
kaf24@5214 201 set_in_cr4(X86_CR4_OSXMMEXCPT);
kaf24@5214 202
kaf24@5146 203 if ( opt_nosmp )
kaf24@5900 204 {
kaf24@5146 205 max_cpus = 0;
kaf24@5900 206 smp_num_siblings = 1;
kaf24@5900 207 boot_cpu_data.x86_num_cores = 1;
kaf24@5900 208 }
kaf24@5900 209
kaf24@5146 210 smp_prepare_cpus(max_cpus);
kaf24@5146 211
kaf24@5146 212 /* We aren't hotplug-capable yet. */
kaf24@5146 213 BUG_ON(!cpus_empty(cpu_present_map));
kaf24@5146 214 for_each_cpu ( i )
kaf24@5146 215 cpu_set(i, cpu_present_map);
kaf24@1452 216
kaf24@5604 217 /*
kaf24@5604 218 * Initialise higher-level timer functions. We do this fairly late
kaf24@5604 219 * (post-SMP) because the time bases and scale factors need to be updated
kaf24@5604 220 * regularly, and SMP initialisation can cause a long delay with
kaf24@5604 221 * interrupts not yet enabled.
kaf24@5604 222 */
kaf24@5604 223 init_xen_time();
kaf24@5177 224
kaf24@4850 225 initialize_keytable();
kaf24@1452 226
kaf24@5195 227 serial_init_postirq();
kaf24@1452 228
kaf24@5604 229 BUG_ON(!local_irq_is_enabled());
kaf24@5146 230
kaf24@5146 231 for_each_present_cpu ( i )
kaf24@1452 232 {
kaf24@5146 233 if ( num_online_cpus() >= max_cpus )
kaf24@5146 234 break;
kaf24@5146 235 if ( !cpu_online(i) )
kaf24@5146 236 __cpu_up(i);
kaf24@1452 237 }
kaf24@1452 238
kaf24@5146 239 printk("Brought up %ld CPUs\n", (long)num_online_cpus());
kaf24@5146 240 smp_cpus_done(max_cpus);
kaf24@1452 241
kaf24@1452 242 do_initcalls();
kaf24@1452 243
kaf24@5146 244 schedulers_start();
kaf24@1452 245
kaf24@4926 246 watchdog_enable();
kaf24@1452 247 }
kaf24@3338 248
kaf24@5011 249 #define EARLY_FAIL() for ( ; ; ) __asm__ __volatile__ ( "hlt" )
kaf24@5011 250
iap10@6238 251 static struct e820entry e820_raw[E820MAX];
iap10@6238 252
kaf24@3338 253 void __init __start_xen(multiboot_info_t *mbi)
kaf24@3338 254 {
riel@3992 255 char *cmdline;
kaf24@3338 256 module_t *mod = (module_t *)__va(mbi->mods_addr);
kaf24@6111 257 unsigned long nr_pages, modules_length;
kaf24@3338 258 unsigned long initial_images_start, initial_images_end;
kaf24@5859 259 unsigned long _initrd_start = 0, _initrd_len = 0;
kaf24@5859 260 unsigned int initrdidx = 1;
kaf24@6111 261 physaddr_t s, e;
kaf24@3354 262 int i, e820_raw_nr = 0, bytes = 0;
kaf24@5776 263 struct ns16550_defaults ns16550 = {
kaf24@5776 264 .data_bits = 8,
kaf24@5776 265 .parity = 'n',
kaf24@5776 266 .stop_bits = 1
kaf24@5776 267 };
kaf24@3338 268
kaf24@3338 269 /* Parse the command-line options. */
kaf24@3344 270 if ( (mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0) )
kaf24@5211 271 cmdline_parse(__va(mbi->cmdline));
kaf24@3338 272
kaf24@3338 273 /* Must do this early -- e.g., spinlocks rely on get_current(). */
kaf24@5289 274 set_current(&idle0_vcpu);
kaf24@4986 275 set_processor_id(0);
kaf24@3338 276
kaf24@5146 277 smp_prepare_boot_cpu();
kaf24@5146 278
kaf24@3338 279 /* We initialise the serial devices very early so we can get debugging. */
kaf24@5776 280 ns16550.io_base = 0x3f8;
kaf24@5776 281 ns16550.irq = 4;
kaf24@5776 282 ns16550_init(0, &ns16550);
kaf24@5776 283 ns16550.io_base = 0x2f8;
kaf24@5776 284 ns16550.irq = 3;
kaf24@5776 285 ns16550_init(1, &ns16550);
kaf24@5195 286 serial_init_preirq();
kaf24@3338 287
kaf24@3338 288 init_console();
kaf24@3338 289
kaf24@3344 290 /* Check that we have at least one Multiboot module. */
kaf24@3344 291 if ( !(mbi->flags & MBI_MODULES) || (mbi->mods_count == 0) )
kaf24@3338 292 {
kaf24@5542 293 printk("FATAL ERROR: dom0 kernel not specified."
kaf24@5542 294 " Check bootloader configuration.\n");
kaf24@5011 295 EARLY_FAIL();
kaf24@5011 296 }
kaf24@5011 297
kaf24@5011 298 if ( ((unsigned long)cpu0_stack & (STACK_SIZE-1)) != 0 )
kaf24@5011 299 {
kaf24@5011 300 printk("FATAL ERROR: Misaligned CPU0 stack.\n");
kaf24@5011 301 EARLY_FAIL();
kaf24@3338 302 }
kaf24@3338 303
kaf24@3338 304 xenheap_phys_end = opt_xenheap_megabytes << 20;
kaf24@3338 305
kaf24@3344 306 if ( mbi->flags & MBI_MEMMAP )
kaf24@3344 307 {
kaf24@3344 308 while ( bytes < mbi->mmap_length )
kaf24@3344 309 {
kaf24@3344 310 memory_map_t *map = __va(mbi->mmap_addr + bytes);
kaf24@3344 311 e820_raw[e820_raw_nr].addr =
kaf24@3344 312 ((u64)map->base_addr_high << 32) | (u64)map->base_addr_low;
kaf24@3344 313 e820_raw[e820_raw_nr].size =
kaf24@3344 314 ((u64)map->length_high << 32) | (u64)map->length_low;
kaf24@3344 315 e820_raw[e820_raw_nr].type =
kaf24@3346 316 (map->type > E820_SHARED_PAGE) ? E820_RESERVED : map->type;
kaf24@3344 317 e820_raw_nr++;
kaf24@3344 318 bytes += map->size + 4;
kaf24@3344 319 }
kaf24@3344 320 }
kaf24@3344 321 else if ( mbi->flags & MBI_MEMLIMITS )
kaf24@3344 322 {
kaf24@3344 323 e820_raw[0].addr = 0;
kaf24@3344 324 e820_raw[0].size = mbi->mem_lower << 10;
kaf24@3344 325 e820_raw[0].type = E820_RAM;
kaf24@3354 326 e820_raw[1].addr = 0x100000;
kaf24@3354 327 e820_raw[1].size = mbi->mem_upper << 10;
kaf24@3354 328 e820_raw[1].type = E820_RAM;
kaf24@3344 329 e820_raw_nr = 2;
kaf24@3344 330 }
kaf24@3344 331 else
kaf24@3344 332 {
kaf24@3344 333 printk("FATAL ERROR: Bootloader provided no memory information.\n");
kaf24@3344 334 for ( ; ; ) ;
kaf24@3344 335 }
kaf24@3344 336
kaf24@4950 337 max_page = init_e820(e820_raw, &e820_raw_nr);
kaf24@3338 338
kaf24@6111 339 modules_length = mod[mbi->mods_count-1].mod_end - mod[0].mod_start;
kaf24@3338 340
kaf24@6111 341 /* Find a large enough RAM extent to stash the DOM0 modules. */
kaf24@6111 342 for ( i = 0; ; i++ )
kaf24@3338 343 {
kaf24@6111 344 if ( i == e820.nr_map )
kaf24@6111 345 {
kaf24@6111 346 printk("Not enough memory to stash the DOM0 kernel image.\n");
kaf24@6111 347 for ( ; ; ) ;
kaf24@6111 348 }
kaf24@6134 349
kaf24@6134 350 if ( (e820.map[i].type == E820_RAM) &&
kaf24@6134 351 (e820.map[i].size >= modules_length) &&
kaf24@6134 352 ((e820.map[i].addr + e820.map[i].size) >=
kaf24@6134 353 (xenheap_phys_end + modules_length)) )
kaf24@6134 354 break;
kaf24@3338 355 }
kaf24@6111 356
kaf24@6134 357 /* Stash as near as possible to the beginning of the RAM extent. */
kaf24@6134 358 initial_images_start = e820.map[i].addr;
kaf24@6134 359 if ( initial_images_start < xenheap_phys_end )
kaf24@6134 360 initial_images_start = xenheap_phys_end;
kaf24@6134 361 initial_images_end = initial_images_start + modules_length;
kaf24@6134 362
kaf24@4950 363 #if defined(CONFIG_X86_32)
kaf24@3338 364 memmove((void *)initial_images_start, /* use low mapping */
kaf24@3338 365 (void *)mod[0].mod_start, /* use low mapping */
kaf24@3338 366 mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
kaf24@4950 367 #elif defined(CONFIG_X86_64)
kaf24@3338 368 memmove(__va(initial_images_start),
kaf24@3338 369 __va(mod[0].mod_start),
kaf24@3338 370 mod[mbi->mods_count-1].mod_end - mod[0].mod_start);
kaf24@3338 371 #endif
kaf24@3338 372
kaf24@3354 373 /* Initialise boot-time allocator with all RAM situated after modules. */
kaf24@5003 374 xenheap_phys_start = init_boot_allocator(__pa(&_end));
kaf24@6111 375 nr_pages = 0;
kaf24@3354 376 for ( i = 0; i < e820.nr_map; i++ )
kaf24@3354 377 {
kaf24@3354 378 if ( e820.map[i].type != E820_RAM )
kaf24@3354 379 continue;
kaf24@6111 380
kaf24@3354 381 nr_pages += e820.map[i].size >> PAGE_SHIFT;
kaf24@6111 382
kaf24@6111 383 /* Initialise boot heap, skipping Xen heap and dom0 modules. */
kaf24@6111 384 s = e820.map[i].addr;
kaf24@6111 385 e = s + e820.map[i].size;
kaf24@6111 386 if ( s < xenheap_phys_end )
kaf24@6111 387 s = xenheap_phys_end;
kaf24@6111 388 if ( (s < initial_images_end) && (e > initial_images_start) )
kaf24@6111 389 s = initial_images_end;
kaf24@6111 390 init_boot_pages(s, e);
kaf24@6111 391
kaf24@5003 392 #if defined (CONFIG_X86_64)
kaf24@5003 393 /*
kaf24@5003 394 * x86/64 maps all registered RAM. Points to note:
kaf24@5003 395 * 1. The initial pagetable already maps low 64MB, so skip that.
kaf24@5003 396 * 2. We must map *only* RAM areas, taking care to avoid I/O holes.
kaf24@5003 397 * Failure to do this can cause coherency problems and deadlocks
kaf24@5003 398 * due to cache-attribute mismatches (e.g., AMD/AGP Linux bug).
kaf24@5003 399 */
kaf24@5003 400 {
kaf24@5004 401 /* Calculate page-frame range, discarding partial frames. */
kaf24@5004 402 unsigned long start, end;
kaf24@5005 403 start = PFN_UP(e820.map[i].addr);
kaf24@5005 404 end = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
kaf24@5004 405 /* Clip the range to above 64MB. */
kaf24@5004 406 if ( end < (64UL << (20-PAGE_SHIFT)) )
kaf24@5004 407 continue;
kaf24@5004 408 if ( start < (64UL << (20-PAGE_SHIFT)) )
kaf24@5004 409 start = 64UL << (20-PAGE_SHIFT);
kaf24@5004 410 /* Request the mapping. */
kaf24@5003 411 map_pages_to_xen(
kaf24@5004 412 PAGE_OFFSET + (start << PAGE_SHIFT),
kaf24@5004 413 start, end-start, PAGE_HYPERVISOR);
kaf24@5003 414 }
kaf24@5003 415 #endif
kaf24@3354 416 }
kaf24@3354 417
kaf24@5003 418 memguard_init();
kaf24@4950 419
kaf24@3354 420 printk("System RAM: %luMB (%lukB)\n",
kaf24@3354 421 nr_pages >> (20 - PAGE_SHIFT),
kaf24@3354 422 nr_pages << (PAGE_SHIFT - 10));
kaf24@3354 423
kaf24@3354 424 init_frametable();
kaf24@3338 425
kaf24@3354 426 end_boot_allocator();
kaf24@3354 427
kaf24@6111 428 /* Initialise the Xen heap, skipping RAM holes. */
kaf24@6111 429 nr_pages = 0;
kaf24@6111 430 for ( i = 0; i < e820.nr_map; i++ )
kaf24@6111 431 {
kaf24@6111 432 if ( e820.map[i].type != E820_RAM )
kaf24@6111 433 continue;
kaf24@6111 434
kaf24@6111 435 s = e820.map[i].addr;
kaf24@6111 436 e = s + e820.map[i].size;
kaf24@6111 437 if ( s < xenheap_phys_start )
kaf24@6111 438 s = xenheap_phys_start;
kaf24@6111 439 if ( e > xenheap_phys_end )
kaf24@6111 440 e = xenheap_phys_end;
kaf24@6111 441
kaf24@6111 442 if ( s < e )
kaf24@6111 443 {
kaf24@6111 444 nr_pages += (e - s) >> PAGE_SHIFT;
kaf24@6111 445 init_xenheap_pages(s, e);
kaf24@6111 446 }
kaf24@6111 447 }
kaf24@6111 448
kaf24@6111 449 printk("Xen heap: %luMB (%lukB)\n",
kaf24@6111 450 nr_pages >> (20 - PAGE_SHIFT),
kaf24@6111 451 nr_pages << (PAGE_SHIFT - 10));
kaf24@3338 452
kaf24@3594 453 early_boot = 0;
kaf24@3338 454
kaf24@3338 455 start_of_day();
kaf24@3338 456
kaf24@3338 457 grant_table_init();
kaf24@3338 458
kaf24@3338 459 shadow_mode_init();
kaf24@3338 460
smh22@5514 461 /* initialize access control security module */
kaf24@5859 462 acm_init(&initrdidx, mbi, initial_images_start);
smh22@5514 463
kaf24@3338 464 /* Create initial domain 0. */
kaf24@3338 465 dom0 = do_createdomain(0, 0);
kaf24@3338 466 if ( dom0 == NULL )
kaf24@3338 467 panic("Error creating domain 0\n");
kaf24@3338 468
kaf24@4877 469 set_bit(_DOMF_privileged, &dom0->domain_flags);
smh22@5514 470 /* post-create hooks sets security label */
smh22@5514 471 acm_post_domain0_create(dom0->domain_id);
kaf24@3338 472
kaf24@4850 473 /* Grab the DOM0 command line. */
riel@3992 474 cmdline = (char *)(mod[0].string ? __va(mod[0].string) : NULL);
kaf24@3338 475 if ( cmdline != NULL )
kaf24@3338 476 {
kaf24@5366 477 static char dom0_cmdline[MAX_GUEST_CMDLINE];
kaf24@4850 478
kaf24@4850 479 /* Skip past the image name. */
kaf24@3338 480 while ( *cmdline == ' ' ) cmdline++;
kaf24@3338 481 if ( (cmdline = strchr(cmdline, ' ')) != NULL )
kaf24@3338 482 while ( *cmdline == ' ' ) cmdline++;
kaf24@4850 483
kaf24@4850 484 /* Copy the command line to a local buffer. */
kaf24@4850 485 strcpy(dom0_cmdline, cmdline);
kaf24@4850 486 cmdline = dom0_cmdline;
kaf24@4850 487
kaf24@4850 488 /* Append any extra parameters. */
kaf24@4850 489 if ( skip_ioapic_setup && !strstr(cmdline, "noapic") )
kaf24@4850 490 strcat(cmdline, " noapic");
kaf24@4850 491 if ( acpi_skip_timer_override &&
kaf24@4850 492 !strstr(cmdline, "acpi_skip_timer_override") )
kaf24@4850 493 strcat(cmdline, " acpi_skip_timer_override");
kaf24@4850 494 if ( (strlen(acpi_param) != 0) && !strstr(cmdline, "acpi=") )
kaf24@4850 495 {
kaf24@4850 496 strcat(cmdline, " acpi=");
kaf24@4850 497 strcat(cmdline, acpi_param);
kaf24@4850 498 }
kaf24@3338 499 }
kaf24@3338 500
kaf24@5859 501 if ( (initrdidx > 0) && (initrdidx < mbi->mods_count) )
kaf24@5859 502 {
kaf24@5859 503 _initrd_start = initial_images_start +
kaf24@5859 504 (mod[initrdidx].mod_start - mod[0].mod_start);
kaf24@5859 505 _initrd_len = mod[initrdidx].mod_end - mod[initrdidx].mod_start;
kaf24@5859 506 }
kaf24@5859 507
kaf24@3338 508 /*
kaf24@3338 509 * We're going to setup domain0 using the module(s) that we stashed safely
kaf24@3338 510 * above our heap. The second module, if present, is an initrd ramdisk.
kaf24@3338 511 */
kaf24@3935 512 if ( construct_dom0(dom0,
kaf24@3635 513 initial_images_start,
kaf24@3338 514 mod[0].mod_end-mod[0].mod_start,
kaf24@5859 515 _initrd_start,
kaf24@5859 516 _initrd_len,
kaf24@3338 517 cmdline) != 0)
kaf24@3338 518 panic("Could not set up DOM0 guest OS\n");
kaf24@3338 519
kaf24@3935 520 /* Scrub RAM that is still free and so may go to an unprivileged domain. */
kaf24@3338 521 scrub_heap_pages();
kaf24@3338 522
kaf24@3338 523 init_trace_bufs();
kaf24@3338 524
kaf24@3338 525 /* Give up the VGA console if DOM0 is configured to grab it. */
kaf24@3338 526 console_endboot(cmdline && strstr(cmdline, "tty0"));
kaf24@3338 527
iap10@4287 528 /* Hide UART from DOM0 if we're using it */
iap10@4287 529 serial_endboot();
iap10@4287 530
kaf24@3338 531 domain_unpause_by_systemcontroller(dom0);
kaf24@5146 532
kaf24@3338 533 startup_cpu_idle_loop();
kaf24@3338 534 }
kaf24@3914 535
iap10@6721 536 void arch_get_xen_caps(xen_capabilities_info_t *info)
iap10@6721 537 {
iap10@6721 538 char *p=info->caps;
iap10@6721 539
iap10@6721 540 *p=0;
iap10@6721 541
iap10@6721 542 #ifdef CONFIG_X86_32
iap10@6721 543
iap10@6721 544 #ifndef CONFIG_X86_PAE
iap10@6721 545 p+=sprintf(p,"xen_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION);
iap10@6721 546 if(hvm_enabled)
iap10@6721 547 {
iap10@6721 548 p+=sprintf(p,"hvm_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION);
iap10@6721 549 }
iap10@6721 550 #else
iap10@6721 551 p+=sprintf(p,"xen_%d.%d_x86_32p ",XEN_VERSION,XEN_SUBVERSION);
iap10@6721 552 if(hvm_enabled)
iap10@6721 553 {
iap10@6721 554 //p+=sprintf(p,"hvm_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION);
iap10@6721 555 //p+=sprintf(p,"hvm_%d.%d_x86_32p ",XEN_VERSION,XEN_SUBVERSION);
iap10@6721 556 }
iap10@6721 557
iap10@6721 558 #endif
iap10@6721 559
iap10@6721 560 #else /* !CONFIG_X86_32 */
iap10@6721 561 p+=sprintf(p,"xen_%d.%d_x86_64 ",XEN_VERSION,XEN_SUBVERSION);
iap10@6721 562 if(hvm_enabled)
iap10@6721 563 {
iap10@6721 564 //p+=sprintf(p,"hvm_%d.%d_x86_32 ",XEN_VERSION,XEN_SUBVERSION);
iap10@6721 565 //p+=sprintf(p,"hvm_%d.%d_x86_32p ",XEN_VERSION,XEN_SUBVERSION);
iap10@6721 566 p+=sprintf(p,"hvm_%d.%d_x86_64 ",XEN_VERSION,XEN_SUBVERSION);
iap10@6721 567 }
iap10@6721 568 #endif
iap10@6721 569
iap10@6721 570 BUG_ON((p-info->caps)>sizeof(*info));
iap10@6721 571
iap10@6721 572 if(p>info->caps) *(p-1) = 0;
iap10@6721 573 }
iap10@6721 574
kaf24@3914 575 /*
kaf24@3914 576 * Local variables:
kaf24@3914 577 * mode: C
kaf24@3914 578 * c-set-style: "BSD"
kaf24@3914 579 * c-basic-offset: 4
kaf24@3914 580 * tab-width: 4
kaf24@3914 581 * indent-tabs-mode: nil
kaf24@3988 582 * End:
kaf24@3914 583 */