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