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