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