]>
Commit | Line | Data |
---|---|---|
1 | #ifndef HW_PC_H | |
2 | #define HW_PC_H | |
3 | ||
4 | #include "qemu-common.h" | |
5 | #include "exec/memory.h" | |
6 | #include "hw/boards.h" | |
7 | #include "hw/isa/isa.h" | |
8 | #include "hw/block/fdc.h" | |
9 | #include "net/net.h" | |
10 | #include "hw/i386/ioapic.h" | |
11 | ||
12 | #include "qemu/range.h" | |
13 | #include "qemu/bitmap.h" | |
14 | #include "sysemu/sysemu.h" | |
15 | #include "hw/pci/pci.h" | |
16 | #include "hw/compat.h" | |
17 | #include "hw/mem/pc-dimm.h" | |
18 | #include "hw/mem/nvdimm.h" | |
19 | #include "hw/acpi/acpi_dev_interface.h" | |
20 | ||
21 | #define HPET_INTCAP "hpet-intcap" | |
22 | ||
23 | /** | |
24 | * PCMachineState: | |
25 | * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling | |
26 | * @boot_cpus: number of present VCPUs | |
27 | */ | |
28 | struct PCMachineState { | |
29 | /*< private >*/ | |
30 | MachineState parent_obj; | |
31 | ||
32 | /* <public> */ | |
33 | ||
34 | /* State for other subsystems/APIs: */ | |
35 | Notifier machine_done; | |
36 | ||
37 | /* Pointers to devices and objects: */ | |
38 | HotplugHandler *acpi_dev; | |
39 | ISADevice *rtc; | |
40 | PCIBus *bus; | |
41 | FWCfgState *fw_cfg; | |
42 | qemu_irq *gsi; | |
43 | ||
44 | /* Configuration options: */ | |
45 | uint64_t max_ram_below_4g; | |
46 | OnOffAuto vmport; | |
47 | OnOffAuto smm; | |
48 | ||
49 | AcpiNVDIMMState acpi_nvdimm_state; | |
50 | ||
51 | bool acpi_build_enabled; | |
52 | bool smbus; | |
53 | bool sata; | |
54 | bool pit; | |
55 | ||
56 | /* RAM information (sizes, addresses, configuration): */ | |
57 | ram_addr_t below_4g_mem_size, above_4g_mem_size; | |
58 | ||
59 | /* CPU and apic information: */ | |
60 | bool apic_xrupt_override; | |
61 | unsigned apic_id_limit; | |
62 | uint16_t boot_cpus; | |
63 | ||
64 | /* NUMA information: */ | |
65 | uint64_t numa_nodes; | |
66 | uint64_t *node_mem; | |
67 | ||
68 | /* Address space used by IOAPIC device. All IOAPIC interrupts | |
69 | * will be translated to MSI messages in the address space. */ | |
70 | AddressSpace *ioapic_as; | |
71 | }; | |
72 | ||
73 | #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" | |
74 | #define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size" | |
75 | #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g" | |
76 | #define PC_MACHINE_VMPORT "vmport" | |
77 | #define PC_MACHINE_SMM "smm" | |
78 | #define PC_MACHINE_NVDIMM "nvdimm" | |
79 | #define PC_MACHINE_NVDIMM_PERSIST "nvdimm-persistence" | |
80 | #define PC_MACHINE_SMBUS "smbus" | |
81 | #define PC_MACHINE_SATA "sata" | |
82 | #define PC_MACHINE_PIT "pit" | |
83 | ||
84 | /** | |
85 | * PCMachineClass: | |
86 | * | |
87 | * Compat fields: | |
88 | * | |
89 | * @enforce_aligned_dimm: check that DIMM's address/size is aligned by | |
90 | * backend's alignment value if provided | |
91 | * @acpi_data_size: Size of the chunk of memory at the top of RAM | |
92 | * for the BIOS ACPI tables and other BIOS | |
93 | * datastructures. | |
94 | * @gigabyte_align: Make sure that guest addresses aligned at | |
95 | * 1Gbyte boundaries get mapped to host | |
96 | * addresses aligned at 1Gbyte boundaries. This | |
97 | * way we can use 1GByte pages in the host. | |
98 | * | |
99 | */ | |
100 | struct PCMachineClass { | |
101 | /*< private >*/ | |
102 | MachineClass parent_class; | |
103 | ||
104 | /*< public >*/ | |
105 | ||
106 | /* Device configuration: */ | |
107 | bool pci_enabled; | |
108 | bool kvmclock_enabled; | |
109 | const char *default_nic_model; | |
110 | ||
111 | /* Compat options: */ | |
112 | ||
113 | /* ACPI compat: */ | |
114 | bool has_acpi_build; | |
115 | bool rsdp_in_ram; | |
116 | int legacy_acpi_table_size; | |
117 | unsigned acpi_data_size; | |
118 | ||
119 | /* SMBIOS compat: */ | |
120 | bool smbios_defaults; | |
121 | bool smbios_legacy_mode; | |
122 | bool smbios_uuid_encoded; | |
123 | ||
124 | /* RAM / address space compat: */ | |
125 | bool gigabyte_align; | |
126 | bool has_reserved_memory; | |
127 | bool enforce_aligned_dimm; | |
128 | bool broken_reserved_end; | |
129 | ||
130 | /* TSC rate migration: */ | |
131 | bool save_tsc_khz; | |
132 | /* generate legacy CPU hotplug AML */ | |
133 | bool legacy_cpu_hotplug; | |
134 | ||
135 | /* use DMA capable linuxboot option rom */ | |
136 | bool linuxboot_dma_enabled; | |
137 | }; | |
138 | ||
139 | #define TYPE_PC_MACHINE "generic-pc-machine" | |
140 | #define PC_MACHINE(obj) \ | |
141 | OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE) | |
142 | #define PC_MACHINE_GET_CLASS(obj) \ | |
143 | OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE) | |
144 | #define PC_MACHINE_CLASS(klass) \ | |
145 | OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE) | |
146 | ||
147 | /* i8259.c */ | |
148 | ||
149 | extern DeviceState *isa_pic; | |
150 | qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq); | |
151 | qemu_irq *kvm_i8259_init(ISABus *bus); | |
152 | int pic_read_irq(DeviceState *d); | |
153 | int pic_get_output(DeviceState *d); | |
154 | ||
155 | /* ioapic.c */ | |
156 | ||
157 | void kvm_ioapic_dump_state(Monitor *mon, const QDict *qdict); | |
158 | void ioapic_dump_state(Monitor *mon, const QDict *qdict); | |
159 | ||
160 | /* Global System Interrupts */ | |
161 | ||
162 | #define GSI_NUM_PINS IOAPIC_NUM_PINS | |
163 | ||
164 | typedef struct GSIState { | |
165 | qemu_irq i8259_irq[ISA_NUM_IRQS]; | |
166 | qemu_irq ioapic_irq[IOAPIC_NUM_PINS]; | |
167 | } GSIState; | |
168 | ||
169 | void gsi_handler(void *opaque, int n, int level); | |
170 | ||
171 | /* vmport.c */ | |
172 | #define TYPE_VMPORT "vmport" | |
173 | typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address); | |
174 | ||
175 | static inline void vmport_init(ISABus *bus) | |
176 | { | |
177 | isa_create_simple(bus, TYPE_VMPORT); | |
178 | } | |
179 | ||
180 | void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque); | |
181 | void vmmouse_get_data(uint32_t *data); | |
182 | void vmmouse_set_data(const uint32_t *data); | |
183 | ||
184 | /* pc.c */ | |
185 | extern int fd_bootchk; | |
186 | ||
187 | bool pc_machine_is_smm_enabled(PCMachineState *pcms); | |
188 | void pc_register_ferr_irq(qemu_irq irq); | |
189 | void pc_acpi_smi_interrupt(void *opaque, int irq, int level); | |
190 | ||
191 | void pc_cpus_init(PCMachineState *pcms); | |
192 | void pc_hot_add_cpu(const int64_t id, Error **errp); | |
193 | void pc_acpi_init(const char *default_dsdt); | |
194 | ||
195 | void pc_guest_info_init(PCMachineState *pcms); | |
196 | ||
197 | #define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start" | |
198 | #define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end" | |
199 | #define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start" | |
200 | #define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end" | |
201 | #define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size" | |
202 | #define PCI_HOST_BELOW_4G_MEM_SIZE "below-4g-mem-size" | |
203 | #define PCI_HOST_ABOVE_4G_MEM_SIZE "above-4g-mem-size" | |
204 | ||
205 | ||
206 | void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory, | |
207 | MemoryRegion *pci_address_space); | |
208 | ||
209 | void xen_load_linux(PCMachineState *pcms); | |
210 | void pc_memory_init(PCMachineState *pcms, | |
211 | MemoryRegion *system_memory, | |
212 | MemoryRegion *rom_memory, | |
213 | MemoryRegion **ram_memory); | |
214 | uint64_t pc_pci_hole64_start(void); | |
215 | qemu_irq pc_allocate_cpu_irq(void); | |
216 | DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); | |
217 | void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, | |
218 | ISADevice **rtc_state, | |
219 | bool create_fdctrl, | |
220 | bool no_vmport, | |
221 | bool has_pit, | |
222 | uint32_t hpet_irqs); | |
223 | void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd); | |
224 | void pc_cmos_init(PCMachineState *pcms, | |
225 | BusState *ide0, BusState *ide1, | |
226 | ISADevice *s); | |
227 | void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus); | |
228 | void pc_pci_device_init(PCIBus *pci_bus); | |
229 | ||
230 | typedef void (*cpu_set_smm_t)(int smm, void *arg); | |
231 | ||
232 | void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); | |
233 | ||
234 | ISADevice *pc_find_fdc0(void); | |
235 | int cmos_get_fd_drive_type(FloppyDriveType fd0); | |
236 | ||
237 | #define FW_CFG_IO_BASE 0x510 | |
238 | ||
239 | #define PORT92_A20_LINE "a20" | |
240 | ||
241 | /* acpi_piix.c */ | |
242 | ||
243 | I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, | |
244 | qemu_irq sci_irq, qemu_irq smi_irq, | |
245 | int smm_enabled, DeviceState **piix4_pm); | |
246 | ||
247 | /* hpet.c */ | |
248 | extern int no_hpet; | |
249 | ||
250 | /* piix_pci.c */ | |
251 | struct PCII440FXState; | |
252 | typedef struct PCII440FXState PCII440FXState; | |
253 | ||
254 | #define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost" | |
255 | #define TYPE_I440FX_PCI_DEVICE "i440FX" | |
256 | ||
257 | #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" | |
258 | ||
259 | /* | |
260 | * Reset Control Register: PCI-accessible ISA-Compatible Register at address | |
261 | * 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000). | |
262 | */ | |
263 | #define RCR_IOPORT 0xcf9 | |
264 | ||
265 | PCIBus *i440fx_init(const char *host_type, const char *pci_type, | |
266 | PCII440FXState **pi440fx_state, int *piix_devfn, | |
267 | ISABus **isa_bus, qemu_irq *pic, | |
268 | MemoryRegion *address_space_mem, | |
269 | MemoryRegion *address_space_io, | |
270 | ram_addr_t ram_size, | |
271 | ram_addr_t below_4g_mem_size, | |
272 | ram_addr_t above_4g_mem_size, | |
273 | MemoryRegion *pci_memory, | |
274 | MemoryRegion *ram_memory); | |
275 | ||
276 | PCIBus *find_i440fx(void); | |
277 | /* piix4.c */ | |
278 | extern PCIDevice *piix4_dev; | |
279 | int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn); | |
280 | ||
281 | /* pc_sysfw.c */ | |
282 | void pc_system_firmware_init(MemoryRegion *rom_memory, | |
283 | bool isapc_ram_fw); | |
284 | ||
285 | /* acpi-build.c */ | |
286 | void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, | |
287 | const CPUArchIdList *apic_ids, GArray *entry); | |
288 | ||
289 | /* e820 types */ | |
290 | #define E820_RAM 1 | |
291 | #define E820_RESERVED 2 | |
292 | #define E820_ACPI 3 | |
293 | #define E820_NVS 4 | |
294 | #define E820_UNUSABLE 5 | |
295 | ||
296 | int e820_add_entry(uint64_t, uint64_t, uint32_t); | |
297 | int e820_get_num_entries(void); | |
298 | bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); | |
299 | ||
300 | #define PC_COMPAT_2_12 \ | |
301 | HW_COMPAT_2_12 \ | |
302 | {\ | |
303 | .driver = TYPE_X86_CPU,\ | |
304 | .property = "legacy-cache",\ | |
305 | .value = "on",\ | |
306 | }, | |
307 | ||
308 | #define PC_COMPAT_2_11 \ | |
309 | HW_COMPAT_2_11 \ | |
310 | {\ | |
311 | .driver = "Skylake-Server" "-" TYPE_X86_CPU,\ | |
312 | .property = "clflushopt",\ | |
313 | .value = "off",\ | |
314 | }, | |
315 | ||
316 | #define PC_COMPAT_2_10 \ | |
317 | HW_COMPAT_2_10 \ | |
318 | {\ | |
319 | .driver = TYPE_X86_CPU,\ | |
320 | .property = "x-hv-max-vps",\ | |
321 | .value = "0x40",\ | |
322 | },{\ | |
323 | .driver = "i440FX-pcihost",\ | |
324 | .property = "x-pci-hole64-fix",\ | |
325 | .value = "off",\ | |
326 | },{\ | |
327 | .driver = "q35-pcihost",\ | |
328 | .property = "x-pci-hole64-fix",\ | |
329 | .value = "off",\ | |
330 | }, | |
331 | ||
332 | #define PC_COMPAT_2_9 \ | |
333 | HW_COMPAT_2_9 \ | |
334 | {\ | |
335 | .driver = "mch",\ | |
336 | .property = "extended-tseg-mbytes",\ | |
337 | .value = stringify(0),\ | |
338 | },\ | |
339 | ||
340 | #define PC_COMPAT_2_8 \ | |
341 | HW_COMPAT_2_8 \ | |
342 | {\ | |
343 | .driver = TYPE_X86_CPU,\ | |
344 | .property = "tcg-cpuid",\ | |
345 | .value = "off",\ | |
346 | },\ | |
347 | {\ | |
348 | .driver = "kvmclock",\ | |
349 | .property = "x-mach-use-reliable-get-clock",\ | |
350 | .value = "off",\ | |
351 | },\ | |
352 | {\ | |
353 | .driver = "ICH9-LPC",\ | |
354 | .property = "x-smi-broadcast",\ | |
355 | .value = "off",\ | |
356 | },\ | |
357 | {\ | |
358 | .driver = TYPE_X86_CPU,\ | |
359 | .property = "vmware-cpuid-freq",\ | |
360 | .value = "off",\ | |
361 | },\ | |
362 | {\ | |
363 | .driver = "Haswell-" TYPE_X86_CPU,\ | |
364 | .property = "stepping",\ | |
365 | .value = "1",\ | |
366 | }, | |
367 | ||
368 | #define PC_COMPAT_2_7 \ | |
369 | HW_COMPAT_2_7 \ | |
370 | {\ | |
371 | .driver = TYPE_X86_CPU,\ | |
372 | .property = "l3-cache",\ | |
373 | .value = "off",\ | |
374 | },\ | |
375 | {\ | |
376 | .driver = TYPE_X86_CPU,\ | |
377 | .property = "full-cpuid-auto-level",\ | |
378 | .value = "off",\ | |
379 | },\ | |
380 | {\ | |
381 | .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ | |
382 | .property = "family",\ | |
383 | .value = "15",\ | |
384 | },\ | |
385 | {\ | |
386 | .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ | |
387 | .property = "model",\ | |
388 | .value = "6",\ | |
389 | },\ | |
390 | {\ | |
391 | .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ | |
392 | .property = "stepping",\ | |
393 | .value = "1",\ | |
394 | },\ | |
395 | {\ | |
396 | .driver = "isa-pcspk",\ | |
397 | .property = "migrate",\ | |
398 | .value = "off",\ | |
399 | }, | |
400 | ||
401 | #define PC_COMPAT_2_6 \ | |
402 | HW_COMPAT_2_6 \ | |
403 | {\ | |
404 | .driver = TYPE_X86_CPU,\ | |
405 | .property = "cpuid-0xb",\ | |
406 | .value = "off",\ | |
407 | },{\ | |
408 | .driver = "vmxnet3",\ | |
409 | .property = "romfile",\ | |
410 | .value = "",\ | |
411 | },\ | |
412 | {\ | |
413 | .driver = TYPE_X86_CPU,\ | |
414 | .property = "fill-mtrr-mask",\ | |
415 | .value = "off",\ | |
416 | },\ | |
417 | {\ | |
418 | .driver = "apic-common",\ | |
419 | .property = "legacy-instance-id",\ | |
420 | .value = "on",\ | |
421 | }, | |
422 | ||
423 | #define PC_COMPAT_2_5 \ | |
424 | HW_COMPAT_2_5 | |
425 | ||
426 | /* Helper for setting model-id for CPU models that changed model-id | |
427 | * depending on QEMU versions up to QEMU 2.4. | |
428 | */ | |
429 | #define PC_CPU_MODEL_IDS(v) \ | |
430 | {\ | |
431 | .driver = "qemu32-" TYPE_X86_CPU,\ | |
432 | .property = "model-id",\ | |
433 | .value = "QEMU Virtual CPU version " v,\ | |
434 | },\ | |
435 | {\ | |
436 | .driver = "qemu64-" TYPE_X86_CPU,\ | |
437 | .property = "model-id",\ | |
438 | .value = "QEMU Virtual CPU version " v,\ | |
439 | },\ | |
440 | {\ | |
441 | .driver = "athlon-" TYPE_X86_CPU,\ | |
442 | .property = "model-id",\ | |
443 | .value = "QEMU Virtual CPU version " v,\ | |
444 | }, | |
445 | ||
446 | #define PC_COMPAT_2_4 \ | |
447 | HW_COMPAT_2_4 \ | |
448 | PC_CPU_MODEL_IDS("2.4.0") \ | |
449 | {\ | |
450 | .driver = "Haswell-" TYPE_X86_CPU,\ | |
451 | .property = "abm",\ | |
452 | .value = "off",\ | |
453 | },\ | |
454 | {\ | |
455 | .driver = "Haswell-noTSX-" TYPE_X86_CPU,\ | |
456 | .property = "abm",\ | |
457 | .value = "off",\ | |
458 | },\ | |
459 | {\ | |
460 | .driver = "Broadwell-" TYPE_X86_CPU,\ | |
461 | .property = "abm",\ | |
462 | .value = "off",\ | |
463 | },\ | |
464 | {\ | |
465 | .driver = "Broadwell-noTSX-" TYPE_X86_CPU,\ | |
466 | .property = "abm",\ | |
467 | .value = "off",\ | |
468 | },\ | |
469 | {\ | |
470 | .driver = "host" "-" TYPE_X86_CPU,\ | |
471 | .property = "host-cache-info",\ | |
472 | .value = "on",\ | |
473 | },\ | |
474 | {\ | |
475 | .driver = TYPE_X86_CPU,\ | |
476 | .property = "check",\ | |
477 | .value = "off",\ | |
478 | },\ | |
479 | {\ | |
480 | .driver = "qemu64" "-" TYPE_X86_CPU,\ | |
481 | .property = "sse4a",\ | |
482 | .value = "on",\ | |
483 | },\ | |
484 | {\ | |
485 | .driver = "qemu64" "-" TYPE_X86_CPU,\ | |
486 | .property = "abm",\ | |
487 | .value = "on",\ | |
488 | },\ | |
489 | {\ | |
490 | .driver = "qemu64" "-" TYPE_X86_CPU,\ | |
491 | .property = "popcnt",\ | |
492 | .value = "on",\ | |
493 | },\ | |
494 | {\ | |
495 | .driver = "qemu32" "-" TYPE_X86_CPU,\ | |
496 | .property = "popcnt",\ | |
497 | .value = "on",\ | |
498 | },{\ | |
499 | .driver = "Opteron_G2" "-" TYPE_X86_CPU,\ | |
500 | .property = "rdtscp",\ | |
501 | .value = "on",\ | |
502 | },{\ | |
503 | .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ | |
504 | .property = "rdtscp",\ | |
505 | .value = "on",\ | |
506 | },{\ | |
507 | .driver = "Opteron_G4" "-" TYPE_X86_CPU,\ | |
508 | .property = "rdtscp",\ | |
509 | .value = "on",\ | |
510 | },{\ | |
511 | .driver = "Opteron_G5" "-" TYPE_X86_CPU,\ | |
512 | .property = "rdtscp",\ | |
513 | .value = "on",\ | |
514 | }, | |
515 | ||
516 | ||
517 | #define PC_COMPAT_2_3 \ | |
518 | HW_COMPAT_2_3 \ | |
519 | PC_CPU_MODEL_IDS("2.3.0") \ | |
520 | {\ | |
521 | .driver = TYPE_X86_CPU,\ | |
522 | .property = "arat",\ | |
523 | .value = "off",\ | |
524 | },{\ | |
525 | .driver = "qemu64" "-" TYPE_X86_CPU,\ | |
526 | .property = "min-level",\ | |
527 | .value = stringify(4),\ | |
528 | },{\ | |
529 | .driver = "kvm64" "-" TYPE_X86_CPU,\ | |
530 | .property = "min-level",\ | |
531 | .value = stringify(5),\ | |
532 | },{\ | |
533 | .driver = "pentium3" "-" TYPE_X86_CPU,\ | |
534 | .property = "min-level",\ | |
535 | .value = stringify(2),\ | |
536 | },{\ | |
537 | .driver = "n270" "-" TYPE_X86_CPU,\ | |
538 | .property = "min-level",\ | |
539 | .value = stringify(5),\ | |
540 | },{\ | |
541 | .driver = "Conroe" "-" TYPE_X86_CPU,\ | |
542 | .property = "min-level",\ | |
543 | .value = stringify(4),\ | |
544 | },{\ | |
545 | .driver = "Penryn" "-" TYPE_X86_CPU,\ | |
546 | .property = "min-level",\ | |
547 | .value = stringify(4),\ | |
548 | },{\ | |
549 | .driver = "Nehalem" "-" TYPE_X86_CPU,\ | |
550 | .property = "min-level",\ | |
551 | .value = stringify(4),\ | |
552 | },{\ | |
553 | .driver = "n270" "-" TYPE_X86_CPU,\ | |
554 | .property = "min-xlevel",\ | |
555 | .value = stringify(0x8000000a),\ | |
556 | },{\ | |
557 | .driver = "Penryn" "-" TYPE_X86_CPU,\ | |
558 | .property = "min-xlevel",\ | |
559 | .value = stringify(0x8000000a),\ | |
560 | },{\ | |
561 | .driver = "Conroe" "-" TYPE_X86_CPU,\ | |
562 | .property = "min-xlevel",\ | |
563 | .value = stringify(0x8000000a),\ | |
564 | },{\ | |
565 | .driver = "Nehalem" "-" TYPE_X86_CPU,\ | |
566 | .property = "min-xlevel",\ | |
567 | .value = stringify(0x8000000a),\ | |
568 | },{\ | |
569 | .driver = "Westmere" "-" TYPE_X86_CPU,\ | |
570 | .property = "min-xlevel",\ | |
571 | .value = stringify(0x8000000a),\ | |
572 | },{\ | |
573 | .driver = "SandyBridge" "-" TYPE_X86_CPU,\ | |
574 | .property = "min-xlevel",\ | |
575 | .value = stringify(0x8000000a),\ | |
576 | },{\ | |
577 | .driver = "IvyBridge" "-" TYPE_X86_CPU,\ | |
578 | .property = "min-xlevel",\ | |
579 | .value = stringify(0x8000000a),\ | |
580 | },{\ | |
581 | .driver = "Haswell" "-" TYPE_X86_CPU,\ | |
582 | .property = "min-xlevel",\ | |
583 | .value = stringify(0x8000000a),\ | |
584 | },{\ | |
585 | .driver = "Haswell-noTSX" "-" TYPE_X86_CPU,\ | |
586 | .property = "min-xlevel",\ | |
587 | .value = stringify(0x8000000a),\ | |
588 | },{\ | |
589 | .driver = "Broadwell" "-" TYPE_X86_CPU,\ | |
590 | .property = "min-xlevel",\ | |
591 | .value = stringify(0x8000000a),\ | |
592 | },{\ | |
593 | .driver = "Broadwell-noTSX" "-" TYPE_X86_CPU,\ | |
594 | .property = "min-xlevel",\ | |
595 | .value = stringify(0x8000000a),\ | |
596 | },{\ | |
597 | .driver = TYPE_X86_CPU,\ | |
598 | .property = "kvm-no-smi-migration",\ | |
599 | .value = "on",\ | |
600 | }, | |
601 | ||
602 | #define PC_COMPAT_2_2 \ | |
603 | HW_COMPAT_2_2 \ | |
604 | PC_CPU_MODEL_IDS("2.2.0") \ | |
605 | {\ | |
606 | .driver = "kvm64" "-" TYPE_X86_CPU,\ | |
607 | .property = "vme",\ | |
608 | .value = "off",\ | |
609 | },\ | |
610 | {\ | |
611 | .driver = "kvm32" "-" TYPE_X86_CPU,\ | |
612 | .property = "vme",\ | |
613 | .value = "off",\ | |
614 | },\ | |
615 | {\ | |
616 | .driver = "Conroe" "-" TYPE_X86_CPU,\ | |
617 | .property = "vme",\ | |
618 | .value = "off",\ | |
619 | },\ | |
620 | {\ | |
621 | .driver = "Penryn" "-" TYPE_X86_CPU,\ | |
622 | .property = "vme",\ | |
623 | .value = "off",\ | |
624 | },\ | |
625 | {\ | |
626 | .driver = "Nehalem" "-" TYPE_X86_CPU,\ | |
627 | .property = "vme",\ | |
628 | .value = "off",\ | |
629 | },\ | |
630 | {\ | |
631 | .driver = "Westmere" "-" TYPE_X86_CPU,\ | |
632 | .property = "vme",\ | |
633 | .value = "off",\ | |
634 | },\ | |
635 | {\ | |
636 | .driver = "SandyBridge" "-" TYPE_X86_CPU,\ | |
637 | .property = "vme",\ | |
638 | .value = "off",\ | |
639 | },\ | |
640 | {\ | |
641 | .driver = "Haswell" "-" TYPE_X86_CPU,\ | |
642 | .property = "vme",\ | |
643 | .value = "off",\ | |
644 | },\ | |
645 | {\ | |
646 | .driver = "Broadwell" "-" TYPE_X86_CPU,\ | |
647 | .property = "vme",\ | |
648 | .value = "off",\ | |
649 | },\ | |
650 | {\ | |
651 | .driver = "Opteron_G1" "-" TYPE_X86_CPU,\ | |
652 | .property = "vme",\ | |
653 | .value = "off",\ | |
654 | },\ | |
655 | {\ | |
656 | .driver = "Opteron_G2" "-" TYPE_X86_CPU,\ | |
657 | .property = "vme",\ | |
658 | .value = "off",\ | |
659 | },\ | |
660 | {\ | |
661 | .driver = "Opteron_G3" "-" TYPE_X86_CPU,\ | |
662 | .property = "vme",\ | |
663 | .value = "off",\ | |
664 | },\ | |
665 | {\ | |
666 | .driver = "Opteron_G4" "-" TYPE_X86_CPU,\ | |
667 | .property = "vme",\ | |
668 | .value = "off",\ | |
669 | },\ | |
670 | {\ | |
671 | .driver = "Opteron_G5" "-" TYPE_X86_CPU,\ | |
672 | .property = "vme",\ | |
673 | .value = "off",\ | |
674 | },\ | |
675 | {\ | |
676 | .driver = "Haswell" "-" TYPE_X86_CPU,\ | |
677 | .property = "f16c",\ | |
678 | .value = "off",\ | |
679 | },\ | |
680 | {\ | |
681 | .driver = "Haswell" "-" TYPE_X86_CPU,\ | |
682 | .property = "rdrand",\ | |
683 | .value = "off",\ | |
684 | },\ | |
685 | {\ | |
686 | .driver = "Broadwell" "-" TYPE_X86_CPU,\ | |
687 | .property = "f16c",\ | |
688 | .value = "off",\ | |
689 | },\ | |
690 | {\ | |
691 | .driver = "Broadwell" "-" TYPE_X86_CPU,\ | |
692 | .property = "rdrand",\ | |
693 | .value = "off",\ | |
694 | }, | |
695 | ||
696 | #define PC_COMPAT_2_1 \ | |
697 | HW_COMPAT_2_1 \ | |
698 | PC_CPU_MODEL_IDS("2.1.0") \ | |
699 | {\ | |
700 | .driver = "coreduo" "-" TYPE_X86_CPU,\ | |
701 | .property = "vmx",\ | |
702 | .value = "on",\ | |
703 | },\ | |
704 | {\ | |
705 | .driver = "core2duo" "-" TYPE_X86_CPU,\ | |
706 | .property = "vmx",\ | |
707 | .value = "on",\ | |
708 | }, | |
709 | ||
710 | #define PC_COMPAT_2_0 \ | |
711 | PC_CPU_MODEL_IDS("2.0.0") \ | |
712 | {\ | |
713 | .driver = "virtio-scsi-pci",\ | |
714 | .property = "any_layout",\ | |
715 | .value = "off",\ | |
716 | },{\ | |
717 | .driver = "PIIX4_PM",\ | |
718 | .property = "memory-hotplug-support",\ | |
719 | .value = "off",\ | |
720 | },\ | |
721 | {\ | |
722 | .driver = "apic",\ | |
723 | .property = "version",\ | |
724 | .value = stringify(0x11),\ | |
725 | },\ | |
726 | {\ | |
727 | .driver = "nec-usb-xhci",\ | |
728 | .property = "superspeed-ports-first",\ | |
729 | .value = "off",\ | |
730 | },\ | |
731 | {\ | |
732 | .driver = "nec-usb-xhci",\ | |
733 | .property = "force-pcie-endcap",\ | |
734 | .value = "on",\ | |
735 | },\ | |
736 | {\ | |
737 | .driver = "pci-serial",\ | |
738 | .property = "prog_if",\ | |
739 | .value = stringify(0),\ | |
740 | },\ | |
741 | {\ | |
742 | .driver = "pci-serial-2x",\ | |
743 | .property = "prog_if",\ | |
744 | .value = stringify(0),\ | |
745 | },\ | |
746 | {\ | |
747 | .driver = "pci-serial-4x",\ | |
748 | .property = "prog_if",\ | |
749 | .value = stringify(0),\ | |
750 | },\ | |
751 | {\ | |
752 | .driver = "virtio-net-pci",\ | |
753 | .property = "guest_announce",\ | |
754 | .value = "off",\ | |
755 | },\ | |
756 | {\ | |
757 | .driver = "ICH9-LPC",\ | |
758 | .property = "memory-hotplug-support",\ | |
759 | .value = "off",\ | |
760 | },{\ | |
761 | .driver = "xio3130-downstream",\ | |
762 | .property = COMPAT_PROP_PCP,\ | |
763 | .value = "off",\ | |
764 | },{\ | |
765 | .driver = "ioh3420",\ | |
766 | .property = COMPAT_PROP_PCP,\ | |
767 | .value = "off",\ | |
768 | }, | |
769 | ||
770 | #define PC_COMPAT_1_7 \ | |
771 | PC_CPU_MODEL_IDS("1.7.0") \ | |
772 | {\ | |
773 | .driver = TYPE_USB_DEVICE,\ | |
774 | .property = "msos-desc",\ | |
775 | .value = "no",\ | |
776 | },\ | |
777 | {\ | |
778 | .driver = "PIIX4_PM",\ | |
779 | .property = "acpi-pci-hotplug-with-bridge-support",\ | |
780 | .value = "off",\ | |
781 | },\ | |
782 | {\ | |
783 | .driver = "hpet",\ | |
784 | .property = HPET_INTCAP,\ | |
785 | .value = stringify(4),\ | |
786 | }, | |
787 | ||
788 | #define PC_COMPAT_1_6 \ | |
789 | PC_CPU_MODEL_IDS("1.6.0") \ | |
790 | {\ | |
791 | .driver = "e1000",\ | |
792 | .property = "mitigation",\ | |
793 | .value = "off",\ | |
794 | },{\ | |
795 | .driver = "qemu64-" TYPE_X86_CPU,\ | |
796 | .property = "model",\ | |
797 | .value = stringify(2),\ | |
798 | },{\ | |
799 | .driver = "qemu32-" TYPE_X86_CPU,\ | |
800 | .property = "model",\ | |
801 | .value = stringify(3),\ | |
802 | },{\ | |
803 | .driver = "i440FX-pcihost",\ | |
804 | .property = "short_root_bus",\ | |
805 | .value = stringify(1),\ | |
806 | },{\ | |
807 | .driver = "q35-pcihost",\ | |
808 | .property = "short_root_bus",\ | |
809 | .value = stringify(1),\ | |
810 | }, | |
811 | ||
812 | #define PC_COMPAT_1_5 \ | |
813 | PC_CPU_MODEL_IDS("1.5.0") \ | |
814 | {\ | |
815 | .driver = "Conroe-" TYPE_X86_CPU,\ | |
816 | .property = "model",\ | |
817 | .value = stringify(2),\ | |
818 | },{\ | |
819 | .driver = "Conroe-" TYPE_X86_CPU,\ | |
820 | .property = "min-level",\ | |
821 | .value = stringify(2),\ | |
822 | },{\ | |
823 | .driver = "Penryn-" TYPE_X86_CPU,\ | |
824 | .property = "model",\ | |
825 | .value = stringify(2),\ | |
826 | },{\ | |
827 | .driver = "Penryn-" TYPE_X86_CPU,\ | |
828 | .property = "min-level",\ | |
829 | .value = stringify(2),\ | |
830 | },{\ | |
831 | .driver = "Nehalem-" TYPE_X86_CPU,\ | |
832 | .property = "model",\ | |
833 | .value = stringify(2),\ | |
834 | },{\ | |
835 | .driver = "Nehalem-" TYPE_X86_CPU,\ | |
836 | .property = "min-level",\ | |
837 | .value = stringify(2),\ | |
838 | },{\ | |
839 | .driver = "virtio-net-pci",\ | |
840 | .property = "any_layout",\ | |
841 | .value = "off",\ | |
842 | },{\ | |
843 | .driver = TYPE_X86_CPU,\ | |
844 | .property = "pmu",\ | |
845 | .value = "on",\ | |
846 | },{\ | |
847 | .driver = "i440FX-pcihost",\ | |
848 | .property = "short_root_bus",\ | |
849 | .value = stringify(0),\ | |
850 | },{\ | |
851 | .driver = "q35-pcihost",\ | |
852 | .property = "short_root_bus",\ | |
853 | .value = stringify(0),\ | |
854 | }, | |
855 | ||
856 | #define PC_COMPAT_1_4 \ | |
857 | PC_CPU_MODEL_IDS("1.4.0") \ | |
858 | {\ | |
859 | .driver = "scsi-hd",\ | |
860 | .property = "discard_granularity",\ | |
861 | .value = stringify(0),\ | |
862 | },{\ | |
863 | .driver = "scsi-cd",\ | |
864 | .property = "discard_granularity",\ | |
865 | .value = stringify(0),\ | |
866 | },{\ | |
867 | .driver = "scsi-disk",\ | |
868 | .property = "discard_granularity",\ | |
869 | .value = stringify(0),\ | |
870 | },{\ | |
871 | .driver = "ide-hd",\ | |
872 | .property = "discard_granularity",\ | |
873 | .value = stringify(0),\ | |
874 | },{\ | |
875 | .driver = "ide-cd",\ | |
876 | .property = "discard_granularity",\ | |
877 | .value = stringify(0),\ | |
878 | },{\ | |
879 | .driver = "ide-drive",\ | |
880 | .property = "discard_granularity",\ | |
881 | .value = stringify(0),\ | |
882 | },{\ | |
883 | .driver = "virtio-blk-pci",\ | |
884 | .property = "discard_granularity",\ | |
885 | .value = stringify(0),\ | |
886 | },{\ | |
887 | .driver = "virtio-serial-pci",\ | |
888 | .property = "vectors",\ | |
889 | /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\ | |
890 | .value = stringify(0xFFFFFFFF),\ | |
891 | },{ \ | |
892 | .driver = "virtio-net-pci", \ | |
893 | .property = "ctrl_guest_offloads", \ | |
894 | .value = "off", \ | |
895 | },{\ | |
896 | .driver = "e1000",\ | |
897 | .property = "romfile",\ | |
898 | .value = "pxe-e1000.rom",\ | |
899 | },{\ | |
900 | .driver = "ne2k_pci",\ | |
901 | .property = "romfile",\ | |
902 | .value = "pxe-ne2k_pci.rom",\ | |
903 | },{\ | |
904 | .driver = "pcnet",\ | |
905 | .property = "romfile",\ | |
906 | .value = "pxe-pcnet.rom",\ | |
907 | },{\ | |
908 | .driver = "rtl8139",\ | |
909 | .property = "romfile",\ | |
910 | .value = "pxe-rtl8139.rom",\ | |
911 | },{\ | |
912 | .driver = "virtio-net-pci",\ | |
913 | .property = "romfile",\ | |
914 | .value = "pxe-virtio.rom",\ | |
915 | },{\ | |
916 | .driver = "486-" TYPE_X86_CPU,\ | |
917 | .property = "model",\ | |
918 | .value = stringify(0),\ | |
919 | },\ | |
920 | {\ | |
921 | .driver = "n270" "-" TYPE_X86_CPU,\ | |
922 | .property = "movbe",\ | |
923 | .value = "off",\ | |
924 | },\ | |
925 | {\ | |
926 | .driver = "Westmere" "-" TYPE_X86_CPU,\ | |
927 | .property = "pclmulqdq",\ | |
928 | .value = "off",\ | |
929 | }, | |
930 | ||
931 | #define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \ | |
932 | static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \ | |
933 | { \ | |
934 | MachineClass *mc = MACHINE_CLASS(oc); \ | |
935 | optsfn(mc); \ | |
936 | mc->init = initfn; \ | |
937 | } \ | |
938 | static const TypeInfo pc_machine_type_##suffix = { \ | |
939 | .name = namestr TYPE_MACHINE_SUFFIX, \ | |
940 | .parent = TYPE_PC_MACHINE, \ | |
941 | .class_init = pc_machine_##suffix##_class_init, \ | |
942 | }; \ | |
943 | static void pc_machine_init_##suffix(void) \ | |
944 | { \ | |
945 | type_register(&pc_machine_type_##suffix); \ | |
946 | } \ | |
947 | type_init(pc_machine_init_##suffix) | |
948 | ||
949 | extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id); | |
950 | #endif |