]> git.proxmox.com Git - qemu.git/blame - hw/pc_piix.c
virtio-serial-bus: post_load send_event when vm is running
[qemu.git] / hw / 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
845773ab
IY
27#include "hw.h"
28#include "pc.h"
29#include "apic.h"
30#include "pci.h"
2ba1d381 31#include "pci_ids.h"
bce54474 32#include "usb.h"
845773ab
IY
33#include "net.h"
34#include "boards.h"
35#include "ide.h"
36#include "kvm.h"
3b9a6ee5 37#include "kvm/clock.h"
666daa68 38#include "sysemu.h"
96051119 39#include "sysbus.h"
0dfa5ef9 40#include "arch_init.h"
2446333c 41#include "blockdev.h"
a88df0b9 42#include "smbus.h"
29d3ccde 43#include "xen.h"
4aa63af1
AK
44#include "memory.h"
45#include "exec-memory.h"
dc59944b 46#include "cpu.h"
29d3ccde
AP
47#ifdef CONFIG_XEN
48# include <xen/hvm/hvm_info_table.h>
49#endif
845773ab
IY
50
51#define MAX_IDE_BUS 2
52
53static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
54static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
55static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
56
10b61882
JK
57static void kvm_piix3_setup_irq_routing(bool pci_enabled)
58{
59#ifdef CONFIG_KVM
60 KVMState *s = kvm_state;
e7b20308 61 int i;
10b61882
JK
62
63 if (kvm_check_extension(s, KVM_CAP_IRQ_ROUTING)) {
64 for (i = 0; i < 8; ++i) {
65 if (i == 2) {
66 continue;
67 }
1df186df 68 kvm_irqchip_add_irq_route(s, i, KVM_IRQCHIP_PIC_MASTER, i);
10b61882
JK
69 }
70 for (i = 8; i < 16; ++i) {
1df186df 71 kvm_irqchip_add_irq_route(s, i, KVM_IRQCHIP_PIC_SLAVE, i - 8);
10b61882 72 }
a39c1d47
JK
73 if (pci_enabled) {
74 for (i = 0; i < 24; ++i) {
75 if (i == 0) {
1df186df 76 kvm_irqchip_add_irq_route(s, i, KVM_IRQCHIP_IOAPIC, 2);
a39c1d47 77 } else if (i != 2) {
1df186df 78 kvm_irqchip_add_irq_route(s, i, KVM_IRQCHIP_IOAPIC, i);
a39c1d47
JK
79 }
80 }
81 }
10b61882
JK
82 }
83#endif /* CONFIG_KVM */
84}
85
86static void kvm_piix3_gsi_handler(void *opaque, int n, int level)
87{
88 GSIState *s = opaque;
89
90 if (n < ISA_NUM_IRQS) {
91 /* Kernel will forward to both PIC and IOAPIC */
92 qemu_set_irq(s->i8259_irq[n], level);
93 } else {
94 qemu_set_irq(s->ioapic_irq[n], level);
95 }
96}
97
b881fbe9 98static void ioapic_init(GSIState *gsi_state)
96051119
BS
99{
100 DeviceState *dev;
101 SysBusDevice *d;
102 unsigned int i;
103
3d4b2649 104 if (kvm_irqchip_in_kernel()) {
a39c1d47
JK
105 dev = qdev_create(NULL, "kvm-ioapic");
106 } else {
107 dev = qdev_create(NULL, "ioapic");
108 }
20288345
PB
109 /* FIXME: this should be under the piix3. */
110 object_property_add_child(object_resolve_path("i440fx", NULL),
111 "ioapic", OBJECT(dev), NULL);
96051119
BS
112 qdev_init_nofail(dev);
113 d = sysbus_from_qdev(dev);
114 sysbus_mmio_map(d, 0, 0xfec00000);
115
116 for (i = 0; i < IOAPIC_NUM_PINS; i++) {
b881fbe9 117 gsi_state->ioapic_irq[i] = qdev_get_gpio_in(dev, i);
96051119
BS
118 }
119}
120
845773ab 121/* PC hardware initialisation */
6bd10515 122static void pc_init1(MemoryRegion *system_memory,
aee97b84 123 MemoryRegion *system_io,
6bd10515 124 ram_addr_t ram_size,
845773ab
IY
125 const char *boot_device,
126 const char *kernel_filename,
127 const char *kernel_cmdline,
128 const char *initrd_filename,
129 const char *cpu_model,
0ec329da
JK
130 int pci_enabled,
131 int kvmclock_enabled)
845773ab
IY
132{
133 int i;
134 ram_addr_t below_4g_mem_size, above_4g_mem_size;
135 PCIBus *pci_bus;
48a18b3c 136 ISABus *isa_bus;
845773ab
IY
137 PCII440FXState *i440fx_state;
138 int piix3_devfn = -1;
139 qemu_irq *cpu_irq;
b881fbe9 140 qemu_irq *gsi;
845773ab 141 qemu_irq *i8259;
845773ab 142 qemu_irq *smi_irq;
b881fbe9 143 GSIState *gsi_state;
845773ab 144 DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
c0897e0c 145 BusState *idebus[MAX_IDE_BUS];
1d914fa0 146 ISADevice *rtc_state;
34d4260e 147 ISADevice *floppy;
ae0a5466
AK
148 MemoryRegion *ram_memory;
149 MemoryRegion *pci_memory;
4463aee6 150 MemoryRegion *rom_memory;
459ae5ea 151 void *fw_cfg = NULL;
845773ab
IY
152
153 pc_cpus_init(cpu_model);
154
0ec329da
JK
155 if (kvmclock_enabled) {
156 kvmclock_create();
157 }
158
e0e7e67b
AP
159 if (ram_size >= 0xe0000000 ) {
160 above_4g_mem_size = ram_size - 0xe0000000;
161 below_4g_mem_size = 0xe0000000;
162 } else {
163 above_4g_mem_size = 0;
164 below_4g_mem_size = ram_size;
165 }
166
4463aee6
JK
167 if (pci_enabled) {
168 pci_memory = g_new(MemoryRegion, 1);
169 memory_region_init(pci_memory, "pci", INT64_MAX);
170 rom_memory = pci_memory;
171 } else {
172 pci_memory = NULL;
173 rom_memory = system_memory;
174 }
ae0a5466 175
845773ab 176 /* allocate ram and load rom/bios */
29d3ccde 177 if (!xen_enabled()) {
459ae5ea 178 fw_cfg = pc_memory_init(system_memory,
4aa63af1 179 kernel_filename, kernel_cmdline, initrd_filename,
ae0a5466 180 below_4g_mem_size, above_4g_mem_size,
0d3cf3b6 181 rom_memory, &ram_memory);
29d3ccde 182 }
845773ab 183
b881fbe9 184 gsi_state = g_malloc0(sizeof(*gsi_state));
3d4b2649 185 if (kvm_irqchip_in_kernel()) {
10b61882
JK
186 kvm_piix3_setup_irq_routing(pci_enabled);
187 gsi = qemu_allocate_irqs(kvm_piix3_gsi_handler, gsi_state,
188 GSI_NUM_PINS);
189 } else {
190 gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
191 }
845773ab
IY
192
193 if (pci_enabled) {
60573079 194 pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
ae0a5466
AK
195 system_memory, system_io, ram_size,
196 below_4g_mem_size,
197 0x100000000ULL - below_4g_mem_size,
198 0x100000000ULL + above_4g_mem_size,
a8170e5e 199 (sizeof(hwaddr) == 4
ae0a5466
AK
200 ? 0
201 : ((uint64_t)1 << 62)),
202 pci_memory, ram_memory);
845773ab
IY
203 } else {
204 pci_bus = NULL;
02a89b21 205 i440fx_state = NULL;
48a18b3c 206 isa_bus = isa_bus_new(NULL, system_io);
57285cc3 207 no_hpet = 1;
845773ab 208 }
48a18b3c 209 isa_bus_irqs(isa_bus, gsi);
845773ab 210
3d4b2649 211 if (kvm_irqchip_in_kernel()) {
10b61882
JK
212 i8259 = kvm_i8259_init(isa_bus);
213 } else if (xen_enabled()) {
214 i8259 = xen_interrupt_controller_init();
215 } else {
4bae1efe 216 cpu_irq = pc_allocate_cpu_irq();
48a18b3c 217 i8259 = i8259_init(isa_bus, cpu_irq[0]);
4bae1efe
RH
218 }
219
43a0db35
JK
220 for (i = 0; i < ISA_NUM_IRQS; i++) {
221 gsi_state->i8259_irq[i] = i8259[i];
222 }
4bae1efe 223 if (pci_enabled) {
b881fbe9 224 ioapic_init(gsi_state);
4bae1efe
RH
225 }
226
b881fbe9 227 pc_register_ferr_irq(gsi[13]);
845773ab 228
f424d5c4 229 pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
01195b73
SS
230 if (xen_enabled()) {
231 pci_create_simple(pci_bus, -1, "xen-platform");
232 }
233
845773ab 234 /* init basic PC hardware */
48a18b3c 235 pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled());
845773ab
IY
236
237 for(i = 0; i < nb_nics; i++) {
238 NICInfo *nd = &nd_table[i];
239
240 if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0))
48a18b3c 241 pc_init_ne2k_isa(isa_bus, nd);
845773ab
IY
242 else
243 pci_nic_init_nofail(nd, "e1000", NULL);
244 }
245
75717903 246 ide_drive_get(hd, MAX_IDE_BUS);
845773ab 247 if (pci_enabled) {
c0897e0c 248 PCIDevice *dev;
679f4f8b
SS
249 if (xen_enabled()) {
250 dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
251 } else {
252 dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
253 }
c0897e0c
MA
254 idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
255 idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
845773ab
IY
256 } else {
257 for(i = 0; i < MAX_IDE_BUS; i++) {
c0897e0c 258 ISADevice *dev;
48a18b3c
HP
259 dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
260 ide_irq[i],
c0897e0c
MA
261 hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
262 idebus[i] = qdev_get_child_bus(&dev->qdev, "ide.0");
845773ab
IY
263 }
264 }
265
4a0f031d 266 audio_init(isa_bus, pci_enabled ? pci_bus : NULL);
845773ab 267
c0897e0c 268 pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
34d4260e 269 floppy, idebus[0], idebus[1], rtc_state);
845773ab 270
094b287f 271 if (pci_enabled && usb_enabled(false)) {
afb9a60e 272 pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
845773ab
IY
273 }
274
275 if (pci_enabled && acpi_enabled) {
845773ab
IY
276 i2c_bus *smbus;
277
845773ab
IY
278 smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
279 /* TODO: Populate SPD eeprom data. */
280 smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
da98c8eb 281 gsi[9], *smi_irq,
459ae5ea 282 kvm_enabled(), fw_cfg);
a88df0b9 283 smbus_eeprom_init(smbus, 8, NULL, 0);
845773ab
IY
284 }
285
845773ab
IY
286 if (pci_enabled) {
287 pc_pci_device_init(pci_bus);
288 }
289}
290
5f072e1f 291static void pc_init_pci(QEMUMachineInitArgs *args)
845773ab 292{
5f072e1f
EH
293 ram_addr_t ram_size = args->ram_size;
294 const char *cpu_model = args->cpu_model;
295 const char *kernel_filename = args->kernel_filename;
296 const char *kernel_cmdline = args->kernel_cmdline;
297 const char *initrd_filename = args->initrd_filename;
298 const char *boot_device = args->boot_device;
6bd10515 299 pc_init1(get_system_memory(),
aee97b84 300 get_system_io(),
6bd10515 301 ram_size, boot_device,
845773ab 302 kernel_filename, kernel_cmdline,
0ec329da
JK
303 initrd_filename, cpu_model, 1, 1);
304}
305
dc59944b
MT
306static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
307{
308 enable_kvm_pv_eoi();
309 pc_init_pci(args);
310}
311
5f072e1f 312static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
0ec329da 313{
5f072e1f
EH
314 ram_addr_t ram_size = args->ram_size;
315 const char *cpu_model = args->cpu_model;
316 const char *kernel_filename = args->kernel_filename;
317 const char *kernel_cmdline = args->kernel_cmdline;
318 const char *initrd_filename = args->initrd_filename;
319 const char *boot_device = args->boot_device;
6bd10515 320 pc_init1(get_system_memory(),
aee97b84 321 get_system_io(),
6bd10515 322 ram_size, boot_device,
0ec329da
JK
323 kernel_filename, kernel_cmdline,
324 initrd_filename, cpu_model, 1, 0);
845773ab
IY
325}
326
5f072e1f 327static void pc_init_isa(QEMUMachineInitArgs *args)
845773ab 328{
5f072e1f
EH
329 ram_addr_t ram_size = args->ram_size;
330 const char *cpu_model = args->cpu_model;
331 const char *kernel_filename = args->kernel_filename;
332 const char *kernel_cmdline = args->kernel_cmdline;
333 const char *initrd_filename = args->initrd_filename;
334 const char *boot_device = args->boot_device;
845773ab
IY
335 if (cpu_model == NULL)
336 cpu_model = "486";
6bd10515 337 pc_init1(get_system_memory(),
aee97b84 338 get_system_io(),
6bd10515 339 ram_size, boot_device,
845773ab 340 kernel_filename, kernel_cmdline,
0ec329da 341 initrd_filename, cpu_model, 0, 1);
845773ab
IY
342}
343
29d3ccde 344#ifdef CONFIG_XEN
5f072e1f 345static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
29d3ccde
AP
346{
347 if (xen_hvm_init() != 0) {
348 hw_error("xen hardware virtual machine initialisation failed");
349 }
5f072e1f 350 pc_init_pci_no_kvmclock(args);
29d3ccde
AP
351 xen_vcpu_init();
352}
353#endif
354
f4306941
GH
355static QEMUMachine pc_machine_v1_3 = {
356 .name = "pc-1.3",
845773ab
IY
357 .alias = "pc",
358 .desc = "Standard PC",
dc59944b 359 .init = pc_init_pci_1_3,
845773ab
IY
360 .max_cpus = 255,
361 .is_default = 1,
362};
363
183c5eaa
GH
364#define PC_COMPAT_1_2 \
365 {\
366 .driver = "nec-usb-xhci",\
367 .property = "msi",\
368 .value = "off",\
369 },{\
370 .driver = "nec-usb-xhci",\
371 .property = "msix",\
372 .value = "off",\
c08ba66f
GH
373 },{\
374 .driver = "ivshmem",\
375 .property = "use64",\
376 .value = "0",\
591af143
GH
377 },{\
378 .driver = "qxl",\
379 .property = "revision",\
380 .value = stringify(3),\
381 },{\
382 .driver = "qxl-vga",\
383 .property = "revision",\
384 .value = stringify(3),\
803ff052
GH
385 },{\
386 .driver = "VGA",\
387 .property = "mmio",\
388 .value = "off",\
183c5eaa
GH
389 }
390
f4306941
GH
391static QEMUMachine pc_machine_v1_2 = {
392 .name = "pc-1.2",
393 .desc = "Standard PC",
394 .init = pc_init_pci,
395 .max_cpus = 255,
183c5eaa
GH
396 .compat_props = (GlobalProperty[]) {
397 PC_COMPAT_1_2,
398 { /* end of list */ }
399 },
f4306941
GH
400};
401
9e56edcf 402#define PC_COMPAT_1_1 \
183c5eaa 403 PC_COMPAT_1_2,\
9e56edcf 404 {\
07a5298c
PB
405 .driver = "virtio-scsi-pci",\
406 .property = "hotplug",\
407 .value = "off",\
408 },{\
409 .driver = "virtio-scsi-pci",\
410 .property = "param_change",\
411 .value = "off",\
412 },{\
9e56edcf
GH
413 .driver = "VGA",\
414 .property = "vgamem_mb",\
415 .value = stringify(8),\
416 },{\
417 .driver = "vmware-svga",\
418 .property = "vgamem_mb",\
419 .value = stringify(8),\
420 },{\
421 .driver = "qxl-vga",\
422 .property = "vgamem_mb",\
423 .value = stringify(8),\
424 },{\
425 .driver = "qxl",\
426 .property = "vgamem_mb",\
427 .value = stringify(8),\
ea776abc
SH
428 },{\
429 .driver = "virtio-blk-pci",\
430 .property = "config-wce",\
431 .value = "off",\
9e56edcf
GH
432 }
433
f1dacf1c
GH
434static QEMUMachine pc_machine_v1_1 = {
435 .name = "pc-1.1",
436 .desc = "Standard PC",
437 .init = pc_init_pci,
438 .max_cpus = 255,
9e56edcf
GH
439 .compat_props = (GlobalProperty[]) {
440 PC_COMPAT_1_1,
441 { /* end of list */ }
442 },
f1dacf1c
GH
443};
444
d6c73008 445#define PC_COMPAT_1_0 \
9e56edcf 446 PC_COMPAT_1_1,\
d6c73008
MT
447 {\
448 .driver = "pc-sysfw",\
449 .property = "rom_only",\
450 .value = stringify(1),\
451 }, {\
452 .driver = "isa-fdc",\
453 .property = "check_media_rate",\
454 .value = "off",\
2ba1d381
DG
455 }, {\
456 .driver = "virtio-balloon-pci",\
457 .property = "class",\
458 .value = stringify(PCI_CLASS_MEMORY_RAM),\
fc34e77b
AL
459 },{\
460 .driver = "apic",\
461 .property = "vapic",\
462 .value = "off",\
eeb0cf9a 463 },{\
bce54474 464 .driver = TYPE_USB_DEVICE,\
eeb0cf9a
GH
465 .property = "full-path",\
466 .value = "no",\
d6c73008
MT
467 }
468
382b3a68
JJ
469static QEMUMachine pc_machine_v1_0 = {
470 .name = "pc-1.0",
471 .desc = "Standard PC",
472 .init = pc_init_pci,
473 .max_cpus = 255,
1b89fafe 474 .compat_props = (GlobalProperty[]) {
d6c73008 475 PC_COMPAT_1_0,
1b89fafe
JJ
476 { /* end of list */ }
477 },
93bfef4c 478 .hw_version = "1.0",
382b3a68
JJ
479};
480
d6c73008
MT
481#define PC_COMPAT_0_15 \
482 PC_COMPAT_1_0
483
ce01a508
AL
484static QEMUMachine pc_machine_v0_15 = {
485 .name = "pc-0.15",
486 .desc = "Standard PC",
487 .init = pc_init_pci,
488 .max_cpus = 255,
1b89fafe 489 .compat_props = (GlobalProperty[]) {
d6c73008 490 PC_COMPAT_0_15,
1b89fafe
JJ
491 { /* end of list */ }
492 },
93bfef4c 493 .hw_version = "0.15",
ce01a508
AL
494};
495
d6c73008
MT
496#define PC_COMPAT_0_14 \
497 PC_COMPAT_0_15,\
498 {\
499 .driver = "virtio-blk-pci",\
500 .property = "event_idx",\
501 .value = "off",\
502 },{\
503 .driver = "virtio-serial-pci",\
504 .property = "event_idx",\
505 .value = "off",\
506 },{\
507 .driver = "virtio-net-pci",\
508 .property = "event_idx",\
509 .value = "off",\
510 },{\
511 .driver = "virtio-balloon-pci",\
512 .property = "event_idx",\
513 .value = "off",\
514 }
515
19857e62
GH
516static QEMUMachine pc_machine_v0_14 = {
517 .name = "pc-0.14",
518 .desc = "Standard PC",
519 .init = pc_init_pci,
520 .max_cpus = 255,
3827cdb1 521 .compat_props = (GlobalProperty[]) {
d6c73008 522 PC_COMPAT_0_14,
3827cdb1
AL
523 {
524 .driver = "qxl",
525 .property = "revision",
526 .value = stringify(2),
527 },{
528 .driver = "qxl-vga",
529 .property = "revision",
530 .value = stringify(2),
1b89fafe 531 },
3827cdb1
AL
532 { /* end of list */ }
533 },
93bfef4c 534 .hw_version = "0.14",
19857e62
GH
535};
536
d6c73008
MT
537#define PC_COMPAT_0_13 \
538 PC_COMPAT_0_14,\
539 {\
bce54474 540 .driver = TYPE_PCI_DEVICE,\
d6c73008
MT
541 .property = "command_serr_enable",\
542 .value = "off",\
543 },{\
544 .driver = "AC97",\
545 .property = "use_broken_id",\
546 .value = stringify(1),\
547 }
548
b903a0f7
GH
549static QEMUMachine pc_machine_v0_13 = {
550 .name = "pc-0.13",
551 .desc = "Standard PC",
0ec329da 552 .init = pc_init_pci_no_kvmclock,
b903a0f7 553 .max_cpus = 255,
9dbcca5a 554 .compat_props = (GlobalProperty[]) {
d6c73008 555 PC_COMPAT_0_13,
9dbcca5a
GH
556 {
557 .driver = "virtio-9p-pci",
558 .property = "vectors",
559 .value = stringify(0),
281a26b1
GH
560 },{
561 .driver = "VGA",
562 .property = "rombar",
563 .value = stringify(0),
564 },{
565 .driver = "vmware-svga",
566 .property = "rombar",
567 .value = stringify(0),
1b89fafe 568 },
9dbcca5a
GH
569 { /* end of list */ }
570 },
93bfef4c 571 .hw_version = "0.13",
b903a0f7
GH
572};
573
d6c73008
MT
574#define PC_COMPAT_0_12 \
575 PC_COMPAT_0_13,\
576 {\
577 .driver = "virtio-serial-pci",\
578 .property = "max_ports",\
579 .value = stringify(1),\
580 },{\
581 .driver = "virtio-serial-pci",\
582 .property = "vectors",\
583 .value = stringify(0),\
584 }
585
845773ab
IY
586static QEMUMachine pc_machine_v0_12 = {
587 .name = "pc-0.12",
588 .desc = "Standard PC",
0ec329da 589 .init = pc_init_pci_no_kvmclock,
845773ab
IY
590 .max_cpus = 255,
591 .compat_props = (GlobalProperty[]) {
d6c73008 592 PC_COMPAT_0_12,
845773ab 593 {
281a26b1
GH
594 .driver = "VGA",
595 .property = "rombar",
596 .value = stringify(0),
597 },{
598 .driver = "vmware-svga",
599 .property = "rombar",
600 .value = stringify(0),
1b89fafe 601 },
845773ab 602 { /* end of list */ }
93bfef4c
CV
603 },
604 .hw_version = "0.12",
845773ab
IY
605};
606
d6c73008
MT
607#define PC_COMPAT_0_11 \
608 PC_COMPAT_0_12,\
609 {\
610 .driver = "virtio-blk-pci",\
611 .property = "vectors",\
612 .value = stringify(0),\
c115cd65 613 },{\
bce54474 614 .driver = TYPE_PCI_DEVICE,\
c115cd65
PB
615 .property = "rombar",\
616 .value = stringify(0),\
d6c73008
MT
617 }
618
845773ab
IY
619static QEMUMachine pc_machine_v0_11 = {
620 .name = "pc-0.11",
621 .desc = "Standard PC, qemu 0.11",
0ec329da 622 .init = pc_init_pci_no_kvmclock,
845773ab
IY
623 .max_cpus = 255,
624 .compat_props = (GlobalProperty[]) {
d6c73008 625 PC_COMPAT_0_11,
845773ab 626 {
845773ab
IY
627 .driver = "ide-drive",
628 .property = "ver",
629 .value = "0.11",
630 },{
631 .driver = "scsi-disk",
632 .property = "ver",
633 .value = "0.11",
1b89fafe 634 },
845773ab 635 { /* end of list */ }
93bfef4c
CV
636 },
637 .hw_version = "0.11",
845773ab
IY
638};
639
640static QEMUMachine pc_machine_v0_10 = {
641 .name = "pc-0.10",
642 .desc = "Standard PC, qemu 0.10",
0ec329da 643 .init = pc_init_pci_no_kvmclock,
845773ab
IY
644 .max_cpus = 255,
645 .compat_props = (GlobalProperty[]) {
d6c73008 646 PC_COMPAT_0_11,
845773ab
IY
647 {
648 .driver = "virtio-blk-pci",
649 .property = "class",
650 .value = stringify(PCI_CLASS_STORAGE_OTHER),
651 },{
652 .driver = "virtio-serial-pci",
653 .property = "class",
654 .value = stringify(PCI_CLASS_DISPLAY_OTHER),
845773ab
IY
655 },{
656 .driver = "virtio-net-pci",
657 .property = "vectors",
658 .value = stringify(0),
845773ab
IY
659 },{
660 .driver = "ide-drive",
661 .property = "ver",
662 .value = "0.10",
663 },{
664 .driver = "scsi-disk",
665 .property = "ver",
666 .value = "0.10",
1b89fafe 667 },
845773ab
IY
668 { /* end of list */ }
669 },
93bfef4c 670 .hw_version = "0.10",
845773ab
IY
671};
672
673static QEMUMachine isapc_machine = {
674 .name = "isapc",
675 .desc = "ISA-only PC",
676 .init = pc_init_isa,
677 .max_cpus = 1,
1b89fafe
JJ
678 .compat_props = (GlobalProperty[]) {
679 {
680 .driver = "pc-sysfw",
681 .property = "rom_only",
682 .value = stringify(1),
683 },
684 { /* end of list */ }
685 },
845773ab
IY
686};
687
29d3ccde
AP
688#ifdef CONFIG_XEN
689static QEMUMachine xenfv_machine = {
690 .name = "xenfv",
691 .desc = "Xen Fully-virtualized PC",
692 .init = pc_xen_hvm_init,
693 .max_cpus = HVM_MAX_VCPUS,
694 .default_machine_opts = "accel=xen",
695};
696#endif
697
845773ab
IY
698static void pc_machine_init(void)
699{
f4306941 700 qemu_register_machine(&pc_machine_v1_3);
f1dacf1c 701 qemu_register_machine(&pc_machine_v1_2);
382b3a68 702 qemu_register_machine(&pc_machine_v1_1);
19857e62 703 qemu_register_machine(&pc_machine_v1_0);
ce01a508 704 qemu_register_machine(&pc_machine_v0_15);
19857e62 705 qemu_register_machine(&pc_machine_v0_14);
b903a0f7 706 qemu_register_machine(&pc_machine_v0_13);
845773ab
IY
707 qemu_register_machine(&pc_machine_v0_12);
708 qemu_register_machine(&pc_machine_v0_11);
709 qemu_register_machine(&pc_machine_v0_10);
710 qemu_register_machine(&isapc_machine);
29d3ccde
AP
711#ifdef CONFIG_XEN
712 qemu_register_machine(&xenfv_machine);
713#endif
845773ab
IY
714}
715
716machine_init(pc_machine_init);