]>
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" |
0d09e41a PB |
28 | #include "hw/i386/pc.h" |
29 | #include "hw/i386/apic.h" | |
83c9f4ca PB |
30 | #include "hw/pci/pci.h" |
31 | #include "hw/pci/pci_ids.h" | |
32 | #include "hw/usb.h" | |
1422e32d | 33 | #include "net/net.h" |
83c9f4ca PB |
34 | #include "hw/boards.h" |
35 | #include "hw/ide.h" | |
9c17d615 | 36 | #include "sysemu/kvm.h" |
83c9f4ca | 37 | #include "hw/kvm/clock.h" |
9c17d615 | 38 | #include "sysemu/sysemu.h" |
83c9f4ca | 39 | #include "hw/sysbus.h" |
f0513d2c | 40 | #include "hw/cpu/icc_bus.h" |
9c17d615 PB |
41 | #include "sysemu/arch_init.h" |
42 | #include "sysemu/blockdev.h" | |
0d09e41a PB |
43 | #include "hw/i2c/smbus.h" |
44 | #include "hw/xen/xen.h" | |
022c62cb PB |
45 | #include "exec/memory.h" |
46 | #include "exec/address-spaces.h" | |
0445259b | 47 | #include "hw/acpi/acpi.h" |
dc59944b | 48 | #include "cpu.h" |
29d3ccde AP |
49 | #ifdef CONFIG_XEN |
50 | # include <xen/hvm/hvm_info_table.h> | |
51 | #endif | |
845773ab IY |
52 | |
53 | #define MAX_IDE_BUS 2 | |
54 | ||
55 | static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 }; | |
56 | static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 }; | |
57 | static const int ide_irq[MAX_IDE_BUS] = { 14, 15 }; | |
58 | ||
3ab135f3 HT |
59 | static bool has_pvpanic = true; |
60 | ||
845773ab | 61 | /* PC hardware initialisation */ |
6bd10515 | 62 | static void pc_init1(MemoryRegion *system_memory, |
aee97b84 | 63 | MemoryRegion *system_io, |
6bd10515 | 64 | ram_addr_t ram_size, |
845773ab IY |
65 | const char *boot_device, |
66 | const char *kernel_filename, | |
67 | const char *kernel_cmdline, | |
68 | const char *initrd_filename, | |
69 | const char *cpu_model, | |
0ec329da JK |
70 | int pci_enabled, |
71 | int kvmclock_enabled) | |
845773ab IY |
72 | { |
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; |
459ae5ea | 92 | void *fw_cfg = NULL; |
845773ab | 93 | |
f0513d2c IM |
94 | icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE); |
95 | object_property_add_child(qdev_get_machine(), "icc-bridge", | |
96 | OBJECT(icc_bridge), NULL); | |
97 | ||
62fc403f | 98 | pc_cpus_init(cpu_model, icc_bridge); |
b7da6c60 | 99 | pc_acpi_init("acpi-dsdt.aml"); |
845773ab | 100 | |
0ec329da JK |
101 | if (kvmclock_enabled) { |
102 | kvmclock_create(); | |
103 | } | |
104 | ||
e0e7e67b AP |
105 | if (ram_size >= 0xe0000000 ) { |
106 | above_4g_mem_size = ram_size - 0xe0000000; | |
107 | below_4g_mem_size = 0xe0000000; | |
108 | } else { | |
109 | above_4g_mem_size = 0; | |
110 | below_4g_mem_size = ram_size; | |
111 | } | |
112 | ||
4463aee6 JK |
113 | if (pci_enabled) { |
114 | pci_memory = g_new(MemoryRegion, 1); | |
115 | memory_region_init(pci_memory, "pci", INT64_MAX); | |
116 | rom_memory = pci_memory; | |
117 | } else { | |
118 | pci_memory = NULL; | |
119 | rom_memory = system_memory; | |
120 | } | |
ae0a5466 | 121 | |
845773ab | 122 | /* allocate ram and load rom/bios */ |
29d3ccde | 123 | if (!xen_enabled()) { |
459ae5ea | 124 | fw_cfg = pc_memory_init(system_memory, |
4aa63af1 | 125 | kernel_filename, kernel_cmdline, initrd_filename, |
ae0a5466 | 126 | below_4g_mem_size, above_4g_mem_size, |
0d3cf3b6 | 127 | rom_memory, &ram_memory); |
29d3ccde | 128 | } |
845773ab | 129 | |
b881fbe9 | 130 | gsi_state = g_malloc0(sizeof(*gsi_state)); |
3d4b2649 | 131 | if (kvm_irqchip_in_kernel()) { |
d8ee0384 JB |
132 | kvm_pc_setup_irq_routing(pci_enabled); |
133 | gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, | |
10b61882 JK |
134 | GSI_NUM_PINS); |
135 | } else { | |
136 | gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); | |
137 | } | |
845773ab IY |
138 | |
139 | if (pci_enabled) { | |
60573079 | 140 | pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi, |
ae0a5466 AK |
141 | system_memory, system_io, ram_size, |
142 | below_4g_mem_size, | |
143 | 0x100000000ULL - below_4g_mem_size, | |
144 | 0x100000000ULL + above_4g_mem_size, | |
a8170e5e | 145 | (sizeof(hwaddr) == 4 |
ae0a5466 AK |
146 | ? 0 |
147 | : ((uint64_t)1 << 62)), | |
148 | pci_memory, ram_memory); | |
845773ab IY |
149 | } else { |
150 | pci_bus = NULL; | |
02a89b21 | 151 | i440fx_state = NULL; |
48a18b3c | 152 | isa_bus = isa_bus_new(NULL, system_io); |
57285cc3 | 153 | no_hpet = 1; |
845773ab | 154 | } |
48a18b3c | 155 | isa_bus_irqs(isa_bus, gsi); |
845773ab | 156 | |
3d4b2649 | 157 | if (kvm_irqchip_in_kernel()) { |
10b61882 JK |
158 | i8259 = kvm_i8259_init(isa_bus); |
159 | } else if (xen_enabled()) { | |
160 | i8259 = xen_interrupt_controller_init(); | |
161 | } else { | |
4bae1efe | 162 | cpu_irq = pc_allocate_cpu_irq(); |
48a18b3c | 163 | i8259 = i8259_init(isa_bus, cpu_irq[0]); |
4bae1efe RH |
164 | } |
165 | ||
43a0db35 JK |
166 | for (i = 0; i < ISA_NUM_IRQS; i++) { |
167 | gsi_state->i8259_irq[i] = i8259[i]; | |
168 | } | |
4bae1efe | 169 | if (pci_enabled) { |
a39e3564 | 170 | ioapic_init_gsi(gsi_state, "i440fx"); |
4bae1efe | 171 | } |
f0513d2c | 172 | qdev_init_nofail(icc_bridge); |
4bae1efe | 173 | |
b881fbe9 | 174 | pc_register_ferr_irq(gsi[13]); |
845773ab | 175 | |
f424d5c4 | 176 | pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL); |
01195b73 SS |
177 | if (xen_enabled()) { |
178 | pci_create_simple(pci_bus, -1, "xen-platform"); | |
179 | } | |
180 | ||
845773ab | 181 | /* init basic PC hardware */ |
48a18b3c | 182 | pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled()); |
845773ab | 183 | |
9011a1a7 | 184 | pc_nic_init(isa_bus, pci_bus); |
845773ab | 185 | |
75717903 | 186 | ide_drive_get(hd, MAX_IDE_BUS); |
845773ab | 187 | if (pci_enabled) { |
c0897e0c | 188 | PCIDevice *dev; |
679f4f8b SS |
189 | if (xen_enabled()) { |
190 | dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1); | |
191 | } else { | |
192 | dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); | |
193 | } | |
c0897e0c MA |
194 | idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0"); |
195 | idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1"); | |
845773ab IY |
196 | } else { |
197 | for(i = 0; i < MAX_IDE_BUS; i++) { | |
c0897e0c | 198 | ISADevice *dev; |
48a18b3c HP |
199 | dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], |
200 | ide_irq[i], | |
c0897e0c MA |
201 | hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); |
202 | idebus[i] = qdev_get_child_bus(&dev->qdev, "ide.0"); | |
845773ab IY |
203 | } |
204 | } | |
205 | ||
c0897e0c | 206 | pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, |
34d4260e | 207 | floppy, idebus[0], idebus[1], rtc_state); |
845773ab | 208 | |
094b287f | 209 | if (pci_enabled && usb_enabled(false)) { |
afb9a60e | 210 | pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci"); |
845773ab IY |
211 | } |
212 | ||
213 | if (pci_enabled && acpi_enabled) { | |
845773ab IY |
214 | i2c_bus *smbus; |
215 | ||
c3affe56 AF |
216 | smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, |
217 | x86_env_get_cpu(first_cpu), 1); | |
845773ab IY |
218 | /* TODO: Populate SPD eeprom data. */ |
219 | smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, | |
da98c8eb | 220 | gsi[9], *smi_irq, |
459ae5ea | 221 | kvm_enabled(), fw_cfg); |
a88df0b9 | 222 | smbus_eeprom_init(smbus, 8, NULL, 0); |
845773ab IY |
223 | } |
224 | ||
845773ab IY |
225 | if (pci_enabled) { |
226 | pc_pci_device_init(pci_bus); | |
227 | } | |
3ab135f3 HT |
228 | |
229 | if (has_pvpanic) { | |
230 | pvpanic_init(isa_bus); | |
231 | } | |
845773ab IY |
232 | } |
233 | ||
5f072e1f | 234 | static void pc_init_pci(QEMUMachineInitArgs *args) |
845773ab | 235 | { |
5f072e1f EH |
236 | ram_addr_t ram_size = args->ram_size; |
237 | const char *cpu_model = args->cpu_model; | |
238 | const char *kernel_filename = args->kernel_filename; | |
239 | const char *kernel_cmdline = args->kernel_cmdline; | |
240 | const char *initrd_filename = args->initrd_filename; | |
241 | const char *boot_device = args->boot_device; | |
6bd10515 | 242 | pc_init1(get_system_memory(), |
aee97b84 | 243 | get_system_io(), |
6bd10515 | 244 | ram_size, boot_device, |
845773ab | 245 | kernel_filename, kernel_cmdline, |
0ec329da JK |
246 | initrd_filename, cpu_model, 1, 1); |
247 | } | |
248 | ||
9953f882 MA |
249 | static void pc_init_pci_1_4(QEMUMachineInitArgs *args) |
250 | { | |
251 | pc_sysfw_flash_vs_rom_bug_compatible = true; | |
3ab135f3 | 252 | has_pvpanic = false; |
4458c236 | 253 | x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE); |
9953f882 MA |
254 | pc_init_pci(args); |
255 | } | |
256 | ||
8932cfdf EH |
257 | static void pc_init_pci_1_3(QEMUMachineInitArgs *args) |
258 | { | |
259 | enable_compat_apic_id_mode(); | |
9953f882 | 260 | pc_sysfw_flash_vs_rom_bug_compatible = true; |
3ab135f3 | 261 | has_pvpanic = false; |
8932cfdf EH |
262 | pc_init_pci(args); |
263 | } | |
264 | ||
6fd028f6 | 265 | /* PC machine init function for pc-1.1 to pc-1.2 */ |
29694758 | 266 | static void pc_init_pci_1_2(QEMUMachineInitArgs *args) |
dc59944b | 267 | { |
29694758 | 268 | disable_kvm_pv_eoi(); |
36afbc51 | 269 | enable_compat_apic_id_mode(); |
9953f882 | 270 | pc_sysfw_flash_vs_rom_bug_compatible = true; |
3ab135f3 | 271 | has_pvpanic = false; |
36afbc51 | 272 | pc_init_pci(args); |
dc59944b MT |
273 | } |
274 | ||
6fd028f6 MA |
275 | /* PC machine init function for pc-0.14 to pc-1.0 */ |
276 | static void pc_init_pci_1_0(QEMUMachineInitArgs *args) | |
277 | { | |
278 | disable_kvm_pv_eoi(); | |
279 | enable_compat_apic_id_mode(); | |
3ab135f3 | 280 | has_pvpanic = false; |
6fd028f6 MA |
281 | pc_init_pci(args); |
282 | } | |
283 | ||
29694758 | 284 | /* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */ |
5f072e1f | 285 | static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args) |
0ec329da | 286 | { |
5f072e1f EH |
287 | ram_addr_t ram_size = args->ram_size; |
288 | const char *cpu_model = args->cpu_model; | |
289 | const char *kernel_filename = args->kernel_filename; | |
290 | const char *kernel_cmdline = args->kernel_cmdline; | |
291 | const char *initrd_filename = args->initrd_filename; | |
292 | const char *boot_device = args->boot_device; | |
3ab135f3 | 293 | has_pvpanic = false; |
29694758 | 294 | disable_kvm_pv_eoi(); |
8932cfdf | 295 | enable_compat_apic_id_mode(); |
6bd10515 | 296 | pc_init1(get_system_memory(), |
aee97b84 | 297 | get_system_io(), |
6bd10515 | 298 | ram_size, boot_device, |
0ec329da JK |
299 | kernel_filename, kernel_cmdline, |
300 | initrd_filename, cpu_model, 1, 0); | |
845773ab IY |
301 | } |
302 | ||
5f072e1f | 303 | static void pc_init_isa(QEMUMachineInitArgs *args) |
845773ab | 304 | { |
5f072e1f EH |
305 | ram_addr_t ram_size = args->ram_size; |
306 | const char *cpu_model = args->cpu_model; | |
307 | const char *kernel_filename = args->kernel_filename; | |
308 | const char *kernel_cmdline = args->kernel_cmdline; | |
309 | const char *initrd_filename = args->initrd_filename; | |
310 | const char *boot_device = args->boot_device; | |
3ab135f3 | 311 | has_pvpanic = false; |
845773ab IY |
312 | if (cpu_model == NULL) |
313 | cpu_model = "486"; | |
29694758 | 314 | disable_kvm_pv_eoi(); |
8932cfdf | 315 | enable_compat_apic_id_mode(); |
6bd10515 | 316 | pc_init1(get_system_memory(), |
aee97b84 | 317 | get_system_io(), |
6bd10515 | 318 | ram_size, boot_device, |
845773ab | 319 | kernel_filename, kernel_cmdline, |
0ec329da | 320 | initrd_filename, cpu_model, 0, 1); |
845773ab IY |
321 | } |
322 | ||
29d3ccde | 323 | #ifdef CONFIG_XEN |
5f072e1f | 324 | static void pc_xen_hvm_init(QEMUMachineInitArgs *args) |
29d3ccde AP |
325 | { |
326 | if (xen_hvm_init() != 0) { | |
327 | hw_error("xen hardware virtual machine initialisation failed"); | |
328 | } | |
5f072e1f | 329 | pc_init_pci_no_kvmclock(args); |
29d3ccde AP |
330 | xen_vcpu_init(); |
331 | } | |
332 | #endif | |
333 | ||
bf3caa3d PB |
334 | static QEMUMachine pc_i440fx_machine_v1_5 = { |
335 | .name = "pc-i440fx-1.5", | |
845773ab | 336 | .alias = "pc", |
94dec594 | 337 | .desc = "Standard PC (i440FX + PIIX, 1996)", |
29694758 | 338 | .init = pc_init_pci, |
c649983b | 339 | .hot_add_cpu = pc_hot_add_cpu, |
845773ab IY |
340 | .max_cpus = 255, |
341 | .is_default = 1, | |
e4ada29e | 342 | DEFAULT_MACHINE_OPTIONS, |
845773ab IY |
343 | }; |
344 | ||
bf3caa3d PB |
345 | static QEMUMachine pc_i440fx_machine_v1_4 = { |
346 | .name = "pc-i440fx-1.4", | |
347 | .desc = "Standard PC (i440FX + PIIX, 1996)", | |
9953f882 | 348 | .init = pc_init_pci_1_4, |
bf3caa3d PB |
349 | .max_cpus = 255, |
350 | .compat_props = (GlobalProperty[]) { | |
351 | PC_COMPAT_1_4, | |
352 | { /* end of list */ } | |
353 | }, | |
354 | DEFAULT_MACHINE_OPTIONS, | |
355 | }; | |
356 | ||
427e3aa1 | 357 | #define PC_COMPAT_1_3 \ |
bf3caa3d | 358 | PC_COMPAT_1_4, \ |
427e3aa1 HG |
359 | {\ |
360 | .driver = "usb-tablet",\ | |
361 | .property = "usb_version",\ | |
362 | .value = stringify(1),\ | |
c1943a3f AK |
363 | },{\ |
364 | .driver = "virtio-net-pci",\ | |
365 | .property = "ctrl_mac_addr",\ | |
366 | .value = "off", \ | |
a9c87c58 JW |
367 | },{ \ |
368 | .driver = "virtio-net-pci", \ | |
369 | .property = "mq", \ | |
370 | .value = "off", \ | |
2af234e6 MT |
371 | }, {\ |
372 | .driver = "e1000",\ | |
373 | .property = "autonegotiation",\ | |
374 | .value = "off",\ | |
427e3aa1 HG |
375 | } |
376 | ||
f1ae2e38 GH |
377 | static QEMUMachine pc_machine_v1_3 = { |
378 | .name = "pc-1.3", | |
379 | .desc = "Standard PC", | |
8932cfdf | 380 | .init = pc_init_pci_1_3, |
f1ae2e38 GH |
381 | .max_cpus = 255, |
382 | .compat_props = (GlobalProperty[]) { | |
427e3aa1 | 383 | PC_COMPAT_1_3, |
f1ae2e38 GH |
384 | { /* end of list */ } |
385 | }, | |
e4ada29e | 386 | DEFAULT_MACHINE_OPTIONS, |
f1ae2e38 GH |
387 | }; |
388 | ||
183c5eaa | 389 | #define PC_COMPAT_1_2 \ |
427e3aa1 | 390 | PC_COMPAT_1_3,\ |
183c5eaa GH |
391 | {\ |
392 | .driver = "nec-usb-xhci",\ | |
393 | .property = "msi",\ | |
394 | .value = "off",\ | |
395 | },{\ | |
396 | .driver = "nec-usb-xhci",\ | |
397 | .property = "msix",\ | |
398 | .value = "off",\ | |
c08ba66f GH |
399 | },{\ |
400 | .driver = "ivshmem",\ | |
401 | .property = "use64",\ | |
402 | .value = "0",\ | |
591af143 GH |
403 | },{\ |
404 | .driver = "qxl",\ | |
405 | .property = "revision",\ | |
406 | .value = stringify(3),\ | |
407 | },{\ | |
408 | .driver = "qxl-vga",\ | |
409 | .property = "revision",\ | |
410 | .value = stringify(3),\ | |
803ff052 GH |
411 | },{\ |
412 | .driver = "VGA",\ | |
413 | .property = "mmio",\ | |
414 | .value = "off",\ | |
183c5eaa GH |
415 | } |
416 | ||
f4306941 GH |
417 | static QEMUMachine pc_machine_v1_2 = { |
418 | .name = "pc-1.2", | |
419 | .desc = "Standard PC", | |
29694758 | 420 | .init = pc_init_pci_1_2, |
f4306941 | 421 | .max_cpus = 255, |
183c5eaa GH |
422 | .compat_props = (GlobalProperty[]) { |
423 | PC_COMPAT_1_2, | |
424 | { /* end of list */ } | |
425 | }, | |
e4ada29e | 426 | DEFAULT_MACHINE_OPTIONS, |
f4306941 GH |
427 | }; |
428 | ||
9e56edcf | 429 | #define PC_COMPAT_1_1 \ |
183c5eaa | 430 | PC_COMPAT_1_2,\ |
9e56edcf | 431 | {\ |
07a5298c PB |
432 | .driver = "virtio-scsi-pci",\ |
433 | .property = "hotplug",\ | |
434 | .value = "off",\ | |
435 | },{\ | |
436 | .driver = "virtio-scsi-pci",\ | |
437 | .property = "param_change",\ | |
438 | .value = "off",\ | |
439 | },{\ | |
9e56edcf GH |
440 | .driver = "VGA",\ |
441 | .property = "vgamem_mb",\ | |
442 | .value = stringify(8),\ | |
443 | },{\ | |
444 | .driver = "vmware-svga",\ | |
445 | .property = "vgamem_mb",\ | |
446 | .value = stringify(8),\ | |
447 | },{\ | |
448 | .driver = "qxl-vga",\ | |
449 | .property = "vgamem_mb",\ | |
450 | .value = stringify(8),\ | |
451 | },{\ | |
452 | .driver = "qxl",\ | |
453 | .property = "vgamem_mb",\ | |
454 | .value = stringify(8),\ | |
ea776abc SH |
455 | },{\ |
456 | .driver = "virtio-blk-pci",\ | |
457 | .property = "config-wce",\ | |
458 | .value = "off",\ | |
9e56edcf GH |
459 | } |
460 | ||
f1dacf1c GH |
461 | static QEMUMachine pc_machine_v1_1 = { |
462 | .name = "pc-1.1", | |
463 | .desc = "Standard PC", | |
29694758 | 464 | .init = pc_init_pci_1_2, |
f1dacf1c | 465 | .max_cpus = 255, |
9e56edcf GH |
466 | .compat_props = (GlobalProperty[]) { |
467 | PC_COMPAT_1_1, | |
468 | { /* end of list */ } | |
469 | }, | |
e4ada29e | 470 | DEFAULT_MACHINE_OPTIONS, |
f1dacf1c GH |
471 | }; |
472 | ||
d6c73008 | 473 | #define PC_COMPAT_1_0 \ |
9e56edcf | 474 | PC_COMPAT_1_1,\ |
d6c73008 MT |
475 | {\ |
476 | .driver = "pc-sysfw",\ | |
477 | .property = "rom_only",\ | |
478 | .value = stringify(1),\ | |
479 | }, {\ | |
020c8e76 | 480 | .driver = TYPE_ISA_FDC,\ |
d6c73008 MT |
481 | .property = "check_media_rate",\ |
482 | .value = "off",\ | |
2ba1d381 DG |
483 | }, {\ |
484 | .driver = "virtio-balloon-pci",\ | |
485 | .property = "class",\ | |
486 | .value = stringify(PCI_CLASS_MEMORY_RAM),\ | |
fc34e77b AL |
487 | },{\ |
488 | .driver = "apic",\ | |
489 | .property = "vapic",\ | |
490 | .value = "off",\ | |
eeb0cf9a | 491 | },{\ |
bce54474 | 492 | .driver = TYPE_USB_DEVICE,\ |
eeb0cf9a GH |
493 | .property = "full-path",\ |
494 | .value = "no",\ | |
d6c73008 MT |
495 | } |
496 | ||
382b3a68 JJ |
497 | static QEMUMachine pc_machine_v1_0 = { |
498 | .name = "pc-1.0", | |
499 | .desc = "Standard PC", | |
6fd028f6 | 500 | .init = pc_init_pci_1_0, |
382b3a68 | 501 | .max_cpus = 255, |
1b89fafe | 502 | .compat_props = (GlobalProperty[]) { |
d6c73008 | 503 | PC_COMPAT_1_0, |
1b89fafe JJ |
504 | { /* end of list */ } |
505 | }, | |
93bfef4c | 506 | .hw_version = "1.0", |
e4ada29e | 507 | DEFAULT_MACHINE_OPTIONS, |
382b3a68 JJ |
508 | }; |
509 | ||
d6c73008 MT |
510 | #define PC_COMPAT_0_15 \ |
511 | PC_COMPAT_1_0 | |
512 | ||
ce01a508 AL |
513 | static QEMUMachine pc_machine_v0_15 = { |
514 | .name = "pc-0.15", | |
515 | .desc = "Standard PC", | |
6fd028f6 | 516 | .init = pc_init_pci_1_0, |
ce01a508 | 517 | .max_cpus = 255, |
1b89fafe | 518 | .compat_props = (GlobalProperty[]) { |
d6c73008 | 519 | PC_COMPAT_0_15, |
1b89fafe JJ |
520 | { /* end of list */ } |
521 | }, | |
93bfef4c | 522 | .hw_version = "0.15", |
e4ada29e | 523 | DEFAULT_MACHINE_OPTIONS, |
ce01a508 AL |
524 | }; |
525 | ||
d6c73008 MT |
526 | #define PC_COMPAT_0_14 \ |
527 | PC_COMPAT_0_15,\ | |
528 | {\ | |
529 | .driver = "virtio-blk-pci",\ | |
530 | .property = "event_idx",\ | |
531 | .value = "off",\ | |
532 | },{\ | |
533 | .driver = "virtio-serial-pci",\ | |
534 | .property = "event_idx",\ | |
535 | .value = "off",\ | |
536 | },{\ | |
537 | .driver = "virtio-net-pci",\ | |
538 | .property = "event_idx",\ | |
539 | .value = "off",\ | |
540 | },{\ | |
541 | .driver = "virtio-balloon-pci",\ | |
542 | .property = "event_idx",\ | |
543 | .value = "off",\ | |
544 | } | |
545 | ||
19857e62 GH |
546 | static QEMUMachine pc_machine_v0_14 = { |
547 | .name = "pc-0.14", | |
548 | .desc = "Standard PC", | |
6fd028f6 | 549 | .init = pc_init_pci_1_0, |
19857e62 | 550 | .max_cpus = 255, |
3827cdb1 | 551 | .compat_props = (GlobalProperty[]) { |
d6c73008 | 552 | PC_COMPAT_0_14, |
3827cdb1 AL |
553 | { |
554 | .driver = "qxl", | |
555 | .property = "revision", | |
556 | .value = stringify(2), | |
557 | },{ | |
558 | .driver = "qxl-vga", | |
559 | .property = "revision", | |
560 | .value = stringify(2), | |
1b89fafe | 561 | }, |
3827cdb1 AL |
562 | { /* end of list */ } |
563 | }, | |
93bfef4c | 564 | .hw_version = "0.14", |
e4ada29e | 565 | DEFAULT_MACHINE_OPTIONS, |
19857e62 GH |
566 | }; |
567 | ||
d6c73008 MT |
568 | #define PC_COMPAT_0_13 \ |
569 | PC_COMPAT_0_14,\ | |
570 | {\ | |
bce54474 | 571 | .driver = TYPE_PCI_DEVICE,\ |
d6c73008 MT |
572 | .property = "command_serr_enable",\ |
573 | .value = "off",\ | |
574 | },{\ | |
575 | .driver = "AC97",\ | |
576 | .property = "use_broken_id",\ | |
577 | .value = stringify(1),\ | |
578 | } | |
579 | ||
b903a0f7 GH |
580 | static QEMUMachine pc_machine_v0_13 = { |
581 | .name = "pc-0.13", | |
582 | .desc = "Standard PC", | |
0ec329da | 583 | .init = pc_init_pci_no_kvmclock, |
b903a0f7 | 584 | .max_cpus = 255, |
9dbcca5a | 585 | .compat_props = (GlobalProperty[]) { |
d6c73008 | 586 | PC_COMPAT_0_13, |
9dbcca5a GH |
587 | { |
588 | .driver = "virtio-9p-pci", | |
589 | .property = "vectors", | |
590 | .value = stringify(0), | |
281a26b1 GH |
591 | },{ |
592 | .driver = "VGA", | |
593 | .property = "rombar", | |
594 | .value = stringify(0), | |
595 | },{ | |
596 | .driver = "vmware-svga", | |
597 | .property = "rombar", | |
598 | .value = stringify(0), | |
1b89fafe | 599 | }, |
9dbcca5a GH |
600 | { /* end of list */ } |
601 | }, | |
93bfef4c | 602 | .hw_version = "0.13", |
e4ada29e | 603 | DEFAULT_MACHINE_OPTIONS, |
b903a0f7 GH |
604 | }; |
605 | ||
d6c73008 MT |
606 | #define PC_COMPAT_0_12 \ |
607 | PC_COMPAT_0_13,\ | |
608 | {\ | |
609 | .driver = "virtio-serial-pci",\ | |
610 | .property = "max_ports",\ | |
611 | .value = stringify(1),\ | |
612 | },{\ | |
613 | .driver = "virtio-serial-pci",\ | |
614 | .property = "vectors",\ | |
615 | .value = stringify(0),\ | |
616 | } | |
617 | ||
845773ab IY |
618 | static QEMUMachine pc_machine_v0_12 = { |
619 | .name = "pc-0.12", | |
620 | .desc = "Standard PC", | |
0ec329da | 621 | .init = pc_init_pci_no_kvmclock, |
845773ab IY |
622 | .max_cpus = 255, |
623 | .compat_props = (GlobalProperty[]) { | |
d6c73008 | 624 | PC_COMPAT_0_12, |
845773ab | 625 | { |
281a26b1 GH |
626 | .driver = "VGA", |
627 | .property = "rombar", | |
628 | .value = stringify(0), | |
629 | },{ | |
630 | .driver = "vmware-svga", | |
631 | .property = "rombar", | |
632 | .value = stringify(0), | |
1b89fafe | 633 | }, |
845773ab | 634 | { /* end of list */ } |
93bfef4c CV |
635 | }, |
636 | .hw_version = "0.12", | |
e4ada29e | 637 | DEFAULT_MACHINE_OPTIONS, |
845773ab IY |
638 | }; |
639 | ||
d6c73008 MT |
640 | #define PC_COMPAT_0_11 \ |
641 | PC_COMPAT_0_12,\ | |
642 | {\ | |
643 | .driver = "virtio-blk-pci",\ | |
644 | .property = "vectors",\ | |
645 | .value = stringify(0),\ | |
c115cd65 | 646 | },{\ |
bce54474 | 647 | .driver = TYPE_PCI_DEVICE,\ |
c115cd65 PB |
648 | .property = "rombar",\ |
649 | .value = stringify(0),\ | |
d6c73008 MT |
650 | } |
651 | ||
845773ab IY |
652 | static QEMUMachine pc_machine_v0_11 = { |
653 | .name = "pc-0.11", | |
654 | .desc = "Standard PC, qemu 0.11", | |
0ec329da | 655 | .init = pc_init_pci_no_kvmclock, |
845773ab IY |
656 | .max_cpus = 255, |
657 | .compat_props = (GlobalProperty[]) { | |
d6c73008 | 658 | PC_COMPAT_0_11, |
845773ab | 659 | { |
845773ab IY |
660 | .driver = "ide-drive", |
661 | .property = "ver", | |
662 | .value = "0.11", | |
663 | },{ | |
664 | .driver = "scsi-disk", | |
665 | .property = "ver", | |
666 | .value = "0.11", | |
1b89fafe | 667 | }, |
845773ab | 668 | { /* end of list */ } |
93bfef4c CV |
669 | }, |
670 | .hw_version = "0.11", | |
e4ada29e | 671 | DEFAULT_MACHINE_OPTIONS, |
845773ab IY |
672 | }; |
673 | ||
674 | static QEMUMachine pc_machine_v0_10 = { | |
675 | .name = "pc-0.10", | |
676 | .desc = "Standard PC, qemu 0.10", | |
0ec329da | 677 | .init = pc_init_pci_no_kvmclock, |
845773ab IY |
678 | .max_cpus = 255, |
679 | .compat_props = (GlobalProperty[]) { | |
d6c73008 | 680 | PC_COMPAT_0_11, |
845773ab IY |
681 | { |
682 | .driver = "virtio-blk-pci", | |
683 | .property = "class", | |
684 | .value = stringify(PCI_CLASS_STORAGE_OTHER), | |
685 | },{ | |
686 | .driver = "virtio-serial-pci", | |
687 | .property = "class", | |
688 | .value = stringify(PCI_CLASS_DISPLAY_OTHER), | |
845773ab IY |
689 | },{ |
690 | .driver = "virtio-net-pci", | |
691 | .property = "vectors", | |
692 | .value = stringify(0), | |
845773ab IY |
693 | },{ |
694 | .driver = "ide-drive", | |
695 | .property = "ver", | |
696 | .value = "0.10", | |
697 | },{ | |
698 | .driver = "scsi-disk", | |
699 | .property = "ver", | |
700 | .value = "0.10", | |
1b89fafe | 701 | }, |
845773ab IY |
702 | { /* end of list */ } |
703 | }, | |
93bfef4c | 704 | .hw_version = "0.10", |
e4ada29e | 705 | DEFAULT_MACHINE_OPTIONS, |
845773ab IY |
706 | }; |
707 | ||
708 | static QEMUMachine isapc_machine = { | |
709 | .name = "isapc", | |
710 | .desc = "ISA-only PC", | |
711 | .init = pc_init_isa, | |
712 | .max_cpus = 1, | |
1b89fafe JJ |
713 | .compat_props = (GlobalProperty[]) { |
714 | { | |
715 | .driver = "pc-sysfw", | |
716 | .property = "rom_only", | |
717 | .value = stringify(1), | |
718 | }, | |
719 | { /* end of list */ } | |
720 | }, | |
e4ada29e | 721 | DEFAULT_MACHINE_OPTIONS, |
845773ab IY |
722 | }; |
723 | ||
29d3ccde AP |
724 | #ifdef CONFIG_XEN |
725 | static QEMUMachine xenfv_machine = { | |
726 | .name = "xenfv", | |
727 | .desc = "Xen Fully-virtualized PC", | |
728 | .init = pc_xen_hvm_init, | |
729 | .max_cpus = HVM_MAX_VCPUS, | |
730 | .default_machine_opts = "accel=xen", | |
e4ada29e | 731 | DEFAULT_MACHINE_OPTIONS, |
29d3ccde AP |
732 | }; |
733 | #endif | |
734 | ||
845773ab IY |
735 | static void pc_machine_init(void) |
736 | { | |
bf3caa3d | 737 | qemu_register_machine(&pc_i440fx_machine_v1_5); |
94dec594 | 738 | qemu_register_machine(&pc_i440fx_machine_v1_4); |
f4306941 | 739 | qemu_register_machine(&pc_machine_v1_3); |
f1dacf1c | 740 | qemu_register_machine(&pc_machine_v1_2); |
382b3a68 | 741 | qemu_register_machine(&pc_machine_v1_1); |
19857e62 | 742 | qemu_register_machine(&pc_machine_v1_0); |
ce01a508 | 743 | qemu_register_machine(&pc_machine_v0_15); |
19857e62 | 744 | qemu_register_machine(&pc_machine_v0_14); |
b903a0f7 | 745 | qemu_register_machine(&pc_machine_v0_13); |
845773ab IY |
746 | qemu_register_machine(&pc_machine_v0_12); |
747 | qemu_register_machine(&pc_machine_v0_11); | |
748 | qemu_register_machine(&pc_machine_v0_10); | |
749 | qemu_register_machine(&isapc_machine); | |
29d3ccde AP |
750 | #ifdef CONFIG_XEN |
751 | qemu_register_machine(&xenfv_machine); | |
752 | #endif | |
845773ab IY |
753 | } |
754 | ||
755 | machine_init(pc_machine_init); |