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