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