1 /* 2 * QEMU PC System Emulator 3 * 4 * Copyright (c) 2003-2004 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights 9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 * copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in 14 * all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 * THE SOFTWARE. 23 */ 24 25 #include <glib.h> 26 27 #include "hw/hw.h" 28 #include "hw/i386/pc.h" 29 #include "hw/i386/apic.h" 30 #include "hw/pci/pci.h" 31 #include "hw/pci/pci_ids.h" 32 #include "hw/usb.h" 33 #include "net/net.h" 34 #include "hw/boards.h" 35 #include "hw/ide.h" 36 #include "sysemu/kvm.h" 37 #include "hw/kvm/clock.h" 38 #include "sysemu/sysemu.h" 39 #include "hw/sysbus.h" 40 #include "hw/cpu/icc_bus.h" 41 #include "sysemu/arch_init.h" 42 #include "sysemu/blockdev.h" 43 #include "hw/i2c/smbus.h" 44 #include "hw/xen/xen.h" 45 #include "exec/memory.h" 46 #include "exec/address-spaces.h" 47 #include "hw/acpi/acpi.h" 48 #include "cpu.h" 49 #ifdef CONFIG_XEN 50 # include <xen/hvm/hvm_info_table.h> 51 #endif 52 53 #define MAX_IDE_BUS 2 54 55 static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 }; 56 static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 }; 57 static const int ide_irq[MAX_IDE_BUS] = { 14, 15 }; 58 59 static bool has_pvpanic = true; 60 static bool has_pci_info = true; 61 62 /* PC hardware initialisation */ 63 static void pc_init1(MemoryRegion *system_memory, 64 MemoryRegion *system_io, 65 ram_addr_t ram_size, 66 const char *boot_device, 67 const char *kernel_filename, 68 const char *kernel_cmdline, 69 const char *initrd_filename, 70 const char *cpu_model, 71 int pci_enabled, 72 int kvmclock_enabled) 73 { 74 int i; 75 ram_addr_t below_4g_mem_size, above_4g_mem_size; 76 PCIBus *pci_bus; 77 ISABus *isa_bus; 78 PCII440FXState *i440fx_state; 79 int piix3_devfn = -1; 80 qemu_irq *cpu_irq; 81 qemu_irq *gsi; 82 qemu_irq *i8259; 83 qemu_irq *smi_irq; 84 GSIState *gsi_state; 85 DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; 86 BusState *idebus[MAX_IDE_BUS]; 87 ISADevice *rtc_state; 88 ISADevice *floppy; 89 MemoryRegion *ram_memory; 90 MemoryRegion *pci_memory; 91 MemoryRegion *rom_memory; 92 DeviceState *icc_bridge; 93 FWCfgState *fw_cfg = NULL; 94 PcGuestInfo *guest_info; 95 96 if (xen_enabled() && xen_hvm_init() != 0) { 97 fprintf(stderr, "xen hardware virtual machine initialisation failed\n"); 98 exit(1); 99 } 100 101 icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE); 102 object_property_add_child(qdev_get_machine(), "icc-bridge", 103 OBJECT(icc_bridge), NULL); 104 105 pc_cpus_init(cpu_model, icc_bridge); 106 pc_acpi_init("acpi-dsdt.aml"); 107 108 if (kvm_enabled() && kvmclock_enabled) { 109 kvmclock_create(); 110 } 111 112 if (ram_size >= 0xe0000000 ) { 113 above_4g_mem_size = ram_size - 0xe0000000; 114 below_4g_mem_size = 0xe0000000; 115 } else { 116 above_4g_mem_size = 0; 117 below_4g_mem_size = ram_size; 118 } 119 120 if (pci_enabled) { 121 pci_memory = g_new(MemoryRegion, 1); 122 memory_region_init(pci_memory, NULL, "pci", INT64_MAX); 123 rom_memory = pci_memory; 124 } else { 125 pci_memory = NULL; 126 rom_memory = system_memory; 127 } 128 129 guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size); 130 guest_info->has_pci_info = has_pci_info; 131 132 /* allocate ram and load rom/bios */ 133 if (!xen_enabled()) { 134 fw_cfg = pc_memory_init(system_memory, 135 kernel_filename, kernel_cmdline, initrd_filename, 136 below_4g_mem_size, above_4g_mem_size, 137 rom_memory, &ram_memory, guest_info); 138 } 139 140 gsi_state = g_malloc0(sizeof(*gsi_state)); 141 if (kvm_irqchip_in_kernel()) { 142 kvm_pc_setup_irq_routing(pci_enabled); 143 gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, 144 GSI_NUM_PINS); 145 } else { 146 gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); 147 } 148 149 if (pci_enabled) { 150 pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi, 151 system_memory, system_io, ram_size, 152 below_4g_mem_size, 153 0x100000000ULL - below_4g_mem_size, 154 above_4g_mem_size, 155 pci_memory, ram_memory); 156 } else { 157 pci_bus = NULL; 158 i440fx_state = NULL; 159 isa_bus = isa_bus_new(NULL, system_io); 160 no_hpet = 1; 161 } 162 isa_bus_irqs(isa_bus, gsi); 163 164 if (kvm_irqchip_in_kernel()) { 165 i8259 = kvm_i8259_init(isa_bus); 166 } else if (xen_enabled()) { 167 i8259 = xen_interrupt_controller_init(); 168 } else { 169 cpu_irq = pc_allocate_cpu_irq(); 170 i8259 = i8259_init(isa_bus, cpu_irq[0]); 171 } 172 173 for (i = 0; i < ISA_NUM_IRQS; i++) { 174 gsi_state->i8259_irq[i] = i8259[i]; 175 } 176 if (pci_enabled) { 177 ioapic_init_gsi(gsi_state, "i440fx"); 178 } 179 qdev_init_nofail(icc_bridge); 180 181 pc_register_ferr_irq(gsi[13]); 182 183 pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL); 184 185 /* init basic PC hardware */ 186 pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled()); 187 188 pc_nic_init(isa_bus, pci_bus); 189 190 ide_drive_get(hd, MAX_IDE_BUS); 191 if (pci_enabled) { 192 PCIDevice *dev; 193 if (xen_enabled()) { 194 dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1); 195 } else { 196 dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); 197 } 198 idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0"); 199 idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1"); 200 } else { 201 for(i = 0; i < MAX_IDE_BUS; i++) { 202 ISADevice *dev; 203 dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], 204 ide_irq[i], 205 hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); 206 idebus[i] = qdev_get_child_bus(DEVICE(dev), "ide.0"); 207 } 208 } 209 210 pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, 211 floppy, idebus[0], idebus[1], rtc_state); 212 213 if (pci_enabled && usb_enabled(false)) { 214 pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci"); 215 } 216 217 if (pci_enabled && acpi_enabled) { 218 i2c_bus *smbus; 219 220 smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1); 221 /* TODO: Populate SPD eeprom data. */ 222 smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, 223 gsi[9], *smi_irq, 224 kvm_enabled(), fw_cfg); 225 smbus_eeprom_init(smbus, 8, NULL, 0); 226 } 227 228 if (pci_enabled) { 229 pc_pci_device_init(pci_bus); 230 } 231 232 if (has_pvpanic) { 233 pvpanic_init(isa_bus); 234 } 235 } 236 237 static void pc_init_pci(QEMUMachineInitArgs *args) 238 { 239 ram_addr_t ram_size = args->ram_size; 240 const char *cpu_model = args->cpu_model; 241 const char *kernel_filename = args->kernel_filename; 242 const char *kernel_cmdline = args->kernel_cmdline; 243 const char *initrd_filename = args->initrd_filename; 244 const char *boot_device = args->boot_device; 245 pc_init1(get_system_memory(), 246 get_system_io(), 247 ram_size, boot_device, 248 kernel_filename, kernel_cmdline, 249 initrd_filename, cpu_model, 1, 1); 250 } 251 252 static void pc_init_pci_1_5(QEMUMachineInitArgs *args) 253 { 254 has_pci_info = false; 255 pc_init_pci(args); 256 } 257 258 static void pc_init_pci_1_4(QEMUMachineInitArgs *args) 259 { 260 has_pvpanic = false; 261 x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE); 262 pc_init_pci_1_5(args); 263 } 264 265 static void pc_init_pci_1_3(QEMUMachineInitArgs *args) 266 { 267 enable_compat_apic_id_mode(); 268 pc_init_pci_1_4(args); 269 } 270 271 /* PC machine init function for pc-1.1 to pc-1.2 */ 272 static void pc_init_pci_1_2(QEMUMachineInitArgs *args) 273 { 274 disable_kvm_pv_eoi(); 275 pc_init_pci_1_3(args); 276 } 277 278 /* PC machine init function for pc-0.14 to pc-1.0 */ 279 static void pc_init_pci_1_0(QEMUMachineInitArgs *args) 280 { 281 pc_init_pci_1_2(args); 282 } 283 284 /* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */ 285 static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args) 286 { 287 ram_addr_t ram_size = args->ram_size; 288 const char *cpu_model = args->cpu_model; 289 const char *kernel_filename = args->kernel_filename; 290 const char *kernel_cmdline = args->kernel_cmdline; 291 const char *initrd_filename = args->initrd_filename; 292 const char *boot_device = args->boot_device; 293 has_pvpanic = false; 294 has_pci_info = false; 295 disable_kvm_pv_eoi(); 296 enable_compat_apic_id_mode(); 297 pc_init1(get_system_memory(), 298 get_system_io(), 299 ram_size, boot_device, 300 kernel_filename, kernel_cmdline, 301 initrd_filename, cpu_model, 1, 0); 302 } 303 304 static void pc_init_isa(QEMUMachineInitArgs *args) 305 { 306 ram_addr_t ram_size = args->ram_size; 307 const char *cpu_model = args->cpu_model; 308 const char *kernel_filename = args->kernel_filename; 309 const char *kernel_cmdline = args->kernel_cmdline; 310 const char *initrd_filename = args->initrd_filename; 311 const char *boot_device = args->boot_device; 312 has_pvpanic = false; 313 has_pci_info = false; 314 if (cpu_model == NULL) 315 cpu_model = "486"; 316 disable_kvm_pv_eoi(); 317 enable_compat_apic_id_mode(); 318 pc_init1(get_system_memory(), 319 get_system_io(), 320 ram_size, boot_device, 321 kernel_filename, kernel_cmdline, 322 initrd_filename, cpu_model, 0, 1); 323 } 324 325 #ifdef CONFIG_XEN 326 static void pc_xen_hvm_init(QEMUMachineInitArgs *args) 327 { 328 PCIBus *bus; 329 330 pc_init_pci(args); 331 332 bus = pci_find_primary_bus(); 333 if (bus != NULL) { 334 pci_create_simple(bus, -1, "xen-platform"); 335 } 336 } 337 #endif 338 339 static QEMUMachine pc_i440fx_machine_v1_6 = { 340 .name = "pc-i440fx-1.6", 341 .alias = "pc", 342 .desc = "Standard PC (i440FX + PIIX, 1996)", 343 .init = pc_init_pci, 344 .hot_add_cpu = pc_hot_add_cpu, 345 .max_cpus = 255, 346 .is_default = 1, 347 DEFAULT_MACHINE_OPTIONS, 348 }; 349 350 static QEMUMachine pc_i440fx_machine_v1_5 = { 351 .name = "pc-i440fx-1.5", 352 .desc = "Standard PC (i440FX + PIIX, 1996)", 353 .init = pc_init_pci_1_5, 354 .hot_add_cpu = pc_hot_add_cpu, 355 .max_cpus = 255, 356 .compat_props = (GlobalProperty[]) { 357 PC_COMPAT_1_5, 358 { /* end of list */ } 359 }, 360 DEFAULT_MACHINE_OPTIONS, 361 }; 362 363 static QEMUMachine pc_i440fx_machine_v1_4 = { 364 .name = "pc-i440fx-1.4", 365 .desc = "Standard PC (i440FX + PIIX, 1996)", 366 .init = pc_init_pci_1_4, 367 .max_cpus = 255, 368 .compat_props = (GlobalProperty[]) { 369 PC_COMPAT_1_4, 370 { /* end of list */ } 371 }, 372 DEFAULT_MACHINE_OPTIONS, 373 }; 374 375 #define PC_COMPAT_1_3 \ 376 PC_COMPAT_1_4, \ 377 {\ 378 .driver = "usb-tablet",\ 379 .property = "usb_version",\ 380 .value = stringify(1),\ 381 },{\ 382 .driver = "virtio-net-pci",\ 383 .property = "ctrl_mac_addr",\ 384 .value = "off", \ 385 },{ \ 386 .driver = "virtio-net-pci", \ 387 .property = "mq", \ 388 .value = "off", \ 389 }, {\ 390 .driver = "e1000",\ 391 .property = "autonegotiation",\ 392 .value = "off",\ 393 } 394 395 static QEMUMachine pc_machine_v1_3 = { 396 .name = "pc-1.3", 397 .desc = "Standard PC", 398 .init = pc_init_pci_1_3, 399 .max_cpus = 255, 400 .compat_props = (GlobalProperty[]) { 401 PC_COMPAT_1_3, 402 { /* end of list */ } 403 }, 404 DEFAULT_MACHINE_OPTIONS, 405 }; 406 407 #define PC_COMPAT_1_2 \ 408 PC_COMPAT_1_3,\ 409 {\ 410 .driver = "nec-usb-xhci",\ 411 .property = "msi",\ 412 .value = "off",\ 413 },{\ 414 .driver = "nec-usb-xhci",\ 415 .property = "msix",\ 416 .value = "off",\ 417 },{\ 418 .driver = "ivshmem",\ 419 .property = "use64",\ 420 .value = "0",\ 421 },{\ 422 .driver = "qxl",\ 423 .property = "revision",\ 424 .value = stringify(3),\ 425 },{\ 426 .driver = "qxl-vga",\ 427 .property = "revision",\ 428 .value = stringify(3),\ 429 },{\ 430 .driver = "VGA",\ 431 .property = "mmio",\ 432 .value = "off",\ 433 } 434 435 static QEMUMachine pc_machine_v1_2 = { 436 .name = "pc-1.2", 437 .desc = "Standard PC", 438 .init = pc_init_pci_1_2, 439 .max_cpus = 255, 440 .compat_props = (GlobalProperty[]) { 441 PC_COMPAT_1_2, 442 { /* end of list */ } 443 }, 444 DEFAULT_MACHINE_OPTIONS, 445 }; 446 447 #define PC_COMPAT_1_1 \ 448 PC_COMPAT_1_2,\ 449 {\ 450 .driver = "virtio-scsi-pci",\ 451 .property = "hotplug",\ 452 .value = "off",\ 453 },{\ 454 .driver = "virtio-scsi-pci",\ 455 .property = "param_change",\ 456 .value = "off",\ 457 },{\ 458 .driver = "VGA",\ 459 .property = "vgamem_mb",\ 460 .value = stringify(8),\ 461 },{\ 462 .driver = "vmware-svga",\ 463 .property = "vgamem_mb",\ 464 .value = stringify(8),\ 465 },{\ 466 .driver = "qxl-vga",\ 467 .property = "vgamem_mb",\ 468 .value = stringify(8),\ 469 },{\ 470 .driver = "qxl",\ 471 .property = "vgamem_mb",\ 472 .value = stringify(8),\ 473 },{\ 474 .driver = "virtio-blk-pci",\ 475 .property = "config-wce",\ 476 .value = "off",\ 477 } 478 479 static QEMUMachine pc_machine_v1_1 = { 480 .name = "pc-1.1", 481 .desc = "Standard PC", 482 .init = pc_init_pci_1_2, 483 .max_cpus = 255, 484 .compat_props = (GlobalProperty[]) { 485 PC_COMPAT_1_1, 486 { /* end of list */ } 487 }, 488 DEFAULT_MACHINE_OPTIONS, 489 }; 490 491 #define PC_COMPAT_1_0 \ 492 PC_COMPAT_1_1,\ 493 {\ 494 .driver = "pc-sysfw",\ 495 .property = "rom_only",\ 496 .value = stringify(1),\ 497 }, {\ 498 .driver = TYPE_ISA_FDC,\ 499 .property = "check_media_rate",\ 500 .value = "off",\ 501 }, {\ 502 .driver = "virtio-balloon-pci",\ 503 .property = "class",\ 504 .value = stringify(PCI_CLASS_MEMORY_RAM),\ 505 },{\ 506 .driver = "apic",\ 507 .property = "vapic",\ 508 .value = "off",\ 509 },{\ 510 .driver = TYPE_USB_DEVICE,\ 511 .property = "full-path",\ 512 .value = "no",\ 513 } 514 515 static QEMUMachine pc_machine_v1_0 = { 516 .name = "pc-1.0", 517 .desc = "Standard PC", 518 .init = pc_init_pci_1_0, 519 .max_cpus = 255, 520 .compat_props = (GlobalProperty[]) { 521 PC_COMPAT_1_0, 522 { /* end of list */ } 523 }, 524 .hw_version = "1.0", 525 DEFAULT_MACHINE_OPTIONS, 526 }; 527 528 #define PC_COMPAT_0_15 \ 529 PC_COMPAT_1_0 530 531 static QEMUMachine pc_machine_v0_15 = { 532 .name = "pc-0.15", 533 .desc = "Standard PC", 534 .init = pc_init_pci_1_0, 535 .max_cpus = 255, 536 .compat_props = (GlobalProperty[]) { 537 PC_COMPAT_0_15, 538 { /* end of list */ } 539 }, 540 .hw_version = "0.15", 541 DEFAULT_MACHINE_OPTIONS, 542 }; 543 544 #define PC_COMPAT_0_14 \ 545 PC_COMPAT_0_15,\ 546 {\ 547 .driver = "virtio-blk-pci",\ 548 .property = "event_idx",\ 549 .value = "off",\ 550 },{\ 551 .driver = "virtio-serial-pci",\ 552 .property = "event_idx",\ 553 .value = "off",\ 554 },{\ 555 .driver = "virtio-net-pci",\ 556 .property = "event_idx",\ 557 .value = "off",\ 558 },{\ 559 .driver = "virtio-balloon-pci",\ 560 .property = "event_idx",\ 561 .value = "off",\ 562 } 563 564 static QEMUMachine pc_machine_v0_14 = { 565 .name = "pc-0.14", 566 .desc = "Standard PC", 567 .init = pc_init_pci_1_0, 568 .max_cpus = 255, 569 .compat_props = (GlobalProperty[]) { 570 PC_COMPAT_0_14, 571 { 572 .driver = "qxl", 573 .property = "revision", 574 .value = stringify(2), 575 },{ 576 .driver = "qxl-vga", 577 .property = "revision", 578 .value = stringify(2), 579 }, 580 { /* end of list */ } 581 }, 582 .hw_version = "0.14", 583 DEFAULT_MACHINE_OPTIONS, 584 }; 585 586 #define PC_COMPAT_0_13 \ 587 PC_COMPAT_0_14,\ 588 {\ 589 .driver = TYPE_PCI_DEVICE,\ 590 .property = "command_serr_enable",\ 591 .value = "off",\ 592 },{\ 593 .driver = "AC97",\ 594 .property = "use_broken_id",\ 595 .value = stringify(1),\ 596 } 597 598 static QEMUMachine pc_machine_v0_13 = { 599 .name = "pc-0.13", 600 .desc = "Standard PC", 601 .init = pc_init_pci_no_kvmclock, 602 .max_cpus = 255, 603 .compat_props = (GlobalProperty[]) { 604 PC_COMPAT_0_13, 605 { 606 .driver = "virtio-9p-pci", 607 .property = "vectors", 608 .value = stringify(0), 609 },{ 610 .driver = "VGA", 611 .property = "rombar", 612 .value = stringify(0), 613 },{ 614 .driver = "vmware-svga", 615 .property = "rombar", 616 .value = stringify(0), 617 }, 618 { /* end of list */ } 619 }, 620 .hw_version = "0.13", 621 DEFAULT_MACHINE_OPTIONS, 622 }; 623 624 #define PC_COMPAT_0_12 \ 625 PC_COMPAT_0_13,\ 626 {\ 627 .driver = "virtio-serial-pci",\ 628 .property = "max_ports",\ 629 .value = stringify(1),\ 630 },{\ 631 .driver = "virtio-serial-pci",\ 632 .property = "vectors",\ 633 .value = stringify(0),\ 634 },{\ 635 .driver = "usb-mouse",\ 636 .property = "serial",\ 637 .value = "1",\ 638 },{\ 639 .driver = "usb-tablet",\ 640 .property = "serial",\ 641 .value = "1",\ 642 },{\ 643 .driver = "usb-kbd",\ 644 .property = "serial",\ 645 .value = "1",\ 646 } 647 648 static QEMUMachine pc_machine_v0_12 = { 649 .name = "pc-0.12", 650 .desc = "Standard PC", 651 .init = pc_init_pci_no_kvmclock, 652 .max_cpus = 255, 653 .compat_props = (GlobalProperty[]) { 654 PC_COMPAT_0_12, 655 { 656 .driver = "VGA", 657 .property = "rombar", 658 .value = stringify(0), 659 },{ 660 .driver = "vmware-svga", 661 .property = "rombar", 662 .value = stringify(0), 663 }, 664 { /* end of list */ } 665 }, 666 .hw_version = "0.12", 667 DEFAULT_MACHINE_OPTIONS, 668 }; 669 670 #define PC_COMPAT_0_11 \ 671 PC_COMPAT_0_12,\ 672 {\ 673 .driver = "virtio-blk-pci",\ 674 .property = "vectors",\ 675 .value = stringify(0),\ 676 },{\ 677 .driver = TYPE_PCI_DEVICE,\ 678 .property = "rombar",\ 679 .value = stringify(0),\ 680 } 681 682 static QEMUMachine pc_machine_v0_11 = { 683 .name = "pc-0.11", 684 .desc = "Standard PC, qemu 0.11", 685 .init = pc_init_pci_no_kvmclock, 686 .max_cpus = 255, 687 .compat_props = (GlobalProperty[]) { 688 PC_COMPAT_0_11, 689 { 690 .driver = "ide-drive", 691 .property = "ver", 692 .value = "0.11", 693 },{ 694 .driver = "scsi-disk", 695 .property = "ver", 696 .value = "0.11", 697 }, 698 { /* end of list */ } 699 }, 700 .hw_version = "0.11", 701 DEFAULT_MACHINE_OPTIONS, 702 }; 703 704 static QEMUMachine pc_machine_v0_10 = { 705 .name = "pc-0.10", 706 .desc = "Standard PC, qemu 0.10", 707 .init = pc_init_pci_no_kvmclock, 708 .max_cpus = 255, 709 .compat_props = (GlobalProperty[]) { 710 PC_COMPAT_0_11, 711 { 712 .driver = "virtio-blk-pci", 713 .property = "class", 714 .value = stringify(PCI_CLASS_STORAGE_OTHER), 715 },{ 716 .driver = "virtio-serial-pci", 717 .property = "class", 718 .value = stringify(PCI_CLASS_DISPLAY_OTHER), 719 },{ 720 .driver = "virtio-net-pci", 721 .property = "vectors", 722 .value = stringify(0), 723 },{ 724 .driver = "ide-drive", 725 .property = "ver", 726 .value = "0.10", 727 },{ 728 .driver = "scsi-disk", 729 .property = "ver", 730 .value = "0.10", 731 }, 732 { /* end of list */ } 733 }, 734 .hw_version = "0.10", 735 DEFAULT_MACHINE_OPTIONS, 736 }; 737 738 static QEMUMachine isapc_machine = { 739 .name = "isapc", 740 .desc = "ISA-only PC", 741 .init = pc_init_isa, 742 .max_cpus = 1, 743 .compat_props = (GlobalProperty[]) { 744 { 745 .driver = "pc-sysfw", 746 .property = "rom_only", 747 .value = stringify(1), 748 }, 749 { 750 .driver = "pc-sysfw", 751 .property = "isapc_ram_fw", 752 .value = stringify(1), 753 }, 754 { /* end of list */ } 755 }, 756 DEFAULT_MACHINE_OPTIONS, 757 }; 758 759 #ifdef CONFIG_XEN 760 static QEMUMachine xenfv_machine = { 761 .name = "xenfv", 762 .desc = "Xen Fully-virtualized PC", 763 .init = pc_xen_hvm_init, 764 .max_cpus = HVM_MAX_VCPUS, 765 .default_machine_opts = "accel=xen", 766 DEFAULT_MACHINE_OPTIONS, 767 }; 768 #endif 769 770 static void pc_machine_init(void) 771 { 772 qemu_register_machine(&pc_i440fx_machine_v1_6); 773 qemu_register_machine(&pc_i440fx_machine_v1_5); 774 qemu_register_machine(&pc_i440fx_machine_v1_4); 775 qemu_register_machine(&pc_machine_v1_3); 776 qemu_register_machine(&pc_machine_v1_2); 777 qemu_register_machine(&pc_machine_v1_1); 778 qemu_register_machine(&pc_machine_v1_0); 779 qemu_register_machine(&pc_machine_v0_15); 780 qemu_register_machine(&pc_machine_v0_14); 781 qemu_register_machine(&pc_machine_v0_13); 782 qemu_register_machine(&pc_machine_v0_12); 783 qemu_register_machine(&pc_machine_v0_11); 784 qemu_register_machine(&pc_machine_v0_10); 785 qemu_register_machine(&isapc_machine); 786 #ifdef CONFIG_XEN 787 qemu_register_machine(&xenfv_machine); 788 #endif 789 } 790 791 machine_init(pc_machine_init); 792