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