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