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