]> Git Repo - qemu.git/blame - hw/i386/pc_piix.c
xen, gfx passthrough: retrieve VGA BIOS to work
[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"
60d8f328 31#include "hw/smbios/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 43#include "sysemu/arch_init.h"
4be74634 44#include "sysemu/block-backend.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"
c87b1520 51#include "qemu/error-report.h"
29d3ccde
AP
52#ifdef CONFIG_XEN
53# include <xen/hvm/hvm_info_table.h>
54#endif
37fb569c 55#include "migration/migration.h"
845773ab
IY
56
57#define MAX_IDE_BUS 2
58
59static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 };
60static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 };
61static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
62
72d164aa 63static bool pci_enabled = true;
72c194f7 64static bool has_acpi_build = true;
384fb32e 65static bool rsdp_in_ram = true;
07fb6176 66static int legacy_acpi_table_size;
e6667f71 67static bool smbios_defaults = true;
c97294ec 68static bool smbios_legacy_mode;
caad057b 69static bool smbios_uuid_encoded = true;
ecdbfceb
MT
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.
73 */
bb43d383 74static bool gigabyte_align = true;
de268e13 75static bool has_reserved_memory = true;
72d164aa 76static bool kvmclock_enabled = true;
3ab135f3 77
845773ab 78/* PC hardware initialisation */
76d39ab4
TC
79static void pc_init1(MachineState *machine,
80 const char *host_type, const char *pci_type)
845773ab 81{
ec68007a 82 PCMachineState *pcms = PC_MACHINE(machine);
1e099556
EH
83 MemoryRegion *system_memory = get_system_memory();
84 MemoryRegion *system_io = get_system_io();
845773ab 85 int i;
845773ab 86 PCIBus *pci_bus;
48a18b3c 87 ISABus *isa_bus;
845773ab
IY
88 PCII440FXState *i440fx_state;
89 int piix3_devfn = -1;
b881fbe9 90 qemu_irq *gsi;
845773ab 91 qemu_irq *i8259;
2ba154cf 92 qemu_irq smi_irq;
b881fbe9 93 GSIState *gsi_state;
845773ab 94 DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
c0897e0c 95 BusState *idebus[MAX_IDE_BUS];
1d914fa0 96 ISADevice *rtc_state;
ae0a5466
AK
97 MemoryRegion *ram_memory;
98 MemoryRegion *pci_memory;
4463aee6 99 MemoryRegion *rom_memory;
f0513d2c 100 DeviceState *icc_bridge;
3459a625 101 PcGuestInfo *guest_info;
c87b1520 102 ram_addr_t lowmem;
845773ab 103
ecdbfceb
MT
104 /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory).
105 * If it doesn't, we need to split it in chunks below and above 4G.
106 * In any case, try to make sure that guest addresses aligned at
107 * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
108 * For old machine types, use whatever split we used historically to avoid
109 * breaking migration.
110 */
3ef96221 111 if (machine->ram_size >= 0xe0000000) {
c87b1520
DS
112 lowmem = gigabyte_align ? 0xc0000000 : 0xe0000000;
113 } else {
114 lowmem = 0xe0000000;
115 }
116
a9dd38db 117 /* Handle the machine opt max-ram-below-4g. It is basically doing
c87b1520
DS
118 * min(qemu limit, user limit).
119 */
ec68007a
EH
120 if (lowmem > pcms->max_ram_below_4g) {
121 lowmem = pcms->max_ram_below_4g;
c87b1520
DS
122 if (machine->ram_size - lowmem > lowmem &&
123 lowmem & ((1ULL << 30) - 1)) {
124 error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64
125 ") not a multiple of 1G; possible bad performance.",
ec68007a 126 pcms->max_ram_below_4g);
c87b1520
DS
127 }
128 }
129
130 if (machine->ram_size >= lowmem) {
c0aa4e1e
EH
131 pcms->above_4g_mem_size = machine->ram_size - lowmem;
132 pcms->below_4g_mem_size = lowmem;
e0e7e67b 133 } else {
c0aa4e1e
EH
134 pcms->above_4g_mem_size = 0;
135 pcms->below_4g_mem_size = machine->ram_size;
e0e7e67b
AP
136 }
137
c0aa4e1e
EH
138 if (xen_enabled() && xen_hvm_init(&pcms->below_4g_mem_size,
139 &pcms->above_4g_mem_size,
3c2a9669
DS
140 &ram_memory) != 0) {
141 fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
142 exit(1);
143 }
144
145 icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
146 object_property_add_child(qdev_get_machine(), "icc-bridge",
147 OBJECT(icc_bridge), NULL);
148
149 pc_cpus_init(machine->cpu_model, icc_bridge);
150
151 if (kvm_enabled() && kvmclock_enabled) {
152 kvmclock_create();
153 }
154
4463aee6
JK
155 if (pci_enabled) {
156 pci_memory = g_new(MemoryRegion, 1);
286690e3 157 memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
4463aee6
JK
158 rom_memory = pci_memory;
159 } else {
160 pci_memory = NULL;
161 rom_memory = system_memory;
162 }
ae0a5466 163
b9cfc918 164 guest_info = pc_guest_info_init(pcms);
72c194f7
MT
165
166 guest_info->has_acpi_build = has_acpi_build;
07fb6176 167 guest_info->legacy_acpi_table_size = legacy_acpi_table_size;
72c194f7 168
6dd2a5c9 169 guest_info->isapc_ram_fw = !pci_enabled;
de268e13 170 guest_info->has_reserved_memory = has_reserved_memory;
384fb32e 171 guest_info->rsdp_in_ram = rsdp_in_ram;
3459a625 172
e6667f71 173 if (smbios_defaults) {
3ef96221 174 MachineClass *mc = MACHINE_GET_CLASS(machine);
b29ad07e 175 /* These values are guest ABI, do not change */
e6667f71 176 smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
86299120
WH
177 mc->name, smbios_legacy_mode, smbios_uuid_encoded,
178 SMBIOS_ENTRY_POINT_21);
b29ad07e
MA
179 }
180
845773ab 181 /* allocate ram and load rom/bios */
29d3ccde 182 if (!xen_enabled()) {
62b160c0 183 pc_memory_init(pcms, system_memory,
6e7d8249 184 rom_memory, &ram_memory, guest_info);
b33a5bbf
CL
185 } else if (machine->kernel_filename != NULL) {
186 /* For xen HVM direct kernel boot, load linux here */
df1f79fd 187 xen_load_linux(pcms, guest_info);
29d3ccde 188 }
845773ab 189
b881fbe9 190 gsi_state = g_malloc0(sizeof(*gsi_state));
3d4b2649 191 if (kvm_irqchip_in_kernel()) {
d8ee0384
JB
192 kvm_pc_setup_irq_routing(pci_enabled);
193 gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
10b61882
JK
194 GSI_NUM_PINS);
195 } else {
196 gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
197 }
845773ab
IY
198
199 if (pci_enabled) {
76d39ab4
TC
200 pci_bus = i440fx_init(host_type,
201 pci_type,
7bb836e4 202 &i440fx_state, &piix3_devfn, &isa_bus, gsi,
3ef96221 203 system_memory, system_io, machine->ram_size,
c0aa4e1e
EH
204 pcms->below_4g_mem_size,
205 pcms->above_4g_mem_size,
ae0a5466 206 pci_memory, ram_memory);
845773ab
IY
207 } else {
208 pci_bus = NULL;
02a89b21 209 i440fx_state = NULL;
bb2ed009 210 isa_bus = isa_bus_new(NULL, get_system_memory(), system_io);
57285cc3 211 no_hpet = 1;
845773ab 212 }
48a18b3c 213 isa_bus_irqs(isa_bus, gsi);
845773ab 214
3d4b2649 215 if (kvm_irqchip_in_kernel()) {
10b61882
JK
216 i8259 = kvm_i8259_init(isa_bus);
217 } else if (xen_enabled()) {
218 i8259 = xen_interrupt_controller_init();
219 } else {
0b0cc076 220 i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq());
4bae1efe
RH
221 }
222
43a0db35
JK
223 for (i = 0; i < ISA_NUM_IRQS; i++) {
224 gsi_state->i8259_irq[i] = i8259[i];
225 }
2ba154cf 226 g_free(i8259);
4bae1efe 227 if (pci_enabled) {
a39e3564 228 ioapic_init_gsi(gsi_state, "i440fx");
4bae1efe 229 }
f0513d2c 230 qdev_init_nofail(icc_bridge);
4bae1efe 231
b881fbe9 232 pc_register_ferr_irq(gsi[13]);
845773ab 233
f424d5c4 234 pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
01195b73 235
ec68007a
EH
236 assert(pcms->vmport != ON_OFF_AUTO_MAX);
237 if (pcms->vmport == ON_OFF_AUTO_AUTO) {
238 pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;
d1048bef
DS
239 }
240
845773ab 241 /* init basic PC hardware */
220a8846 242 pc_basic_device_init(isa_bus, gsi, &rtc_state, true,
ec68007a 243 (pcms->vmport != ON_OFF_AUTO_ON), 0x4);
845773ab 244
9011a1a7 245 pc_nic_init(isa_bus, pci_bus);
845773ab 246
d8f94e1b 247 ide_drive_get(hd, ARRAY_SIZE(hd));
845773ab 248 if (pci_enabled) {
c0897e0c 249 PCIDevice *dev;
679f4f8b
SS
250 if (xen_enabled()) {
251 dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
252 } else {
253 dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
254 }
c0897e0c
MA
255 idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
256 idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
845773ab
IY
257 } else {
258 for(i = 0; i < MAX_IDE_BUS; i++) {
c0897e0c 259 ISADevice *dev;
61de3676 260 char busname[] = "ide.0";
48a18b3c
HP
261 dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
262 ide_irq[i],
c0897e0c 263 hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
61de3676
AG
264 /*
265 * The ide bus name is ide.0 for the first bus and ide.1 for the
266 * second one.
267 */
268 busname[4] = '0' + i;
269 idebus[i] = qdev_get_child_bus(DEVICE(dev), busname);
845773ab
IY
270 }
271 }
272
88076854 273 pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state);
845773ab 274
de77a243 275 if (pci_enabled && usb_enabled()) {
afb9a60e 276 pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
845773ab
IY
277 }
278
279 if (pci_enabled && acpi_enabled) {
781bbd6b 280 DeviceState *piix4_pm;
a5c82852 281 I2CBus *smbus;
845773ab 282
2ba154cf 283 smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0);
845773ab
IY
284 /* TODO: Populate SPD eeprom data. */
285 smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
2ba154cf 286 gsi[9], smi_irq,
ec68007a 287 pc_machine_is_smm_enabled(pcms),
355023f2 288 &piix4_pm);
a88df0b9 289 smbus_eeprom_init(smbus, 8, NULL, 0);
781bbd6b
IM
290
291 object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
292 TYPE_HOTPLUG_HANDLER,
ec68007a 293 (Object **)&pcms->acpi_dev,
781bbd6b
IM
294 object_property_allow_set_link,
295 OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort);
296 object_property_set_link(OBJECT(machine), OBJECT(piix4_pm),
297 PC_MACHINE_ACPI_DEVICE_PROP, &error_abort);
845773ab
IY
298 }
299
845773ab
IY
300 if (pci_enabled) {
301 pc_pci_device_init(pci_bus);
302 }
303}
304
5cb50e0a
JW
305static void pc_compat_2_3(MachineState *machine)
306{
355023f2 307 PCMachineState *pcms = PC_MACHINE(machine);
37fb569c 308 savevm_skip_section_footers();
355023f2
PB
309 if (kvm_enabled()) {
310 pcms->smm = ON_OFF_AUTO_OFF;
311 }
13d16814 312 global_state_set_optional();
61964c23 313 savevm_skip_configuration();
5cb50e0a
JW
314}
315
64bbd372
PB
316static void pc_compat_2_2(MachineState *machine)
317{
5cb50e0a 318 pc_compat_2_3(machine);
384fb32e 319 rsdp_in_ram = false;
54ed388b 320 machine->suppress_vmdesc = true;
64bbd372
PB
321}
322
2cad57c7
EH
323static void pc_compat_2_1(MachineState *machine)
324{
91aa70ab 325 PCMachineState *pcms = PC_MACHINE(machine);
64bbd372
PB
326
327 pc_compat_2_2(machine);
caad057b 328 smbios_uuid_encoded = false;
75d373ef 329 x86_cpu_compat_kvm_no_autodisable(FEAT_8000_0001_ECX, CPUID_EXT3_SVM);
91aa70ab 330 pcms->enforce_aligned_dimm = false;
2cad57c7
EH
331}
332
3ef96221 333static void pc_compat_2_0(MachineState *machine)
3458b2b0 334{
2cad57c7 335 pc_compat_2_1(machine);
07fb6176
PB
336 /* This value depends on the actual DSDT and SSDT compiled into
337 * the source QEMU; unfortunately it depends on the binary and
338 * not on the machine type, so we cannot make pc-i440fx-1.7 work on
339 * both QEMU 1.7 and QEMU 2.0.
340 *
341 * Large variations cause migration to fail for more than one
342 * consecutive value of the "-smp" maxcpus option.
343 *
344 * For small variations of the kind caused by different iasl versions,
345 * the 4k rounding usually leaves slack. However, there could be still
346 * one or two values that break. For QEMU 1.7 and QEMU 2.0 the
347 * slack is only ~10 bytes before one "-smp maxcpus" value breaks!
348 *
349 * 6652 is valid for QEMU 2.0, the right value for pc-i440fx-1.7 on
350 * QEMU 1.7 it is 6414. For RHEL/CentOS 7.0 it is 6418.
351 */
352 legacy_acpi_table_size = 6652;
c97294ec 353 smbios_legacy_mode = true;
de268e13 354 has_reserved_memory = false;
927766c7 355 pc_set_legacy_acpi_data_size();
3458b2b0
MT
356}
357
3ef96221 358static void pc_compat_1_7(MachineState *machine)
b29ad07e 359{
3ef96221 360 pc_compat_2_0(machine);
e6667f71 361 smbios_defaults = false;
bb43d383 362 gigabyte_align = false;
ac41881b 363 option_rom_has_mr = true;
f47337cb 364 legacy_acpi_table_size = 6414;
1cadaa94 365 x86_cpu_compat_kvm_no_autoenable(FEAT_1_ECX, CPUID_EXT_X2APIC);
b29ad07e
MA
366}
367
3ef96221 368static void pc_compat_1_6(MachineState *machine)
f8c457b8 369{
3ef96221 370 pc_compat_1_7(machine);
98bc3ab0 371 rom_file_has_mr = false;
72c194f7 372 has_acpi_build = false;
f8c457b8
MT
373}
374
3ef96221 375static void pc_compat_1_5(MachineState *machine)
9604f70f 376{
3ef96221 377 pc_compat_1_6(machine);
9604f70f
MT
378}
379
3ef96221 380static void pc_compat_1_4(MachineState *machine)
9953f882 381{
3ef96221 382 pc_compat_1_5(machine);
9953f882
MA
383}
384
3ef96221 385static void pc_compat_1_3(MachineState *machine)
8932cfdf 386{
3ef96221 387 pc_compat_1_4(machine);
8932cfdf 388 enable_compat_apic_id_mode();
89b439f3
EH
389}
390
391/* PC compat function for pc-0.14 to pc-1.2 */
3ef96221 392static void pc_compat_1_2(MachineState *machine)
89b439f3 393{
3ef96221 394 pc_compat_1_3(machine);
0034a0f2 395 x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, 1 << KVM_FEATURE_PV_EOI);
89b439f3
EH
396}
397
72d164aa
EH
398/* PC compat function for pc-0.10 to pc-0.13 */
399static void pc_compat_0_13(MachineState *machine)
400{
401 pc_compat_1_2(machine);
402 kvmclock_enabled = false;
403}
404
3ef96221 405static void pc_init_isa(MachineState *machine)
845773ab 406{
72d164aa 407 pci_enabled = false;
98af2ac9 408 has_acpi_build = false;
e6667f71 409 smbios_defaults = false;
5f8632d3
DS
410 gigabyte_align = false;
411 smbios_legacy_mode = true;
412 has_reserved_memory = false;
413 option_rom_has_mr = true;
414 rom_file_has_mr = false;
3ef96221
MA
415 if (!machine->cpu_model) {
416 machine->cpu_model = "486";
5650f5f4 417 }
0034a0f2 418 x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, 1 << KVM_FEATURE_PV_EOI);
8932cfdf 419 enable_compat_apic_id_mode();
76d39ab4 420 pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, TYPE_I440FX_PCI_DEVICE);
845773ab
IY
421}
422
29d3ccde 423#ifdef CONFIG_XEN
3ef96221 424static void pc_xen_hvm_init(MachineState *machine)
29d3ccde 425{
39ae4972
PD
426 PCIBus *bus;
427
76d39ab4 428 pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, TYPE_I440FX_PCI_DEVICE);
39ae4972 429
1ef7a2a2 430 bus = pci_find_primary_bus();
39ae4972
PD
431 if (bus != NULL) {
432 pci_create_simple(bus, -1, "xen-platform");
433 }
29d3ccde
AP
434}
435#endif
436
99fbeafe
EH
437#define DEFINE_I440FX_MACHINE(suffix, name, compatfn, optionfn) \
438 static void pc_init_##suffix(MachineState *machine) \
439 { \
440 void (*compat)(MachineState *m) = (compatfn); \
441 if (compat) { \
442 compat(machine); \
443 } \
76d39ab4
TC
444 pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, \
445 TYPE_I440FX_PCI_DEVICE); \
99fbeafe
EH
446 } \
447 DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
fddd179a 448
865906f7 449static void pc_i440fx_machine_options(MachineClass *m)
fddd179a 450{
fddd179a
EH
451 m->family = "pc_piix";
452 m->desc = "Standard PC (i440FX + PIIX, 1996)";
453 m->hot_add_cpu = pc_hot_add_cpu;
454}
455
865906f7 456static void pc_i440fx_2_4_machine_options(MachineClass *m)
fddd179a
EH
457{
458 pc_i440fx_machine_options(m);
459 m->default_machine_opts = "firmware=bios-256k.bin";
460 m->default_display = "std";
461 m->alias = "pc";
462 m->is_default = 1;
463}
aeca6e8d 464
99fbeafe
EH
465DEFINE_I440FX_MACHINE(v2_4, "pc-i440fx-2.4", NULL,
466 pc_i440fx_2_4_machine_options)
5cb50e0a 467
f9f21873 468
865906f7 469static void pc_i440fx_2_3_machine_options(MachineClass *m)
fddd179a 470{
4421c6a3 471 pc_i440fx_2_4_machine_options(m);
fddd179a
EH
472 m->alias = NULL;
473 m->is_default = 0;
25519b06 474 SET_MACHINE_COMPAT(m, PC_COMPAT_2_3);
fddd179a 475}
5cb50e0a 476
99fbeafe
EH
477DEFINE_I440FX_MACHINE(v2_3, "pc-i440fx-2.3", pc_compat_2_3,
478 pc_i440fx_2_3_machine_options);
61f219df 479
5cb50e0a 480
865906f7 481static void pc_i440fx_2_2_machine_options(MachineClass *m)
fddd179a
EH
482{
483 pc_i440fx_2_3_machine_options(m);
25519b06 484 SET_MACHINE_COMPAT(m, PC_COMPAT_2_2);
fddd179a 485}
64bbd372 486
99fbeafe
EH
487DEFINE_I440FX_MACHINE(v2_2, "pc-i440fx-2.2", pc_compat_2_2,
488 pc_i440fx_2_2_machine_options);
61f219df 489
64bbd372 490
865906f7 491static void pc_i440fx_2_1_machine_options(MachineClass *m)
fddd179a
EH
492{
493 pc_i440fx_2_2_machine_options(m);
494 m->default_display = NULL;
25519b06 495 SET_MACHINE_COMPAT(m, PC_COMPAT_2_1);
fddd179a 496}
f9f21873 497
99fbeafe
EH
498DEFINE_I440FX_MACHINE(v2_1, "pc-i440fx-2.1", pc_compat_2_1,
499 pc_i440fx_2_1_machine_options);
61f219df 500
aeca6e8d 501
fddd179a 502
865906f7 503static void pc_i440fx_2_0_machine_options(MachineClass *m)
fddd179a
EH
504{
505 pc_i440fx_2_1_machine_options(m);
25519b06 506 SET_MACHINE_COMPAT(m, PC_COMPAT_2_0);
fddd179a 507}
3458b2b0 508
99fbeafe
EH
509DEFINE_I440FX_MACHINE(v2_0, "pc-i440fx-2.0", pc_compat_2_0,
510 pc_i440fx_2_0_machine_options);
61f219df 511
3458b2b0 512
865906f7 513static void pc_i440fx_1_7_machine_options(MachineClass *m)
fddd179a
EH
514{
515 pc_i440fx_2_0_machine_options(m);
516 m->default_machine_opts = NULL;
25519b06 517 SET_MACHINE_COMPAT(m, PC_COMPAT_1_7);
fddd179a 518}
aeca6e8d 519
99fbeafe
EH
520DEFINE_I440FX_MACHINE(v1_7, "pc-i440fx-1.7", pc_compat_1_7,
521 pc_i440fx_1_7_machine_options);
61f219df 522
e9845f09 523
865906f7 524static void pc_i440fx_1_6_machine_options(MachineClass *m)
fddd179a
EH
525{
526 pc_i440fx_1_7_machine_options(m);
25519b06 527 SET_MACHINE_COMPAT(m, PC_COMPAT_1_6);
fddd179a 528}
a0dba644 529
99fbeafe
EH
530DEFINE_I440FX_MACHINE(v1_6, "pc-i440fx-1.6", pc_compat_1_6,
531 pc_i440fx_1_6_machine_options);
61f219df 532
845773ab 533
865906f7 534static void pc_i440fx_1_5_machine_options(MachineClass *m)
fddd179a
EH
535{
536 pc_i440fx_1_6_machine_options(m);
25519b06 537 SET_MACHINE_COMPAT(m, PC_COMPAT_1_5);
fddd179a 538}
b6b5c8e4 539
99fbeafe
EH
540DEFINE_I440FX_MACHINE(v1_5, "pc-i440fx-1.5", pc_compat_1_5,
541 pc_i440fx_1_5_machine_options);
61f219df 542
45053fde 543
865906f7 544static void pc_i440fx_1_4_machine_options(MachineClass *m)
fddd179a
EH
545{
546 pc_i440fx_1_5_machine_options(m);
547 m->hot_add_cpu = NULL;
25519b06 548 SET_MACHINE_COMPAT(m, PC_COMPAT_1_4);
fddd179a 549}
a0dba644 550
99fbeafe
EH
551DEFINE_I440FX_MACHINE(v1_4, "pc-i440fx-1.4", pc_compat_1_4,
552 pc_i440fx_1_4_machine_options);
61f219df 553
bf3caa3d 554
427e3aa1 555#define PC_COMPAT_1_3 \
a7cde24d 556 PC_COMPAT_1_4 \
427e3aa1
HG
557 {\
558 .driver = "usb-tablet",\
559 .property = "usb_version",\
560 .value = stringify(1),\
c1943a3f
AK
561 },{\
562 .driver = "virtio-net-pci",\
563 .property = "ctrl_mac_addr",\
564 .value = "off", \
a9c87c58
JW
565 },{ \
566 .driver = "virtio-net-pci", \
567 .property = "mq", \
568 .value = "off", \
2af234e6
MT
569 }, {\
570 .driver = "e1000",\
571 .property = "autonegotiation",\
572 .value = "off",\
a7cde24d 573 },
427e3aa1 574
fddd179a 575
865906f7 576static void pc_i440fx_1_3_machine_options(MachineClass *m)
fddd179a
EH
577{
578 pc_i440fx_1_4_machine_options(m);
25519b06 579 SET_MACHINE_COMPAT(m, PC_COMPAT_1_3);
fddd179a 580}
b6b5c8e4 581
99fbeafe
EH
582DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3,
583 pc_i440fx_1_3_machine_options);
61f219df 584
f1ae2e38 585
183c5eaa 586#define PC_COMPAT_1_2 \
a7cde24d 587 PC_COMPAT_1_3 \
183c5eaa
GH
588 {\
589 .driver = "nec-usb-xhci",\
590 .property = "msi",\
591 .value = "off",\
592 },{\
593 .driver = "nec-usb-xhci",\
594 .property = "msix",\
595 .value = "off",\
c08ba66f
GH
596 },{\
597 .driver = "ivshmem",\
598 .property = "use64",\
599 .value = "0",\
591af143
GH
600 },{\
601 .driver = "qxl",\
602 .property = "revision",\
603 .value = stringify(3),\
604 },{\
605 .driver = "qxl-vga",\
606 .property = "revision",\
607 .value = stringify(3),\
803ff052
GH
608 },{\
609 .driver = "VGA",\
610 .property = "mmio",\
611 .value = "off",\
a7cde24d 612 },
183c5eaa 613
865906f7 614static void pc_i440fx_1_2_machine_options(MachineClass *m)
fddd179a
EH
615{
616 pc_i440fx_1_3_machine_options(m);
25519b06 617 SET_MACHINE_COMPAT(m, PC_COMPAT_1_2);
fddd179a 618}
a0dba644 619
99fbeafe
EH
620DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2,
621 pc_i440fx_1_2_machine_options);
61f219df 622
f4306941 623
9e56edcf 624#define PC_COMPAT_1_1 \
a7cde24d 625 PC_COMPAT_1_2 \
9e56edcf 626 {\
07a5298c
PB
627 .driver = "virtio-scsi-pci",\
628 .property = "hotplug",\
629 .value = "off",\
630 },{\
631 .driver = "virtio-scsi-pci",\
632 .property = "param_change",\
633 .value = "off",\
634 },{\
9e56edcf
GH
635 .driver = "VGA",\
636 .property = "vgamem_mb",\
637 .value = stringify(8),\
638 },{\
639 .driver = "vmware-svga",\
640 .property = "vgamem_mb",\
641 .value = stringify(8),\
642 },{\
643 .driver = "qxl-vga",\
644 .property = "vgamem_mb",\
645 .value = stringify(8),\
646 },{\
647 .driver = "qxl",\
648 .property = "vgamem_mb",\
649 .value = stringify(8),\
ea776abc
SH
650 },{\
651 .driver = "virtio-blk-pci",\
652 .property = "config-wce",\
653 .value = "off",\
a7cde24d 654 },
9e56edcf 655
865906f7 656static void pc_i440fx_1_1_machine_options(MachineClass *m)
fddd179a
EH
657{
658 pc_i440fx_1_2_machine_options(m);
25519b06 659 SET_MACHINE_COMPAT(m, PC_COMPAT_1_1);
fddd179a 660}
b6b5c8e4 661
99fbeafe
EH
662DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2,
663 pc_i440fx_1_1_machine_options);
61f219df 664
f1dacf1c 665
d6c73008 666#define PC_COMPAT_1_0 \
a7cde24d 667 PC_COMPAT_1_1 \
d6c73008 668 {\
020c8e76 669 .driver = TYPE_ISA_FDC,\
d6c73008
MT
670 .property = "check_media_rate",\
671 .value = "off",\
2ba1d381
DG
672 }, {\
673 .driver = "virtio-balloon-pci",\
674 .property = "class",\
675 .value = stringify(PCI_CLASS_MEMORY_RAM),\
fc34e77b 676 },{\
df1fd4b5 677 .driver = "apic-common",\
fc34e77b
AL
678 .property = "vapic",\
679 .value = "off",\
eeb0cf9a 680 },{\
bce54474 681 .driver = TYPE_USB_DEVICE,\
eeb0cf9a
GH
682 .property = "full-path",\
683 .value = "no",\
a7cde24d 684 },
d6c73008 685
865906f7 686static void pc_i440fx_1_0_machine_options(MachineClass *m)
fddd179a
EH
687{
688 pc_i440fx_1_1_machine_options(m);
689 m->hw_version = "1.0";
25519b06 690 SET_MACHINE_COMPAT(m, PC_COMPAT_1_0);
fddd179a 691}
b6b5c8e4 692
99fbeafe
EH
693DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2,
694 pc_i440fx_1_0_machine_options);
61f219df 695
382b3a68 696
d6c73008
MT
697#define PC_COMPAT_0_15 \
698 PC_COMPAT_1_0
699
865906f7 700static void pc_i440fx_0_15_machine_options(MachineClass *m)
fddd179a
EH
701{
702 pc_i440fx_1_0_machine_options(m);
703 m->hw_version = "0.15";
25519b06 704 SET_MACHINE_COMPAT(m, PC_COMPAT_0_15);
fddd179a 705}
b6b5c8e4 706
99fbeafe
EH
707DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2,
708 pc_i440fx_0_15_machine_options);
61f219df 709
ce01a508 710
d6c73008 711#define PC_COMPAT_0_14 \
a7cde24d 712 PC_COMPAT_0_15 \
d6c73008
MT
713 {\
714 .driver = "virtio-blk-pci",\
715 .property = "event_idx",\
716 .value = "off",\
717 },{\
718 .driver = "virtio-serial-pci",\
719 .property = "event_idx",\
720 .value = "off",\
721 },{\
722 .driver = "virtio-net-pci",\
723 .property = "event_idx",\
724 .value = "off",\
725 },{\
726 .driver = "virtio-balloon-pci",\
727 .property = "event_idx",\
728 .value = "off",\
bb08d882
EH
729 },{\
730 .driver = "qxl",\
731 .property = "revision",\
732 .value = stringify(2),\
733 },{\
734 .driver = "qxl-vga",\
735 .property = "revision",\
736 .value = stringify(2),\
a7cde24d 737 },
d6c73008 738
865906f7 739static void pc_i440fx_0_14_machine_options(MachineClass *m)
fddd179a
EH
740{
741 pc_i440fx_0_15_machine_options(m);
742 m->hw_version = "0.14";
25519b06 743 SET_MACHINE_COMPAT(m, PC_COMPAT_0_14);
fddd179a 744}
b6b5c8e4 745
99fbeafe
EH
746DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2,
747 pc_i440fx_0_14_machine_options);
61f219df 748
19857e62 749
d6c73008 750#define PC_COMPAT_0_13 \
a7cde24d 751 PC_COMPAT_0_14 \
d6c73008 752 {\
bce54474 753 .driver = TYPE_PCI_DEVICE,\
d6c73008
MT
754 .property = "command_serr_enable",\
755 .value = "off",\
756 },{\
757 .driver = "AC97",\
758 .property = "use_broken_id",\
759 .value = stringify(1),\
d765519b
EH
760 },{\
761 .driver = "virtio-9p-pci",\
762 .property = "vectors",\
763 .value = stringify(0),\
faf7e425
EH
764 },{\
765 .driver = "VGA",\
766 .property = "rombar",\
767 .value = stringify(0),\
768 },{\
769 .driver = "vmware-svga",\
770 .property = "rombar",\
771 .value = stringify(0),\
a7cde24d 772 },
d6c73008 773
865906f7 774static void pc_i440fx_0_13_machine_options(MachineClass *m)
fddd179a
EH
775{
776 pc_i440fx_0_14_machine_options(m);
777 m->hw_version = "0.13";
25519b06 778 SET_MACHINE_COMPAT(m, PC_COMPAT_0_13);
fddd179a 779}
a0dba644 780
99fbeafe
EH
781DEFINE_I440FX_MACHINE(v0_13, "pc-0.13", pc_compat_0_13,
782 pc_i440fx_0_13_machine_options);
61f219df 783
b903a0f7 784
d6c73008 785#define PC_COMPAT_0_12 \
a7cde24d 786 PC_COMPAT_0_13 \
d6c73008
MT
787 {\
788 .driver = "virtio-serial-pci",\
789 .property = "max_ports",\
790 .value = stringify(1),\
791 },{\
792 .driver = "virtio-serial-pci",\
793 .property = "vectors",\
794 .value = stringify(0),\
93c8e4dc
GH
795 },{\
796 .driver = "usb-mouse",\
797 .property = "serial",\
798 .value = "1",\
799 },{\
800 .driver = "usb-tablet",\
801 .property = "serial",\
802 .value = "1",\
803 },{\
804 .driver = "usb-kbd",\
805 .property = "serial",\
806 .value = "1",\
a7cde24d 807 },
d6c73008 808
865906f7 809static void pc_i440fx_0_12_machine_options(MachineClass *m)
fddd179a
EH
810{
811 pc_i440fx_0_13_machine_options(m);
812 m->hw_version = "0.12";
25519b06 813 SET_MACHINE_COMPAT(m, PC_COMPAT_0_12);
fddd179a 814}
b6b5c8e4 815
99fbeafe
EH
816DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13,
817 pc_i440fx_0_12_machine_options);
61f219df 818
845773ab 819
d6c73008 820#define PC_COMPAT_0_11 \
a7cde24d 821 PC_COMPAT_0_12 \
d6c73008
MT
822 {\
823 .driver = "virtio-blk-pci",\
824 .property = "vectors",\
825 .value = stringify(0),\
c115cd65 826 },{\
bce54474 827 .driver = TYPE_PCI_DEVICE,\
c115cd65
PB
828 .property = "rombar",\
829 .value = stringify(0),\
d5303df7
EH
830 },{\
831 .driver = "ide-drive",\
832 .property = "ver",\
833 .value = "0.11",\
834 },{\
835 .driver = "scsi-disk",\
836 .property = "ver",\
837 .value = "0.11",\
a7cde24d 838 },
d6c73008 839
865906f7 840static void pc_i440fx_0_11_machine_options(MachineClass *m)
fddd179a
EH
841{
842 pc_i440fx_0_12_machine_options(m);
843 m->hw_version = "0.11";
25519b06 844 SET_MACHINE_COMPAT(m, PC_COMPAT_0_11);
fddd179a 845}
b6b5c8e4 846
99fbeafe
EH
847DEFINE_I440FX_MACHINE(v0_11, "pc-0.11", pc_compat_0_13,
848 pc_i440fx_0_11_machine_options);
61f219df 849
845773ab 850
f6d5a0ba
EH
851#define PC_COMPAT_0_10 \
852 PC_COMPAT_0_11 \
853 {\
854 .driver = "virtio-blk-pci",\
855 .property = "class",\
856 .value = stringify(PCI_CLASS_STORAGE_OTHER),\
857 },{\
858 .driver = "virtio-serial-pci",\
859 .property = "class",\
860 .value = stringify(PCI_CLASS_DISPLAY_OTHER),\
861 },{\
862 .driver = "virtio-net-pci",\
863 .property = "vectors",\
864 .value = stringify(0),\
865 },{\
866 .driver = "ide-drive",\
867 .property = "ver",\
868 .value = "0.10",\
869 },{\
870 .driver = "scsi-disk",\
871 .property = "ver",\
872 .value = "0.10",\
873 },
874
865906f7 875static void pc_i440fx_0_10_machine_options(MachineClass *m)
fddd179a
EH
876{
877 pc_i440fx_0_11_machine_options(m);
878 m->hw_version = "0.10";
25519b06 879 SET_MACHINE_COMPAT(m, PC_COMPAT_0_10);
fddd179a 880}
b6b5c8e4 881
99fbeafe
EH
882DEFINE_I440FX_MACHINE(v0_10, "pc-0.10", pc_compat_0_13,
883 pc_i440fx_0_10_machine_options);
61f219df 884
845773ab 885
865906f7 886static void isapc_machine_options(MachineClass *m)
fddd179a 887{
fddd179a
EH
888 m->desc = "ISA-only PC";
889 m->max_cpus = 1;
890}
b6b5c8e4 891
61f219df 892DEFINE_PC_MACHINE(isapc, "isapc", pc_init_isa,
25519b06 893 isapc_machine_options);
61f219df 894
845773ab 895
29d3ccde 896#ifdef CONFIG_XEN
865906f7 897static void xenfv_machine_options(MachineClass *m)
fddd179a 898{
fddd179a
EH
899 m->desc = "Xen Fully-virtualized PC";
900 m->max_cpus = HVM_MAX_VCPUS;
901 m->default_machine_opts = "accel=xen";
902 m->hot_add_cpu = pc_hot_add_cpu;
903}
b6b5c8e4 904
61f219df 905DEFINE_PC_MACHINE(xenfv, "xenfv", pc_xen_hvm_init,
25519b06 906 xenfv_machine_options);
29d3ccde 907#endif
This page took 0.680496 seconds and 4 git commands to generate.