xref: /qemu/hw/i386/pc_piix.c (revision 494c271784a5e360523e874be9f67259932ea68c)
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 
25 #include <glib.h>
26 
27 #include "hw/hw.h"
28 #include "hw/loader.h"
29 #include "hw/i386/pc.h"
30 #include "hw/i386/apic.h"
31 #include "hw/i386/smbios.h"
32 #include "hw/pci/pci.h"
33 #include "hw/pci/pci_ids.h"
34 #include "hw/usb.h"
35 #include "net/net.h"
36 #include "hw/boards.h"
37 #include "hw/ide.h"
38 #include "sysemu/kvm.h"
39 #include "hw/kvm/clock.h"
40 #include "sysemu/sysemu.h"
41 #include "hw/sysbus.h"
42 #include "hw/cpu/icc_bus.h"
43 #include "sysemu/arch_init.h"
44 #include "sysemu/blockdev.h"
45 #include "hw/i2c/smbus.h"
46 #include "hw/xen/xen.h"
47 #include "exec/memory.h"
48 #include "exec/address-spaces.h"
49 #include "hw/acpi/acpi.h"
50 #include "cpu.h"
51 #ifdef CONFIG_XEN
52 #  include <xen/hvm/hvm_info_table.h>
53 #endif
54 
55 #define MAX_IDE_BUS 2
56 
57 static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
58 static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
59 static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
60 
61 static bool has_pci_info;
62 static bool has_acpi_build = true;
63 static bool smbios_type1_defaults = true;
64 
65 /* PC hardware initialisation */
66 static void pc_init1(QEMUMachineInitArgs *args,
67                      int pci_enabled,
68                      int kvmclock_enabled)
69 {
70     MemoryRegion *system_memory = get_system_memory();
71     MemoryRegion *system_io = get_system_io();
72     int i;
73     ram_addr_t below_4g_mem_size, above_4g_mem_size;
74     PCIBus *pci_bus;
75     ISABus *isa_bus;
76     PCII440FXState *i440fx_state;
77     int piix3_devfn = -1;
78     qemu_irq *cpu_irq;
79     qemu_irq *gsi;
80     qemu_irq *i8259;
81     qemu_irq *smi_irq;
82     GSIState *gsi_state;
83     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
84     BusState *idebus[MAX_IDE_BUS];
85     ISADevice *rtc_state;
86     ISADevice *floppy;
87     MemoryRegion *ram_memory;
88     MemoryRegion *pci_memory;
89     MemoryRegion *rom_memory;
90     DeviceState *icc_bridge;
91     FWCfgState *fw_cfg = NULL;
92     PcGuestInfo *guest_info;
93 
94     if (xen_enabled() && xen_hvm_init(&ram_memory) != 0) {
95         fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
96         exit(1);
97     }
98 
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 
103     pc_cpus_init(args->cpu_model, icc_bridge);
104 
105     if (kvm_enabled() && kvmclock_enabled) {
106         kvmclock_create();
107     }
108 
109     if (args->ram_size >= 0xe0000000) {
110         above_4g_mem_size = args->ram_size - 0xe0000000;
111         below_4g_mem_size = 0xe0000000;
112     } else {
113         above_4g_mem_size = 0;
114         below_4g_mem_size = args->ram_size;
115     }
116 
117     if (pci_enabled) {
118         pci_memory = g_new(MemoryRegion, 1);
119         memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
120         rom_memory = pci_memory;
121     } else {
122         pci_memory = NULL;
123         rom_memory = system_memory;
124     }
125 
126     guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
127 
128     guest_info->has_acpi_build = has_acpi_build;
129 
130     guest_info->has_pci_info = has_pci_info;
131     guest_info->isapc_ram_fw = !pci_enabled;
132 
133     if (smbios_type1_defaults) {
134         /* These values are guest ABI, do not change */
135         smbios_set_type1_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
136                                   args->machine->name);
137     }
138 
139     /* allocate ram and load rom/bios */
140     if (!xen_enabled()) {
141         fw_cfg = pc_memory_init(system_memory,
142                        args->kernel_filename, args->kernel_cmdline,
143                        args->initrd_filename,
144                        below_4g_mem_size, above_4g_mem_size,
145                        rom_memory, &ram_memory, guest_info);
146     }
147 
148     gsi_state = g_malloc0(sizeof(*gsi_state));
149     if (kvm_irqchip_in_kernel()) {
150         kvm_pc_setup_irq_routing(pci_enabled);
151         gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
152                                  GSI_NUM_PINS);
153     } else {
154         gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
155     }
156 
157     if (pci_enabled) {
158         pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
159                               system_memory, system_io, args->ram_size,
160                               above_4g_mem_size,
161                               pci_memory, ram_memory);
162     } else {
163         pci_bus = NULL;
164         i440fx_state = NULL;
165         isa_bus = isa_bus_new(NULL, system_io);
166         no_hpet = 1;
167     }
168     isa_bus_irqs(isa_bus, gsi);
169 
170     if (kvm_irqchip_in_kernel()) {
171         i8259 = kvm_i8259_init(isa_bus);
172     } else if (xen_enabled()) {
173         i8259 = xen_interrupt_controller_init();
174     } else {
175         cpu_irq = pc_allocate_cpu_irq();
176         i8259 = i8259_init(isa_bus, cpu_irq[0]);
177     }
178 
179     for (i = 0; i < ISA_NUM_IRQS; i++) {
180         gsi_state->i8259_irq[i] = i8259[i];
181     }
182     if (pci_enabled) {
183         ioapic_init_gsi(gsi_state, "i440fx");
184     }
185     qdev_init_nofail(icc_bridge);
186 
187     pc_register_ferr_irq(gsi[13]);
188 
189     pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
190 
191     /* init basic PC hardware */
192     pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled(),
193         0x4);
194 
195     pc_nic_init(isa_bus, pci_bus);
196 
197     ide_drive_get(hd, MAX_IDE_BUS);
198     if (pci_enabled) {
199         PCIDevice *dev;
200         if (xen_enabled()) {
201             dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
202         } else {
203             dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
204         }
205         idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
206         idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
207     } else {
208         for(i = 0; i < MAX_IDE_BUS; i++) {
209             ISADevice *dev;
210             dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
211                                ide_irq[i],
212                                hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
213             idebus[i] = qdev_get_child_bus(DEVICE(dev), "ide.0");
214         }
215     }
216 
217     pc_cmos_init(below_4g_mem_size, above_4g_mem_size, args->boot_order,
218                  floppy, idebus[0], idebus[1], rtc_state);
219 
220     if (pci_enabled && usb_enabled(false)) {
221         pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
222     }
223 
224     if (pci_enabled && acpi_enabled) {
225         i2c_bus *smbus;
226 
227         smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
228         /* TODO: Populate SPD eeprom data.  */
229         smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
230                               gsi[9], *smi_irq,
231                               kvm_enabled(), fw_cfg);
232         smbus_eeprom_init(smbus, 8, NULL, 0);
233     }
234 
235     if (pci_enabled) {
236         pc_pci_device_init(pci_bus);
237     }
238 }
239 
240 static void pc_init_pci(QEMUMachineInitArgs *args)
241 {
242     pc_init1(args, 1, 1);
243 }
244 
245 static void pc_compat_1_7(QEMUMachineInitArgs *args)
246 {
247     smbios_type1_defaults = false;
248 }
249 
250 static void pc_compat_1_6(QEMUMachineInitArgs *args)
251 {
252     pc_compat_1_7(args);
253     has_pci_info = false;
254     rom_file_in_ram = false;
255     has_acpi_build = false;
256 }
257 
258 static void pc_compat_1_5(QEMUMachineInitArgs *args)
259 {
260     pc_compat_1_6(args);
261 }
262 
263 static void pc_compat_1_4(QEMUMachineInitArgs *args)
264 {
265     pc_compat_1_5(args);
266     x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
267     x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
268 }
269 
270 static void pc_compat_1_3(QEMUMachineInitArgs *args)
271 {
272     pc_compat_1_4(args);
273     enable_compat_apic_id_mode();
274 }
275 
276 /* PC compat function for pc-0.14 to pc-1.2 */
277 static void pc_compat_1_2(QEMUMachineInitArgs *args)
278 {
279     pc_compat_1_3(args);
280     disable_kvm_pv_eoi();
281 }
282 
283 static void pc_init_pci_1_7(QEMUMachineInitArgs *args)
284 {
285     pc_compat_1_7(args);
286     pc_init_pci(args);
287 }
288 
289 static void pc_init_pci_1_6(QEMUMachineInitArgs *args)
290 {
291     pc_compat_1_6(args);
292     pc_init_pci(args);
293 }
294 
295 static void pc_init_pci_1_5(QEMUMachineInitArgs *args)
296 {
297     pc_compat_1_5(args);
298     pc_init_pci(args);
299 }
300 
301 static void pc_init_pci_1_4(QEMUMachineInitArgs *args)
302 {
303     pc_compat_1_4(args);
304     pc_init_pci(args);
305 }
306 
307 static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
308 {
309     pc_compat_1_3(args);
310     pc_init_pci(args);
311 }
312 
313 /* PC machine init function for pc-0.14 to pc-1.2 */
314 static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
315 {
316     pc_compat_1_2(args);
317     pc_init_pci(args);
318 }
319 
320 /* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
321 static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
322 {
323     has_pci_info = false;
324     has_acpi_build = false;
325     smbios_type1_defaults = false;
326     disable_kvm_pv_eoi();
327     enable_compat_apic_id_mode();
328     pc_init1(args, 1, 0);
329 }
330 
331 static void pc_init_isa(QEMUMachineInitArgs *args)
332 {
333     has_pci_info = false;
334     has_acpi_build = false;
335     smbios_type1_defaults = false;
336     if (!args->cpu_model) {
337         args->cpu_model = "486";
338     }
339     disable_kvm_pv_eoi();
340     enable_compat_apic_id_mode();
341     pc_init1(args, 0, 1);
342 }
343 
344 #ifdef CONFIG_XEN
345 static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
346 {
347     PCIBus *bus;
348 
349     pc_init_pci(args);
350 
351     bus = pci_find_primary_bus();
352     if (bus != NULL) {
353         pci_create_simple(bus, -1, "xen-platform");
354     }
355 }
356 #endif
357 
358 #define PC_I440FX_MACHINE_OPTIONS \
359     PC_DEFAULT_MACHINE_OPTIONS, \
360     .desc = "Standard PC (i440FX + PIIX, 1996)", \
361     .hot_add_cpu = pc_hot_add_cpu
362 
363 #define PC_I440FX_2_0_MACHINE_OPTIONS                           \
364     PC_I440FX_MACHINE_OPTIONS,                                  \
365     .default_machine_opts = "firmware=bios-256k.bin"
366 
367 static QEMUMachine pc_i440fx_machine_v2_0 = {
368     PC_I440FX_2_0_MACHINE_OPTIONS,
369     .name = "pc-i440fx-2.0",
370     .alias = "pc",
371     .init = pc_init_pci,
372     .is_default = 1,
373 };
374 
375 #define PC_I440FX_1_7_MACHINE_OPTIONS PC_I440FX_MACHINE_OPTIONS
376 
377 static QEMUMachine pc_i440fx_machine_v1_7 = {
378     PC_I440FX_1_7_MACHINE_OPTIONS,
379     .name = "pc-i440fx-1.7",
380     .init = pc_init_pci_1_7,
381 };
382 
383 #define PC_I440FX_1_6_MACHINE_OPTIONS PC_I440FX_MACHINE_OPTIONS
384 
385 static QEMUMachine pc_i440fx_machine_v1_6 = {
386     PC_I440FX_1_6_MACHINE_OPTIONS,
387     .name = "pc-i440fx-1.6",
388     .init = pc_init_pci_1_6,
389     .compat_props = (GlobalProperty[]) {
390         PC_COMPAT_1_6,
391         { /* end of list */ }
392     },
393 };
394 
395 static QEMUMachine pc_i440fx_machine_v1_5 = {
396     PC_I440FX_1_6_MACHINE_OPTIONS,
397     .name = "pc-i440fx-1.5",
398     .init = pc_init_pci_1_5,
399     .compat_props = (GlobalProperty[]) {
400         PC_COMPAT_1_5,
401         { /* end of list */ }
402     },
403 };
404 
405 #define PC_I440FX_1_4_MACHINE_OPTIONS \
406     PC_I440FX_1_6_MACHINE_OPTIONS, \
407     .hot_add_cpu = NULL
408 
409 static QEMUMachine pc_i440fx_machine_v1_4 = {
410     PC_I440FX_1_4_MACHINE_OPTIONS,
411     .name = "pc-i440fx-1.4",
412     .init = pc_init_pci_1_4,
413     .compat_props = (GlobalProperty[]) {
414         PC_COMPAT_1_4,
415         { /* end of list */ }
416     },
417 };
418 
419 #define PC_COMPAT_1_3 \
420 	PC_COMPAT_1_4, \
421         {\
422             .driver   = "usb-tablet",\
423             .property = "usb_version",\
424             .value    = stringify(1),\
425         },{\
426             .driver   = "virtio-net-pci",\
427             .property = "ctrl_mac_addr",\
428             .value    = "off",      \
429         },{ \
430             .driver   = "virtio-net-pci", \
431             .property = "mq", \
432             .value    = "off", \
433         }, {\
434             .driver   = "e1000",\
435             .property = "autonegotiation",\
436             .value    = "off",\
437         }
438 
439 static QEMUMachine pc_machine_v1_3 = {
440     PC_I440FX_1_4_MACHINE_OPTIONS,
441     .name = "pc-1.3",
442     .init = pc_init_pci_1_3,
443     .compat_props = (GlobalProperty[]) {
444         PC_COMPAT_1_3,
445         { /* end of list */ }
446     },
447 };
448 
449 #define PC_COMPAT_1_2 \
450         PC_COMPAT_1_3,\
451         {\
452             .driver   = "nec-usb-xhci",\
453             .property = "msi",\
454             .value    = "off",\
455         },{\
456             .driver   = "nec-usb-xhci",\
457             .property = "msix",\
458             .value    = "off",\
459         },{\
460             .driver   = "ivshmem",\
461             .property = "use64",\
462             .value    = "0",\
463         },{\
464             .driver   = "qxl",\
465             .property = "revision",\
466             .value    = stringify(3),\
467         },{\
468             .driver   = "qxl-vga",\
469             .property = "revision",\
470             .value    = stringify(3),\
471         },{\
472             .driver   = "VGA",\
473             .property = "mmio",\
474             .value    = "off",\
475         }
476 
477 #define PC_I440FX_1_2_MACHINE_OPTIONS \
478     PC_I440FX_1_4_MACHINE_OPTIONS, \
479     .init = pc_init_pci_1_2
480 
481 static QEMUMachine pc_machine_v1_2 = {
482     PC_I440FX_1_2_MACHINE_OPTIONS,
483     .name = "pc-1.2",
484     .compat_props = (GlobalProperty[]) {
485         PC_COMPAT_1_2,
486         { /* end of list */ }
487     },
488 };
489 
490 #define PC_COMPAT_1_1 \
491         PC_COMPAT_1_2,\
492         {\
493             .driver   = "virtio-scsi-pci",\
494             .property = "hotplug",\
495             .value    = "off",\
496         },{\
497             .driver   = "virtio-scsi-pci",\
498             .property = "param_change",\
499             .value    = "off",\
500         },{\
501             .driver   = "VGA",\
502             .property = "vgamem_mb",\
503             .value    = stringify(8),\
504         },{\
505             .driver   = "vmware-svga",\
506             .property = "vgamem_mb",\
507             .value    = stringify(8),\
508         },{\
509             .driver   = "qxl-vga",\
510             .property = "vgamem_mb",\
511             .value    = stringify(8),\
512         },{\
513             .driver   = "qxl",\
514             .property = "vgamem_mb",\
515             .value    = stringify(8),\
516         },{\
517             .driver   = "virtio-blk-pci",\
518             .property = "config-wce",\
519             .value    = "off",\
520         }
521 
522 static QEMUMachine pc_machine_v1_1 = {
523     PC_I440FX_1_2_MACHINE_OPTIONS,
524     .name = "pc-1.1",
525     .compat_props = (GlobalProperty[]) {
526         PC_COMPAT_1_1,
527         { /* end of list */ }
528     },
529 };
530 
531 #define PC_COMPAT_1_0 \
532         PC_COMPAT_1_1,\
533         {\
534             .driver   = TYPE_ISA_FDC,\
535             .property = "check_media_rate",\
536             .value    = "off",\
537         }, {\
538             .driver   = "virtio-balloon-pci",\
539             .property = "class",\
540             .value    = stringify(PCI_CLASS_MEMORY_RAM),\
541         },{\
542             .driver   = "apic",\
543             .property = "vapic",\
544             .value    = "off",\
545         },{\
546             .driver   = TYPE_USB_DEVICE,\
547             .property = "full-path",\
548             .value    = "no",\
549         }
550 
551 static QEMUMachine pc_machine_v1_0 = {
552     PC_I440FX_1_2_MACHINE_OPTIONS,
553     .name = "pc-1.0",
554     .compat_props = (GlobalProperty[]) {
555         PC_COMPAT_1_0,
556         { /* end of list */ }
557     },
558     .hw_version = "1.0",
559 };
560 
561 #define PC_COMPAT_0_15 \
562         PC_COMPAT_1_0
563 
564 static QEMUMachine pc_machine_v0_15 = {
565     PC_I440FX_1_2_MACHINE_OPTIONS,
566     .name = "pc-0.15",
567     .compat_props = (GlobalProperty[]) {
568         PC_COMPAT_0_15,
569         { /* end of list */ }
570     },
571     .hw_version = "0.15",
572 };
573 
574 #define PC_COMPAT_0_14 \
575         PC_COMPAT_0_15,\
576         {\
577             .driver   = "virtio-blk-pci",\
578             .property = "event_idx",\
579             .value    = "off",\
580         },{\
581             .driver   = "virtio-serial-pci",\
582             .property = "event_idx",\
583             .value    = "off",\
584         },{\
585             .driver   = "virtio-net-pci",\
586             .property = "event_idx",\
587             .value    = "off",\
588         },{\
589             .driver   = "virtio-balloon-pci",\
590             .property = "event_idx",\
591             .value    = "off",\
592         }
593 
594 static QEMUMachine pc_machine_v0_14 = {
595     PC_I440FX_1_2_MACHINE_OPTIONS,
596     .name = "pc-0.14",
597     .compat_props = (GlobalProperty[]) {
598         PC_COMPAT_0_14,
599         {
600             .driver   = "qxl",
601             .property = "revision",
602             .value    = stringify(2),
603         },{
604             .driver   = "qxl-vga",
605             .property = "revision",
606             .value    = stringify(2),
607         },
608         { /* end of list */ }
609     },
610     .hw_version = "0.14",
611 };
612 
613 #define PC_COMPAT_0_13 \
614         PC_COMPAT_0_14,\
615         {\
616             .driver   = TYPE_PCI_DEVICE,\
617             .property = "command_serr_enable",\
618             .value    = "off",\
619         },{\
620             .driver   = "AC97",\
621             .property = "use_broken_id",\
622             .value    = stringify(1),\
623         }
624 
625 #define PC_I440FX_0_13_MACHINE_OPTIONS \
626     PC_I440FX_1_2_MACHINE_OPTIONS, \
627     .init = pc_init_pci_no_kvmclock
628 
629 static QEMUMachine pc_machine_v0_13 = {
630     PC_I440FX_0_13_MACHINE_OPTIONS,
631     .name = "pc-0.13",
632     .compat_props = (GlobalProperty[]) {
633         PC_COMPAT_0_13,
634         {
635             .driver   = "virtio-9p-pci",
636             .property = "vectors",
637             .value    = stringify(0),
638         },{
639             .driver   = "VGA",
640             .property = "rombar",
641             .value    = stringify(0),
642         },{
643             .driver   = "vmware-svga",
644             .property = "rombar",
645             .value    = stringify(0),
646         },
647         { /* end of list */ }
648     },
649     .hw_version = "0.13",
650 };
651 
652 #define PC_COMPAT_0_12 \
653         PC_COMPAT_0_13,\
654         {\
655             .driver   = "virtio-serial-pci",\
656             .property = "max_ports",\
657             .value    = stringify(1),\
658         },{\
659             .driver   = "virtio-serial-pci",\
660             .property = "vectors",\
661             .value    = stringify(0),\
662         },{\
663             .driver   = "usb-mouse",\
664             .property = "serial",\
665             .value    = "1",\
666         },{\
667             .driver   = "usb-tablet",\
668             .property = "serial",\
669             .value    = "1",\
670         },{\
671             .driver   = "usb-kbd",\
672             .property = "serial",\
673             .value    = "1",\
674         }
675 
676 static QEMUMachine pc_machine_v0_12 = {
677     PC_I440FX_0_13_MACHINE_OPTIONS,
678     .name = "pc-0.12",
679     .compat_props = (GlobalProperty[]) {
680         PC_COMPAT_0_12,
681         {
682             .driver   = "VGA",
683             .property = "rombar",
684             .value    = stringify(0),
685         },{
686             .driver   = "vmware-svga",
687             .property = "rombar",
688             .value    = stringify(0),
689         },
690         { /* end of list */ }
691     },
692     .hw_version = "0.12",
693 };
694 
695 #define PC_COMPAT_0_11 \
696         PC_COMPAT_0_12,\
697         {\
698             .driver   = "virtio-blk-pci",\
699             .property = "vectors",\
700             .value    = stringify(0),\
701         },{\
702             .driver   = TYPE_PCI_DEVICE,\
703             .property = "rombar",\
704             .value    = stringify(0),\
705         }
706 
707 static QEMUMachine pc_machine_v0_11 = {
708     PC_I440FX_0_13_MACHINE_OPTIONS,
709     .name = "pc-0.11",
710     .compat_props = (GlobalProperty[]) {
711         PC_COMPAT_0_11,
712         {
713             .driver   = "ide-drive",
714             .property = "ver",
715             .value    = "0.11",
716         },{
717             .driver   = "scsi-disk",
718             .property = "ver",
719             .value    = "0.11",
720         },
721         { /* end of list */ }
722     },
723     .hw_version = "0.11",
724 };
725 
726 static QEMUMachine pc_machine_v0_10 = {
727     PC_I440FX_0_13_MACHINE_OPTIONS,
728     .name = "pc-0.10",
729     .compat_props = (GlobalProperty[]) {
730         PC_COMPAT_0_11,
731         {
732             .driver   = "virtio-blk-pci",
733             .property = "class",
734             .value    = stringify(PCI_CLASS_STORAGE_OTHER),
735         },{
736             .driver   = "virtio-serial-pci",
737             .property = "class",
738             .value    = stringify(PCI_CLASS_DISPLAY_OTHER),
739         },{
740             .driver   = "virtio-net-pci",
741             .property = "vectors",
742             .value    = stringify(0),
743         },{
744             .driver   = "ide-drive",
745             .property = "ver",
746             .value    = "0.10",
747         },{
748             .driver   = "scsi-disk",
749             .property = "ver",
750             .value    = "0.10",
751         },
752         { /* end of list */ }
753     },
754     .hw_version = "0.10",
755 };
756 
757 static QEMUMachine isapc_machine = {
758     PC_COMMON_MACHINE_OPTIONS,
759     .name = "isapc",
760     .desc = "ISA-only PC",
761     .init = pc_init_isa,
762     .max_cpus = 1,
763     .compat_props = (GlobalProperty[]) {
764         { /* end of list */ }
765     },
766 };
767 
768 #ifdef CONFIG_XEN
769 static QEMUMachine xenfv_machine = {
770     PC_COMMON_MACHINE_OPTIONS,
771     .name = "xenfv",
772     .desc = "Xen Fully-virtualized PC",
773     .init = pc_xen_hvm_init,
774     .max_cpus = HVM_MAX_VCPUS,
775     .default_machine_opts = "accel=xen",
776     .hot_add_cpu = pc_hot_add_cpu,
777 };
778 #endif
779 
780 static void pc_machine_init(void)
781 {
782     qemu_register_machine(&pc_i440fx_machine_v2_0);
783     qemu_register_machine(&pc_i440fx_machine_v1_7);
784     qemu_register_machine(&pc_i440fx_machine_v1_6);
785     qemu_register_machine(&pc_i440fx_machine_v1_5);
786     qemu_register_machine(&pc_i440fx_machine_v1_4);
787     qemu_register_machine(&pc_machine_v1_3);
788     qemu_register_machine(&pc_machine_v1_2);
789     qemu_register_machine(&pc_machine_v1_1);
790     qemu_register_machine(&pc_machine_v1_0);
791     qemu_register_machine(&pc_machine_v0_15);
792     qemu_register_machine(&pc_machine_v0_14);
793     qemu_register_machine(&pc_machine_v0_13);
794     qemu_register_machine(&pc_machine_v0_12);
795     qemu_register_machine(&pc_machine_v0_11);
796     qemu_register_machine(&pc_machine_v0_10);
797     qemu_register_machine(&isapc_machine);
798 #ifdef CONFIG_XEN
799     qemu_register_machine(&xenfv_machine);
800 #endif
801 }
802 
803 machine_init(pc_machine_init);
804