]> git.proxmox.com Git - mirror_qemu.git/blame - hw/pc_piix.c
spice: raise requirement to 0.12
[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,
198 (sizeof(target_phys_addr_t) == 4
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
IY
269
270 if (pci_enabled && usb_enabled) {
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
290static void pc_init_pci(ram_addr_t ram_size,
291 const char *boot_device,
292 const char *kernel_filename,
293 const char *kernel_cmdline,
294 const char *initrd_filename,
295 const char *cpu_model)
296{
6bd10515 297 pc_init1(get_system_memory(),
aee97b84 298 get_system_io(),
6bd10515 299 ram_size, boot_device,
845773ab 300 kernel_filename, kernel_cmdline,
0ec329da
JK
301 initrd_filename, cpu_model, 1, 1);
302}
303
304static void pc_init_pci_no_kvmclock(ram_addr_t ram_size,
305 const char *boot_device,
306 const char *kernel_filename,
307 const char *kernel_cmdline,
308 const char *initrd_filename,
309 const char *cpu_model)
310{
6bd10515 311 pc_init1(get_system_memory(),
aee97b84 312 get_system_io(),
6bd10515 313 ram_size, boot_device,
0ec329da
JK
314 kernel_filename, kernel_cmdline,
315 initrd_filename, cpu_model, 1, 0);
845773ab
IY
316}
317
318static void pc_init_isa(ram_addr_t ram_size,
319 const char *boot_device,
320 const char *kernel_filename,
321 const char *kernel_cmdline,
322 const char *initrd_filename,
323 const char *cpu_model)
324{
325 if (cpu_model == NULL)
326 cpu_model = "486";
6bd10515 327 pc_init1(get_system_memory(),
aee97b84 328 get_system_io(),
6bd10515 329 ram_size, boot_device,
845773ab 330 kernel_filename, kernel_cmdline,
0ec329da 331 initrd_filename, cpu_model, 0, 1);
845773ab
IY
332}
333
29d3ccde
AP
334#ifdef CONFIG_XEN
335static void pc_xen_hvm_init(ram_addr_t ram_size,
336 const char *boot_device,
337 const char *kernel_filename,
338 const char *kernel_cmdline,
339 const char *initrd_filename,
340 const char *cpu_model)
341{
342 if (xen_hvm_init() != 0) {
343 hw_error("xen hardware virtual machine initialisation failed");
344 }
345 pc_init_pci_no_kvmclock(ram_size, boot_device,
346 kernel_filename, kernel_cmdline,
347 initrd_filename, cpu_model);
348 xen_vcpu_init();
349}
350#endif
351
f4306941
GH
352static QEMUMachine pc_machine_v1_3 = {
353 .name = "pc-1.3",
845773ab
IY
354 .alias = "pc",
355 .desc = "Standard PC",
356 .init = pc_init_pci,
357 .max_cpus = 255,
358 .is_default = 1,
359};
360
183c5eaa
GH
361#define PC_COMPAT_1_2 \
362 {\
363 .driver = "nec-usb-xhci",\
364 .property = "msi",\
365 .value = "off",\
366 },{\
367 .driver = "nec-usb-xhci",\
368 .property = "msix",\
369 .value = "off",\
c08ba66f
GH
370 },{\
371 .driver = "ivshmem",\
372 .property = "use64",\
373 .value = "0",\
183c5eaa
GH
374 }
375
f4306941
GH
376static QEMUMachine pc_machine_v1_2 = {
377 .name = "pc-1.2",
378 .desc = "Standard PC",
379 .init = pc_init_pci,
380 .max_cpus = 255,
183c5eaa
GH
381 .compat_props = (GlobalProperty[]) {
382 PC_COMPAT_1_2,
383 { /* end of list */ }
384 },
f4306941
GH
385};
386
9e56edcf 387#define PC_COMPAT_1_1 \
183c5eaa 388 PC_COMPAT_1_2,\
9e56edcf 389 {\
07a5298c
PB
390 .driver = "virtio-scsi-pci",\
391 .property = "hotplug",\
392 .value = "off",\
393 },{\
394 .driver = "virtio-scsi-pci",\
395 .property = "param_change",\
396 .value = "off",\
397 },{\
9e56edcf
GH
398 .driver = "VGA",\
399 .property = "vgamem_mb",\
400 .value = stringify(8),\
401 },{\
402 .driver = "vmware-svga",\
403 .property = "vgamem_mb",\
404 .value = stringify(8),\
405 },{\
406 .driver = "qxl-vga",\
407 .property = "vgamem_mb",\
408 .value = stringify(8),\
409 },{\
410 .driver = "qxl",\
411 .property = "vgamem_mb",\
412 .value = stringify(8),\
ea776abc
SH
413 },{\
414 .driver = "virtio-blk-pci",\
415 .property = "config-wce",\
416 .value = "off",\
9e56edcf
GH
417 }
418
f1dacf1c
GH
419static QEMUMachine pc_machine_v1_1 = {
420 .name = "pc-1.1",
421 .desc = "Standard PC",
422 .init = pc_init_pci,
423 .max_cpus = 255,
9e56edcf
GH
424 .compat_props = (GlobalProperty[]) {
425 PC_COMPAT_1_1,
426 { /* end of list */ }
427 },
f1dacf1c
GH
428};
429
d6c73008 430#define PC_COMPAT_1_0 \
9e56edcf 431 PC_COMPAT_1_1,\
d6c73008
MT
432 {\
433 .driver = "pc-sysfw",\
434 .property = "rom_only",\
435 .value = stringify(1),\
436 }, {\
437 .driver = "isa-fdc",\
438 .property = "check_media_rate",\
439 .value = "off",\
2ba1d381
DG
440 }, {\
441 .driver = "virtio-balloon-pci",\
442 .property = "class",\
443 .value = stringify(PCI_CLASS_MEMORY_RAM),\
fc34e77b
AL
444 },{\
445 .driver = "apic",\
446 .property = "vapic",\
447 .value = "off",\
eeb0cf9a 448 },{\
bce54474 449 .driver = TYPE_USB_DEVICE,\
eeb0cf9a
GH
450 .property = "full-path",\
451 .value = "no",\
d6c73008
MT
452 }
453
382b3a68
JJ
454static QEMUMachine pc_machine_v1_0 = {
455 .name = "pc-1.0",
456 .desc = "Standard PC",
457 .init = pc_init_pci,
458 .max_cpus = 255,
1b89fafe 459 .compat_props = (GlobalProperty[]) {
d6c73008 460 PC_COMPAT_1_0,
1b89fafe
JJ
461 { /* end of list */ }
462 },
93bfef4c 463 .hw_version = "1.0",
382b3a68
JJ
464};
465
d6c73008
MT
466#define PC_COMPAT_0_15 \
467 PC_COMPAT_1_0
468
ce01a508
AL
469static QEMUMachine pc_machine_v0_15 = {
470 .name = "pc-0.15",
471 .desc = "Standard PC",
472 .init = pc_init_pci,
473 .max_cpus = 255,
1b89fafe 474 .compat_props = (GlobalProperty[]) {
d6c73008 475 PC_COMPAT_0_15,
1b89fafe
JJ
476 { /* end of list */ }
477 },
93bfef4c 478 .hw_version = "0.15",
ce01a508
AL
479};
480
d6c73008
MT
481#define PC_COMPAT_0_14 \
482 PC_COMPAT_0_15,\
483 {\
484 .driver = "virtio-blk-pci",\
485 .property = "event_idx",\
486 .value = "off",\
487 },{\
488 .driver = "virtio-serial-pci",\
489 .property = "event_idx",\
490 .value = "off",\
491 },{\
492 .driver = "virtio-net-pci",\
493 .property = "event_idx",\
494 .value = "off",\
495 },{\
496 .driver = "virtio-balloon-pci",\
497 .property = "event_idx",\
498 .value = "off",\
499 }
500
19857e62
GH
501static QEMUMachine pc_machine_v0_14 = {
502 .name = "pc-0.14",
503 .desc = "Standard PC",
504 .init = pc_init_pci,
505 .max_cpus = 255,
3827cdb1 506 .compat_props = (GlobalProperty[]) {
d6c73008 507 PC_COMPAT_0_14,
3827cdb1
AL
508 {
509 .driver = "qxl",
510 .property = "revision",
511 .value = stringify(2),
512 },{
513 .driver = "qxl-vga",
514 .property = "revision",
515 .value = stringify(2),
1b89fafe 516 },
3827cdb1
AL
517 { /* end of list */ }
518 },
93bfef4c 519 .hw_version = "0.14",
19857e62
GH
520};
521
d6c73008
MT
522#define PC_COMPAT_0_13 \
523 PC_COMPAT_0_14,\
524 {\
bce54474 525 .driver = TYPE_PCI_DEVICE,\
d6c73008
MT
526 .property = "command_serr_enable",\
527 .value = "off",\
528 },{\
529 .driver = "AC97",\
530 .property = "use_broken_id",\
531 .value = stringify(1),\
532 }
533
b903a0f7
GH
534static QEMUMachine pc_machine_v0_13 = {
535 .name = "pc-0.13",
536 .desc = "Standard PC",
0ec329da 537 .init = pc_init_pci_no_kvmclock,
b903a0f7 538 .max_cpus = 255,
9dbcca5a 539 .compat_props = (GlobalProperty[]) {
d6c73008 540 PC_COMPAT_0_13,
9dbcca5a
GH
541 {
542 .driver = "virtio-9p-pci",
543 .property = "vectors",
544 .value = stringify(0),
281a26b1
GH
545 },{
546 .driver = "VGA",
547 .property = "rombar",
548 .value = stringify(0),
549 },{
550 .driver = "vmware-svga",
551 .property = "rombar",
552 .value = stringify(0),
1b89fafe 553 },
9dbcca5a
GH
554 { /* end of list */ }
555 },
93bfef4c 556 .hw_version = "0.13",
b903a0f7
GH
557};
558
d6c73008
MT
559#define PC_COMPAT_0_12 \
560 PC_COMPAT_0_13,\
561 {\
562 .driver = "virtio-serial-pci",\
563 .property = "max_ports",\
564 .value = stringify(1),\
565 },{\
566 .driver = "virtio-serial-pci",\
567 .property = "vectors",\
568 .value = stringify(0),\
569 }
570
845773ab
IY
571static QEMUMachine pc_machine_v0_12 = {
572 .name = "pc-0.12",
573 .desc = "Standard PC",
0ec329da 574 .init = pc_init_pci_no_kvmclock,
845773ab
IY
575 .max_cpus = 255,
576 .compat_props = (GlobalProperty[]) {
d6c73008 577 PC_COMPAT_0_12,
845773ab 578 {
281a26b1
GH
579 .driver = "VGA",
580 .property = "rombar",
581 .value = stringify(0),
582 },{
583 .driver = "vmware-svga",
584 .property = "rombar",
585 .value = stringify(0),
1b89fafe 586 },
845773ab 587 { /* end of list */ }
93bfef4c
CV
588 },
589 .hw_version = "0.12",
845773ab
IY
590};
591
d6c73008
MT
592#define PC_COMPAT_0_11 \
593 PC_COMPAT_0_12,\
594 {\
595 .driver = "virtio-blk-pci",\
596 .property = "vectors",\
597 .value = stringify(0),\
c115cd65 598 },{\
bce54474 599 .driver = TYPE_PCI_DEVICE,\
c115cd65
PB
600 .property = "rombar",\
601 .value = stringify(0),\
d6c73008
MT
602 }
603
845773ab
IY
604static QEMUMachine pc_machine_v0_11 = {
605 .name = "pc-0.11",
606 .desc = "Standard PC, qemu 0.11",
0ec329da 607 .init = pc_init_pci_no_kvmclock,
845773ab
IY
608 .max_cpus = 255,
609 .compat_props = (GlobalProperty[]) {
d6c73008 610 PC_COMPAT_0_11,
845773ab 611 {
845773ab
IY
612 .driver = "ide-drive",
613 .property = "ver",
614 .value = "0.11",
615 },{
616 .driver = "scsi-disk",
617 .property = "ver",
618 .value = "0.11",
1b89fafe 619 },
845773ab 620 { /* end of list */ }
93bfef4c
CV
621 },
622 .hw_version = "0.11",
845773ab
IY
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[]) {
d6c73008 631 PC_COMPAT_0_11,
845773ab
IY
632 {
633 .driver = "virtio-blk-pci",
634 .property = "class",
635 .value = stringify(PCI_CLASS_STORAGE_OTHER),
636 },{
637 .driver = "virtio-serial-pci",
638 .property = "class",
639 .value = stringify(PCI_CLASS_DISPLAY_OTHER),
845773ab
IY
640 },{
641 .driver = "virtio-net-pci",
642 .property = "vectors",
643 .value = stringify(0),
845773ab
IY
644 },{
645 .driver = "ide-drive",
646 .property = "ver",
647 .value = "0.10",
648 },{
649 .driver = "scsi-disk",
650 .property = "ver",
651 .value = "0.10",
1b89fafe 652 },
845773ab
IY
653 { /* end of list */ }
654 },
93bfef4c 655 .hw_version = "0.10",
845773ab
IY
656};
657
658static QEMUMachine isapc_machine = {
659 .name = "isapc",
660 .desc = "ISA-only PC",
661 .init = pc_init_isa,
662 .max_cpus = 1,
1b89fafe
JJ
663 .compat_props = (GlobalProperty[]) {
664 {
665 .driver = "pc-sysfw",
666 .property = "rom_only",
667 .value = stringify(1),
668 },
669 { /* end of list */ }
670 },
845773ab
IY
671};
672
29d3ccde
AP
673#ifdef CONFIG_XEN
674static QEMUMachine xenfv_machine = {
675 .name = "xenfv",
676 .desc = "Xen Fully-virtualized PC",
677 .init = pc_xen_hvm_init,
678 .max_cpus = HVM_MAX_VCPUS,
679 .default_machine_opts = "accel=xen",
680};
681#endif
682
845773ab
IY
683static void pc_machine_init(void)
684{
f4306941 685 qemu_register_machine(&pc_machine_v1_3);
f1dacf1c 686 qemu_register_machine(&pc_machine_v1_2);
382b3a68 687 qemu_register_machine(&pc_machine_v1_1);
19857e62 688 qemu_register_machine(&pc_machine_v1_0);
ce01a508 689 qemu_register_machine(&pc_machine_v0_15);
19857e62 690 qemu_register_machine(&pc_machine_v0_14);
b903a0f7 691 qemu_register_machine(&pc_machine_v0_13);
845773ab
IY
692 qemu_register_machine(&pc_machine_v0_12);
693 qemu_register_machine(&pc_machine_v0_11);
694 qemu_register_machine(&pc_machine_v0_10);
695 qemu_register_machine(&isapc_machine);
29d3ccde
AP
696#ifdef CONFIG_XEN
697 qemu_register_machine(&xenfv_machine);
698#endif
845773ab
IY
699}
700
701machine_init(pc_machine_init);