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