]> git.proxmox.com Git - mirror_qemu.git/blame - hw/i386/pc_piix.c
qdev: Add SIZE type to qdev properties
[mirror_qemu.git] / hw / i386 / pc_piix.c
CommitLineData
845773ab
IY
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
ae0a5466
AK
25#include <glib.h>
26
83c9f4ca 27#include "hw/hw.h"
0d09e41a
PB
28#include "hw/i386/pc.h"
29#include "hw/i386/apic.h"
83c9f4ca
PB
30#include "hw/pci/pci.h"
31#include "hw/pci/pci_ids.h"
32#include "hw/usb.h"
1422e32d 33#include "net/net.h"
83c9f4ca
PB
34#include "hw/boards.h"
35#include "hw/ide.h"
9c17d615 36#include "sysemu/kvm.h"
83c9f4ca 37#include "hw/kvm/clock.h"
9c17d615 38#include "sysemu/sysemu.h"
83c9f4ca 39#include "hw/sysbus.h"
f0513d2c 40#include "hw/cpu/icc_bus.h"
9c17d615
PB
41#include "sysemu/arch_init.h"
42#include "sysemu/blockdev.h"
0d09e41a
PB
43#include "hw/i2c/smbus.h"
44#include "hw/xen/xen.h"
022c62cb
PB
45#include "exec/memory.h"
46#include "exec/address-spaces.h"
0445259b 47#include "hw/acpi/acpi.h"
dc59944b 48#include "cpu.h"
29d3ccde
AP
49#ifdef CONFIG_XEN
50# include <xen/hvm/hvm_info_table.h>
51#endif
845773ab
IY
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
3ab135f3 59static bool has_pvpanic = true;
f8c457b8 60static bool has_pci_info = true;
3ab135f3 61
845773ab 62/* PC hardware initialisation */
6bd10515 63static void pc_init1(MemoryRegion *system_memory,
aee97b84 64 MemoryRegion *system_io,
6bd10515 65 ram_addr_t ram_size,
845773ab
IY
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,
0ec329da
JK
71 int pci_enabled,
72 int kvmclock_enabled)
845773ab
IY
73{
74 int i;
75 ram_addr_t below_4g_mem_size, above_4g_mem_size;
76 PCIBus *pci_bus;
48a18b3c 77 ISABus *isa_bus;
845773ab
IY
78 PCII440FXState *i440fx_state;
79 int piix3_devfn = -1;
80 qemu_irq *cpu_irq;
b881fbe9 81 qemu_irq *gsi;
845773ab 82 qemu_irq *i8259;
845773ab 83 qemu_irq *smi_irq;
b881fbe9 84 GSIState *gsi_state;
845773ab 85 DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
c0897e0c 86 BusState *idebus[MAX_IDE_BUS];
1d914fa0 87 ISADevice *rtc_state;
34d4260e 88 ISADevice *floppy;
ae0a5466
AK
89 MemoryRegion *ram_memory;
90 MemoryRegion *pci_memory;
4463aee6 91 MemoryRegion *rom_memory;
f0513d2c 92 DeviceState *icc_bridge;
a88b362c 93 FWCfgState *fw_cfg = NULL;
3459a625 94 PcGuestInfo *guest_info;
845773ab 95
a97d6fe6
PD
96 if (xen_enabled() && xen_hvm_init() != 0) {
97 fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
98 exit(1);
99 }
100
f0513d2c
IM
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
62fc403f 105 pc_cpus_init(cpu_model, icc_bridge);
b7da6c60 106 pc_acpi_init("acpi-dsdt.aml");
845773ab 107
9cdf79d0 108 if (kvm_enabled() && kvmclock_enabled) {
0ec329da
JK
109 kvmclock_create();
110 }
111
fc744bb1
SS
112 if (ram_size >= 0xe0000000 ) {
113 above_4g_mem_size = ram_size - 0xe0000000;
114 below_4g_mem_size = 0xe0000000;
e0e7e67b
AP
115 } else {
116 above_4g_mem_size = 0;
117 below_4g_mem_size = ram_size;
118 }
119
4463aee6
JK
120 if (pci_enabled) {
121 pci_memory = g_new(MemoryRegion, 1);
2c9b15ca 122 memory_region_init(pci_memory, NULL, "pci", INT64_MAX);
4463aee6
JK
123 rom_memory = pci_memory;
124 } else {
125 pci_memory = NULL;
126 rom_memory = system_memory;
127 }
ae0a5466 128
3459a625 129 guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
f8c457b8 130 guest_info->has_pci_info = has_pci_info;
3459a625
MT
131
132 /* Set PCI window size the way seabios has always done it. */
133 /* Power of 2 so bios can cover it with a single MTRR */
134 if (ram_size <= 0x80000000)
135 guest_info->pci_info.w32.begin = 0x80000000;
136 else if (ram_size <= 0xc0000000)
137 guest_info->pci_info.w32.begin = 0xc0000000;
138 else
139 guest_info->pci_info.w32.begin = 0xe0000000;
140
845773ab 141 /* allocate ram and load rom/bios */
29d3ccde 142 if (!xen_enabled()) {
459ae5ea 143 fw_cfg = pc_memory_init(system_memory,
4aa63af1 144 kernel_filename, kernel_cmdline, initrd_filename,
ae0a5466 145 below_4g_mem_size, above_4g_mem_size,
3459a625 146 rom_memory, &ram_memory, guest_info);
29d3ccde 147 }
845773ab 148
b881fbe9 149 gsi_state = g_malloc0(sizeof(*gsi_state));
3d4b2649 150 if (kvm_irqchip_in_kernel()) {
d8ee0384
JB
151 kvm_pc_setup_irq_routing(pci_enabled);
152 gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
10b61882
JK
153 GSI_NUM_PINS);
154 } else {
155 gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
156 }
845773ab
IY
157
158 if (pci_enabled) {
60573079 159 pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
ae0a5466
AK
160 system_memory, system_io, ram_size,
161 below_4g_mem_size,
162 0x100000000ULL - below_4g_mem_size,
163 0x100000000ULL + above_4g_mem_size,
a8170e5e 164 (sizeof(hwaddr) == 4
ae0a5466
AK
165 ? 0
166 : ((uint64_t)1 << 62)),
167 pci_memory, ram_memory);
845773ab
IY
168 } else {
169 pci_bus = NULL;
02a89b21 170 i440fx_state = NULL;
48a18b3c 171 isa_bus = isa_bus_new(NULL, system_io);
57285cc3 172 no_hpet = 1;
845773ab 173 }
48a18b3c 174 isa_bus_irqs(isa_bus, gsi);
845773ab 175
3d4b2649 176 if (kvm_irqchip_in_kernel()) {
10b61882
JK
177 i8259 = kvm_i8259_init(isa_bus);
178 } else if (xen_enabled()) {
179 i8259 = xen_interrupt_controller_init();
180 } else {
4bae1efe 181 cpu_irq = pc_allocate_cpu_irq();
48a18b3c 182 i8259 = i8259_init(isa_bus, cpu_irq[0]);
4bae1efe
RH
183 }
184
43a0db35
JK
185 for (i = 0; i < ISA_NUM_IRQS; i++) {
186 gsi_state->i8259_irq[i] = i8259[i];
187 }
4bae1efe 188 if (pci_enabled) {
a39e3564 189 ioapic_init_gsi(gsi_state, "i440fx");
4bae1efe 190 }
f0513d2c 191 qdev_init_nofail(icc_bridge);
4bae1efe 192
b881fbe9 193 pc_register_ferr_irq(gsi[13]);
845773ab 194
f424d5c4 195 pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
01195b73 196
845773ab 197 /* init basic PC hardware */
48a18b3c 198 pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled());
845773ab 199
9011a1a7 200 pc_nic_init(isa_bus, pci_bus);
845773ab 201
75717903 202 ide_drive_get(hd, MAX_IDE_BUS);
845773ab 203 if (pci_enabled) {
c0897e0c 204 PCIDevice *dev;
679f4f8b
SS
205 if (xen_enabled()) {
206 dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
207 } else {
208 dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
209 }
c0897e0c
MA
210 idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
211 idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
845773ab
IY
212 } else {
213 for(i = 0; i < MAX_IDE_BUS; i++) {
c0897e0c 214 ISADevice *dev;
48a18b3c
HP
215 dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
216 ide_irq[i],
c0897e0c 217 hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
4a17cc4f 218 idebus[i] = qdev_get_child_bus(DEVICE(dev), "ide.0");
845773ab
IY
219 }
220 }
221
c0897e0c 222 pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
34d4260e 223 floppy, idebus[0], idebus[1], rtc_state);
845773ab 224
094b287f 225 if (pci_enabled && usb_enabled(false)) {
afb9a60e 226 pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
845773ab
IY
227 }
228
229 if (pci_enabled && acpi_enabled) {
845773ab
IY
230 i2c_bus *smbus;
231
182735ef 232 smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
845773ab
IY
233 /* TODO: Populate SPD eeprom data. */
234 smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
da98c8eb 235 gsi[9], *smi_irq,
459ae5ea 236 kvm_enabled(), fw_cfg);
a88df0b9 237 smbus_eeprom_init(smbus, 8, NULL, 0);
845773ab
IY
238 }
239
845773ab
IY
240 if (pci_enabled) {
241 pc_pci_device_init(pci_bus);
242 }
3ab135f3
HT
243
244 if (has_pvpanic) {
245 pvpanic_init(isa_bus);
246 }
845773ab
IY
247}
248
5f072e1f 249static void pc_init_pci(QEMUMachineInitArgs *args)
845773ab 250{
5f072e1f
EH
251 ram_addr_t ram_size = args->ram_size;
252 const char *cpu_model = args->cpu_model;
253 const char *kernel_filename = args->kernel_filename;
254 const char *kernel_cmdline = args->kernel_cmdline;
255 const char *initrd_filename = args->initrd_filename;
256 const char *boot_device = args->boot_device;
6bd10515 257 pc_init1(get_system_memory(),
aee97b84 258 get_system_io(),
6bd10515 259 ram_size, boot_device,
845773ab 260 kernel_filename, kernel_cmdline,
0ec329da
JK
261 initrd_filename, cpu_model, 1, 1);
262}
263
f8c457b8
MT
264static void pc_init_pci_1_5(QEMUMachineInitArgs *args)
265{
266 has_pci_info = false;
267 pc_init_pci(args);
268}
269
9953f882
MA
270static void pc_init_pci_1_4(QEMUMachineInitArgs *args)
271{
3ab135f3 272 has_pvpanic = false;
4458c236 273 x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
fcbe0a70 274 pc_init_pci_1_5(args);
9953f882
MA
275}
276
8932cfdf
EH
277static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
278{
279 enable_compat_apic_id_mode();
fcbe0a70 280 pc_init_pci_1_4(args);
8932cfdf
EH
281}
282
6fd028f6 283/* PC machine init function for pc-1.1 to pc-1.2 */
29694758 284static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
dc59944b 285{
29694758 286 disable_kvm_pv_eoi();
fcbe0a70 287 pc_init_pci_1_3(args);
dc59944b
MT
288}
289
6fd028f6
MA
290/* PC machine init function for pc-0.14 to pc-1.0 */
291static void pc_init_pci_1_0(QEMUMachineInitArgs *args)
292{
fcbe0a70 293 pc_init_pci_1_2(args);
6fd028f6
MA
294}
295
29694758 296/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
5f072e1f 297static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
0ec329da 298{
5f072e1f
EH
299 ram_addr_t ram_size = args->ram_size;
300 const char *cpu_model = args->cpu_model;
301 const char *kernel_filename = args->kernel_filename;
302 const char *kernel_cmdline = args->kernel_cmdline;
303 const char *initrd_filename = args->initrd_filename;
304 const char *boot_device = args->boot_device;
3ab135f3 305 has_pvpanic = false;
f8c457b8 306 has_pci_info = false;
29694758 307 disable_kvm_pv_eoi();
8932cfdf 308 enable_compat_apic_id_mode();
6bd10515 309 pc_init1(get_system_memory(),
aee97b84 310 get_system_io(),
6bd10515 311 ram_size, boot_device,
0ec329da
JK
312 kernel_filename, kernel_cmdline,
313 initrd_filename, cpu_model, 1, 0);
845773ab
IY
314}
315
5f072e1f 316static void pc_init_isa(QEMUMachineInitArgs *args)
845773ab 317{
5f072e1f
EH
318 ram_addr_t ram_size = args->ram_size;
319 const char *cpu_model = args->cpu_model;
320 const char *kernel_filename = args->kernel_filename;
321 const char *kernel_cmdline = args->kernel_cmdline;
322 const char *initrd_filename = args->initrd_filename;
323 const char *boot_device = args->boot_device;
3ab135f3 324 has_pvpanic = false;
f8c457b8 325 has_pci_info = false;
845773ab
IY
326 if (cpu_model == NULL)
327 cpu_model = "486";
29694758 328 disable_kvm_pv_eoi();
8932cfdf 329 enable_compat_apic_id_mode();
6bd10515 330 pc_init1(get_system_memory(),
aee97b84 331 get_system_io(),
6bd10515 332 ram_size, boot_device,
845773ab 333 kernel_filename, kernel_cmdline,
0ec329da 334 initrd_filename, cpu_model, 0, 1);
845773ab
IY
335}
336
29d3ccde 337#ifdef CONFIG_XEN
5f072e1f 338static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
29d3ccde 339{
39ae4972
PD
340 PCIBus *bus;
341
9cdf79d0 342 pc_init_pci(args);
39ae4972 343
1ef7a2a2 344 bus = pci_find_primary_bus();
39ae4972
PD
345 if (bus != NULL) {
346 pci_create_simple(bus, -1, "xen-platform");
347 }
29d3ccde
AP
348}
349#endif
350
45053fde
EH
351static QEMUMachine pc_i440fx_machine_v1_6 = {
352 .name = "pc-i440fx-1.6",
845773ab 353 .alias = "pc",
94dec594 354 .desc = "Standard PC (i440FX + PIIX, 1996)",
29694758 355 .init = pc_init_pci,
c649983b 356 .hot_add_cpu = pc_hot_add_cpu,
845773ab
IY
357 .max_cpus = 255,
358 .is_default = 1,
e4ada29e 359 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
360};
361
45053fde
EH
362static QEMUMachine pc_i440fx_machine_v1_5 = {
363 .name = "pc-i440fx-1.5",
364 .desc = "Standard PC (i440FX + PIIX, 1996)",
f8c457b8 365 .init = pc_init_pci_1_5,
45053fde
EH
366 .hot_add_cpu = pc_hot_add_cpu,
367 .max_cpus = 255,
ffce9ebb
EH
368 .compat_props = (GlobalProperty[]) {
369 PC_COMPAT_1_5,
370 { /* end of list */ }
371 },
45053fde
EH
372 DEFAULT_MACHINE_OPTIONS,
373};
374
bf3caa3d
PB
375static QEMUMachine pc_i440fx_machine_v1_4 = {
376 .name = "pc-i440fx-1.4",
377 .desc = "Standard PC (i440FX + PIIX, 1996)",
9953f882 378 .init = pc_init_pci_1_4,
bf3caa3d
PB
379 .max_cpus = 255,
380 .compat_props = (GlobalProperty[]) {
381 PC_COMPAT_1_4,
382 { /* end of list */ }
383 },
384 DEFAULT_MACHINE_OPTIONS,
385};
386
427e3aa1 387#define PC_COMPAT_1_3 \
bf3caa3d 388 PC_COMPAT_1_4, \
427e3aa1
HG
389 {\
390 .driver = "usb-tablet",\
391 .property = "usb_version",\
392 .value = stringify(1),\
c1943a3f
AK
393 },{\
394 .driver = "virtio-net-pci",\
395 .property = "ctrl_mac_addr",\
396 .value = "off", \
a9c87c58
JW
397 },{ \
398 .driver = "virtio-net-pci", \
399 .property = "mq", \
400 .value = "off", \
2af234e6
MT
401 }, {\
402 .driver = "e1000",\
403 .property = "autonegotiation",\
404 .value = "off",\
427e3aa1
HG
405 }
406
f1ae2e38
GH
407static QEMUMachine pc_machine_v1_3 = {
408 .name = "pc-1.3",
409 .desc = "Standard PC",
8932cfdf 410 .init = pc_init_pci_1_3,
f1ae2e38
GH
411 .max_cpus = 255,
412 .compat_props = (GlobalProperty[]) {
427e3aa1 413 PC_COMPAT_1_3,
f1ae2e38
GH
414 { /* end of list */ }
415 },
e4ada29e 416 DEFAULT_MACHINE_OPTIONS,
f1ae2e38
GH
417};
418
183c5eaa 419#define PC_COMPAT_1_2 \
427e3aa1 420 PC_COMPAT_1_3,\
183c5eaa
GH
421 {\
422 .driver = "nec-usb-xhci",\
423 .property = "msi",\
424 .value = "off",\
425 },{\
426 .driver = "nec-usb-xhci",\
427 .property = "msix",\
428 .value = "off",\
c08ba66f
GH
429 },{\
430 .driver = "ivshmem",\
431 .property = "use64",\
432 .value = "0",\
591af143
GH
433 },{\
434 .driver = "qxl",\
435 .property = "revision",\
436 .value = stringify(3),\
437 },{\
438 .driver = "qxl-vga",\
439 .property = "revision",\
440 .value = stringify(3),\
803ff052
GH
441 },{\
442 .driver = "VGA",\
443 .property = "mmio",\
444 .value = "off",\
183c5eaa
GH
445 }
446
f4306941
GH
447static QEMUMachine pc_machine_v1_2 = {
448 .name = "pc-1.2",
449 .desc = "Standard PC",
29694758 450 .init = pc_init_pci_1_2,
f4306941 451 .max_cpus = 255,
183c5eaa
GH
452 .compat_props = (GlobalProperty[]) {
453 PC_COMPAT_1_2,
454 { /* end of list */ }
455 },
e4ada29e 456 DEFAULT_MACHINE_OPTIONS,
f4306941
GH
457};
458
9e56edcf 459#define PC_COMPAT_1_1 \
183c5eaa 460 PC_COMPAT_1_2,\
9e56edcf 461 {\
07a5298c
PB
462 .driver = "virtio-scsi-pci",\
463 .property = "hotplug",\
464 .value = "off",\
465 },{\
466 .driver = "virtio-scsi-pci",\
467 .property = "param_change",\
468 .value = "off",\
469 },{\
9e56edcf
GH
470 .driver = "VGA",\
471 .property = "vgamem_mb",\
472 .value = stringify(8),\
473 },{\
474 .driver = "vmware-svga",\
475 .property = "vgamem_mb",\
476 .value = stringify(8),\
477 },{\
478 .driver = "qxl-vga",\
479 .property = "vgamem_mb",\
480 .value = stringify(8),\
481 },{\
482 .driver = "qxl",\
483 .property = "vgamem_mb",\
484 .value = stringify(8),\
ea776abc
SH
485 },{\
486 .driver = "virtio-blk-pci",\
487 .property = "config-wce",\
488 .value = "off",\
9e56edcf
GH
489 }
490
f1dacf1c
GH
491static QEMUMachine pc_machine_v1_1 = {
492 .name = "pc-1.1",
493 .desc = "Standard PC",
29694758 494 .init = pc_init_pci_1_2,
f1dacf1c 495 .max_cpus = 255,
9e56edcf
GH
496 .compat_props = (GlobalProperty[]) {
497 PC_COMPAT_1_1,
498 { /* end of list */ }
499 },
e4ada29e 500 DEFAULT_MACHINE_OPTIONS,
f1dacf1c
GH
501};
502
d6c73008 503#define PC_COMPAT_1_0 \
9e56edcf 504 PC_COMPAT_1_1,\
d6c73008
MT
505 {\
506 .driver = "pc-sysfw",\
507 .property = "rom_only",\
508 .value = stringify(1),\
509 }, {\
020c8e76 510 .driver = TYPE_ISA_FDC,\
d6c73008
MT
511 .property = "check_media_rate",\
512 .value = "off",\
2ba1d381
DG
513 }, {\
514 .driver = "virtio-balloon-pci",\
515 .property = "class",\
516 .value = stringify(PCI_CLASS_MEMORY_RAM),\
fc34e77b
AL
517 },{\
518 .driver = "apic",\
519 .property = "vapic",\
520 .value = "off",\
eeb0cf9a 521 },{\
bce54474 522 .driver = TYPE_USB_DEVICE,\
eeb0cf9a
GH
523 .property = "full-path",\
524 .value = "no",\
d6c73008
MT
525 }
526
382b3a68
JJ
527static QEMUMachine pc_machine_v1_0 = {
528 .name = "pc-1.0",
529 .desc = "Standard PC",
6fd028f6 530 .init = pc_init_pci_1_0,
382b3a68 531 .max_cpus = 255,
1b89fafe 532 .compat_props = (GlobalProperty[]) {
d6c73008 533 PC_COMPAT_1_0,
1b89fafe
JJ
534 { /* end of list */ }
535 },
93bfef4c 536 .hw_version = "1.0",
e4ada29e 537 DEFAULT_MACHINE_OPTIONS,
382b3a68
JJ
538};
539
d6c73008
MT
540#define PC_COMPAT_0_15 \
541 PC_COMPAT_1_0
542
ce01a508
AL
543static QEMUMachine pc_machine_v0_15 = {
544 .name = "pc-0.15",
545 .desc = "Standard PC",
6fd028f6 546 .init = pc_init_pci_1_0,
ce01a508 547 .max_cpus = 255,
1b89fafe 548 .compat_props = (GlobalProperty[]) {
d6c73008 549 PC_COMPAT_0_15,
1b89fafe
JJ
550 { /* end of list */ }
551 },
93bfef4c 552 .hw_version = "0.15",
e4ada29e 553 DEFAULT_MACHINE_OPTIONS,
ce01a508
AL
554};
555
d6c73008
MT
556#define PC_COMPAT_0_14 \
557 PC_COMPAT_0_15,\
558 {\
559 .driver = "virtio-blk-pci",\
560 .property = "event_idx",\
561 .value = "off",\
562 },{\
563 .driver = "virtio-serial-pci",\
564 .property = "event_idx",\
565 .value = "off",\
566 },{\
567 .driver = "virtio-net-pci",\
568 .property = "event_idx",\
569 .value = "off",\
570 },{\
571 .driver = "virtio-balloon-pci",\
572 .property = "event_idx",\
573 .value = "off",\
574 }
575
19857e62
GH
576static QEMUMachine pc_machine_v0_14 = {
577 .name = "pc-0.14",
578 .desc = "Standard PC",
6fd028f6 579 .init = pc_init_pci_1_0,
19857e62 580 .max_cpus = 255,
3827cdb1 581 .compat_props = (GlobalProperty[]) {
d6c73008 582 PC_COMPAT_0_14,
3827cdb1
AL
583 {
584 .driver = "qxl",
585 .property = "revision",
586 .value = stringify(2),
587 },{
588 .driver = "qxl-vga",
589 .property = "revision",
590 .value = stringify(2),
1b89fafe 591 },
3827cdb1
AL
592 { /* end of list */ }
593 },
93bfef4c 594 .hw_version = "0.14",
e4ada29e 595 DEFAULT_MACHINE_OPTIONS,
19857e62
GH
596};
597
d6c73008
MT
598#define PC_COMPAT_0_13 \
599 PC_COMPAT_0_14,\
600 {\
bce54474 601 .driver = TYPE_PCI_DEVICE,\
d6c73008
MT
602 .property = "command_serr_enable",\
603 .value = "off",\
604 },{\
605 .driver = "AC97",\
606 .property = "use_broken_id",\
607 .value = stringify(1),\
608 }
609
b903a0f7
GH
610static QEMUMachine pc_machine_v0_13 = {
611 .name = "pc-0.13",
612 .desc = "Standard PC",
0ec329da 613 .init = pc_init_pci_no_kvmclock,
b903a0f7 614 .max_cpus = 255,
9dbcca5a 615 .compat_props = (GlobalProperty[]) {
d6c73008 616 PC_COMPAT_0_13,
9dbcca5a
GH
617 {
618 .driver = "virtio-9p-pci",
619 .property = "vectors",
620 .value = stringify(0),
281a26b1
GH
621 },{
622 .driver = "VGA",
623 .property = "rombar",
624 .value = stringify(0),
625 },{
626 .driver = "vmware-svga",
627 .property = "rombar",
628 .value = stringify(0),
1b89fafe 629 },
9dbcca5a
GH
630 { /* end of list */ }
631 },
93bfef4c 632 .hw_version = "0.13",
e4ada29e 633 DEFAULT_MACHINE_OPTIONS,
b903a0f7
GH
634};
635
d6c73008
MT
636#define PC_COMPAT_0_12 \
637 PC_COMPAT_0_13,\
638 {\
639 .driver = "virtio-serial-pci",\
640 .property = "max_ports",\
641 .value = stringify(1),\
642 },{\
643 .driver = "virtio-serial-pci",\
644 .property = "vectors",\
645 .value = stringify(0),\
93c8e4dc
GH
646 },{\
647 .driver = "usb-mouse",\
648 .property = "serial",\
649 .value = "1",\
650 },{\
651 .driver = "usb-tablet",\
652 .property = "serial",\
653 .value = "1",\
654 },{\
655 .driver = "usb-kbd",\
656 .property = "serial",\
657 .value = "1",\
d6c73008
MT
658 }
659
845773ab
IY
660static QEMUMachine pc_machine_v0_12 = {
661 .name = "pc-0.12",
662 .desc = "Standard PC",
0ec329da 663 .init = pc_init_pci_no_kvmclock,
845773ab
IY
664 .max_cpus = 255,
665 .compat_props = (GlobalProperty[]) {
d6c73008 666 PC_COMPAT_0_12,
845773ab 667 {
281a26b1
GH
668 .driver = "VGA",
669 .property = "rombar",
670 .value = stringify(0),
671 },{
672 .driver = "vmware-svga",
673 .property = "rombar",
674 .value = stringify(0),
1b89fafe 675 },
845773ab 676 { /* end of list */ }
93bfef4c
CV
677 },
678 .hw_version = "0.12",
e4ada29e 679 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
680};
681
d6c73008
MT
682#define PC_COMPAT_0_11 \
683 PC_COMPAT_0_12,\
684 {\
685 .driver = "virtio-blk-pci",\
686 .property = "vectors",\
687 .value = stringify(0),\
c115cd65 688 },{\
bce54474 689 .driver = TYPE_PCI_DEVICE,\
c115cd65
PB
690 .property = "rombar",\
691 .value = stringify(0),\
d6c73008
MT
692 }
693
845773ab
IY
694static QEMUMachine pc_machine_v0_11 = {
695 .name = "pc-0.11",
696 .desc = "Standard PC, qemu 0.11",
0ec329da 697 .init = pc_init_pci_no_kvmclock,
845773ab
IY
698 .max_cpus = 255,
699 .compat_props = (GlobalProperty[]) {
d6c73008 700 PC_COMPAT_0_11,
845773ab 701 {
845773ab
IY
702 .driver = "ide-drive",
703 .property = "ver",
704 .value = "0.11",
705 },{
706 .driver = "scsi-disk",
707 .property = "ver",
708 .value = "0.11",
1b89fafe 709 },
845773ab 710 { /* end of list */ }
93bfef4c
CV
711 },
712 .hw_version = "0.11",
e4ada29e 713 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
714};
715
716static QEMUMachine pc_machine_v0_10 = {
717 .name = "pc-0.10",
718 .desc = "Standard PC, qemu 0.10",
0ec329da 719 .init = pc_init_pci_no_kvmclock,
845773ab
IY
720 .max_cpus = 255,
721 .compat_props = (GlobalProperty[]) {
d6c73008 722 PC_COMPAT_0_11,
845773ab
IY
723 {
724 .driver = "virtio-blk-pci",
725 .property = "class",
726 .value = stringify(PCI_CLASS_STORAGE_OTHER),
727 },{
728 .driver = "virtio-serial-pci",
729 .property = "class",
730 .value = stringify(PCI_CLASS_DISPLAY_OTHER),
845773ab
IY
731 },{
732 .driver = "virtio-net-pci",
733 .property = "vectors",
734 .value = stringify(0),
845773ab
IY
735 },{
736 .driver = "ide-drive",
737 .property = "ver",
738 .value = "0.10",
739 },{
740 .driver = "scsi-disk",
741 .property = "ver",
742 .value = "0.10",
1b89fafe 743 },
845773ab
IY
744 { /* end of list */ }
745 },
93bfef4c 746 .hw_version = "0.10",
e4ada29e 747 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
748};
749
750static QEMUMachine isapc_machine = {
751 .name = "isapc",
752 .desc = "ISA-only PC",
753 .init = pc_init_isa,
754 .max_cpus = 1,
1b89fafe
JJ
755 .compat_props = (GlobalProperty[]) {
756 {
757 .driver = "pc-sysfw",
758 .property = "rom_only",
759 .value = stringify(1),
760 },
dade922f
JJ
761 {
762 .driver = "pc-sysfw",
763 .property = "isapc_ram_fw",
764 .value = stringify(1),
765 },
1b89fafe
JJ
766 { /* end of list */ }
767 },
e4ada29e 768 DEFAULT_MACHINE_OPTIONS,
845773ab
IY
769};
770
29d3ccde
AP
771#ifdef CONFIG_XEN
772static QEMUMachine xenfv_machine = {
773 .name = "xenfv",
774 .desc = "Xen Fully-virtualized PC",
775 .init = pc_xen_hvm_init,
776 .max_cpus = HVM_MAX_VCPUS,
777 .default_machine_opts = "accel=xen",
e4ada29e 778 DEFAULT_MACHINE_OPTIONS,
29d3ccde
AP
779};
780#endif
781
845773ab
IY
782static void pc_machine_init(void)
783{
45053fde 784 qemu_register_machine(&pc_i440fx_machine_v1_6);
bf3caa3d 785 qemu_register_machine(&pc_i440fx_machine_v1_5);
94dec594 786 qemu_register_machine(&pc_i440fx_machine_v1_4);
f4306941 787 qemu_register_machine(&pc_machine_v1_3);
f1dacf1c 788 qemu_register_machine(&pc_machine_v1_2);
382b3a68 789 qemu_register_machine(&pc_machine_v1_1);
19857e62 790 qemu_register_machine(&pc_machine_v1_0);
ce01a508 791 qemu_register_machine(&pc_machine_v0_15);
19857e62 792 qemu_register_machine(&pc_machine_v0_14);
b903a0f7 793 qemu_register_machine(&pc_machine_v0_13);
845773ab
IY
794 qemu_register_machine(&pc_machine_v0_12);
795 qemu_register_machine(&pc_machine_v0_11);
796 qemu_register_machine(&pc_machine_v0_10);
797 qemu_register_machine(&isapc_machine);
29d3ccde
AP
798#ifdef CONFIG_XEN
799 qemu_register_machine(&xenfv_machine);
800#endif
845773ab
IY
801}
802
803machine_init(pc_machine_init);