]> git.proxmox.com Git - mirror_qemu.git/blame - hw/i386/pc_piix.c
qom-test: Test qom-list on link<> properties
[mirror_qemu.git] / hw / i386 / pc_piix.c
CommitLineData
845773ab
IY
1/*
2 * QEMU PC System Emulator
3 *
4 * Copyright (c) 2003-2004 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
ae0a5466
AK
25#include <glib.h>
26
83c9f4ca 27#include "hw/hw.h"
04920fc0 28#include "hw/loader.h"
0d09e41a
PB
29#include "hw/i386/pc.h"
30#include "hw/i386/apic.h"
b29ad07e 31#include "hw/i386/smbios.h"
83c9f4ca
PB
32#include "hw/pci/pci.h"
33#include "hw/pci/pci_ids.h"
34#include "hw/usb.h"
1422e32d 35#include "net/net.h"
83c9f4ca
PB
36#include "hw/boards.h"
37#include "hw/ide.h"
9c17d615 38#include "sysemu/kvm.h"
83c9f4ca 39#include "hw/kvm/clock.h"
9c17d615 40#include "sysemu/sysemu.h"
83c9f4ca 41#include "hw/sysbus.h"
f0513d2c 42#include "hw/cpu/icc_bus.h"
9c17d615
PB
43#include "sysemu/arch_init.h"
44#include "sysemu/blockdev.h"
0d09e41a
PB
45#include "hw/i2c/smbus.h"
46#include "hw/xen/xen.h"
022c62cb
PB
47#include "exec/memory.h"
48#include "exec/address-spaces.h"
0445259b 49#include "hw/acpi/acpi.h"
dc59944b 50#include "cpu.h"
29d3ccde
AP
51#ifdef CONFIG_XEN
52# include <xen/hvm/hvm_info_table.h>
53#endif
845773ab
IY
54
55#define MAX_IDE_BUS 2
56
57static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
58static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
59static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
60
7f1bb742 61static bool has_pci_info;
72c194f7 62static bool has_acpi_build = true;
e6667f71 63static bool smbios_defaults = true;
c97294ec 64static bool smbios_legacy_mode;
ecdbfceb
MT
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 */
bb43d383 69static bool gigabyte_align = true;
3ab135f3 70
845773ab 71/* PC hardware initialisation */
5650f5f4 72static void pc_init1(QEMUMachineInitArgs *args,
0ec329da
JK
73 int pci_enabled,
74 int kvmclock_enabled)
845773ab 75{
1e099556
EH
76 MemoryRegion *system_memory = get_system_memory();
77 MemoryRegion *system_io = get_system_io();
845773ab
IY
78 int i;
79 ram_addr_t below_4g_mem_size, above_4g_mem_size;
80 PCIBus *pci_bus;
48a18b3c 81 ISABus *isa_bus;
845773ab
IY
82 PCII440FXState *i440fx_state;
83 int piix3_devfn = -1;
84 qemu_irq *cpu_irq;
b881fbe9 85 qemu_irq *gsi;
845773ab 86 qemu_irq *i8259;
845773ab 87 qemu_irq *smi_irq;
b881fbe9 88 GSIState *gsi_state;
845773ab 89 DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
c0897e0c 90 BusState *idebus[MAX_IDE_BUS];
1d914fa0 91 ISADevice *rtc_state;
34d4260e 92 ISADevice *floppy;
ae0a5466
AK
93 MemoryRegion *ram_memory;
94 MemoryRegion *pci_memory;
4463aee6 95 MemoryRegion *rom_memory;
f0513d2c 96 DeviceState *icc_bridge;
a88b362c 97 FWCfgState *fw_cfg = NULL;
3459a625 98 PcGuestInfo *guest_info;
845773ab 99
04d7bad8 100 if (xen_enabled() && xen_hvm_init(&ram_memory) != 0) {
a97d6fe6
PD
101 fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
102 exit(1);
103 }
104
f0513d2c
IM
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
5650f5f4 109 pc_cpus_init(args->cpu_model, icc_bridge);
845773ab 110
9cdf79d0 111 if (kvm_enabled() && kvmclock_enabled) {
0ec329da
JK
112 kvmclock_create();
113 }
114
ecdbfceb
MT
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 */
5650f5f4 122 if (args->ram_size >= 0xe0000000) {
bb43d383
GH
123 ram_addr_t lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;
124 above_4g_mem_size = args->ram_size - lowmem;
125 below_4g_mem_size = lowmem;
e0e7e67b
AP
126 } else {
127 above_4g_mem_size = 0;
5650f5f4 128 below_4g_mem_size = args->ram_size;
e0e7e67b
AP
129 }
130
4463aee6
JK
131 if (pci_enabled) {
132 pci_memory = g_new(MemoryRegion, 1);
286690e3 133 memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
4463aee6
JK
134 rom_memory = pci_memory;
135 } else {
136 pci_memory = NULL;
137 rom_memory = system_memory;
138 }
ae0a5466 139
3459a625 140 guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
72c194f7
MT
141
142 guest_info->has_acpi_build = has_acpi_build;
143
f8c457b8 144 guest_info->has_pci_info = has_pci_info;
6dd2a5c9 145 guest_info->isapc_ram_fw = !pci_enabled;
3459a625 146
e6667f71 147 if (smbios_defaults) {
b29ad07e 148 /* These values are guest ABI, do not change */
e6667f71 149 smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
c97294ec 150 args->machine->name, smbios_legacy_mode);
b29ad07e
MA
151 }
152
845773ab 153 /* allocate ram and load rom/bios */
29d3ccde 154 if (!xen_enabled()) {
459ae5ea 155 fw_cfg = pc_memory_init(system_memory,
5650f5f4
MA
156 args->kernel_filename, args->kernel_cmdline,
157 args->initrd_filename,
ae0a5466 158 below_4g_mem_size, above_4g_mem_size,
3459a625 159 rom_memory, &ram_memory, guest_info);
29d3ccde 160 }
845773ab 161
b881fbe9 162 gsi_state = g_malloc0(sizeof(*gsi_state));
3d4b2649 163 if (kvm_irqchip_in_kernel()) {
d8ee0384
JB
164 kvm_pc_setup_irq_routing(pci_enabled);
165 gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
10b61882
JK
166 GSI_NUM_PINS);
167 } else {
168 gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
169 }
845773ab
IY
170
171 if (pci_enabled) {
60573079 172 pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi,
5650f5f4 173 system_memory, system_io, args->ram_size,
ddaaefb4 174 below_4g_mem_size,
39848901 175 above_4g_mem_size,
ae0a5466 176 pci_memory, ram_memory);
845773ab
IY
177 } else {
178 pci_bus = NULL;
02a89b21 179 i440fx_state = NULL;
48a18b3c 180 isa_bus = isa_bus_new(NULL, system_io);
57285cc3 181 no_hpet = 1;
845773ab 182 }
48a18b3c 183 isa_bus_irqs(isa_bus, gsi);
845773ab 184
3d4b2649 185 if (kvm_irqchip_in_kernel()) {
10b61882
JK
186 i8259 = kvm_i8259_init(isa_bus);
187 } else if (xen_enabled()) {
188 i8259 = xen_interrupt_controller_init();
189 } else {
4bae1efe 190 cpu_irq = pc_allocate_cpu_irq();
48a18b3c 191 i8259 = i8259_init(isa_bus, cpu_irq[0]);
4bae1efe
RH
192 }
193
43a0db35
JK
194 for (i = 0; i < ISA_NUM_IRQS; i++) {
195 gsi_state->i8259_irq[i] = i8259[i];
196 }
4bae1efe 197 if (pci_enabled) {
a39e3564 198 ioapic_init_gsi(gsi_state, "i440fx");
4bae1efe 199 }
f0513d2c 200 qdev_init_nofail(icc_bridge);
4bae1efe 201
b881fbe9 202 pc_register_ferr_irq(gsi[13]);
845773ab 203
f424d5c4 204 pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
01195b73 205
845773ab 206 /* init basic PC hardware */
7a10ef51
LPF
207 pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled(),
208 0x4);
845773ab 209
9011a1a7 210 pc_nic_init(isa_bus, pci_bus);
845773ab 211
75717903 212 ide_drive_get(hd, MAX_IDE_BUS);
845773ab 213 if (pci_enabled) {
c0897e0c 214 PCIDevice *dev;
679f4f8b
SS
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 }
c0897e0c
MA
220 idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
221 idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
845773ab
IY
222 } else {
223 for(i = 0; i < MAX_IDE_BUS; i++) {
c0897e0c 224 ISADevice *dev;
61de3676 225 char busname[] = "ide.0";
48a18b3c
HP
226 dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
227 ide_irq[i],
c0897e0c 228 hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
61de3676
AG
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);
845773ab
IY
235 }
236 }
237
c1654732 238 pc_cmos_init(below_4g_mem_size, above_4g_mem_size, args->boot_order,
34d4260e 239 floppy, idebus[0], idebus[1], rtc_state);
845773ab 240
094b287f 241 if (pci_enabled && usb_enabled(false)) {
afb9a60e 242 pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
845773ab
IY
243 }
244
245 if (pci_enabled && acpi_enabled) {
a5c82852 246 I2CBus *smbus;
845773ab 247
182735ef 248 smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
845773ab
IY
249 /* TODO: Populate SPD eeprom data. */
250 smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
da98c8eb 251 gsi[9], *smi_irq,
459ae5ea 252 kvm_enabled(), fw_cfg);
a88df0b9 253 smbus_eeprom_init(smbus, 8, NULL, 0);
845773ab
IY
254 }
255
845773ab
IY
256 if (pci_enabled) {
257 pc_pci_device_init(pci_bus);
258 }
259}
260
5f072e1f 261static void pc_init_pci(QEMUMachineInitArgs *args)
845773ab 262{
1e099556 263 pc_init1(args, 1, 1);
0ec329da
JK
264}
265
3458b2b0
MT
266static void pc_compat_2_0(QEMUMachineInitArgs *args)
267{
c97294ec 268 smbios_legacy_mode = true;
3458b2b0
MT
269}
270
b29ad07e
MA
271static void pc_compat_1_7(QEMUMachineInitArgs *args)
272{
3458b2b0 273 pc_compat_2_0(args);
e6667f71 274 smbios_defaults = false;
bb43d383 275 gigabyte_align = false;
ac41881b 276 option_rom_has_mr = true;
ef02ef5f 277 x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
b29ad07e
MA
278}
279
89b439f3 280static void pc_compat_1_6(QEMUMachineInitArgs *args)
f8c457b8 281{
b29ad07e 282 pc_compat_1_7(args);
f8c457b8 283 has_pci_info = false;
98bc3ab0 284 rom_file_has_mr = false;
72c194f7 285 has_acpi_build = false;
f8c457b8
MT
286}
287
89b439f3 288static void pc_compat_1_5(QEMUMachineInitArgs *args)
9604f70f 289{
89b439f3 290 pc_compat_1_6(args);
9604f70f
MT
291}
292
89b439f3 293static void pc_compat_1_4(QEMUMachineInitArgs *args)
9953f882 294{
396f79f4 295 pc_compat_1_5(args);
4458c236 296 x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
56383703 297 x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
9953f882
MA
298}
299
89b439f3 300static void pc_compat_1_3(QEMUMachineInitArgs *args)
8932cfdf 301{
89b439f3 302 pc_compat_1_4(args);
8932cfdf 303 enable_compat_apic_id_mode();
89b439f3
EH
304}
305
306/* PC compat function for pc-0.14 to pc-1.2 */
307static void pc_compat_1_2(QEMUMachineInitArgs *args)
308{
309 pc_compat_1_3(args);
8fb4f821 310 x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
89b439f3
EH
311}
312
3458b2b0
MT
313static void pc_init_pci_2_0(QEMUMachineInitArgs *args)
314{
315 pc_compat_2_0(args);
316 pc_init_pci(args);
317}
318
b29ad07e
MA
319static void pc_init_pci_1_7(QEMUMachineInitArgs *args)
320{
321 pc_compat_1_7(args);
322 pc_init_pci(args);
323}
324
89b439f3
EH
325static void pc_init_pci_1_6(QEMUMachineInitArgs *args)
326{
327 pc_compat_1_6(args);
328 pc_init_pci(args);
329}
330
331static void pc_init_pci_1_5(QEMUMachineInitArgs *args)
332{
333 pc_compat_1_5(args);
334 pc_init_pci(args);
335}
336
337static void pc_init_pci_1_4(QEMUMachineInitArgs *args)
338{
339 pc_compat_1_4(args);
340 pc_init_pci(args);
341}
342
343static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
344{
345 pc_compat_1_3(args);
346 pc_init_pci(args);
8932cfdf
EH
347}
348
43a52ce6 349/* PC machine init function for pc-0.14 to pc-1.2 */
29694758 350static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
dc59944b 351{
89b439f3
EH
352 pc_compat_1_2(args);
353 pc_init_pci(args);
dc59944b
MT
354}
355
29694758 356/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
5f072e1f 357static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
0ec329da 358{
f8c457b8 359 has_pci_info = false;
98af2ac9 360 has_acpi_build = false;
e6667f71 361 smbios_defaults = false;
8fb4f821 362 x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
8932cfdf 363 enable_compat_apic_id_mode();
1e099556 364 pc_init1(args, 1, 0);
845773ab
IY
365}
366
5f072e1f 367static void pc_init_isa(QEMUMachineInitArgs *args)
845773ab 368{
f8c457b8 369 has_pci_info = false;
98af2ac9 370 has_acpi_build = false;
e6667f71 371 smbios_defaults = false;
5650f5f4
MA
372 if (!args->cpu_model) {
373 args->cpu_model = "486";
374 }
8fb4f821 375 x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
8932cfdf 376 enable_compat_apic_id_mode();
1e099556 377 pc_init1(args, 0, 1);
845773ab
IY
378}
379
29d3ccde 380#ifdef CONFIG_XEN
5f072e1f 381static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
29d3ccde 382{
39ae4972
PD
383 PCIBus *bus;
384
9cdf79d0 385 pc_init_pci(args);
39ae4972 386
1ef7a2a2 387 bus = pci_find_primary_bus();
39ae4972
PD
388 if (bus != NULL) {
389 pci_create_simple(bus, -1, "xen-platform");
390 }
29d3ccde
AP
391}
392#endif
393
a0dba644
MT
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
3458b2b0 399#define PC_I440FX_2_1_MACHINE_OPTIONS \
bcf2b7d2
GH
400 PC_I440FX_MACHINE_OPTIONS, \
401 .default_machine_opts = "firmware=bios-256k.bin"
aeca6e8d 402
3458b2b0
MT
403static QEMUMachine pc_i440fx_machine_v2_1 = {
404 PC_I440FX_2_1_MACHINE_OPTIONS,
405 .name = "pc-i440fx-2.1",
aeca6e8d
GH
406 .alias = "pc",
407 .init = pc_init_pci,
408 .is_default = 1,
409};
410
3458b2b0
MT
411#define PC_I440FX_2_0_MACHINE_OPTIONS PC_I440FX_2_1_MACHINE_OPTIONS
412
413static 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,
9df11c9f
GS
417 .compat_props = (GlobalProperty[]) {
418 PC_COMPAT_2_0,
419 { /* end of list */ }
420 },
3458b2b0
MT
421};
422
e9845f09 423#define PC_I440FX_1_7_MACHINE_OPTIONS PC_I440FX_MACHINE_OPTIONS
aeca6e8d 424
e9845f09
VM
425static QEMUMachine pc_i440fx_machine_v1_7 = {
426 PC_I440FX_1_7_MACHINE_OPTIONS,
427 .name = "pc-i440fx-1.7",
b29ad07e 428 .init = pc_init_pci_1_7,
5319dc7b
GH
429 .compat_props = (GlobalProperty[]) {
430 PC_COMPAT_1_7,
431 { /* end of list */ }
432 },
e9845f09
VM
433};
434
a0dba644
MT
435#define PC_I440FX_1_6_MACHINE_OPTIONS PC_I440FX_MACHINE_OPTIONS
436
45053fde 437static QEMUMachine pc_i440fx_machine_v1_6 = {
a0dba644 438 PC_I440FX_1_6_MACHINE_OPTIONS,
45053fde 439 .name = "pc-i440fx-1.6",
9604f70f 440 .init = pc_init_pci_1_6,
e9845f09
VM
441 .compat_props = (GlobalProperty[]) {
442 PC_COMPAT_1_6,
443 { /* end of list */ }
444 },
845773ab
IY
445};
446
45053fde 447static QEMUMachine pc_i440fx_machine_v1_5 = {
a0dba644 448 PC_I440FX_1_6_MACHINE_OPTIONS,
45053fde 449 .name = "pc-i440fx-1.5",
f8c457b8 450 .init = pc_init_pci_1_5,
ffce9ebb
EH
451 .compat_props = (GlobalProperty[]) {
452 PC_COMPAT_1_5,
453 { /* end of list */ }
454 },
45053fde
EH
455};
456
a0dba644
MT
457#define PC_I440FX_1_4_MACHINE_OPTIONS \
458 PC_I440FX_1_6_MACHINE_OPTIONS, \
459 .hot_add_cpu = NULL
460
bf3caa3d 461static QEMUMachine pc_i440fx_machine_v1_4 = {
a0dba644 462 PC_I440FX_1_4_MACHINE_OPTIONS,
bf3caa3d 463 .name = "pc-i440fx-1.4",
9953f882 464 .init = pc_init_pci_1_4,
bf3caa3d
PB
465 .compat_props = (GlobalProperty[]) {
466 PC_COMPAT_1_4,
467 { /* end of list */ }
468 },
bf3caa3d
PB
469};
470
427e3aa1 471#define PC_COMPAT_1_3 \
bf3caa3d 472 PC_COMPAT_1_4, \
427e3aa1
HG
473 {\
474 .driver = "usb-tablet",\
475 .property = "usb_version",\
476 .value = stringify(1),\
c1943a3f
AK
477 },{\
478 .driver = "virtio-net-pci",\
479 .property = "ctrl_mac_addr",\
480 .value = "off", \
a9c87c58
JW
481 },{ \
482 .driver = "virtio-net-pci", \
483 .property = "mq", \
484 .value = "off", \
2af234e6
MT
485 }, {\
486 .driver = "e1000",\
487 .property = "autonegotiation",\
488 .value = "off",\
427e3aa1
HG
489 }
490
f1ae2e38 491static QEMUMachine pc_machine_v1_3 = {
a0dba644 492 PC_I440FX_1_4_MACHINE_OPTIONS,
f1ae2e38 493 .name = "pc-1.3",
8932cfdf 494 .init = pc_init_pci_1_3,
f1ae2e38 495 .compat_props = (GlobalProperty[]) {
427e3aa1 496 PC_COMPAT_1_3,
f1ae2e38
GH
497 { /* end of list */ }
498 },
499};
500
183c5eaa 501#define PC_COMPAT_1_2 \
427e3aa1 502 PC_COMPAT_1_3,\
183c5eaa
GH
503 {\
504 .driver = "nec-usb-xhci",\
505 .property = "msi",\
506 .value = "off",\
507 },{\
508 .driver = "nec-usb-xhci",\
509 .property = "msix",\
510 .value = "off",\
c08ba66f
GH
511 },{\
512 .driver = "ivshmem",\
513 .property = "use64",\
514 .value = "0",\
591af143
GH
515 },{\
516 .driver = "qxl",\
517 .property = "revision",\
518 .value = stringify(3),\
519 },{\
520 .driver = "qxl-vga",\
521 .property = "revision",\
522 .value = stringify(3),\
803ff052
GH
523 },{\
524 .driver = "VGA",\
525 .property = "mmio",\
526 .value = "off",\
183c5eaa
GH
527 }
528
a0dba644
MT
529#define PC_I440FX_1_2_MACHINE_OPTIONS \
530 PC_I440FX_1_4_MACHINE_OPTIONS, \
531 .init = pc_init_pci_1_2
532
f4306941 533static QEMUMachine pc_machine_v1_2 = {
a0dba644 534 PC_I440FX_1_2_MACHINE_OPTIONS,
f4306941 535 .name = "pc-1.2",
183c5eaa
GH
536 .compat_props = (GlobalProperty[]) {
537 PC_COMPAT_1_2,
538 { /* end of list */ }
539 },
f4306941
GH
540};
541
9e56edcf 542#define PC_COMPAT_1_1 \
183c5eaa 543 PC_COMPAT_1_2,\
9e56edcf 544 {\
07a5298c
PB
545 .driver = "virtio-scsi-pci",\
546 .property = "hotplug",\
547 .value = "off",\
548 },{\
549 .driver = "virtio-scsi-pci",\
550 .property = "param_change",\
551 .value = "off",\
552 },{\
9e56edcf
GH
553 .driver = "VGA",\
554 .property = "vgamem_mb",\
555 .value = stringify(8),\
556 },{\
557 .driver = "vmware-svga",\
558 .property = "vgamem_mb",\
559 .value = stringify(8),\
560 },{\
561 .driver = "qxl-vga",\
562 .property = "vgamem_mb",\
563 .value = stringify(8),\
564 },{\
565 .driver = "qxl",\
566 .property = "vgamem_mb",\
567 .value = stringify(8),\
ea776abc
SH
568 },{\
569 .driver = "virtio-blk-pci",\
570 .property = "config-wce",\
571 .value = "off",\
9e56edcf
GH
572 }
573
f1dacf1c 574static QEMUMachine pc_machine_v1_1 = {
a0dba644 575 PC_I440FX_1_2_MACHINE_OPTIONS,
f1dacf1c 576 .name = "pc-1.1",
9e56edcf
GH
577 .compat_props = (GlobalProperty[]) {
578 PC_COMPAT_1_1,
579 { /* end of list */ }
580 },
f1dacf1c
GH
581};
582
d6c73008 583#define PC_COMPAT_1_0 \
9e56edcf 584 PC_COMPAT_1_1,\
d6c73008 585 {\
020c8e76 586 .driver = TYPE_ISA_FDC,\
d6c73008
MT
587 .property = "check_media_rate",\
588 .value = "off",\
2ba1d381
DG
589 }, {\
590 .driver = "virtio-balloon-pci",\
591 .property = "class",\
592 .value = stringify(PCI_CLASS_MEMORY_RAM),\
fc34e77b
AL
593 },{\
594 .driver = "apic",\
595 .property = "vapic",\
596 .value = "off",\
eeb0cf9a 597 },{\
bce54474 598 .driver = TYPE_USB_DEVICE,\
eeb0cf9a
GH
599 .property = "full-path",\
600 .value = "no",\
d6c73008
MT
601 }
602
382b3a68 603static QEMUMachine pc_machine_v1_0 = {
a0dba644 604 PC_I440FX_1_2_MACHINE_OPTIONS,
382b3a68 605 .name = "pc-1.0",
1b89fafe 606 .compat_props = (GlobalProperty[]) {
d6c73008 607 PC_COMPAT_1_0,
1b89fafe
JJ
608 { /* end of list */ }
609 },
93bfef4c 610 .hw_version = "1.0",
382b3a68
JJ
611};
612
d6c73008
MT
613#define PC_COMPAT_0_15 \
614 PC_COMPAT_1_0
615
ce01a508 616static QEMUMachine pc_machine_v0_15 = {
a0dba644 617 PC_I440FX_1_2_MACHINE_OPTIONS,
ce01a508 618 .name = "pc-0.15",
1b89fafe 619 .compat_props = (GlobalProperty[]) {
d6c73008 620 PC_COMPAT_0_15,
1b89fafe
JJ
621 { /* end of list */ }
622 },
93bfef4c 623 .hw_version = "0.15",
ce01a508
AL
624};
625
d6c73008
MT
626#define PC_COMPAT_0_14 \
627 PC_COMPAT_0_15,\
628 {\
629 .driver = "virtio-blk-pci",\
630 .property = "event_idx",\
631 .value = "off",\
632 },{\
633 .driver = "virtio-serial-pci",\
634 .property = "event_idx",\
635 .value = "off",\
636 },{\
637 .driver = "virtio-net-pci",\
638 .property = "event_idx",\
639 .value = "off",\
640 },{\
641 .driver = "virtio-balloon-pci",\
642 .property = "event_idx",\
643 .value = "off",\
644 }
645
19857e62 646static QEMUMachine pc_machine_v0_14 = {
a0dba644 647 PC_I440FX_1_2_MACHINE_OPTIONS,
19857e62 648 .name = "pc-0.14",
3827cdb1 649 .compat_props = (GlobalProperty[]) {
d6c73008 650 PC_COMPAT_0_14,
3827cdb1
AL
651 {
652 .driver = "qxl",
653 .property = "revision",
654 .value = stringify(2),
655 },{
656 .driver = "qxl-vga",
657 .property = "revision",
658 .value = stringify(2),
1b89fafe 659 },
3827cdb1
AL
660 { /* end of list */ }
661 },
93bfef4c 662 .hw_version = "0.14",
19857e62
GH
663};
664
d6c73008
MT
665#define PC_COMPAT_0_13 \
666 PC_COMPAT_0_14,\
667 {\
bce54474 668 .driver = TYPE_PCI_DEVICE,\
d6c73008
MT
669 .property = "command_serr_enable",\
670 .value = "off",\
671 },{\
672 .driver = "AC97",\
673 .property = "use_broken_id",\
674 .value = stringify(1),\
675 }
676
a0dba644
MT
677#define PC_I440FX_0_13_MACHINE_OPTIONS \
678 PC_I440FX_1_2_MACHINE_OPTIONS, \
679 .init = pc_init_pci_no_kvmclock
680
b903a0f7 681static QEMUMachine pc_machine_v0_13 = {
a0dba644 682 PC_I440FX_0_13_MACHINE_OPTIONS,
b903a0f7 683 .name = "pc-0.13",
9dbcca5a 684 .compat_props = (GlobalProperty[]) {
d6c73008 685 PC_COMPAT_0_13,
9dbcca5a
GH
686 {
687 .driver = "virtio-9p-pci",
688 .property = "vectors",
689 .value = stringify(0),
281a26b1
GH
690 },{
691 .driver = "VGA",
692 .property = "rombar",
693 .value = stringify(0),
694 },{
695 .driver = "vmware-svga",
696 .property = "rombar",
697 .value = stringify(0),
1b89fafe 698 },
9dbcca5a
GH
699 { /* end of list */ }
700 },
93bfef4c 701 .hw_version = "0.13",
b903a0f7
GH
702};
703
d6c73008
MT
704#define PC_COMPAT_0_12 \
705 PC_COMPAT_0_13,\
706 {\
707 .driver = "virtio-serial-pci",\
708 .property = "max_ports",\
709 .value = stringify(1),\
710 },{\
711 .driver = "virtio-serial-pci",\
712 .property = "vectors",\
713 .value = stringify(0),\
93c8e4dc
GH
714 },{\
715 .driver = "usb-mouse",\
716 .property = "serial",\
717 .value = "1",\
718 },{\
719 .driver = "usb-tablet",\
720 .property = "serial",\
721 .value = "1",\
722 },{\
723 .driver = "usb-kbd",\
724 .property = "serial",\
725 .value = "1",\
d6c73008
MT
726 }
727
845773ab 728static QEMUMachine pc_machine_v0_12 = {
a0dba644 729 PC_I440FX_0_13_MACHINE_OPTIONS,
845773ab 730 .name = "pc-0.12",
845773ab 731 .compat_props = (GlobalProperty[]) {
d6c73008 732 PC_COMPAT_0_12,
845773ab 733 {
281a26b1
GH
734 .driver = "VGA",
735 .property = "rombar",
736 .value = stringify(0),
737 },{
738 .driver = "vmware-svga",
739 .property = "rombar",
740 .value = stringify(0),
1b89fafe 741 },
845773ab 742 { /* end of list */ }
93bfef4c
CV
743 },
744 .hw_version = "0.12",
845773ab
IY
745};
746
d6c73008
MT
747#define PC_COMPAT_0_11 \
748 PC_COMPAT_0_12,\
749 {\
750 .driver = "virtio-blk-pci",\
751 .property = "vectors",\
752 .value = stringify(0),\
c115cd65 753 },{\
bce54474 754 .driver = TYPE_PCI_DEVICE,\
c115cd65
PB
755 .property = "rombar",\
756 .value = stringify(0),\
d6c73008
MT
757 }
758
845773ab 759static QEMUMachine pc_machine_v0_11 = {
a0dba644 760 PC_I440FX_0_13_MACHINE_OPTIONS,
845773ab 761 .name = "pc-0.11",
845773ab 762 .compat_props = (GlobalProperty[]) {
d6c73008 763 PC_COMPAT_0_11,
845773ab 764 {
845773ab
IY
765 .driver = "ide-drive",
766 .property = "ver",
767 .value = "0.11",
768 },{
769 .driver = "scsi-disk",
770 .property = "ver",
771 .value = "0.11",
1b89fafe 772 },
845773ab 773 { /* end of list */ }
93bfef4c
CV
774 },
775 .hw_version = "0.11",
845773ab
IY
776};
777
778static QEMUMachine pc_machine_v0_10 = {
a0dba644 779 PC_I440FX_0_13_MACHINE_OPTIONS,
845773ab 780 .name = "pc-0.10",
845773ab 781 .compat_props = (GlobalProperty[]) {
d6c73008 782 PC_COMPAT_0_11,
845773ab
IY
783 {
784 .driver = "virtio-blk-pci",
785 .property = "class",
786 .value = stringify(PCI_CLASS_STORAGE_OTHER),
787 },{
788 .driver = "virtio-serial-pci",
789 .property = "class",
790 .value = stringify(PCI_CLASS_DISPLAY_OTHER),
845773ab
IY
791 },{
792 .driver = "virtio-net-pci",
793 .property = "vectors",
794 .value = stringify(0),
845773ab
IY
795 },{
796 .driver = "ide-drive",
797 .property = "ver",
798 .value = "0.10",
799 },{
800 .driver = "scsi-disk",
801 .property = "ver",
802 .value = "0.10",
1b89fafe 803 },
845773ab
IY
804 { /* end of list */ }
805 },
93bfef4c 806 .hw_version = "0.10",
845773ab
IY
807};
808
809static QEMUMachine isapc_machine = {
a0dba644 810 PC_COMMON_MACHINE_OPTIONS,
845773ab
IY
811 .name = "isapc",
812 .desc = "ISA-only PC",
813 .init = pc_init_isa,
814 .max_cpus = 1,
1b89fafe 815 .compat_props = (GlobalProperty[]) {
1b89fafe
JJ
816 { /* end of list */ }
817 },
845773ab
IY
818};
819
29d3ccde
AP
820#ifdef CONFIG_XEN
821static QEMUMachine xenfv_machine = {
a0dba644 822 PC_COMMON_MACHINE_OPTIONS,
29d3ccde
AP
823 .name = "xenfv",
824 .desc = "Xen Fully-virtualized PC",
825 .init = pc_xen_hvm_init,
826 .max_cpus = HVM_MAX_VCPUS,
827 .default_machine_opts = "accel=xen",
594278d9 828 .hot_add_cpu = pc_hot_add_cpu,
d160024f
MT
829 .compat_props = (GlobalProperty[]) {
830 /* xenfv has no fwcfg and so does not load acpi from QEMU.
831 * as such new acpi features don't work.
832 */
833 {
834 .driver = "PIIX4_PM",
835 .property = "acpi-pci-hotplug-with-bridge-support",
836 .value = "off",
837 },
838 { /* end of list */ }
839 },
29d3ccde
AP
840};
841#endif
842
845773ab
IY
843static void pc_machine_init(void)
844{
3458b2b0 845 qemu_register_machine(&pc_i440fx_machine_v2_1);
aeca6e8d 846 qemu_register_machine(&pc_i440fx_machine_v2_0);
e9845f09 847 qemu_register_machine(&pc_i440fx_machine_v1_7);
45053fde 848 qemu_register_machine(&pc_i440fx_machine_v1_6);
bf3caa3d 849 qemu_register_machine(&pc_i440fx_machine_v1_5);
94dec594 850 qemu_register_machine(&pc_i440fx_machine_v1_4);
f4306941 851 qemu_register_machine(&pc_machine_v1_3);
f1dacf1c 852 qemu_register_machine(&pc_machine_v1_2);
382b3a68 853 qemu_register_machine(&pc_machine_v1_1);
19857e62 854 qemu_register_machine(&pc_machine_v1_0);
ce01a508 855 qemu_register_machine(&pc_machine_v0_15);
19857e62 856 qemu_register_machine(&pc_machine_v0_14);
b903a0f7 857 qemu_register_machine(&pc_machine_v0_13);
845773ab
IY
858 qemu_register_machine(&pc_machine_v0_12);
859 qemu_register_machine(&pc_machine_v0_11);
860 qemu_register_machine(&pc_machine_v0_10);
861 qemu_register_machine(&isapc_machine);
29d3ccde
AP
862#ifdef CONFIG_XEN
863 qemu_register_machine(&xenfv_machine);
864#endif
845773ab
IY
865}
866
867machine_init(pc_machine_init);