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