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