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