]>
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 | ||
845773ab IY |
27 | #include "hw.h" |
28 | #include "pc.h" | |
29 | #include "apic.h" | |
30 | #include "pci.h" | |
845773ab IY |
31 | #include "net.h" |
32 | #include "boards.h" | |
33 | #include "ide.h" | |
34 | #include "kvm.h" | |
3b9a6ee5 | 35 | #include "kvm/clock.h" |
666daa68 | 36 | #include "sysemu.h" |
96051119 | 37 | #include "sysbus.h" |
0dfa5ef9 | 38 | #include "arch_init.h" |
2446333c | 39 | #include "blockdev.h" |
a88df0b9 | 40 | #include "smbus.h" |
29d3ccde | 41 | #include "xen.h" |
4aa63af1 AK |
42 | #include "memory.h" |
43 | #include "exec-memory.h" | |
29d3ccde AP |
44 | #ifdef CONFIG_XEN |
45 | # include <xen/hvm/hvm_info_table.h> | |
46 | #endif | |
845773ab IY |
47 | |
48 | #define MAX_IDE_BUS 2 | |
49 | ||
50 | static const int ide_iobase[MAX_IDE_BUS] = { 0x1f0, 0x170 }; | |
51 | static const int ide_iobase2[MAX_IDE_BUS] = { 0x3f6, 0x376 }; | |
52 | static const int ide_irq[MAX_IDE_BUS] = { 14, 15 }; | |
53 | ||
10b61882 JK |
54 | static void kvm_piix3_setup_irq_routing(bool pci_enabled) |
55 | { | |
56 | #ifdef CONFIG_KVM | |
57 | KVMState *s = kvm_state; | |
58 | int ret, i; | |
59 | ||
60 | if (kvm_check_extension(s, KVM_CAP_IRQ_ROUTING)) { | |
61 | for (i = 0; i < 8; ++i) { | |
62 | if (i == 2) { | |
63 | continue; | |
64 | } | |
65 | kvm_irqchip_add_route(s, i, KVM_IRQCHIP_PIC_MASTER, i); | |
66 | } | |
67 | for (i = 8; i < 16; ++i) { | |
68 | kvm_irqchip_add_route(s, i, KVM_IRQCHIP_PIC_SLAVE, i - 8); | |
69 | } | |
a39c1d47 JK |
70 | if (pci_enabled) { |
71 | for (i = 0; i < 24; ++i) { | |
72 | if (i == 0) { | |
73 | kvm_irqchip_add_route(s, i, KVM_IRQCHIP_IOAPIC, 2); | |
74 | } else if (i != 2) { | |
75 | kvm_irqchip_add_route(s, i, KVM_IRQCHIP_IOAPIC, i); | |
76 | } | |
77 | } | |
78 | } | |
10b61882 JK |
79 | ret = kvm_irqchip_commit_routes(s); |
80 | if (ret < 0) { | |
81 | hw_error("KVM IRQ routing setup failed"); | |
82 | } | |
83 | } | |
84 | #endif /* CONFIG_KVM */ | |
85 | } | |
86 | ||
87 | static void kvm_piix3_gsi_handler(void *opaque, int n, int level) | |
88 | { | |
89 | GSIState *s = opaque; | |
90 | ||
91 | if (n < ISA_NUM_IRQS) { | |
92 | /* Kernel will forward to both PIC and IOAPIC */ | |
93 | qemu_set_irq(s->i8259_irq[n], level); | |
94 | } else { | |
95 | qemu_set_irq(s->ioapic_irq[n], level); | |
96 | } | |
97 | } | |
98 | ||
b881fbe9 | 99 | static void ioapic_init(GSIState *gsi_state) |
96051119 BS |
100 | { |
101 | DeviceState *dev; | |
102 | SysBusDevice *d; | |
103 | unsigned int i; | |
104 | ||
3d4b2649 | 105 | if (kvm_irqchip_in_kernel()) { |
a39c1d47 JK |
106 | dev = qdev_create(NULL, "kvm-ioapic"); |
107 | } else { | |
108 | dev = qdev_create(NULL, "ioapic"); | |
109 | } | |
20288345 PB |
110 | /* FIXME: this should be under the piix3. */ |
111 | object_property_add_child(object_resolve_path("i440fx", NULL), | |
112 | "ioapic", OBJECT(dev), NULL); | |
96051119 BS |
113 | qdev_init_nofail(dev); |
114 | d = sysbus_from_qdev(dev); | |
115 | sysbus_mmio_map(d, 0, 0xfec00000); | |
116 | ||
117 | for (i = 0; i < IOAPIC_NUM_PINS; i++) { | |
b881fbe9 | 118 | gsi_state->ioapic_irq[i] = qdev_get_gpio_in(dev, i); |
96051119 BS |
119 | } |
120 | } | |
121 | ||
845773ab | 122 | /* PC hardware initialisation */ |
6bd10515 | 123 | static void pc_init1(MemoryRegion *system_memory, |
aee97b84 | 124 | MemoryRegion *system_io, |
6bd10515 | 125 | ram_addr_t ram_size, |
845773ab IY |
126 | const char *boot_device, |
127 | const char *kernel_filename, | |
128 | const char *kernel_cmdline, | |
129 | const char *initrd_filename, | |
130 | const char *cpu_model, | |
0ec329da JK |
131 | int pci_enabled, |
132 | int kvmclock_enabled) | |
845773ab IY |
133 | { |
134 | int i; | |
135 | ram_addr_t below_4g_mem_size, above_4g_mem_size; | |
136 | PCIBus *pci_bus; | |
48a18b3c | 137 | ISABus *isa_bus; |
845773ab IY |
138 | PCII440FXState *i440fx_state; |
139 | int piix3_devfn = -1; | |
140 | qemu_irq *cpu_irq; | |
b881fbe9 | 141 | qemu_irq *gsi; |
845773ab | 142 | qemu_irq *i8259; |
845773ab | 143 | qemu_irq *smi_irq; |
b881fbe9 | 144 | GSIState *gsi_state; |
845773ab | 145 | DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; |
c0897e0c | 146 | BusState *idebus[MAX_IDE_BUS]; |
1d914fa0 | 147 | ISADevice *rtc_state; |
34d4260e | 148 | ISADevice *floppy; |
ae0a5466 AK |
149 | MemoryRegion *ram_memory; |
150 | MemoryRegion *pci_memory; | |
4463aee6 | 151 | MemoryRegion *rom_memory; |
845773ab IY |
152 | |
153 | pc_cpus_init(cpu_model); | |
154 | ||
0ec329da JK |
155 | if (kvmclock_enabled) { |
156 | kvmclock_create(); | |
157 | } | |
158 | ||
e0e7e67b AP |
159 | if (ram_size >= 0xe0000000 ) { |
160 | above_4g_mem_size = ram_size - 0xe0000000; | |
161 | below_4g_mem_size = 0xe0000000; | |
162 | } else { | |
163 | above_4g_mem_size = 0; | |
164 | below_4g_mem_size = ram_size; | |
165 | } | |
166 | ||
4463aee6 JK |
167 | if (pci_enabled) { |
168 | pci_memory = g_new(MemoryRegion, 1); | |
169 | memory_region_init(pci_memory, "pci", INT64_MAX); | |
170 | rom_memory = pci_memory; | |
171 | } else { | |
172 | pci_memory = NULL; | |
173 | rom_memory = system_memory; | |
174 | } | |
ae0a5466 | 175 | |
845773ab | 176 | /* allocate ram and load rom/bios */ |
29d3ccde | 177 | if (!xen_enabled()) { |
4aa63af1 AK |
178 | pc_memory_init(system_memory, |
179 | kernel_filename, kernel_cmdline, initrd_filename, | |
ae0a5466 | 180 | below_4g_mem_size, above_4g_mem_size, |
c1d23eac | 181 | pci_enabled ? rom_memory : system_memory, &ram_memory); |
29d3ccde | 182 | } |
845773ab | 183 | |
b881fbe9 | 184 | gsi_state = g_malloc0(sizeof(*gsi_state)); |
3d4b2649 | 185 | if (kvm_irqchip_in_kernel()) { |
10b61882 JK |
186 | kvm_piix3_setup_irq_routing(pci_enabled); |
187 | gsi = qemu_allocate_irqs(kvm_piix3_gsi_handler, gsi_state, | |
188 | GSI_NUM_PINS); | |
189 | } else { | |
190 | gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); | |
191 | } | |
845773ab IY |
192 | |
193 | if (pci_enabled) { | |
60573079 | 194 | pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi, |
ae0a5466 AK |
195 | system_memory, system_io, ram_size, |
196 | below_4g_mem_size, | |
197 | 0x100000000ULL - below_4g_mem_size, | |
198 | 0x100000000ULL + above_4g_mem_size, | |
199 | (sizeof(target_phys_addr_t) == 4 | |
200 | ? 0 | |
201 | : ((uint64_t)1 << 62)), | |
202 | pci_memory, ram_memory); | |
845773ab IY |
203 | } else { |
204 | pci_bus = NULL; | |
02a89b21 | 205 | i440fx_state = NULL; |
48a18b3c | 206 | isa_bus = isa_bus_new(NULL, system_io); |
57285cc3 | 207 | no_hpet = 1; |
845773ab | 208 | } |
48a18b3c | 209 | isa_bus_irqs(isa_bus, gsi); |
845773ab | 210 | |
3d4b2649 | 211 | if (kvm_irqchip_in_kernel()) { |
10b61882 JK |
212 | i8259 = kvm_i8259_init(isa_bus); |
213 | } else if (xen_enabled()) { | |
214 | i8259 = xen_interrupt_controller_init(); | |
215 | } else { | |
4bae1efe | 216 | cpu_irq = pc_allocate_cpu_irq(); |
48a18b3c | 217 | i8259 = i8259_init(isa_bus, cpu_irq[0]); |
4bae1efe RH |
218 | } |
219 | ||
43a0db35 JK |
220 | for (i = 0; i < ISA_NUM_IRQS; i++) { |
221 | gsi_state->i8259_irq[i] = i8259[i]; | |
222 | } | |
4bae1efe | 223 | if (pci_enabled) { |
b881fbe9 | 224 | ioapic_init(gsi_state); |
4bae1efe RH |
225 | } |
226 | ||
b881fbe9 | 227 | pc_register_ferr_irq(gsi[13]); |
845773ab | 228 | |
f424d5c4 | 229 | pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL); |
01195b73 SS |
230 | if (xen_enabled()) { |
231 | pci_create_simple(pci_bus, -1, "xen-platform"); | |
232 | } | |
233 | ||
845773ab | 234 | /* init basic PC hardware */ |
48a18b3c | 235 | pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled()); |
845773ab IY |
236 | |
237 | for(i = 0; i < nb_nics; i++) { | |
238 | NICInfo *nd = &nd_table[i]; | |
239 | ||
240 | if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) | |
48a18b3c | 241 | pc_init_ne2k_isa(isa_bus, nd); |
845773ab IY |
242 | else |
243 | pci_nic_init_nofail(nd, "e1000", NULL); | |
244 | } | |
245 | ||
75717903 | 246 | ide_drive_get(hd, MAX_IDE_BUS); |
845773ab | 247 | if (pci_enabled) { |
c0897e0c | 248 | PCIDevice *dev; |
679f4f8b SS |
249 | if (xen_enabled()) { |
250 | dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1); | |
251 | } else { | |
252 | dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); | |
253 | } | |
c0897e0c MA |
254 | idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0"); |
255 | idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1"); | |
845773ab IY |
256 | } else { |
257 | for(i = 0; i < MAX_IDE_BUS; i++) { | |
c0897e0c | 258 | ISADevice *dev; |
48a18b3c HP |
259 | dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], |
260 | ide_irq[i], | |
c0897e0c MA |
261 | hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); |
262 | idebus[i] = qdev_get_child_bus(&dev->qdev, "ide.0"); | |
845773ab IY |
263 | } |
264 | } | |
265 | ||
4a0f031d | 266 | audio_init(isa_bus, pci_enabled ? pci_bus : NULL); |
845773ab | 267 | |
c0897e0c | 268 | pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, |
34d4260e | 269 | floppy, idebus[0], idebus[1], rtc_state); |
845773ab IY |
270 | |
271 | if (pci_enabled && usb_enabled) { | |
afb9a60e | 272 | pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci"); |
845773ab IY |
273 | } |
274 | ||
275 | if (pci_enabled && acpi_enabled) { | |
845773ab IY |
276 | i2c_bus *smbus; |
277 | ||
845773ab IY |
278 | smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1); |
279 | /* TODO: Populate SPD eeprom data. */ | |
280 | smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, | |
da98c8eb | 281 | gsi[9], *smi_irq, |
845773ab | 282 | kvm_enabled()); |
a88df0b9 | 283 | smbus_eeprom_init(smbus, 8, NULL, 0); |
845773ab IY |
284 | } |
285 | ||
845773ab IY |
286 | if (pci_enabled) { |
287 | pc_pci_device_init(pci_bus); | |
288 | } | |
289 | } | |
290 | ||
291 | static void pc_init_pci(ram_addr_t ram_size, | |
292 | const char *boot_device, | |
293 | const char *kernel_filename, | |
294 | const char *kernel_cmdline, | |
295 | const char *initrd_filename, | |
296 | const char *cpu_model) | |
297 | { | |
6bd10515 | 298 | pc_init1(get_system_memory(), |
aee97b84 | 299 | get_system_io(), |
6bd10515 | 300 | ram_size, boot_device, |
845773ab | 301 | kernel_filename, kernel_cmdline, |
0ec329da JK |
302 | initrd_filename, cpu_model, 1, 1); |
303 | } | |
304 | ||
305 | static void pc_init_pci_no_kvmclock(ram_addr_t ram_size, | |
306 | const char *boot_device, | |
307 | const char *kernel_filename, | |
308 | const char *kernel_cmdline, | |
309 | const char *initrd_filename, | |
310 | const char *cpu_model) | |
311 | { | |
6bd10515 | 312 | pc_init1(get_system_memory(), |
aee97b84 | 313 | get_system_io(), |
6bd10515 | 314 | ram_size, boot_device, |
0ec329da JK |
315 | kernel_filename, kernel_cmdline, |
316 | initrd_filename, cpu_model, 1, 0); | |
845773ab IY |
317 | } |
318 | ||
319 | static void pc_init_isa(ram_addr_t ram_size, | |
320 | const char *boot_device, | |
321 | const char *kernel_filename, | |
322 | const char *kernel_cmdline, | |
323 | const char *initrd_filename, | |
324 | const char *cpu_model) | |
325 | { | |
326 | if (cpu_model == NULL) | |
327 | cpu_model = "486"; | |
6bd10515 | 328 | pc_init1(get_system_memory(), |
aee97b84 | 329 | get_system_io(), |
6bd10515 | 330 | ram_size, boot_device, |
845773ab | 331 | kernel_filename, kernel_cmdline, |
0ec329da | 332 | initrd_filename, cpu_model, 0, 1); |
845773ab IY |
333 | } |
334 | ||
29d3ccde AP |
335 | #ifdef CONFIG_XEN |
336 | static void pc_xen_hvm_init(ram_addr_t ram_size, | |
337 | const char *boot_device, | |
338 | const char *kernel_filename, | |
339 | const char *kernel_cmdline, | |
340 | const char *initrd_filename, | |
341 | const char *cpu_model) | |
342 | { | |
343 | if (xen_hvm_init() != 0) { | |
344 | hw_error("xen hardware virtual machine initialisation failed"); | |
345 | } | |
346 | pc_init_pci_no_kvmclock(ram_size, boot_device, | |
347 | kernel_filename, kernel_cmdline, | |
348 | initrd_filename, cpu_model); | |
349 | xen_vcpu_init(); | |
350 | } | |
351 | #endif | |
352 | ||
382b3a68 JJ |
353 | static QEMUMachine pc_machine_v1_1 = { |
354 | .name = "pc-1.1", | |
845773ab IY |
355 | .alias = "pc", |
356 | .desc = "Standard PC", | |
357 | .init = pc_init_pci, | |
358 | .max_cpus = 255, | |
359 | .is_default = 1, | |
360 | }; | |
361 | ||
382b3a68 JJ |
362 | static QEMUMachine pc_machine_v1_0 = { |
363 | .name = "pc-1.0", | |
364 | .desc = "Standard PC", | |
365 | .init = pc_init_pci, | |
366 | .max_cpus = 255, | |
1b89fafe JJ |
367 | .compat_props = (GlobalProperty[]) { |
368 | { | |
369 | .driver = "pc-sysfw", | |
370 | .property = "rom_only", | |
371 | .value = stringify(1), | |
09c6d585 HP |
372 | }, { |
373 | .driver = "isa-fdc", | |
374 | .property = "check_media_rate", | |
375 | .value = "off", | |
1b89fafe JJ |
376 | }, |
377 | { /* end of list */ } | |
378 | }, | |
382b3a68 JJ |
379 | }; |
380 | ||
ce01a508 AL |
381 | static QEMUMachine pc_machine_v0_15 = { |
382 | .name = "pc-0.15", | |
383 | .desc = "Standard PC", | |
384 | .init = pc_init_pci, | |
385 | .max_cpus = 255, | |
1b89fafe JJ |
386 | .compat_props = (GlobalProperty[]) { |
387 | { | |
388 | .driver = "pc-sysfw", | |
389 | .property = "rom_only", | |
390 | .value = stringify(1), | |
09c6d585 HP |
391 | }, { |
392 | .driver = "isa-fdc", | |
393 | .property = "check_media_rate", | |
394 | .value = "off", | |
1b89fafe JJ |
395 | }, |
396 | { /* end of list */ } | |
397 | }, | |
ce01a508 AL |
398 | }; |
399 | ||
19857e62 GH |
400 | static QEMUMachine pc_machine_v0_14 = { |
401 | .name = "pc-0.14", | |
402 | .desc = "Standard PC", | |
403 | .init = pc_init_pci, | |
404 | .max_cpus = 255, | |
3827cdb1 AL |
405 | .compat_props = (GlobalProperty[]) { |
406 | { | |
407 | .driver = "qxl", | |
408 | .property = "revision", | |
409 | .value = stringify(2), | |
410 | },{ | |
411 | .driver = "qxl-vga", | |
412 | .property = "revision", | |
413 | .value = stringify(2), | |
ea830ebb AL |
414 | },{ |
415 | .driver = "virtio-blk-pci", | |
416 | .property = "event_idx", | |
417 | .value = "off", | |
418 | },{ | |
419 | .driver = "virtio-serial-pci", | |
420 | .property = "event_idx", | |
421 | .value = "off", | |
422 | },{ | |
423 | .driver = "virtio-net-pci", | |
424 | .property = "event_idx", | |
425 | .value = "off", | |
426 | },{ | |
427 | .driver = "virtio-balloon-pci", | |
428 | .property = "event_idx", | |
429 | .value = "off", | |
09c6d585 HP |
430 | },{ |
431 | .driver = "isa-fdc", | |
432 | .property = "check_media_rate", | |
433 | .value = "off", | |
3827cdb1 | 434 | }, |
1b89fafe JJ |
435 | { |
436 | .driver = "pc-sysfw", | |
437 | .property = "rom_only", | |
438 | .value = stringify(1), | |
439 | }, | |
3827cdb1 AL |
440 | { /* end of list */ } |
441 | }, | |
19857e62 GH |
442 | }; |
443 | ||
b903a0f7 GH |
444 | static QEMUMachine pc_machine_v0_13 = { |
445 | .name = "pc-0.13", | |
446 | .desc = "Standard PC", | |
0ec329da | 447 | .init = pc_init_pci_no_kvmclock, |
b903a0f7 | 448 | .max_cpus = 255, |
9dbcca5a GH |
449 | .compat_props = (GlobalProperty[]) { |
450 | { | |
451 | .driver = "virtio-9p-pci", | |
452 | .property = "vectors", | |
453 | .value = stringify(0), | |
281a26b1 GH |
454 | },{ |
455 | .driver = "VGA", | |
456 | .property = "rombar", | |
457 | .value = stringify(0), | |
458 | },{ | |
459 | .driver = "vmware-svga", | |
460 | .property = "rombar", | |
461 | .value = stringify(0), | |
362dd48c IY |
462 | },{ |
463 | .driver = "PCI", | |
464 | .property = "command_serr_enable", | |
465 | .value = "off", | |
b91cb442 MT |
466 | },{ |
467 | .driver = "virtio-blk-pci", | |
468 | .property = "event_idx", | |
469 | .value = "off", | |
470 | },{ | |
471 | .driver = "virtio-serial-pci", | |
472 | .property = "event_idx", | |
473 | .value = "off", | |
474 | },{ | |
475 | .driver = "virtio-net-pci", | |
476 | .property = "event_idx", | |
477 | .value = "off", | |
ea830ebb AL |
478 | },{ |
479 | .driver = "virtio-balloon-pci", | |
480 | .property = "event_idx", | |
481 | .value = "off", | |
25a21c94 GH |
482 | },{ |
483 | .driver = "AC97", | |
484 | .property = "use_broken_id", | |
485 | .value = stringify(1), | |
09c6d585 HP |
486 | },{ |
487 | .driver = "isa-fdc", | |
488 | .property = "check_media_rate", | |
489 | .value = "off", | |
9dbcca5a | 490 | }, |
1b89fafe JJ |
491 | { |
492 | .driver = "pc-sysfw", | |
493 | .property = "rom_only", | |
494 | .value = stringify(1), | |
495 | }, | |
9dbcca5a GH |
496 | { /* end of list */ } |
497 | }, | |
b903a0f7 GH |
498 | }; |
499 | ||
845773ab IY |
500 | static QEMUMachine pc_machine_v0_12 = { |
501 | .name = "pc-0.12", | |
502 | .desc = "Standard PC", | |
0ec329da | 503 | .init = pc_init_pci_no_kvmclock, |
845773ab IY |
504 | .max_cpus = 255, |
505 | .compat_props = (GlobalProperty[]) { | |
506 | { | |
507 | .driver = "virtio-serial-pci", | |
1e29a009 | 508 | .property = "max_ports", |
845773ab IY |
509 | .value = stringify(1), |
510 | },{ | |
511 | .driver = "virtio-serial-pci", | |
512 | .property = "vectors", | |
513 | .value = stringify(0), | |
281a26b1 GH |
514 | },{ |
515 | .driver = "VGA", | |
516 | .property = "rombar", | |
517 | .value = stringify(0), | |
518 | },{ | |
519 | .driver = "vmware-svga", | |
520 | .property = "rombar", | |
521 | .value = stringify(0), | |
b1aeb926 IY |
522 | },{ |
523 | .driver = "PCI", | |
524 | .property = "command_serr_enable", | |
525 | .value = "off", | |
b91cb442 MT |
526 | },{ |
527 | .driver = "virtio-blk-pci", | |
528 | .property = "event_idx", | |
529 | .value = "off", | |
530 | },{ | |
531 | .driver = "virtio-serial-pci", | |
532 | .property = "event_idx", | |
533 | .value = "off", | |
534 | },{ | |
535 | .driver = "virtio-net-pci", | |
536 | .property = "event_idx", | |
537 | .value = "off", | |
ea830ebb AL |
538 | },{ |
539 | .driver = "virtio-balloon-pci", | |
540 | .property = "event_idx", | |
541 | .value = "off", | |
25a21c94 GH |
542 | },{ |
543 | .driver = "AC97", | |
544 | .property = "use_broken_id", | |
545 | .value = stringify(1), | |
09c6d585 HP |
546 | },{ |
547 | .driver = "isa-fdc", | |
548 | .property = "check_media_rate", | |
549 | .value = "off", | |
845773ab | 550 | }, |
1b89fafe JJ |
551 | { |
552 | .driver = "pc-sysfw", | |
553 | .property = "rom_only", | |
554 | .value = stringify(1), | |
555 | }, | |
845773ab IY |
556 | { /* end of list */ } |
557 | } | |
558 | }; | |
559 | ||
560 | static QEMUMachine pc_machine_v0_11 = { | |
561 | .name = "pc-0.11", | |
562 | .desc = "Standard PC, qemu 0.11", | |
0ec329da | 563 | .init = pc_init_pci_no_kvmclock, |
845773ab IY |
564 | .max_cpus = 255, |
565 | .compat_props = (GlobalProperty[]) { | |
566 | { | |
567 | .driver = "virtio-blk-pci", | |
568 | .property = "vectors", | |
569 | .value = stringify(0), | |
570 | },{ | |
571 | .driver = "virtio-serial-pci", | |
1e29a009 | 572 | .property = "max_ports", |
845773ab IY |
573 | .value = stringify(1), |
574 | },{ | |
575 | .driver = "virtio-serial-pci", | |
576 | .property = "vectors", | |
577 | .value = stringify(0), | |
578 | },{ | |
579 | .driver = "ide-drive", | |
580 | .property = "ver", | |
581 | .value = "0.11", | |
582 | },{ | |
583 | .driver = "scsi-disk", | |
584 | .property = "ver", | |
585 | .value = "0.11", | |
586 | },{ | |
587 | .driver = "PCI", | |
588 | .property = "rombar", | |
589 | .value = stringify(0), | |
b1aeb926 IY |
590 | },{ |
591 | .driver = "PCI", | |
592 | .property = "command_serr_enable", | |
593 | .value = "off", | |
b91cb442 MT |
594 | },{ |
595 | .driver = "virtio-blk-pci", | |
596 | .property = "event_idx", | |
597 | .value = "off", | |
598 | },{ | |
599 | .driver = "virtio-serial-pci", | |
600 | .property = "event_idx", | |
601 | .value = "off", | |
602 | },{ | |
603 | .driver = "virtio-net-pci", | |
604 | .property = "event_idx", | |
605 | .value = "off", | |
ea830ebb AL |
606 | },{ |
607 | .driver = "virtio-balloon-pci", | |
608 | .property = "event_idx", | |
609 | .value = "off", | |
25a21c94 GH |
610 | },{ |
611 | .driver = "AC97", | |
612 | .property = "use_broken_id", | |
613 | .value = stringify(1), | |
09c6d585 HP |
614 | },{ |
615 | .driver = "isa-fdc", | |
616 | .property = "check_media_rate", | |
617 | .value = "off", | |
845773ab | 618 | }, |
1b89fafe JJ |
619 | { |
620 | .driver = "pc-sysfw", | |
621 | .property = "rom_only", | |
622 | .value = stringify(1), | |
623 | }, | |
845773ab IY |
624 | { /* end of list */ } |
625 | } | |
626 | }; | |
627 | ||
628 | static QEMUMachine pc_machine_v0_10 = { | |
629 | .name = "pc-0.10", | |
630 | .desc = "Standard PC, qemu 0.10", | |
0ec329da | 631 | .init = pc_init_pci_no_kvmclock, |
845773ab IY |
632 | .max_cpus = 255, |
633 | .compat_props = (GlobalProperty[]) { | |
634 | { | |
635 | .driver = "virtio-blk-pci", | |
636 | .property = "class", | |
637 | .value = stringify(PCI_CLASS_STORAGE_OTHER), | |
638 | },{ | |
639 | .driver = "virtio-serial-pci", | |
640 | .property = "class", | |
641 | .value = stringify(PCI_CLASS_DISPLAY_OTHER), | |
642 | },{ | |
643 | .driver = "virtio-serial-pci", | |
1e29a009 | 644 | .property = "max_ports", |
845773ab IY |
645 | .value = stringify(1), |
646 | },{ | |
647 | .driver = "virtio-serial-pci", | |
648 | .property = "vectors", | |
649 | .value = stringify(0), | |
650 | },{ | |
651 | .driver = "virtio-net-pci", | |
652 | .property = "vectors", | |
653 | .value = stringify(0), | |
654 | },{ | |
655 | .driver = "virtio-blk-pci", | |
656 | .property = "vectors", | |
657 | .value = stringify(0), | |
658 | },{ | |
659 | .driver = "ide-drive", | |
660 | .property = "ver", | |
661 | .value = "0.10", | |
662 | },{ | |
663 | .driver = "scsi-disk", | |
664 | .property = "ver", | |
665 | .value = "0.10", | |
666 | },{ | |
667 | .driver = "PCI", | |
668 | .property = "rombar", | |
669 | .value = stringify(0), | |
b1aeb926 IY |
670 | },{ |
671 | .driver = "PCI", | |
672 | .property = "command_serr_enable", | |
673 | .value = "off", | |
b91cb442 MT |
674 | },{ |
675 | .driver = "virtio-blk-pci", | |
676 | .property = "event_idx", | |
677 | .value = "off", | |
678 | },{ | |
679 | .driver = "virtio-serial-pci", | |
680 | .property = "event_idx", | |
681 | .value = "off", | |
682 | },{ | |
683 | .driver = "virtio-net-pci", | |
684 | .property = "event_idx", | |
685 | .value = "off", | |
ea830ebb AL |
686 | },{ |
687 | .driver = "virtio-balloon-pci", | |
688 | .property = "event_idx", | |
689 | .value = "off", | |
25a21c94 GH |
690 | },{ |
691 | .driver = "AC97", | |
692 | .property = "use_broken_id", | |
693 | .value = stringify(1), | |
09c6d585 HP |
694 | },{ |
695 | .driver = "isa-fdc", | |
696 | .property = "check_media_rate", | |
697 | .value = "off", | |
845773ab | 698 | }, |
1b89fafe JJ |
699 | { |
700 | .driver = "pc-sysfw", | |
701 | .property = "rom_only", | |
702 | .value = stringify(1), | |
703 | }, | |
845773ab IY |
704 | { /* end of list */ } |
705 | }, | |
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 | }, | |
845773ab IY |
721 | }; |
722 | ||
29d3ccde AP |
723 | #ifdef CONFIG_XEN |
724 | static QEMUMachine xenfv_machine = { | |
725 | .name = "xenfv", | |
726 | .desc = "Xen Fully-virtualized PC", | |
727 | .init = pc_xen_hvm_init, | |
728 | .max_cpus = HVM_MAX_VCPUS, | |
729 | .default_machine_opts = "accel=xen", | |
730 | }; | |
731 | #endif | |
732 | ||
845773ab IY |
733 | static void pc_machine_init(void) |
734 | { | |
382b3a68 | 735 | qemu_register_machine(&pc_machine_v1_1); |
19857e62 | 736 | qemu_register_machine(&pc_machine_v1_0); |
ce01a508 | 737 | qemu_register_machine(&pc_machine_v0_15); |
19857e62 | 738 | qemu_register_machine(&pc_machine_v0_14); |
b903a0f7 | 739 | qemu_register_machine(&pc_machine_v0_13); |
845773ab IY |
740 | qemu_register_machine(&pc_machine_v0_12); |
741 | qemu_register_machine(&pc_machine_v0_11); | |
742 | qemu_register_machine(&pc_machine_v0_10); | |
743 | qemu_register_machine(&isapc_machine); | |
29d3ccde AP |
744 | #ifdef CONFIG_XEN |
745 | qemu_register_machine(&xenfv_machine); | |
746 | #endif | |
845773ab IY |
747 | } |
748 | ||
749 | machine_init(pc_machine_init); |