]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/i386/pc.h
i386: Fix up the Node id for CPUID_8000_001E
[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;
be232eb0 52 bool smbus;
272f0428 53 bool sata;
feddd2fd 54 bool pit;
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
157void kvm_ioapic_dump_state(Monitor *mon, const QDict *qdict);
6bde8fd6 158void ioapic_dump_state(Monitor *mon, const QDict *qdict);
d665d696 159
b881fbe9 160/* Global System Interrupts */
96051119 161
b881fbe9 162#define GSI_NUM_PINS IOAPIC_NUM_PINS
845773ab 163
b881fbe9 164typedef struct GSIState {
43a0db35 165 qemu_irq i8259_irq[ISA_NUM_IRQS];
b881fbe9
JK
166 qemu_irq ioapic_irq[IOAPIC_NUM_PINS];
167} GSIState;
168
169void gsi_handler(void *opaque, int n, int level);
845773ab 170
87ecb68b 171/* vmport.c */
936a6447 172#define TYPE_VMPORT "vmport"
d67f679d
JK
173typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address);
174
48a18b3c 175static inline void vmport_init(ISABus *bus)
6872ef61 176{
936a6447 177 isa_create_simple(bus, TYPE_VMPORT);
6872ef61 178}
d67f679d
JK
179
180void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque);
86d86414
BS
181void vmmouse_get_data(uint32_t *data);
182void vmmouse_set_data(const uint32_t *data);
87ecb68b 183
87ecb68b
PB
184/* pc.c */
185extern int fd_bootchk;
186
355023f2 187bool pc_machine_is_smm_enabled(PCMachineState *pcms);
8e78eb28 188void pc_register_ferr_irq(qemu_irq irq);
845773ab
IY
189void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
190
4884b7bf 191void pc_cpus_init(PCMachineState *pcms);
c649983b 192void pc_hot_add_cpu(const int64_t id, Error **errp);
f7e4dd6c 193void pc_acpi_init(const char *default_dsdt);
3459a625 194
e4e8ba04 195void pc_guest_info_init(PCMachineState *pcms);
3459a625 196
39848901
IM
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"
401f2f3e
EV
202#define PCI_HOST_BELOW_4G_MEM_SIZE "below-4g-mem-size"
203#define PCI_HOST_ABOVE_4G_MEM_SIZE "above-4g-mem-size"
1466cef3 204
39848901 205
83d08f26
MT
206void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
207 MemoryRegion *pci_address_space);
39848901 208
7bc35e0f 209void xen_load_linux(PCMachineState *pcms);
5934e216
EH
210void pc_memory_init(PCMachineState *pcms,
211 MemoryRegion *system_memory,
212 MemoryRegion *rom_memory,
213 MemoryRegion **ram_memory);
9fa99d25 214uint64_t pc_pci_hole64_start(void);
0b0cc076 215qemu_irq pc_allocate_cpu_irq(void);
48a18b3c
HP
216DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
217void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
1611977c 218 ISADevice **rtc_state,
fd53c87c 219 bool create_fdctrl,
7a10ef51 220 bool no_vmport,
feddd2fd 221 bool has_pit,
3a87d009 222 uint32_t hpet_irqs);
48a18b3c 223void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd);
23d30407 224void pc_cmos_init(PCMachineState *pcms,
220a8846 225 BusState *ide0, BusState *ide1,
63ffb564 226 ISADevice *s);
4b9c264b 227void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus);
845773ab 228void pc_pci_device_init(PCIBus *pci_bus);
8e78eb28 229
f885f1ea 230typedef void (*cpu_set_smm_t)(int smm, void *arg);
f885f1ea 231
a39e3564
JB
232void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
233
424e4a87 234ISADevice *pc_find_fdc0(void);
bda05509 235int cmos_get_fd_drive_type(FloppyDriveType fd0);
424e4a87 236
305ae888
GS
237#define FW_CFG_IO_BASE 0x510
238
d812b3d6
EV
239#define PORT92_A20_LINE "a20"
240
9d5e77a2 241/* acpi_piix.c */
53b67b30 242
a5c82852
AF
243I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
244 qemu_irq sci_irq, qemu_irq smi_irq,
61e66c62 245 int smm_enabled, DeviceState **piix4_pm);
87ecb68b 246
16b29ae1
AL
247/* hpet.c */
248extern int no_hpet;
249
87ecb68b 250/* piix_pci.c */
0a3bacf3
JQ
251struct PCII440FXState;
252typedef struct PCII440FXState PCII440FXState;
253
7bb836e4
MT
254#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
255#define TYPE_I440FX_PCI_DEVICE "i440FX"
256
595a4f07
TC
257#define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX"
258
6103451a
PDJ
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
7bb836e4
MT
265PCIBus *i440fx_init(const char *host_type, const char *pci_type,
266 PCII440FXState **pi440fx_state, int *piix_devfn,
60573079 267 ISABus **isa_bus, qemu_irq *pic,
aee97b84
AK
268 MemoryRegion *address_space_mem,
269 MemoryRegion *address_space_io,
ae0a5466 270 ram_addr_t ram_size,
ddaaefb4 271 ram_addr_t below_4g_mem_size,
39848901 272 ram_addr_t above_4g_mem_size,
ae0a5466
AK
273 MemoryRegion *pci_memory,
274 MemoryRegion *ram_memory);
87ecb68b 275
277e9340 276PCIBus *find_i440fx(void);
823e675a 277/* piix4.c */
b1d8e52e 278extern PCIDevice *piix4_dev;
142e9787 279int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
87ecb68b 280
cbc5b5f3 281/* pc_sysfw.c */
6dd2a5c9
PB
282void pc_system_firmware_init(MemoryRegion *rom_memory,
283 bool isapc_ram_fw);
cbc5b5f3 284
ac35f13b
IM
285/* acpi-build.c */
286void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
80e5db30 287 const CPUArchIdList *apic_ids, GArray *entry);
ac35f13b 288
4c5b10b7
JS
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
296int e820_add_entry(uint64_t, uint64_t, uint32_t);
7bf8ef19
GS
297int e820_get_num_entries(void);
298bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
4c5b10b7 299
968ee4ad
BM
300#define PC_COMPAT_2_12 \
301 HW_COMPAT_2_12 \
ab8f992e
BM
302 {\
303 .driver = TYPE_X86_CPU,\
304 .property = "legacy-cache",\
305 .value = "on",\
306 },
968ee4ad 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 949extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
87ecb68b 950#endif