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