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