pc: Remove redundant arguments from xen_hvm_init()
[qemu/ar7.git] / hw / i386 / pc_piix.c
blob117f8dc4178e623a9937dbaaa2441479594a954f
1 /*
2 * QEMU PC System Emulator
4 * Copyright (c) 2003-2004 Fabrice Bellard
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:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
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.
25 #include <glib.h>
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/smbios/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/block-backend.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 #include "qemu/error-report.h"
52 #ifdef CONFIG_XEN
53 # include <xen/hvm/hvm_info_table.h>
54 #endif
55 #include "migration/migration.h"
57 #define MAX_IDE_BUS 2
59 static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
60 static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
61 static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
63 static bool pci_enabled = true;
64 static bool has_acpi_build = true;
65 static bool rsdp_in_ram = true;
66 static int legacy_acpi_table_size;
67 static bool smbios_defaults = true;
68 static bool smbios_legacy_mode;
69 static bool smbios_uuid_encoded = true;
70 /* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
71 * host addresses aligned at 1Gbyte boundaries. This way we can use 1GByte
72 * pages in the host.
74 static bool gigabyte_align = true;
75 static bool has_reserved_memory = true;
76 static bool kvmclock_enabled = true;
78 /* PC hardware initialisation */
79 static void pc_init1(MachineState *machine)
81 PCMachineState *pcms = PC_MACHINE(machine);
82 MemoryRegion *system_memory = get_system_memory();
83 MemoryRegion *system_io = get_system_io();
84 int i;
85 PCIBus *pci_bus;
86 ISABus *isa_bus;
87 PCII440FXState *i440fx_state;
88 int piix3_devfn = -1;
89 qemu_irq *gsi;
90 qemu_irq *i8259;
91 qemu_irq smi_irq;
92 GSIState *gsi_state;
93 DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
94 BusState *idebus[MAX_IDE_BUS];
95 ISADevice *rtc_state;
96 MemoryRegion *ram_memory;
97 MemoryRegion *pci_memory;
98 MemoryRegion *rom_memory;
99 DeviceState *icc_bridge;
100 PcGuestInfo *guest_info;
101 ram_addr_t lowmem;
103 /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
104 * If it doesn't, we need to split it in chunks below and above 4G.
105 * In any case, try to make sure that guest addresses aligned at
106 * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
107 * For old machine types, use whatever split we used historically to avoid
108 * breaking migration.
110 if (machine->ram_size >= 0xe0000000) {
111 lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;
112 } else {
113 lowmem = 0xe0000000;
116 /* Handle the machine opt max-ram-below-4g. It is basically doing
117 * min(qemu limit, user limit).
119 if (lowmem > pcms->max_ram_below_4g) {
120 lowmem = pcms->max_ram_below_4g;
121 if (machine->ram_size - lowmem > lowmem &&
122 lowmem & ((1ULL << 30) - 1)) {
123 error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64
124 ") not a multiple of 1G; possible bad performance.",
125 pcms->max_ram_below_4g);
129 if (machine->ram_size >= lowmem) {
130 pcms->above_4g_mem_size = machine->ram_size - lowmem;
131 pcms->below_4g_mem_size = lowmem;
132 } else {
133 pcms->above_4g_mem_size = 0;
134 pcms->below_4g_mem_size = machine->ram_size;
137 if (xen_enabled() && xen_hvm_init(pcms, &ram_memory) != 0) {
138 fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
139 exit(1);
142 icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
143 object_property_add_child(qdev_get_machine(), "icc-bridge",
144 OBJECT(icc_bridge), NULL);
146 pc_cpus_init(machine->cpu_model, icc_bridge);
148 if (kvm_enabled() && kvmclock_enabled) {
149 kvmclock_create();
152 if (pci_enabled) {
153 pci_memory = g_new(MemoryRegion, 1);
154 memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
155 rom_memory = pci_memory;
156 } else {
157 pci_memory = NULL;
158 rom_memory = system_memory;
161 guest_info = pc_guest_info_init(pcms);
163 guest_info->has_acpi_build = has_acpi_build;
164 guest_info->legacy_acpi_table_size = legacy_acpi_table_size;
166 guest_info->isapc_ram_fw = !pci_enabled;
167 guest_info->has_reserved_memory = has_reserved_memory;
168 guest_info->rsdp_in_ram = rsdp_in_ram;
170 if (smbios_defaults) {
171 MachineClass *mc = MACHINE_GET_CLASS(machine);
172 /* These values are guest ABI, do not change */
173 smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
174 mc->name, smbios_legacy_mode, smbios_uuid_encoded,
175 SMBIOS_ENTRY_POINT_21);
178 /* allocate ram and load rom/bios */
179 if (!xen_enabled()) {
180 pc_memory_init(pcms, system_memory,
181 rom_memory, &ram_memory, guest_info);
182 } else if (machine->kernel_filename != NULL) {
183 /* For xen HVM direct kernel boot, load linux here */
184 xen_load_linux(pcms, guest_info);
187 gsi_state = g_malloc0(sizeof(*gsi_state));
188 if (kvm_irqchip_in_kernel()) {
189 kvm_pc_setup_irq_routing(pci_enabled);
190 gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
191 GSI_NUM_PINS);
192 } else {
193 gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
196 if (pci_enabled) {
197 pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
198 system_memory, system_io, machine->ram_size,
199 pcms->below_4g_mem_size,
200 pcms->above_4g_mem_size,
201 pci_memory, ram_memory);
202 } else {
203 pci_bus = NULL;
204 i440fx_state = NULL;
205 isa_bus = isa_bus_new(NULL, get_system_memory(), system_io);
206 no_hpet = 1;
208 isa_bus_irqs(isa_bus, gsi);
210 if (kvm_irqchip_in_kernel()) {
211 i8259 = kvm_i8259_init(isa_bus);
212 } else if (xen_enabled()) {
213 i8259 = xen_interrupt_controller_init();
214 } else {
215 i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq());
218 for (i = 0; i < ISA_NUM_IRQS; i++) {
219 gsi_state->i8259_irq[i] = i8259[i];
221 g_free(i8259);
222 if (pci_enabled) {
223 ioapic_init_gsi(gsi_state, "i440fx");
225 qdev_init_nofail(icc_bridge);
227 pc_register_ferr_irq(gsi[13]);
229 pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
231 assert(pcms->vmport != ON_OFF_AUTO_MAX);
232 if (pcms->vmport == ON_OFF_AUTO_AUTO) {
233 pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;
236 /* init basic PC hardware */
237 pc_basic_device_init(isa_bus, gsi, &rtc_state, true,
238 (pcms->vmport != ON_OFF_AUTO_ON), 0x4);
240 pc_nic_init(isa_bus, pci_bus);
242 ide_drive_get(hd, ARRAY_SIZE(hd));
243 if (pci_enabled) {
244 PCIDevice *dev;
245 if (xen_enabled()) {
246 dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
247 } else {
248 dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
250 idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
251 idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
252 } else {
253 for(i = 0; i < MAX_IDE_BUS; i++) {
254 ISADevice *dev;
255 char busname[] = "ide.0";
256 dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
257 ide_irq[i],
258 hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
260 * The ide bus name is ide.0 for the first bus and ide.1 for the
261 * second one.
263 busname[4] = '0' + i;
264 idebus[i] = qdev_get_child_bus(DEVICE(dev), busname);
268 pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state);
270 if (pci_enabled && usb_enabled()) {
271 pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
274 if (pci_enabled && acpi_enabled) {
275 DeviceState *piix4_pm;
276 I2CBus *smbus;
278 smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0);
279 /* TODO: Populate SPD eeprom data. */
280 smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
281 gsi[9], smi_irq,
282 pc_machine_is_smm_enabled(pcms),
283 &piix4_pm);
284 smbus_eeprom_init(smbus, 8, NULL, 0);
286 object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
287 TYPE_HOTPLUG_HANDLER,
288 (Object **)&pcms->acpi_dev,
289 object_property_allow_set_link,
290 OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort);
291 object_property_set_link(OBJECT(machine), OBJECT(piix4_pm),
292 PC_MACHINE_ACPI_DEVICE_PROP, &error_abort);
295 if (pci_enabled) {
296 pc_pci_device_init(pci_bus);
300 static void pc_compat_2_3(MachineState *machine)
302 PCMachineState *pcms = PC_MACHINE(machine);
303 savevm_skip_section_footers();
304 if (kvm_enabled()) {
305 pcms->smm = ON_OFF_AUTO_OFF;
307 global_state_set_optional();
308 savevm_skip_configuration();
311 static void pc_compat_2_2(MachineState *machine)
313 pc_compat_2_3(machine);
314 rsdp_in_ram = false;
315 machine->suppress_vmdesc = true;
318 static void pc_compat_2_1(MachineState *machine)
320 PCMachineState *pcms = PC_MACHINE(machine);
322 pc_compat_2_2(machine);
323 smbios_uuid_encoded = false;
324 x86_cpu_compat_kvm_no_autodisable(FEAT_8000_0001_ECX, CPUID_EXT3_SVM);
325 pcms->enforce_aligned_dimm = false;
328 static void pc_compat_2_0(MachineState *machine)
330 pc_compat_2_1(machine);
331 /* This value depends on the actual DSDT and SSDT compiled into
332 * the source QEMU; unfortunately it depends on the binary and
333 * not on the machine type, so we cannot make pc-i440fx-1.7 work on
334 * both QEMU 1.7 and QEMU 2.0.
336 * Large variations cause migration to fail for more than one
337 * consecutive value of the "-smp" maxcpus option.
339 * For small variations of the kind caused by different iasl versions,
340 * the 4k rounding usually leaves slack. However, there could be still
341 * one or two values that break. For QEMU 1.7 and QEMU 2.0 the
342 * slack is only ~10 bytes before one "-smp maxcpus" value breaks!
344 * 6652 is valid for QEMU 2.0, the right value for pc-i440fx-1.7 on
345 * QEMU 1.7 it is 6414. For RHEL/CentOS 7.0 it is 6418.
347 legacy_acpi_table_size = 6652;
348 smbios_legacy_mode = true;
349 has_reserved_memory = false;
350 pc_set_legacy_acpi_data_size();
353 static void pc_compat_1_7(MachineState *machine)
355 pc_compat_2_0(machine);
356 smbios_defaults = false;
357 gigabyte_align = false;
358 option_rom_has_mr = true;
359 legacy_acpi_table_size = 6414;
360 x86_cpu_compat_kvm_no_autoenable(FEAT_1_ECX, CPUID_EXT_X2APIC);
363 static void pc_compat_1_6(MachineState *machine)
365 pc_compat_1_7(machine);
366 rom_file_has_mr = false;
367 has_acpi_build = false;
370 static void pc_compat_1_5(MachineState *machine)
372 pc_compat_1_6(machine);
375 static void pc_compat_1_4(MachineState *machine)
377 pc_compat_1_5(machine);
380 static void pc_compat_1_3(MachineState *machine)
382 pc_compat_1_4(machine);
383 enable_compat_apic_id_mode();
386 /* PC compat function for pc-0.14 to pc-1.2 */
387 static void pc_compat_1_2(MachineState *machine)
389 pc_compat_1_3(machine);
390 x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, 1 << KVM_FEATURE_PV_EOI);
393 /* PC compat function for pc-0.10 to pc-0.13 */
394 static void pc_compat_0_13(MachineState *machine)
396 pc_compat_1_2(machine);
397 kvmclock_enabled = false;
400 static void pc_init_isa(MachineState *machine)
402 pci_enabled = false;
403 has_acpi_build = false;
404 smbios_defaults = false;
405 gigabyte_align = false;
406 smbios_legacy_mode = true;
407 has_reserved_memory = false;
408 option_rom_has_mr = true;
409 rom_file_has_mr = false;
410 if (!machine->cpu_model) {
411 machine->cpu_model = "486";
413 x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, 1 << KVM_FEATURE_PV_EOI);
414 enable_compat_apic_id_mode();
415 pc_init1(machine);
418 #ifdef CONFIG_XEN
419 static void pc_xen_hvm_init(MachineState *machine)
421 PCIBus *bus;
423 pc_init1(machine);
425 bus = pci_find_primary_bus();
426 if (bus != NULL) {
427 pci_create_simple(bus, -1, "xen-platform");
430 #endif
432 #define DEFINE_I440FX_MACHINE(suffix, name, compatfn, optionfn) \
433 static void pc_init_##suffix(MachineState *machine) \
435 void (*compat)(MachineState *m) = (compatfn); \
436 if (compat) { \
437 compat(machine); \
439 pc_init1(machine); \
441 DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
443 static void pc_i440fx_machine_options(MachineClass *m)
445 m->family = "pc_piix";
446 m->desc = "Standard PC (i440FX + PIIX, 1996)";
447 m->hot_add_cpu = pc_hot_add_cpu;
450 static void pc_i440fx_2_4_machine_options(MachineClass *m)
452 pc_i440fx_machine_options(m);
453 m->default_machine_opts = "firmware=bios-256k.bin";
454 m->default_display = "std";
455 m->alias = "pc";
456 m->is_default = 1;
459 DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL,
460 pc_i440fx_2_4_machine_options)
463 static void pc_i440fx_2_3_machine_options(MachineClass *m)
465 pc_i440fx_2_4_machine_options(m);
466 m->alias = NULL;
467 m->is_default = 0;
468 SET_MACHINE_COMPAT(m, PC_COMPAT_2_3);
471 DEFINE_I440FX_MACHINE(v2_3, "pc-i440fx-2.3", pc_compat_2_3,
472 pc_i440fx_2_3_machine_options);
475 static void pc_i440fx_2_2_machine_options(MachineClass *m)
477 pc_i440fx_2_3_machine_options(m);
478 SET_MACHINE_COMPAT(m, PC_COMPAT_2_2);
481 DEFINE_I440FX_MACHINE(v2_2, "pc-i440fx-2.2", pc_compat_2_2,
482 pc_i440fx_2_2_machine_options);
485 static void pc_i440fx_2_1_machine_options(MachineClass *m)
487 pc_i440fx_2_2_machine_options(m);
488 m->default_display = NULL;
489 SET_MACHINE_COMPAT(m, PC_COMPAT_2_1);
492 DEFINE_I440FX_MACHINE(v2_1, "pc-i440fx-2.1", pc_compat_2_1,
493 pc_i440fx_2_1_machine_options);
497 static void pc_i440fx_2_0_machine_options(MachineClass *m)
499 pc_i440fx_2_1_machine_options(m);
500 SET_MACHINE_COMPAT(m, PC_COMPAT_2_0);
503 DEFINE_I440FX_MACHINE(v2_0, "pc-i440fx-2.0", pc_compat_2_0,
504 pc_i440fx_2_0_machine_options);
507 static void pc_i440fx_1_7_machine_options(MachineClass *m)
509 pc_i440fx_2_0_machine_options(m);
510 m->default_machine_opts = NULL;
511 SET_MACHINE_COMPAT(m, PC_COMPAT_1_7);
514 DEFINE_I440FX_MACHINE(v1_7, "pc-i440fx-1.7", pc_compat_1_7,
515 pc_i440fx_1_7_machine_options);
518 static void pc_i440fx_1_6_machine_options(MachineClass *m)
520 pc_i440fx_1_7_machine_options(m);
521 SET_MACHINE_COMPAT(m, PC_COMPAT_1_6);
524 DEFINE_I440FX_MACHINE(v1_6, "pc-i440fx-1.6", pc_compat_1_6,
525 pc_i440fx_1_6_machine_options);
528 static void pc_i440fx_1_5_machine_options(MachineClass *m)
530 pc_i440fx_1_6_machine_options(m);
531 SET_MACHINE_COMPAT(m, PC_COMPAT_1_5);
534 DEFINE_I440FX_MACHINE(v1_5, "pc-i440fx-1.5", pc_compat_1_5,
535 pc_i440fx_1_5_machine_options);
538 static void pc_i440fx_1_4_machine_options(MachineClass *m)
540 pc_i440fx_1_5_machine_options(m);
541 m->hot_add_cpu = NULL;
542 SET_MACHINE_COMPAT(m, PC_COMPAT_1_4);
545 DEFINE_I440FX_MACHINE(v1_4, "pc-i440fx-1.4", pc_compat_1_4,
546 pc_i440fx_1_4_machine_options);
549 #define PC_COMPAT_1_3 \
550 PC_COMPAT_1_4 \
552 .driver = "usb-tablet",\
553 .property = "usb_version",\
554 .value = stringify(1),\
555 },{\
556 .driver = "virtio-net-pci",\
557 .property = "ctrl_mac_addr",\
558 .value = "off", \
559 },{ \
560 .driver = "virtio-net-pci", \
561 .property = "mq", \
562 .value = "off", \
563 }, {\
564 .driver = "e1000",\
565 .property = "autonegotiation",\
566 .value = "off",\
570 static void pc_i440fx_1_3_machine_options(MachineClass *m)
572 pc_i440fx_1_4_machine_options(m);
573 SET_MACHINE_COMPAT(m, PC_COMPAT_1_3);
576 DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3,
577 pc_i440fx_1_3_machine_options);
580 #define PC_COMPAT_1_2 \
581 PC_COMPAT_1_3 \
583 .driver = "nec-usb-xhci",\
584 .property = "msi",\
585 .value = "off",\
586 },{\
587 .driver = "nec-usb-xhci",\
588 .property = "msix",\
589 .value = "off",\
590 },{\
591 .driver = "ivshmem",\
592 .property = "use64",\
593 .value = "0",\
594 },{\
595 .driver = "qxl",\
596 .property = "revision",\
597 .value = stringify(3),\
598 },{\
599 .driver = "qxl-vga",\
600 .property = "revision",\
601 .value = stringify(3),\
602 },{\
603 .driver = "VGA",\
604 .property = "mmio",\
605 .value = "off",\
608 static void pc_i440fx_1_2_machine_options(MachineClass *m)
610 pc_i440fx_1_3_machine_options(m);
611 SET_MACHINE_COMPAT(m, PC_COMPAT_1_2);
614 DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2,
615 pc_i440fx_1_2_machine_options);
618 #define PC_COMPAT_1_1 \
619 PC_COMPAT_1_2 \
621 .driver = "virtio-scsi-pci",\
622 .property = "hotplug",\
623 .value = "off",\
624 },{\
625 .driver = "virtio-scsi-pci",\
626 .property = "param_change",\
627 .value = "off",\
628 },{\
629 .driver = "VGA",\
630 .property = "vgamem_mb",\
631 .value = stringify(8),\
632 },{\
633 .driver = "vmware-svga",\
634 .property = "vgamem_mb",\
635 .value = stringify(8),\
636 },{\
637 .driver = "qxl-vga",\
638 .property = "vgamem_mb",\
639 .value = stringify(8),\
640 },{\
641 .driver = "qxl",\
642 .property = "vgamem_mb",\
643 .value = stringify(8),\
644 },{\
645 .driver = "virtio-blk-pci",\
646 .property = "config-wce",\
647 .value = "off",\
650 static void pc_i440fx_1_1_machine_options(MachineClass *m)
652 pc_i440fx_1_2_machine_options(m);
653 SET_MACHINE_COMPAT(m, PC_COMPAT_1_1);
656 DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2,
657 pc_i440fx_1_1_machine_options);
660 #define PC_COMPAT_1_0 \
661 PC_COMPAT_1_1 \
663 .driver = TYPE_ISA_FDC,\
664 .property = "check_media_rate",\
665 .value = "off",\
666 }, {\
667 .driver = "virtio-balloon-pci",\
668 .property = "class",\
669 .value = stringify(PCI_CLASS_MEMORY_RAM),\
670 },{\
671 .driver = "apic-common",\
672 .property = "vapic",\
673 .value = "off",\
674 },{\
675 .driver = TYPE_USB_DEVICE,\
676 .property = "full-path",\
677 .value = "no",\
680 static void pc_i440fx_1_0_machine_options(MachineClass *m)
682 pc_i440fx_1_1_machine_options(m);
683 m->hw_version = "1.0";
684 SET_MACHINE_COMPAT(m, PC_COMPAT_1_0);
687 DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2,
688 pc_i440fx_1_0_machine_options);
691 #define PC_COMPAT_0_15 \
692 PC_COMPAT_1_0
694 static void pc_i440fx_0_15_machine_options(MachineClass *m)
696 pc_i440fx_1_0_machine_options(m);
697 m->hw_version = "0.15";
698 SET_MACHINE_COMPAT(m, PC_COMPAT_0_15);
701 DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2,
702 pc_i440fx_0_15_machine_options);
705 #define PC_COMPAT_0_14 \
706 PC_COMPAT_0_15 \
708 .driver = "virtio-blk-pci",\
709 .property = "event_idx",\
710 .value = "off",\
711 },{\
712 .driver = "virtio-serial-pci",\
713 .property = "event_idx",\
714 .value = "off",\
715 },{\
716 .driver = "virtio-net-pci",\
717 .property = "event_idx",\
718 .value = "off",\
719 },{\
720 .driver = "virtio-balloon-pci",\
721 .property = "event_idx",\
722 .value = "off",\
723 },{\
724 .driver = "qxl",\
725 .property = "revision",\
726 .value = stringify(2),\
727 },{\
728 .driver = "qxl-vga",\
729 .property = "revision",\
730 .value = stringify(2),\
733 static void pc_i440fx_0_14_machine_options(MachineClass *m)
735 pc_i440fx_0_15_machine_options(m);
736 m->hw_version = "0.14";
737 SET_MACHINE_COMPAT(m, PC_COMPAT_0_14);
740 DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2,
741 pc_i440fx_0_14_machine_options);
744 #define PC_COMPAT_0_13 \
745 PC_COMPAT_0_14 \
747 .driver = TYPE_PCI_DEVICE,\
748 .property = "command_serr_enable",\
749 .value = "off",\
750 },{\
751 .driver = "AC97",\
752 .property = "use_broken_id",\
753 .value = stringify(1),\
754 },{\
755 .driver = "virtio-9p-pci",\
756 .property = "vectors",\
757 .value = stringify(0),\
758 },{\
759 .driver = "VGA",\
760 .property = "rombar",\
761 .value = stringify(0),\
762 },{\
763 .driver = "vmware-svga",\
764 .property = "rombar",\
765 .value = stringify(0),\
768 static void pc_i440fx_0_13_machine_options(MachineClass *m)
770 pc_i440fx_0_14_machine_options(m);
771 m->hw_version = "0.13";
772 SET_MACHINE_COMPAT(m, PC_COMPAT_0_13);
775 DEFINE_I440FX_MACHINE(v0_13, "pc-0.13", pc_compat_0_13,
776 pc_i440fx_0_13_machine_options);
779 #define PC_COMPAT_0_12 \
780 PC_COMPAT_0_13 \
782 .driver = "virtio-serial-pci",\
783 .property = "max_ports",\
784 .value = stringify(1),\
785 },{\
786 .driver = "virtio-serial-pci",\
787 .property = "vectors",\
788 .value = stringify(0),\
789 },{\
790 .driver = "usb-mouse",\
791 .property = "serial",\
792 .value = "1",\
793 },{\
794 .driver = "usb-tablet",\
795 .property = "serial",\
796 .value = "1",\
797 },{\
798 .driver = "usb-kbd",\
799 .property = "serial",\
800 .value = "1",\
803 static void pc_i440fx_0_12_machine_options(MachineClass *m)
805 pc_i440fx_0_13_machine_options(m);
806 m->hw_version = "0.12";
807 SET_MACHINE_COMPAT(m, PC_COMPAT_0_12);
810 DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13,
811 pc_i440fx_0_12_machine_options);
814 #define PC_COMPAT_0_11 \
815 PC_COMPAT_0_12 \
817 .driver = "virtio-blk-pci",\
818 .property = "vectors",\
819 .value = stringify(0),\
820 },{\
821 .driver = TYPE_PCI_DEVICE,\
822 .property = "rombar",\
823 .value = stringify(0),\
824 },{\
825 .driver = "ide-drive",\
826 .property = "ver",\
827 .value = "0.11",\
828 },{\
829 .driver = "scsi-disk",\
830 .property = "ver",\
831 .value = "0.11",\
834 static void pc_i440fx_0_11_machine_options(MachineClass *m)
836 pc_i440fx_0_12_machine_options(m);
837 m->hw_version = "0.11";
838 SET_MACHINE_COMPAT(m, PC_COMPAT_0_11);
841 DEFINE_I440FX_MACHINE(v0_11, "pc-0.11", pc_compat_0_13,
842 pc_i440fx_0_11_machine_options);
845 #define PC_COMPAT_0_10 \
846 PC_COMPAT_0_11 \
848 .driver = "virtio-blk-pci",\
849 .property = "class",\
850 .value = stringify(PCI_CLASS_STORAGE_OTHER),\
851 },{\
852 .driver = "virtio-serial-pci",\
853 .property = "class",\
854 .value = stringify(PCI_CLASS_DISPLAY_OTHER),\
855 },{\
856 .driver = "virtio-net-pci",\
857 .property = "vectors",\
858 .value = stringify(0),\
859 },{\
860 .driver = "ide-drive",\
861 .property = "ver",\
862 .value = "0.10",\
863 },{\
864 .driver = "scsi-disk",\
865 .property = "ver",\
866 .value = "0.10",\
869 static void pc_i440fx_0_10_machine_options(MachineClass *m)
871 pc_i440fx_0_11_machine_options(m);
872 m->hw_version = "0.10";
873 SET_MACHINE_COMPAT(m, PC_COMPAT_0_10);
876 DEFINE_I440FX_MACHINE(v0_10, "pc-0.10", pc_compat_0_13,
877 pc_i440fx_0_10_machine_options);
880 static void isapc_machine_options(MachineClass *m)
882 m->desc = "ISA-only PC";
883 m->max_cpus = 1;
886 DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa,
887 isapc_machine_options);
890 #ifdef CONFIG_XEN
891 static void xenfv_machine_options(MachineClass *m)
893 m->desc = "Xen Fully-virtualized PC";
894 m->max_cpus = HVM_MAX_VCPUS;
895 m->default_machine_opts = "accel=xen";
896 m->hot_add_cpu = pc_hot_add_cpu;
899 DEFINE_PC_MACHINE(xenfv, "xenfv", pc_xen_hvm_init,
900 xenfv_machine_options);
901 #endif