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