]>
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; | |
59 | int ret, i; | |
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 | ret = kvm_irqchip_commit_routes(s); |
81 | if (ret < 0) { | |
82 | hw_error("KVM IRQ routing setup failed"); | |
83 | } | |
84 | } | |
85 | #endif /* CONFIG_KVM */ | |
86 | } | |
87 | ||
88 | static void kvm_piix3_gsi_handler(void *opaque, int n, int level) | |
89 | { | |
90 | GSIState *s = opaque; | |
91 | ||
92 | if (n < ISA_NUM_IRQS) { | |
93 | /* Kernel will forward to both PIC and IOAPIC */ | |
94 | qemu_set_irq(s->i8259_irq[n], level); | |
95 | } else { | |
96 | qemu_set_irq(s->ioapic_irq[n], level); | |
97 | } | |
98 | } | |
99 | ||
b881fbe9 | 100 | static void ioapic_init(GSIState *gsi_state) |
96051119 BS |
101 | { |
102 | DeviceState *dev; | |
103 | SysBusDevice *d; | |
104 | unsigned int i; | |
105 | ||
3d4b2649 | 106 | if (kvm_irqchip_in_kernel()) { |
a39c1d47 JK |
107 | dev = qdev_create(NULL, "kvm-ioapic"); |
108 | } else { | |
109 | dev = qdev_create(NULL, "ioapic"); | |
110 | } | |
20288345 PB |
111 | /* FIXME: this should be under the piix3. */ |
112 | object_property_add_child(object_resolve_path("i440fx", NULL), | |
113 | "ioapic", OBJECT(dev), NULL); | |
96051119 BS |
114 | qdev_init_nofail(dev); |
115 | d = sysbus_from_qdev(dev); | |
116 | sysbus_mmio_map(d, 0, 0xfec00000); | |
117 | ||
118 | for (i = 0; i < IOAPIC_NUM_PINS; i++) { | |
b881fbe9 | 119 | gsi_state->ioapic_irq[i] = qdev_get_gpio_in(dev, i); |
96051119 BS |
120 | } |
121 | } | |
122 | ||
845773ab | 123 | /* PC hardware initialisation */ |
6bd10515 | 124 | static void pc_init1(MemoryRegion *system_memory, |
aee97b84 | 125 | MemoryRegion *system_io, |
6bd10515 | 126 | ram_addr_t ram_size, |
845773ab IY |
127 | const char *boot_device, |
128 | const char *kernel_filename, | |
129 | const char *kernel_cmdline, | |
130 | const char *initrd_filename, | |
131 | const char *cpu_model, | |
0ec329da JK |
132 | int pci_enabled, |
133 | int kvmclock_enabled) | |
845773ab IY |
134 | { |
135 | int i; | |
136 | ram_addr_t below_4g_mem_size, above_4g_mem_size; | |
137 | PCIBus *pci_bus; | |
48a18b3c | 138 | ISABus *isa_bus; |
845773ab IY |
139 | PCII440FXState *i440fx_state; |
140 | int piix3_devfn = -1; | |
141 | qemu_irq *cpu_irq; | |
b881fbe9 | 142 | qemu_irq *gsi; |
845773ab | 143 | qemu_irq *i8259; |
845773ab | 144 | qemu_irq *smi_irq; |
b881fbe9 | 145 | GSIState *gsi_state; |
845773ab | 146 | DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; |
c0897e0c | 147 | BusState *idebus[MAX_IDE_BUS]; |
1d914fa0 | 148 | ISADevice *rtc_state; |
34d4260e | 149 | ISADevice *floppy; |
ae0a5466 AK |
150 | MemoryRegion *ram_memory; |
151 | MemoryRegion *pci_memory; | |
4463aee6 | 152 | MemoryRegion *rom_memory; |
845773ab IY |
153 | |
154 | pc_cpus_init(cpu_model); | |
155 | ||
0ec329da JK |
156 | if (kvmclock_enabled) { |
157 | kvmclock_create(); | |
158 | } | |
159 | ||
e0e7e67b AP |
160 | if (ram_size >= 0xe0000000 ) { |
161 | above_4g_mem_size = ram_size - 0xe0000000; | |
162 | below_4g_mem_size = 0xe0000000; | |
163 | } else { | |
164 | above_4g_mem_size = 0; | |
165 | below_4g_mem_size = ram_size; | |
166 | } | |
167 | ||
4463aee6 JK |
168 | if (pci_enabled) { |
169 | pci_memory = g_new(MemoryRegion, 1); | |
170 | memory_region_init(pci_memory, "pci", INT64_MAX); | |
171 | rom_memory = pci_memory; | |
172 | } else { | |
173 | pci_memory = NULL; | |
174 | rom_memory = system_memory; | |
175 | } | |
ae0a5466 | 176 | |
845773ab | 177 | /* allocate ram and load rom/bios */ |
29d3ccde | 178 | if (!xen_enabled()) { |
4aa63af1 AK |
179 | pc_memory_init(system_memory, |
180 | kernel_filename, kernel_cmdline, initrd_filename, | |
ae0a5466 | 181 | below_4g_mem_size, above_4g_mem_size, |
c1d23eac | 182 | pci_enabled ? rom_memory : system_memory, &ram_memory); |
29d3ccde | 183 | } |
845773ab | 184 | |
b881fbe9 | 185 | gsi_state = g_malloc0(sizeof(*gsi_state)); |
3d4b2649 | 186 | if (kvm_irqchip_in_kernel()) { |
10b61882 JK |
187 | kvm_piix3_setup_irq_routing(pci_enabled); |
188 | gsi = qemu_allocate_irqs(kvm_piix3_gsi_handler, gsi_state, | |
189 | GSI_NUM_PINS); | |
190 | } else { | |
191 | gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); | |
192 | } | |
845773ab IY |
193 | |
194 | if (pci_enabled) { | |
60573079 | 195 | pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi, |
ae0a5466 AK |
196 | system_memory, system_io, ram_size, |
197 | below_4g_mem_size, | |
198 | 0x100000000ULL - below_4g_mem_size, | |
199 | 0x100000000ULL + above_4g_mem_size, | |
200 | (sizeof(target_phys_addr_t) == 4 | |
201 | ? 0 | |
202 | : ((uint64_t)1 << 62)), | |
203 | pci_memory, ram_memory); | |
845773ab IY |
204 | } else { |
205 | pci_bus = NULL; | |
02a89b21 | 206 | i440fx_state = NULL; |
48a18b3c | 207 | isa_bus = isa_bus_new(NULL, system_io); |
57285cc3 | 208 | no_hpet = 1; |
845773ab | 209 | } |
48a18b3c | 210 | isa_bus_irqs(isa_bus, gsi); |
845773ab | 211 | |
3d4b2649 | 212 | if (kvm_irqchip_in_kernel()) { |
10b61882 JK |
213 | i8259 = kvm_i8259_init(isa_bus); |
214 | } else if (xen_enabled()) { | |
215 | i8259 = xen_interrupt_controller_init(); | |
216 | } else { | |
4bae1efe | 217 | cpu_irq = pc_allocate_cpu_irq(); |
48a18b3c | 218 | i8259 = i8259_init(isa_bus, cpu_irq[0]); |
4bae1efe RH |
219 | } |
220 | ||
43a0db35 JK |
221 | for (i = 0; i < ISA_NUM_IRQS; i++) { |
222 | gsi_state->i8259_irq[i] = i8259[i]; | |
223 | } | |
4bae1efe | 224 | if (pci_enabled) { |
b881fbe9 | 225 | ioapic_init(gsi_state); |
4bae1efe RH |
226 | } |
227 | ||
b881fbe9 | 228 | pc_register_ferr_irq(gsi[13]); |
845773ab | 229 | |
f424d5c4 | 230 | pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL); |
01195b73 SS |
231 | if (xen_enabled()) { |
232 | pci_create_simple(pci_bus, -1, "xen-platform"); | |
233 | } | |
234 | ||
845773ab | 235 | /* init basic PC hardware */ |
48a18b3c | 236 | pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled()); |
845773ab IY |
237 | |
238 | for(i = 0; i < nb_nics; i++) { | |
239 | NICInfo *nd = &nd_table[i]; | |
240 | ||
241 | if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0)) | |
48a18b3c | 242 | pc_init_ne2k_isa(isa_bus, nd); |
845773ab IY |
243 | else |
244 | pci_nic_init_nofail(nd, "e1000", NULL); | |
245 | } | |
246 | ||
75717903 | 247 | ide_drive_get(hd, MAX_IDE_BUS); |
845773ab | 248 | if (pci_enabled) { |
c0897e0c | 249 | PCIDevice *dev; |
679f4f8b SS |
250 | if (xen_enabled()) { |
251 | dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1); | |
252 | } else { | |
253 | dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); | |
254 | } | |
c0897e0c MA |
255 | idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0"); |
256 | idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1"); | |
845773ab IY |
257 | } else { |
258 | for(i = 0; i < MAX_IDE_BUS; i++) { | |
c0897e0c | 259 | ISADevice *dev; |
48a18b3c HP |
260 | dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], |
261 | ide_irq[i], | |
c0897e0c MA |
262 | hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); |
263 | idebus[i] = qdev_get_child_bus(&dev->qdev, "ide.0"); | |
845773ab IY |
264 | } |
265 | } | |
266 | ||
4a0f031d | 267 | audio_init(isa_bus, pci_enabled ? pci_bus : NULL); |
845773ab | 268 | |
c0897e0c | 269 | pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, |
34d4260e | 270 | floppy, idebus[0], idebus[1], rtc_state); |
845773ab IY |
271 | |
272 | if (pci_enabled && usb_enabled) { | |
afb9a60e | 273 | pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci"); |
845773ab IY |
274 | } |
275 | ||
276 | if (pci_enabled && acpi_enabled) { | |
845773ab IY |
277 | i2c_bus *smbus; |
278 | ||
845773ab IY |
279 | smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1); |
280 | /* TODO: Populate SPD eeprom data. */ | |
281 | smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, | |
da98c8eb | 282 | gsi[9], *smi_irq, |
845773ab | 283 | kvm_enabled()); |
a88df0b9 | 284 | smbus_eeprom_init(smbus, 8, NULL, 0); |
845773ab IY |
285 | } |
286 | ||
845773ab IY |
287 | if (pci_enabled) { |
288 | pc_pci_device_init(pci_bus); | |
289 | } | |
290 | } | |
291 | ||
292 | static void pc_init_pci(ram_addr_t ram_size, | |
293 | const char *boot_device, | |
294 | const char *kernel_filename, | |
295 | const char *kernel_cmdline, | |
296 | const char *initrd_filename, | |
297 | const char *cpu_model) | |
298 | { | |
6bd10515 | 299 | pc_init1(get_system_memory(), |
aee97b84 | 300 | get_system_io(), |
6bd10515 | 301 | ram_size, boot_device, |
845773ab | 302 | kernel_filename, kernel_cmdline, |
0ec329da JK |
303 | initrd_filename, cpu_model, 1, 1); |
304 | } | |
305 | ||
306 | static void pc_init_pci_no_kvmclock(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, |
0ec329da JK |
316 | kernel_filename, kernel_cmdline, |
317 | initrd_filename, cpu_model, 1, 0); | |
845773ab IY |
318 | } |
319 | ||
320 | static void pc_init_isa(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 | { | |
327 | if (cpu_model == NULL) | |
328 | cpu_model = "486"; | |
6bd10515 | 329 | pc_init1(get_system_memory(), |
aee97b84 | 330 | get_system_io(), |
6bd10515 | 331 | ram_size, boot_device, |
845773ab | 332 | kernel_filename, kernel_cmdline, |
0ec329da | 333 | initrd_filename, cpu_model, 0, 1); |
845773ab IY |
334 | } |
335 | ||
29d3ccde AP |
336 | #ifdef CONFIG_XEN |
337 | static void pc_xen_hvm_init(ram_addr_t ram_size, | |
338 | const char *boot_device, | |
339 | const char *kernel_filename, | |
340 | const char *kernel_cmdline, | |
341 | const char *initrd_filename, | |
342 | const char *cpu_model) | |
343 | { | |
344 | if (xen_hvm_init() != 0) { | |
345 | hw_error("xen hardware virtual machine initialisation failed"); | |
346 | } | |
347 | pc_init_pci_no_kvmclock(ram_size, boot_device, | |
348 | kernel_filename, kernel_cmdline, | |
349 | initrd_filename, cpu_model); | |
350 | xen_vcpu_init(); | |
351 | } | |
352 | #endif | |
353 | ||
382b3a68 JJ |
354 | static QEMUMachine pc_machine_v1_1 = { |
355 | .name = "pc-1.1", | |
845773ab IY |
356 | .alias = "pc", |
357 | .desc = "Standard PC", | |
358 | .init = pc_init_pci, | |
359 | .max_cpus = 255, | |
360 | .is_default = 1, | |
361 | }; | |
362 | ||
d6c73008 MT |
363 | #define PC_COMPAT_1_0 \ |
364 | {\ | |
365 | .driver = "pc-sysfw",\ | |
366 | .property = "rom_only",\ | |
367 | .value = stringify(1),\ | |
368 | }, {\ | |
369 | .driver = "isa-fdc",\ | |
370 | .property = "check_media_rate",\ | |
371 | .value = "off",\ | |
2ba1d381 DG |
372 | }, {\ |
373 | .driver = "virtio-balloon-pci",\ | |
374 | .property = "class",\ | |
375 | .value = stringify(PCI_CLASS_MEMORY_RAM),\ | |
fc34e77b AL |
376 | },{\ |
377 | .driver = "apic",\ | |
378 | .property = "vapic",\ | |
379 | .value = "off",\ | |
eeb0cf9a GH |
380 | },{\ |
381 | .driver = "USB",\ | |
382 | .property = "full-path",\ | |
383 | .value = "no",\ | |
d6c73008 MT |
384 | } |
385 | ||
382b3a68 JJ |
386 | static QEMUMachine pc_machine_v1_0 = { |
387 | .name = "pc-1.0", | |
388 | .desc = "Standard PC", | |
389 | .init = pc_init_pci, | |
390 | .max_cpus = 255, | |
1b89fafe | 391 | .compat_props = (GlobalProperty[]) { |
d6c73008 | 392 | PC_COMPAT_1_0, |
1b89fafe JJ |
393 | { /* end of list */ } |
394 | }, | |
382b3a68 JJ |
395 | }; |
396 | ||
d6c73008 MT |
397 | #define PC_COMPAT_0_15 \ |
398 | PC_COMPAT_1_0 | |
399 | ||
ce01a508 AL |
400 | static QEMUMachine pc_machine_v0_15 = { |
401 | .name = "pc-0.15", | |
402 | .desc = "Standard PC", | |
403 | .init = pc_init_pci, | |
404 | .max_cpus = 255, | |
1b89fafe | 405 | .compat_props = (GlobalProperty[]) { |
d6c73008 | 406 | PC_COMPAT_0_15, |
1b89fafe JJ |
407 | { /* end of list */ } |
408 | }, | |
ce01a508 AL |
409 | }; |
410 | ||
d6c73008 MT |
411 | #define PC_COMPAT_0_14 \ |
412 | PC_COMPAT_0_15,\ | |
413 | {\ | |
414 | .driver = "virtio-blk-pci",\ | |
415 | .property = "event_idx",\ | |
416 | .value = "off",\ | |
417 | },{\ | |
418 | .driver = "virtio-serial-pci",\ | |
419 | .property = "event_idx",\ | |
420 | .value = "off",\ | |
421 | },{\ | |
422 | .driver = "virtio-net-pci",\ | |
423 | .property = "event_idx",\ | |
424 | .value = "off",\ | |
425 | },{\ | |
426 | .driver = "virtio-balloon-pci",\ | |
427 | .property = "event_idx",\ | |
428 | .value = "off",\ | |
429 | } | |
430 | ||
19857e62 GH |
431 | static QEMUMachine pc_machine_v0_14 = { |
432 | .name = "pc-0.14", | |
433 | .desc = "Standard PC", | |
434 | .init = pc_init_pci, | |
435 | .max_cpus = 255, | |
3827cdb1 | 436 | .compat_props = (GlobalProperty[]) { |
d6c73008 | 437 | PC_COMPAT_0_14, |
3827cdb1 AL |
438 | { |
439 | .driver = "qxl", | |
440 | .property = "revision", | |
441 | .value = stringify(2), | |
442 | },{ | |
443 | .driver = "qxl-vga", | |
444 | .property = "revision", | |
445 | .value = stringify(2), | |
1b89fafe | 446 | }, |
3827cdb1 AL |
447 | { /* end of list */ } |
448 | }, | |
19857e62 GH |
449 | }; |
450 | ||
d6c73008 MT |
451 | #define PC_COMPAT_0_13 \ |
452 | PC_COMPAT_0_14,\ | |
453 | {\ | |
454 | .driver = "PCI",\ | |
455 | .property = "command_serr_enable",\ | |
456 | .value = "off",\ | |
457 | },{\ | |
458 | .driver = "AC97",\ | |
459 | .property = "use_broken_id",\ | |
460 | .value = stringify(1),\ | |
461 | } | |
462 | ||
b903a0f7 GH |
463 | static QEMUMachine pc_machine_v0_13 = { |
464 | .name = "pc-0.13", | |
465 | .desc = "Standard PC", | |
0ec329da | 466 | .init = pc_init_pci_no_kvmclock, |
b903a0f7 | 467 | .max_cpus = 255, |
9dbcca5a | 468 | .compat_props = (GlobalProperty[]) { |
d6c73008 | 469 | PC_COMPAT_0_13, |
9dbcca5a GH |
470 | { |
471 | .driver = "virtio-9p-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), | |
1b89fafe | 482 | }, |
9dbcca5a GH |
483 | { /* end of list */ } |
484 | }, | |
b903a0f7 GH |
485 | }; |
486 | ||
d6c73008 MT |
487 | #define PC_COMPAT_0_12 \ |
488 | PC_COMPAT_0_13,\ | |
489 | {\ | |
490 | .driver = "virtio-serial-pci",\ | |
491 | .property = "max_ports",\ | |
492 | .value = stringify(1),\ | |
493 | },{\ | |
494 | .driver = "virtio-serial-pci",\ | |
495 | .property = "vectors",\ | |
496 | .value = stringify(0),\ | |
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[]) { | |
d6c73008 | 505 | PC_COMPAT_0_12, |
845773ab | 506 | { |
281a26b1 GH |
507 | .driver = "VGA", |
508 | .property = "rombar", | |
509 | .value = stringify(0), | |
510 | },{ | |
511 | .driver = "vmware-svga", | |
512 | .property = "rombar", | |
513 | .value = stringify(0), | |
1b89fafe | 514 | }, |
845773ab IY |
515 | { /* end of list */ } |
516 | } | |
517 | }; | |
518 | ||
d6c73008 MT |
519 | #define PC_COMPAT_0_11 \ |
520 | PC_COMPAT_0_12,\ | |
521 | {\ | |
522 | .driver = "virtio-blk-pci",\ | |
523 | .property = "vectors",\ | |
524 | .value = stringify(0),\ | |
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); |