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