qemu/hw/i386/pc_piix.c
<<
>>
Prefs
   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
  55static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
  56static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
  57static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
  58
  59static bool has_pvpanic;
  60static bool has_pci_info = true;
  61
  62/* PC hardware initialisation */
  63static 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(&ram_memory) != 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
 107    if (kvm_enabled() && kvmclock_enabled) {
 108        kvmclock_create();
 109    }
 110
 111    if (ram_size >= 0xe0000000 ) {
 112        above_4g_mem_size = ram_size - 0xe0000000;
 113        below_4g_mem_size = 0xe0000000;
 114    } else {
 115        above_4g_mem_size = 0;
 116        below_4g_mem_size = ram_size;
 117    }
 118
 119    if (pci_enabled) {
 120        pci_memory = g_new(MemoryRegion, 1);
 121        memory_region_init(pci_memory, NULL, "pci", INT64_MAX);
 122        rom_memory = pci_memory;
 123    } else {
 124        pci_memory = NULL;
 125        rom_memory = system_memory;
 126    }
 127
 128    guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
 129    guest_info->has_pci_info = has_pci_info;
 130    guest_info->isapc_ram_fw = !pci_enabled;
 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
 237static 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
 252static void pc_init_pci_1_6(QEMUMachineInitArgs *args)
 253{
 254    has_pci_info = false;
 255    pc_init_pci(args);
 256}
 257
 258static void pc_init_pci_1_5(QEMUMachineInitArgs *args)
 259{
 260    has_pvpanic = true;
 261    pc_init_pci_1_6(args);
 262}
 263
 264static void pc_init_pci_1_4(QEMUMachineInitArgs *args)
 265{
 266    x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
 267    x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
 268    has_pci_info = false;
 269    pc_init_pci(args);
 270}
 271
 272static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
 273{
 274    enable_compat_apic_id_mode();
 275    pc_init_pci_1_4(args);
 276}
 277
 278/* PC machine init function for pc-1.1 to pc-1.2 */
 279static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
 280{
 281    disable_kvm_pv_eoi();
 282    pc_init_pci_1_3(args);
 283}
 284
 285/* PC machine init function for pc-0.14 to pc-1.0 */
 286static void pc_init_pci_1_0(QEMUMachineInitArgs *args)
 287{
 288    pc_init_pci_1_2(args);
 289}
 290
 291/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
 292static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
 293{
 294    ram_addr_t ram_size = args->ram_size;
 295    const char *cpu_model = args->cpu_model;
 296    const char *kernel_filename = args->kernel_filename;
 297    const char *kernel_cmdline = args->kernel_cmdline;
 298    const char *initrd_filename = args->initrd_filename;
 299    const char *boot_device = args->boot_device;
 300    has_pci_info = false;
 301    disable_kvm_pv_eoi();
 302    enable_compat_apic_id_mode();
 303    pc_init1(get_system_memory(),
 304             get_system_io(),
 305             ram_size, boot_device,
 306             kernel_filename, kernel_cmdline,
 307             initrd_filename, cpu_model, 1, 0);
 308}
 309
 310static void pc_init_isa(QEMUMachineInitArgs *args)
 311{
 312    ram_addr_t ram_size = args->ram_size;
 313    const char *cpu_model = args->cpu_model;
 314    const char *kernel_filename = args->kernel_filename;
 315    const char *kernel_cmdline = args->kernel_cmdline;
 316    const char *initrd_filename = args->initrd_filename;
 317    const char *boot_device = args->boot_device;
 318    has_pci_info = false;
 319    if (cpu_model == NULL)
 320        cpu_model = "486";
 321    disable_kvm_pv_eoi();
 322    enable_compat_apic_id_mode();
 323    pc_init1(get_system_memory(),
 324             get_system_io(),
 325             ram_size, boot_device,
 326             kernel_filename, kernel_cmdline,
 327             initrd_filename, cpu_model, 0, 1);
 328}
 329
 330#ifdef CONFIG_XEN
 331static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
 332{
 333    PCIBus *bus;
 334
 335    pc_init_pci(args);
 336
 337    bus = pci_find_primary_bus();
 338    if (bus != NULL) {
 339        pci_create_simple(bus, -1, "xen-platform");
 340    }
 341}
 342#endif
 343
 344static QEMUMachine pc_i440fx_machine_v1_6 = {
 345    .name = "pc-i440fx-1.6",
 346    .alias = "pc",
 347    .desc = "Standard PC (i440FX + PIIX, 1996)",
 348    .init = pc_init_pci_1_6,
 349    .hot_add_cpu = pc_hot_add_cpu,
 350    .max_cpus = 255,
 351    .is_default = 1,
 352    DEFAULT_MACHINE_OPTIONS,
 353};
 354
 355static QEMUMachine pc_i440fx_machine_v1_5 = {
 356    .name = "pc-i440fx-1.5",
 357    .desc = "Standard PC (i440FX + PIIX, 1996)",
 358    .init = pc_init_pci_1_5,
 359    .hot_add_cpu = pc_hot_add_cpu,
 360    .max_cpus = 255,
 361    .compat_props = (GlobalProperty[]) {
 362        PC_COMPAT_1_5,
 363        { /* end of list */ }
 364    },
 365    DEFAULT_MACHINE_OPTIONS,
 366};
 367
 368static QEMUMachine pc_i440fx_machine_v1_4 = {
 369    .name = "pc-i440fx-1.4",
 370    .desc = "Standard PC (i440FX + PIIX, 1996)",
 371    .init = pc_init_pci_1_4,
 372    .max_cpus = 255,
 373    .compat_props = (GlobalProperty[]) {
 374        PC_COMPAT_1_4,
 375        { /* end of list */ }
 376    },
 377    DEFAULT_MACHINE_OPTIONS,
 378};
 379
 380#define PC_COMPAT_1_3 \
 381        PC_COMPAT_1_4, \
 382        {\
 383            .driver   = "usb-tablet",\
 384            .property = "usb_version",\
 385            .value    = stringify(1),\
 386        },{\
 387            .driver   = "virtio-net-pci",\
 388            .property = "ctrl_mac_addr",\
 389            .value    = "off",      \
 390        },{ \
 391            .driver   = "virtio-net-pci", \
 392            .property = "mq", \
 393            .value    = "off", \
 394        }, {\
 395            .driver   = "e1000",\
 396            .property = "autonegotiation",\
 397            .value    = "off",\
 398        }
 399
 400static QEMUMachine pc_machine_v1_3 = {
 401    .name = "pc-1.3",
 402    .desc = "Standard PC",
 403    .init = pc_init_pci_1_3,
 404    .max_cpus = 255,
 405    .compat_props = (GlobalProperty[]) {
 406        PC_COMPAT_1_3,
 407        { /* end of list */ }
 408    },
 409    DEFAULT_MACHINE_OPTIONS,
 410};
 411
 412#define PC_COMPAT_1_2 \
 413        PC_COMPAT_1_3,\
 414        {\
 415            .driver   = "nec-usb-xhci",\
 416            .property = "msi",\
 417            .value    = "off",\
 418        },{\
 419            .driver   = "nec-usb-xhci",\
 420            .property = "msix",\
 421            .value    = "off",\
 422        },{\
 423            .driver   = "ivshmem",\
 424            .property = "use64",\
 425            .value    = "0",\
 426        },{\
 427            .driver   = "qxl",\
 428            .property = "revision",\
 429            .value    = stringify(3),\
 430        },{\
 431            .driver   = "qxl-vga",\
 432            .property = "revision",\
 433            .value    = stringify(3),\
 434        },{\
 435            .driver   = "VGA",\
 436            .property = "mmio",\
 437            .value    = "off",\
 438        }
 439
 440static QEMUMachine pc_machine_v1_2 = {
 441    .name = "pc-1.2",
 442    .desc = "Standard PC",
 443    .init = pc_init_pci_1_2,
 444    .max_cpus = 255,
 445    .compat_props = (GlobalProperty[]) {
 446        PC_COMPAT_1_2,
 447        { /* end of list */ }
 448    },
 449    DEFAULT_MACHINE_OPTIONS,
 450};
 451
 452#define PC_COMPAT_1_1 \
 453        PC_COMPAT_1_2,\
 454        {\
 455            .driver   = "virtio-scsi-pci",\
 456            .property = "hotplug",\
 457            .value    = "off",\
 458        },{\
 459            .driver   = "virtio-scsi-pci",\
 460            .property = "param_change",\
 461            .value    = "off",\
 462        },{\
 463            .driver   = "VGA",\
 464            .property = "vgamem_mb",\
 465            .value    = stringify(8),\
 466        },{\
 467            .driver   = "vmware-svga",\
 468            .property = "vgamem_mb",\
 469            .value    = stringify(8),\
 470        },{\
 471            .driver   = "qxl-vga",\
 472            .property = "vgamem_mb",\
 473            .value    = stringify(8),\
 474        },{\
 475            .driver   = "qxl",\
 476            .property = "vgamem_mb",\
 477            .value    = stringify(8),\
 478        },{\
 479            .driver   = "virtio-blk-pci",\
 480            .property = "config-wce",\
 481            .value    = "off",\
 482        }
 483
 484static QEMUMachine pc_machine_v1_1 = {
 485    .name = "pc-1.1",
 486    .desc = "Standard PC",
 487    .init = pc_init_pci_1_2,
 488    .max_cpus = 255,
 489    .compat_props = (GlobalProperty[]) {
 490        PC_COMPAT_1_1,
 491        { /* end of list */ }
 492    },
 493    DEFAULT_MACHINE_OPTIONS,
 494};
 495
 496#define PC_COMPAT_1_0 \
 497        PC_COMPAT_1_1,\
 498        {\
 499            .driver   = TYPE_ISA_FDC,\
 500            .property = "check_media_rate",\
 501            .value    = "off",\
 502        }, {\
 503            .driver   = "virtio-balloon-pci",\
 504            .property = "class",\
 505            .value    = stringify(PCI_CLASS_MEMORY_RAM),\
 506        },{\
 507            .driver   = "apic",\
 508            .property = "vapic",\
 509            .value    = "off",\
 510        },{\
 511            .driver   = TYPE_USB_DEVICE,\
 512            .property = "full-path",\
 513            .value    = "no",\
 514        }
 515
 516static QEMUMachine pc_machine_v1_0 = {
 517    .name = "pc-1.0",
 518    .desc = "Standard PC",
 519    .init = pc_init_pci_1_0,
 520    .max_cpus = 255,
 521    .compat_props = (GlobalProperty[]) {
 522        PC_COMPAT_1_0,
 523        { /* end of list */ }
 524    },
 525    .hw_version = "1.0",
 526    DEFAULT_MACHINE_OPTIONS,
 527};
 528
 529#define PC_COMPAT_0_15 \
 530        PC_COMPAT_1_0
 531
 532static QEMUMachine pc_machine_v0_15 = {
 533    .name = "pc-0.15",
 534    .desc = "Standard PC",
 535    .init = pc_init_pci_1_0,
 536    .max_cpus = 255,
 537    .compat_props = (GlobalProperty[]) {
 538        PC_COMPAT_0_15,
 539        { /* end of list */ }
 540    },
 541    .hw_version = "0.15",
 542    DEFAULT_MACHINE_OPTIONS,
 543};
 544
 545#define PC_COMPAT_0_14 \
 546        PC_COMPAT_0_15,\
 547        {\
 548            .driver   = "virtio-blk-pci",\
 549            .property = "event_idx",\
 550            .value    = "off",\
 551        },{\
 552            .driver   = "virtio-serial-pci",\
 553            .property = "event_idx",\
 554            .value    = "off",\
 555        },{\
 556            .driver   = "virtio-net-pci",\
 557            .property = "event_idx",\
 558            .value    = "off",\
 559        },{\
 560            .driver   = "virtio-balloon-pci",\
 561            .property = "event_idx",\
 562            .value    = "off",\
 563        }
 564
 565static QEMUMachine pc_machine_v0_14 = {
 566    .name = "pc-0.14",
 567    .desc = "Standard PC",
 568    .init = pc_init_pci_1_0,
 569    .max_cpus = 255,
 570    .compat_props = (GlobalProperty[]) {
 571        PC_COMPAT_0_14, 
 572        {
 573            .driver   = "qxl",
 574            .property = "revision",
 575            .value    = stringify(2),
 576        },{
 577            .driver   = "qxl-vga",
 578            .property = "revision",
 579            .value    = stringify(2),
 580        },
 581        { /* end of list */ }
 582    },
 583    .hw_version = "0.14",
 584    DEFAULT_MACHINE_OPTIONS,
 585};
 586
 587#define PC_COMPAT_0_13 \
 588        PC_COMPAT_0_14,\
 589        {\
 590            .driver   = TYPE_PCI_DEVICE,\
 591            .property = "command_serr_enable",\
 592            .value    = "off",\
 593        },{\
 594            .driver   = "AC97",\
 595            .property = "use_broken_id",\
 596            .value    = stringify(1),\
 597        }
 598
 599static QEMUMachine pc_machine_v0_13 = {
 600    .name = "pc-0.13",
 601    .desc = "Standard PC",
 602    .init = pc_init_pci_no_kvmclock,
 603    .max_cpus = 255,
 604    .compat_props = (GlobalProperty[]) {
 605        PC_COMPAT_0_13,
 606        {
 607            .driver   = "virtio-9p-pci",
 608            .property = "vectors",
 609            .value    = stringify(0),
 610        },{
 611            .driver   = "VGA",
 612            .property = "rombar",
 613            .value    = stringify(0),
 614        },{
 615            .driver   = "vmware-svga",
 616            .property = "rombar",
 617            .value    = stringify(0),
 618        },
 619        { /* end of list */ }
 620    },
 621    .hw_version = "0.13",
 622    DEFAULT_MACHINE_OPTIONS,
 623};
 624
 625#define PC_COMPAT_0_12 \
 626        PC_COMPAT_0_13,\
 627        {\
 628            .driver   = "virtio-serial-pci",\
 629            .property = "max_ports",\
 630            .value    = stringify(1),\
 631        },{\
 632            .driver   = "virtio-serial-pci",\
 633            .property = "vectors",\
 634            .value    = stringify(0),\
 635        },{\
 636            .driver   = "usb-mouse",\
 637            .property = "serial",\
 638            .value    = "1",\
 639        },{\
 640            .driver   = "usb-tablet",\
 641            .property = "serial",\
 642            .value    = "1",\
 643        },{\
 644            .driver   = "usb-kbd",\
 645            .property = "serial",\
 646            .value    = "1",\
 647        }
 648
 649static QEMUMachine pc_machine_v0_12 = {
 650    .name = "pc-0.12",
 651    .desc = "Standard PC",
 652    .init = pc_init_pci_no_kvmclock,
 653    .max_cpus = 255,
 654    .compat_props = (GlobalProperty[]) {
 655        PC_COMPAT_0_12,
 656        {
 657            .driver   = "VGA",
 658            .property = "rombar",
 659            .value    = stringify(0),
 660        },{
 661            .driver   = "vmware-svga",
 662            .property = "rombar",
 663            .value    = stringify(0),
 664        },
 665        { /* end of list */ }
 666    },
 667    .hw_version = "0.12",
 668    DEFAULT_MACHINE_OPTIONS,
 669};
 670
 671#define PC_COMPAT_0_11 \
 672        PC_COMPAT_0_12,\
 673        {\
 674            .driver   = "virtio-blk-pci",\
 675            .property = "vectors",\
 676            .value    = stringify(0),\
 677        },{\
 678            .driver   = TYPE_PCI_DEVICE,\
 679            .property = "rombar",\
 680            .value    = stringify(0),\
 681        }
 682
 683static QEMUMachine pc_machine_v0_11 = {
 684    .name = "pc-0.11",
 685    .desc = "Standard PC, qemu 0.11",
 686    .init = pc_init_pci_no_kvmclock,
 687    .max_cpus = 255,
 688    .compat_props = (GlobalProperty[]) {
 689        PC_COMPAT_0_11,
 690        {
 691            .driver   = "ide-drive",
 692            .property = "ver",
 693            .value    = "0.11",
 694        },{
 695            .driver   = "scsi-disk",
 696            .property = "ver",
 697            .value    = "0.11",
 698        },
 699        { /* end of list */ }
 700    },
 701    .hw_version = "0.11",
 702    DEFAULT_MACHINE_OPTIONS,
 703};
 704
 705static QEMUMachine pc_machine_v0_10 = {
 706    .name = "pc-0.10",
 707    .desc = "Standard PC, qemu 0.10",
 708    .init = pc_init_pci_no_kvmclock,
 709    .max_cpus = 255,
 710    .compat_props = (GlobalProperty[]) {
 711        PC_COMPAT_0_11,
 712        {
 713            .driver   = "virtio-blk-pci",
 714            .property = "class",
 715            .value    = stringify(PCI_CLASS_STORAGE_OTHER),
 716        },{
 717            .driver   = "virtio-serial-pci",
 718            .property = "class",
 719            .value    = stringify(PCI_CLASS_DISPLAY_OTHER),
 720        },{
 721            .driver   = "virtio-net-pci",
 722            .property = "vectors",
 723            .value    = stringify(0),
 724        },{
 725            .driver   = "ide-drive",
 726            .property = "ver",
 727            .value    = "0.10",
 728        },{
 729            .driver   = "scsi-disk",
 730            .property = "ver",
 731            .value    = "0.10",
 732        },
 733        { /* end of list */ }
 734    },
 735    .hw_version = "0.10",
 736    DEFAULT_MACHINE_OPTIONS,
 737};
 738
 739static QEMUMachine isapc_machine = {
 740    .name = "isapc",
 741    .desc = "ISA-only PC",
 742    .init = pc_init_isa,
 743    .max_cpus = 1,
 744    .compat_props = (GlobalProperty[]) {
 745        { /* end of list */ }
 746    },
 747    DEFAULT_MACHINE_OPTIONS,
 748};
 749
 750#ifdef CONFIG_XEN
 751static QEMUMachine xenfv_machine = {
 752    .name = "xenfv",
 753    .desc = "Xen Fully-virtualized PC",
 754    .init = pc_xen_hvm_init,
 755    .max_cpus = HVM_MAX_VCPUS,
 756    .default_machine_opts = "accel=xen",
 757    DEFAULT_MACHINE_OPTIONS,
 758};
 759#endif
 760
 761static void pc_machine_init(void)
 762{
 763    qemu_register_machine(&pc_i440fx_machine_v1_6);
 764    qemu_register_machine(&pc_i440fx_machine_v1_5);
 765    qemu_register_machine(&pc_i440fx_machine_v1_4);
 766    qemu_register_machine(&pc_machine_v1_3);
 767    qemu_register_machine(&pc_machine_v1_2);
 768    qemu_register_machine(&pc_machine_v1_1);
 769    qemu_register_machine(&pc_machine_v1_0);
 770    qemu_register_machine(&pc_machine_v0_15);
 771    qemu_register_machine(&pc_machine_v0_14);
 772    qemu_register_machine(&pc_machine_v0_13);
 773    qemu_register_machine(&pc_machine_v0_12);
 774    qemu_register_machine(&pc_machine_v0_11);
 775    qemu_register_machine(&pc_machine_v0_10);
 776    qemu_register_machine(&isapc_machine);
 777#ifdef CONFIG_XEN
 778    qemu_register_machine(&xenfv_machine);
 779#endif
 780}
 781
 782machine_init(pc_machine_init);
 783