]>
Commit | Line | Data |
---|---|---|
87ecb68b PB |
1 | #ifndef HW_PC_H |
2 | #define HW_PC_H | |
376253ec AL |
3 | |
4 | #include "qemu-common.h" | |
022c62cb | 5 | #include "exec/memory.h" |
9521d42b | 6 | #include "hw/boards.h" |
0d09e41a PB |
7 | #include "hw/isa/isa.h" |
8 | #include "hw/block/fdc.h" | |
1422e32d | 9 | #include "net/net.h" |
0d09e41a | 10 | #include "hw/i386/ioapic.h" |
376253ec | 11 | |
3459a625 | 12 | #include "qemu/range.h" |
b20c9bd5 MT |
13 | #include "qemu/bitmap.h" |
14 | #include "sysemu/sysemu.h" | |
15 | #include "hw/pci/pci.h" | |
68a27b20 | 16 | #include "hw/compat.h" |
a7d69ff1 | 17 | #include "hw/mem/pc-dimm.h" |
5fe79386 | 18 | #include "hw/mem/nvdimm.h" |
ac35f13b | 19 | #include "hw/acpi/acpi_dev_interface.h" |
3459a625 | 20 | |
7a10ef51 LPF |
21 | #define HPET_INTCAP "hpet-intcap" |
22 | ||
619d11e4 IM |
23 | /** |
24 | * PCMachineState: | |
781bbd6b | 25 | * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling |
e3cadac0 | 26 | * @boot_cpus: number of present VCPUs |
619d11e4 | 27 | */ |
d5747cac IM |
28 | struct PCMachineState { |
29 | /*< private >*/ | |
30 | MachineState parent_obj; | |
619d11e4 IM |
31 | |
32 | /* <public> */ | |
13fc8343 EH |
33 | |
34 | /* State for other subsystems/APIs: */ | |
a7d69ff1 | 35 | MemoryHotplugState hotplug_memory; |
9ebeed0c | 36 | Notifier machine_done; |
781bbd6b | 37 | |
13fc8343 | 38 | /* Pointers to devices and objects: */ |
781bbd6b | 39 | HotplugHandler *acpi_dev; |
2d996150 | 40 | ISADevice *rtc; |
13fc8343 | 41 | PCIBus *bus; |
f264d360 | 42 | FWCfgState *fw_cfg; |
3e6c0c4c | 43 | qemu_irq *gsi; |
c87b1520 | 44 | |
13fc8343 | 45 | /* Configuration options: */ |
c87b1520 | 46 | uint64_t max_ram_below_4g; |
d1048bef | 47 | OnOffAuto vmport; |
355023f2 | 48 | OnOffAuto smm; |
5fe79386 XG |
49 | |
50 | AcpiNVDIMMState acpi_nvdimm_state; | |
13fc8343 | 51 | |
021746c1 | 52 | bool acpi_build_enabled; |
be232eb0 | 53 | bool smbus; |
272f0428 | 54 | bool sata; |
feddd2fd | 55 | bool pit; |
021746c1 | 56 | |
13fc8343 | 57 | /* RAM information (sizes, addresses, configuration): */ |
c0aa4e1e | 58 | ram_addr_t below_4g_mem_size, above_4g_mem_size; |
dd4c2f01 EH |
59 | |
60 | /* CPU and apic information: */ | |
61 | bool apic_xrupt_override; | |
62 | unsigned apic_id_limit; | |
e3cadac0 | 63 | uint16_t boot_cpus; |
dd4c2f01 EH |
64 | |
65 | /* NUMA information: */ | |
66 | uint64_t numa_nodes; | |
67 | uint64_t *node_mem; | |
cb135f59 PX |
68 | |
69 | /* Address space used by IOAPIC device. All IOAPIC interrupts | |
70 | * will be translated to MSI messages in the address space. */ | |
71 | AddressSpace *ioapic_as; | |
d5747cac IM |
72 | }; |
73 | ||
781bbd6b | 74 | #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" |
bf1e8939 | 75 | #define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size" |
c87b1520 | 76 | #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g" |
9b23cfb7 | 77 | #define PC_MACHINE_VMPORT "vmport" |
355023f2 | 78 | #define PC_MACHINE_SMM "smm" |
87252e1b | 79 | #define PC_MACHINE_NVDIMM "nvdimm" |
be232eb0 | 80 | #define PC_MACHINE_SMBUS "smbus" |
272f0428 | 81 | #define PC_MACHINE_SATA "sata" |
feddd2fd | 82 | #define PC_MACHINE_PIT "pit" |
781bbd6b | 83 | |
95bee274 IM |
84 | /** |
85 | * PCMachineClass: | |
13fc8343 EH |
86 | * |
87 | * Methods: | |
88 | * | |
95bee274 | 89 | * @get_hotplug_handler: pointer to parent class callback @get_hotplug_handler |
13fc8343 EH |
90 | * |
91 | * Compat fields: | |
92 | * | |
16a9e8a5 EH |
93 | * @enforce_aligned_dimm: check that DIMM's address/size is aligned by |
94 | * backend's alignment value if provided | |
13fc8343 EH |
95 | * @acpi_data_size: Size of the chunk of memory at the top of RAM |
96 | * for the BIOS ACPI tables and other BIOS | |
97 | * datastructures. | |
98 | * @gigabyte_align: Make sure that guest addresses aligned at | |
99 | * 1Gbyte boundaries get mapped to host | |
100 | * addresses aligned at 1Gbyte boundaries. This | |
101 | * way we can use 1GByte pages in the host. | |
102 | * | |
95bee274 | 103 | */ |
d5747cac IM |
104 | struct PCMachineClass { |
105 | /*< private >*/ | |
106 | MachineClass parent_class; | |
95bee274 IM |
107 | |
108 | /*< public >*/ | |
13fc8343 EH |
109 | |
110 | /* Methods: */ | |
95bee274 IM |
111 | HotplugHandler *(*get_hotplug_handler)(MachineState *machine, |
112 | DeviceState *dev); | |
7102fa70 | 113 | |
13fc8343 | 114 | /* Device configuration: */ |
7102fa70 | 115 | bool pci_enabled; |
13fc8343 | 116 | bool kvmclock_enabled; |
4b9c264b | 117 | const char *default_nic_model; |
13fc8343 EH |
118 | |
119 | /* Compat options: */ | |
120 | ||
121 | /* ACPI compat: */ | |
7102fa70 EH |
122 | bool has_acpi_build; |
123 | bool rsdp_in_ram; | |
13fc8343 EH |
124 | int legacy_acpi_table_size; |
125 | unsigned acpi_data_size; | |
126 | ||
127 | /* SMBIOS compat: */ | |
7102fa70 EH |
128 | bool smbios_defaults; |
129 | bool smbios_legacy_mode; | |
130 | bool smbios_uuid_encoded; | |
13fc8343 EH |
131 | |
132 | /* RAM / address space compat: */ | |
7102fa70 EH |
133 | bool gigabyte_align; |
134 | bool has_reserved_memory; | |
16a9e8a5 | 135 | bool enforce_aligned_dimm; |
13fc8343 | 136 | bool broken_reserved_end; |
36f96c4b HZ |
137 | |
138 | /* TSC rate migration: */ | |
139 | bool save_tsc_khz; | |
679dd1a9 IM |
140 | /* generate legacy CPU hotplug AML */ |
141 | bool legacy_cpu_hotplug; | |
98e753a6 IM |
142 | |
143 | /* use DMA capable linuxboot option rom */ | |
144 | bool linuxboot_dma_enabled; | |
d5747cac IM |
145 | }; |
146 | ||
d5747cac IM |
147 | #define TYPE_PC_MACHINE "generic-pc-machine" |
148 | #define PC_MACHINE(obj) \ | |
149 | OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE) | |
150 | #define PC_MACHINE_GET_CLASS(obj) \ | |
151 | OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE) | |
152 | #define PC_MACHINE_CLASS(klass) \ | |
153 | OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE) | |
154 | ||
87ecb68b PB |
155 | /* i8259.c */ |
156 | ||
9aa78c42 | 157 | extern DeviceState *isa_pic; |
48a18b3c | 158 | qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq); |
10b61882 | 159 | qemu_irq *kvm_i8259_init(ISABus *bus); |
9aa78c42 JK |
160 | int pic_read_irq(DeviceState *d); |
161 | int pic_get_output(DeviceState *d); | |
87ecb68b | 162 | |
d665d696 PB |
163 | /* ioapic.c */ |
164 | ||
165 | void kvm_ioapic_dump_state(Monitor *mon, const QDict *qdict); | |
6bde8fd6 | 166 | void ioapic_dump_state(Monitor *mon, const QDict *qdict); |
d665d696 | 167 | |
b881fbe9 | 168 | /* Global System Interrupts */ |
96051119 | 169 | |
b881fbe9 | 170 | #define GSI_NUM_PINS IOAPIC_NUM_PINS |
845773ab | 171 | |
b881fbe9 | 172 | typedef struct GSIState { |
43a0db35 | 173 | qemu_irq i8259_irq[ISA_NUM_IRQS]; |
b881fbe9 JK |
174 | qemu_irq ioapic_irq[IOAPIC_NUM_PINS]; |
175 | } GSIState; | |
176 | ||
177 | void gsi_handler(void *opaque, int n, int level); | |
845773ab | 178 | |
87ecb68b | 179 | /* vmport.c */ |
936a6447 | 180 | #define TYPE_VMPORT "vmport" |
d67f679d JK |
181 | typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address); |
182 | ||
48a18b3c | 183 | static inline void vmport_init(ISABus *bus) |
6872ef61 | 184 | { |
936a6447 | 185 | isa_create_simple(bus, TYPE_VMPORT); |
6872ef61 | 186 | } |
d67f679d JK |
187 | |
188 | void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque); | |
86d86414 BS |
189 | void vmmouse_get_data(uint32_t *data); |
190 | void vmmouse_set_data(const uint32_t *data); | |
87ecb68b | 191 | |
87ecb68b PB |
192 | /* pc.c */ |
193 | extern int fd_bootchk; | |
194 | ||
355023f2 | 195 | bool pc_machine_is_smm_enabled(PCMachineState *pcms); |
8e78eb28 | 196 | void pc_register_ferr_irq(qemu_irq irq); |
845773ab IY |
197 | void pc_acpi_smi_interrupt(void *opaque, int irq, int level); |
198 | ||
4884b7bf | 199 | void pc_cpus_init(PCMachineState *pcms); |
c649983b | 200 | void pc_hot_add_cpu(const int64_t id, Error **errp); |
f7e4dd6c | 201 | void pc_acpi_init(const char *default_dsdt); |
3459a625 | 202 | |
e4e8ba04 | 203 | void pc_guest_info_init(PCMachineState *pcms); |
3459a625 | 204 | |
39848901 IM |
205 | #define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start" |
206 | #define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end" | |
207 | #define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start" | |
208 | #define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end" | |
209 | #define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size" | |
401f2f3e EV |
210 | #define PCI_HOST_BELOW_4G_MEM_SIZE "below-4g-mem-size" |
211 | #define PCI_HOST_ABOVE_4G_MEM_SIZE "above-4g-mem-size" | |
1466cef3 | 212 | |
39848901 | 213 | |
83d08f26 MT |
214 | void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory, |
215 | MemoryRegion *pci_address_space); | |
39848901 | 216 | |
7bc35e0f | 217 | void xen_load_linux(PCMachineState *pcms); |
5934e216 EH |
218 | void pc_memory_init(PCMachineState *pcms, |
219 | MemoryRegion *system_memory, | |
220 | MemoryRegion *rom_memory, | |
221 | MemoryRegion **ram_memory); | |
9fa99d25 | 222 | uint64_t pc_pci_hole64_start(void); |
0b0cc076 | 223 | qemu_irq pc_allocate_cpu_irq(void); |
48a18b3c HP |
224 | DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); |
225 | void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, | |
1611977c | 226 | ISADevice **rtc_state, |
fd53c87c | 227 | bool create_fdctrl, |
7a10ef51 | 228 | bool no_vmport, |
feddd2fd | 229 | bool has_pit, |
3a87d009 | 230 | uint32_t hpet_irqs); |
48a18b3c | 231 | void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd); |
23d30407 | 232 | void pc_cmos_init(PCMachineState *pcms, |
220a8846 | 233 | BusState *ide0, BusState *ide1, |
63ffb564 | 234 | ISADevice *s); |
4b9c264b | 235 | void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus); |
845773ab | 236 | void pc_pci_device_init(PCIBus *pci_bus); |
8e78eb28 | 237 | |
f885f1ea | 238 | typedef void (*cpu_set_smm_t)(int smm, void *arg); |
f885f1ea | 239 | |
a39e3564 JB |
240 | void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); |
241 | ||
424e4a87 | 242 | ISADevice *pc_find_fdc0(void); |
bda05509 | 243 | int cmos_get_fd_drive_type(FloppyDriveType fd0); |
424e4a87 | 244 | |
305ae888 GS |
245 | #define FW_CFG_IO_BASE 0x510 |
246 | ||
d812b3d6 EV |
247 | #define PORT92_A20_LINE "a20" |
248 | ||
9d5e77a2 | 249 | /* acpi_piix.c */ |
53b67b30 | 250 | |
a5c82852 AF |
251 | I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, |
252 | qemu_irq sci_irq, qemu_irq smi_irq, | |
61e66c62 | 253 | int smm_enabled, DeviceState **piix4_pm); |
87ecb68b | 254 | |
16b29ae1 AL |
255 | /* hpet.c */ |
256 | extern int no_hpet; | |
257 | ||
87ecb68b | 258 | /* piix_pci.c */ |
0a3bacf3 JQ |
259 | struct PCII440FXState; |
260 | typedef struct PCII440FXState PCII440FXState; | |
261 | ||
7bb836e4 MT |
262 | #define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost" |
263 | #define TYPE_I440FX_PCI_DEVICE "i440FX" | |
264 | ||
595a4f07 TC |
265 | #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" |
266 | ||
6103451a PDJ |
267 | /* |
268 | * Reset Control Register: PCI-accessible ISA-Compatible Register at address | |
269 | * 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000). | |
270 | */ | |
271 | #define RCR_IOPORT 0xcf9 | |
272 | ||
7bb836e4 MT |
273 | PCIBus *i440fx_init(const char *host_type, const char *pci_type, |
274 | PCII440FXState **pi440fx_state, int *piix_devfn, | |
60573079 | 275 | ISABus **isa_bus, qemu_irq *pic, |
aee97b84 AK |
276 | MemoryRegion *address_space_mem, |
277 | MemoryRegion *address_space_io, | |
ae0a5466 | 278 | ram_addr_t ram_size, |
ddaaefb4 | 279 | ram_addr_t below_4g_mem_size, |
39848901 | 280 | ram_addr_t above_4g_mem_size, |
ae0a5466 AK |
281 | MemoryRegion *pci_memory, |
282 | MemoryRegion *ram_memory); | |
87ecb68b | 283 | |
277e9340 | 284 | PCIBus *find_i440fx(void); |
823e675a | 285 | /* piix4.c */ |
b1d8e52e | 286 | extern PCIDevice *piix4_dev; |
142e9787 | 287 | int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn); |
87ecb68b | 288 | |
cbc5b5f3 | 289 | /* pc_sysfw.c */ |
6dd2a5c9 PB |
290 | void pc_system_firmware_init(MemoryRegion *rom_memory, |
291 | bool isapc_ram_fw); | |
cbc5b5f3 | 292 | |
ac35f13b IM |
293 | /* acpi-build.c */ |
294 | void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, | |
80e5db30 | 295 | const CPUArchIdList *apic_ids, GArray *entry); |
ac35f13b | 296 | |
4c5b10b7 JS |
297 | /* e820 types */ |
298 | #define E820_RAM 1 | |
299 | #define E820_RESERVED 2 | |
300 | #define E820_ACPI 3 | |
301 | #define E820_NVS 4 | |
302 | #define E820_UNUSABLE 5 | |
303 | ||
304 | int e820_add_entry(uint64_t, uint64_t, uint32_t); | |
7bf8ef19 GS |
305 | int e820_get_num_entries(void); |
306 | bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *); | |
4c5b10b7 | 307 | |
df47ce8a HZ |
308 | #define PC_COMPAT_2_11 \ |
309 | HW_COMPAT_2_11 \ | |
c68bcb3a HZ |
310 | {\ |
311 | .driver = "Skylake-Server" "-" TYPE_X86_CPU,\ | |
312 | .property = "clflushopt",\ | |
313 | .value = "off",\ | |
314 | }, | |
df47ce8a | 315 | |
a6fd5b0e MA |
316 | #define PC_COMPAT_2_10 \ |
317 | HW_COMPAT_2_10 \ | |
6c69dfb6 GA |
318 | {\ |
319 | .driver = TYPE_X86_CPU,\ | |
320 | .property = "x-hv-max-vps",\ | |
321 | .value = "0x40",\ | |
9fa99d25 MA |
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",\ | |
6c69dfb6 | 330 | }, |
a6fd5b0e | 331 | |
465238d9 PX |
332 | #define PC_COMPAT_2_9 \ |
333 | HW_COMPAT_2_9 \ | |
2f295167 LE |
334 | {\ |
335 | .driver = "mch",\ | |
336 | .property = "extended-tseg-mbytes",\ | |
337 | .value = stringify(0),\ | |
338 | },\ | |
465238d9 | 339 | |
14c985cf | 340 | #define PC_COMPAT_2_8 \ |
abc62c89 | 341 | HW_COMPAT_2_8 \ |
1ce36bfe DB |
342 | {\ |
343 | .driver = TYPE_X86_CPU,\ | |
344 | .property = "tcg-cpuid",\ | |
345 | .value = "off",\ | |
346 | },\ | |
6053a86f MT |
347 | {\ |
348 | .driver = "kvmclock",\ | |
349 | .property = "x-mach-use-reliable-get-clock",\ | |
350 | .value = "off",\ | |
351 | },\ | |
b8bab8eb LE |
352 | {\ |
353 | .driver = "ICH9-LPC",\ | |
354 | .property = "x-smi-broadcast",\ | |
355 | .value = "off",\ | |
356 | },\ | |
0b564e6f PDJ |
357 | {\ |
358 | .driver = TYPE_X86_CPU,\ | |
359 | .property = "vmware-cpuid-freq",\ | |
360 | .value = "off",\ | |
ec56a4a7 EH |
361 | },\ |
362 | {\ | |
363 | .driver = "Haswell-" TYPE_X86_CPU,\ | |
364 | .property = "stepping",\ | |
365 | .value = "1",\ | |
0b564e6f | 366 | }, |
abc62c89 MT |
367 | |
368 | #define PC_COMPAT_2_7 \ | |
369 | HW_COMPAT_2_7 \ | |
14c985cf LM |
370 | {\ |
371 | .driver = TYPE_X86_CPU,\ | |
372 | .property = "l3-cache",\ | |
373 | .value = "off",\ | |
c39c0edf EH |
374 | },\ |
375 | {\ | |
376 | .driver = TYPE_X86_CPU,\ | |
377 | .property = "full-cpuid-auto-level",\ | |
378 | .value = "off",\ | |
339892d7 EY |
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",\ | |
f9f885b7 DDAG |
394 | },\ |
395 | {\ | |
396 | .driver = "isa-pcspk",\ | |
397 | .property = "migrate",\ | |
398 | .value = "off",\ | |
14c985cf LM |
399 | }, |
400 | ||
d86c1451 | 401 | #define PC_COMPAT_2_6 \ |
5232d00a RK |
402 | HW_COMPAT_2_6 \ |
403 | {\ | |
404 | .driver = TYPE_X86_CPU,\ | |
405 | .property = "cpuid-0xb",\ | |
406 | .value = "off",\ | |
43716de6 GH |
407 | },{\ |
408 | .driver = "vmxnet3",\ | |
409 | .property = "romfile",\ | |
410 | .value = "",\ | |
fcc35e7c DDAG |
411 | },\ |
412 | {\ | |
413 | .driver = TYPE_X86_CPU,\ | |
414 | .property = "fill-mtrr-mask",\ | |
415 | .value = "off",\ | |
f6e98444 IM |
416 | },\ |
417 | {\ | |
7298d4fd | 418 | .driver = "apic-common",\ |
f6e98444 IM |
419 | .property = "legacy-instance-id",\ |
420 | .value = "on",\ | |
5232d00a | 421 | }, |
d86c1451 | 422 | |
240240d5 EH |
423 | #define PC_COMPAT_2_5 \ |
424 | HW_COMPAT_2_5 | |
425 | ||
cd6c1b70 EH |
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 | ||
87e896ab | 446 | #define PC_COMPAT_2_4 \ |
276a65ba | 447 | HW_COMPAT_2_4 \ |
cd6c1b70 | 448 | PC_CPU_MODEL_IDS("2.4.0") \ |
276a65ba EH |
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 | }, | |
87e896ab | 515 | |
33b5e8c0 | 516 | |
42134ac9 | 517 | #define PC_COMPAT_2_3 \ |
276a65ba | 518 | HW_COMPAT_2_3 \ |
cd6c1b70 | 519 | PC_CPU_MODEL_IDS("2.3.0") \ |
276a65ba EH |
520 | {\ |
521 | .driver = TYPE_X86_CPU,\ | |
522 | .property = "arat",\ | |
523 | .value = "off",\ | |
524 | },{\ | |
525 | .driver = "qemu64" "-" TYPE_X86_CPU,\ | |
1f435716 | 526 | .property = "min-level",\ |
276a65ba EH |
527 | .value = stringify(4),\ |
528 | },{\ | |
529 | .driver = "kvm64" "-" TYPE_X86_CPU,\ | |
1f435716 | 530 | .property = "min-level",\ |
276a65ba EH |
531 | .value = stringify(5),\ |
532 | },{\ | |
533 | .driver = "pentium3" "-" TYPE_X86_CPU,\ | |
1f435716 | 534 | .property = "min-level",\ |
276a65ba EH |
535 | .value = stringify(2),\ |
536 | },{\ | |
537 | .driver = "n270" "-" TYPE_X86_CPU,\ | |
1f435716 | 538 | .property = "min-level",\ |
276a65ba EH |
539 | .value = stringify(5),\ |
540 | },{\ | |
541 | .driver = "Conroe" "-" TYPE_X86_CPU,\ | |
1f435716 | 542 | .property = "min-level",\ |
276a65ba EH |
543 | .value = stringify(4),\ |
544 | },{\ | |
545 | .driver = "Penryn" "-" TYPE_X86_CPU,\ | |
1f435716 | 546 | .property = "min-level",\ |
276a65ba EH |
547 | .value = stringify(4),\ |
548 | },{\ | |
549 | .driver = "Nehalem" "-" TYPE_X86_CPU,\ | |
1f435716 | 550 | .property = "min-level",\ |
276a65ba EH |
551 | .value = stringify(4),\ |
552 | },{\ | |
553 | .driver = "n270" "-" TYPE_X86_CPU,\ | |
1f435716 | 554 | .property = "min-xlevel",\ |
276a65ba EH |
555 | .value = stringify(0x8000000a),\ |
556 | },{\ | |
557 | .driver = "Penryn" "-" TYPE_X86_CPU,\ | |
1f435716 | 558 | .property = "min-xlevel",\ |
276a65ba EH |
559 | .value = stringify(0x8000000a),\ |
560 | },{\ | |
561 | .driver = "Conroe" "-" TYPE_X86_CPU,\ | |
1f435716 | 562 | .property = "min-xlevel",\ |
276a65ba EH |
563 | .value = stringify(0x8000000a),\ |
564 | },{\ | |
565 | .driver = "Nehalem" "-" TYPE_X86_CPU,\ | |
1f435716 | 566 | .property = "min-xlevel",\ |
276a65ba EH |
567 | .value = stringify(0x8000000a),\ |
568 | },{\ | |
569 | .driver = "Westmere" "-" TYPE_X86_CPU,\ | |
1f435716 | 570 | .property = "min-xlevel",\ |
276a65ba EH |
571 | .value = stringify(0x8000000a),\ |
572 | },{\ | |
573 | .driver = "SandyBridge" "-" TYPE_X86_CPU,\ | |
1f435716 | 574 | .property = "min-xlevel",\ |
276a65ba EH |
575 | .value = stringify(0x8000000a),\ |
576 | },{\ | |
577 | .driver = "IvyBridge" "-" TYPE_X86_CPU,\ | |
1f435716 | 578 | .property = "min-xlevel",\ |
276a65ba EH |
579 | .value = stringify(0x8000000a),\ |
580 | },{\ | |
581 | .driver = "Haswell" "-" TYPE_X86_CPU,\ | |
1f435716 | 582 | .property = "min-xlevel",\ |
276a65ba EH |
583 | .value = stringify(0x8000000a),\ |
584 | },{\ | |
585 | .driver = "Haswell-noTSX" "-" TYPE_X86_CPU,\ | |
1f435716 | 586 | .property = "min-xlevel",\ |
276a65ba EH |
587 | .value = stringify(0x8000000a),\ |
588 | },{\ | |
589 | .driver = "Broadwell" "-" TYPE_X86_CPU,\ | |
1f435716 | 590 | .property = "min-xlevel",\ |
276a65ba EH |
591 | .value = stringify(0x8000000a),\ |
592 | },{\ | |
593 | .driver = "Broadwell-noTSX" "-" TYPE_X86_CPU,\ | |
1f435716 | 594 | .property = "min-xlevel",\ |
276a65ba | 595 | .value = stringify(0x8000000a),\ |
fc3a1fd7 DDAG |
596 | },{\ |
597 | .driver = TYPE_X86_CPU,\ | |
598 | .property = "kvm-no-smi-migration",\ | |
599 | .value = "on",\ | |
276a65ba | 600 | }, |
42134ac9 EH |
601 | |
602 | #define PC_COMPAT_2_2 \ | |
276a65ba | 603 | HW_COMPAT_2_2 \ |
0ab126f1 | 604 | PC_CPU_MODEL_IDS("2.2.0") \ |
276a65ba EH |
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 | }, | |
42134ac9 EH |
695 | |
696 | #define PC_COMPAT_2_1 \ | |
276a65ba | 697 | HW_COMPAT_2_1 \ |
cd6c1b70 | 698 | PC_CPU_MODEL_IDS("2.1.0") \ |
276a65ba EH |
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 | }, | |
42134ac9 | 709 | |
9df11c9f | 710 | #define PC_COMPAT_2_0 \ |
cd6c1b70 | 711 | PC_CPU_MODEL_IDS("2.0.0") \ |
276a65ba EH |
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 | }, | |
9df11c9f | 769 | |
5319dc7b | 770 | #define PC_COMPAT_1_7 \ |
cd6c1b70 | 771 | PC_CPU_MODEL_IDS("1.7.0") \ |
276a65ba EH |
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 | }, | |
5319dc7b | 787 | |
e9845f09 | 788 | #define PC_COMPAT_1_6 \ |
cd6c1b70 | 789 | PC_CPU_MODEL_IDS("1.6.0") \ |
276a65ba EH |
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 | }, | |
e9845f09 | 811 | |
ffce9ebb | 812 | #define PC_COMPAT_1_5 \ |
cd6c1b70 | 813 | PC_CPU_MODEL_IDS("1.5.0") \ |
276a65ba EH |
814 | {\ |
815 | .driver = "Conroe-" TYPE_X86_CPU,\ | |
816 | .property = "model",\ | |
817 | .value = stringify(2),\ | |
818 | },{\ | |
819 | .driver = "Conroe-" TYPE_X86_CPU,\ | |
1f435716 | 820 | .property = "min-level",\ |
276a65ba EH |
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,\ | |
1f435716 | 828 | .property = "min-level",\ |
276a65ba EH |
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,\ | |
1f435716 | 836 | .property = "min-level",\ |
276a65ba EH |
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 | }, | |
ffce9ebb | 855 | |
bf3caa3d | 856 | #define PC_COMPAT_1_4 \ |
cd6c1b70 | 857 | PC_CPU_MODEL_IDS("1.4.0") \ |
276a65ba EH |
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 | }, | |
bf3caa3d | 930 | |
25519b06 | 931 | #define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \ |
865906f7 EH |
932 | static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \ |
933 | { \ | |
934 | MachineClass *mc = MACHINE_CLASS(oc); \ | |
935 | optsfn(mc); \ | |
865906f7 EH |
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 | }; \ | |
61f219df EH |
943 | static void pc_machine_init_##suffix(void) \ |
944 | { \ | |
865906f7 | 945 | type_register(&pc_machine_type_##suffix); \ |
61f219df | 946 | } \ |
0e6aac87 | 947 | type_init(pc_machine_init_##suffix) |
61f219df | 948 | |
bd8107d7 | 949 | extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id); |
87ecb68b | 950 | #endif |