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