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