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