]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/i386/pc.h
target-i386: Add Intel SHA_NI instruction support.
[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
15eafc2e
PB
23#ifdef CONFIG_KVM
24#define kvm_pit_in_kernel() \
25 (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
26#define kvm_pic_in_kernel() \
27 (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
28#define kvm_ioapic_in_kernel() \
29 (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
30#else
31#define kvm_pit_in_kernel() 0
32#define kvm_pic_in_kernel() 0
33#define kvm_ioapic_in_kernel() 0
34#endif
35
619d11e4
IM
36/**
37 * PCMachineState:
781bbd6b 38 * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling
e3cadac0 39 * @boot_cpus: number of present VCPUs
619d11e4 40 */
d5747cac
IM
41struct PCMachineState {
42 /*< private >*/
43 MachineState parent_obj;
619d11e4
IM
44
45 /* <public> */
13fc8343
EH
46
47 /* State for other subsystems/APIs: */
a7d69ff1 48 MemoryHotplugState hotplug_memory;
9ebeed0c 49 Notifier machine_done;
781bbd6b 50
13fc8343 51 /* Pointers to devices and objects: */
781bbd6b 52 HotplugHandler *acpi_dev;
2d996150 53 ISADevice *rtc;
13fc8343 54 PCIBus *bus;
f264d360 55 FWCfgState *fw_cfg;
3e6c0c4c 56 qemu_irq *gsi;
c87b1520 57
13fc8343 58 /* Configuration options: */
c87b1520 59 uint64_t max_ram_below_4g;
d1048bef 60 OnOffAuto vmport;
355023f2 61 OnOffAuto smm;
5fe79386
XG
62
63 AcpiNVDIMMState acpi_nvdimm_state;
13fc8343 64
021746c1
WL
65 bool acpi_build_enabled;
66
13fc8343 67 /* RAM information (sizes, addresses, configuration): */
c0aa4e1e 68 ram_addr_t below_4g_mem_size, above_4g_mem_size;
dd4c2f01
EH
69
70 /* CPU and apic information: */
71 bool apic_xrupt_override;
72 unsigned apic_id_limit;
3811ef14 73 CPUArchIdList *possible_cpus;
e3cadac0 74 uint16_t boot_cpus;
dd4c2f01
EH
75
76 /* NUMA information: */
77 uint64_t numa_nodes;
78 uint64_t *node_mem;
cb135f59
PX
79
80 /* Address space used by IOAPIC device. All IOAPIC interrupts
81 * will be translated to MSI messages in the address space. */
82 AddressSpace *ioapic_as;
d5747cac
IM
83};
84
781bbd6b 85#define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
bf1e8939 86#define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size"
c87b1520 87#define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
9b23cfb7 88#define PC_MACHINE_VMPORT "vmport"
355023f2 89#define PC_MACHINE_SMM "smm"
87252e1b 90#define PC_MACHINE_NVDIMM "nvdimm"
781bbd6b 91
95bee274
IM
92/**
93 * PCMachineClass:
13fc8343
EH
94 *
95 * Methods:
96 *
95bee274 97 * @get_hotplug_handler: pointer to parent class callback @get_hotplug_handler
13fc8343
EH
98 *
99 * Compat fields:
100 *
16a9e8a5
EH
101 * @enforce_aligned_dimm: check that DIMM's address/size is aligned by
102 * backend's alignment value if provided
13fc8343
EH
103 * @acpi_data_size: Size of the chunk of memory at the top of RAM
104 * for the BIOS ACPI tables and other BIOS
105 * datastructures.
106 * @gigabyte_align: Make sure that guest addresses aligned at
107 * 1Gbyte boundaries get mapped to host
108 * addresses aligned at 1Gbyte boundaries. This
109 * way we can use 1GByte pages in the host.
110 *
95bee274 111 */
d5747cac
IM
112struct PCMachineClass {
113 /*< private >*/
114 MachineClass parent_class;
95bee274
IM
115
116 /*< public >*/
13fc8343
EH
117
118 /* Methods: */
95bee274
IM
119 HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
120 DeviceState *dev);
7102fa70 121
13fc8343 122 /* Device configuration: */
7102fa70 123 bool pci_enabled;
13fc8343
EH
124 bool kvmclock_enabled;
125
126 /* Compat options: */
127
128 /* ACPI compat: */
7102fa70
EH
129 bool has_acpi_build;
130 bool rsdp_in_ram;
13fc8343
EH
131 int legacy_acpi_table_size;
132 unsigned acpi_data_size;
133
134 /* SMBIOS compat: */
7102fa70
EH
135 bool smbios_defaults;
136 bool smbios_legacy_mode;
137 bool smbios_uuid_encoded;
13fc8343
EH
138
139 /* RAM / address space compat: */
7102fa70
EH
140 bool gigabyte_align;
141 bool has_reserved_memory;
16a9e8a5 142 bool enforce_aligned_dimm;
13fc8343 143 bool broken_reserved_end;
36f96c4b
HZ
144
145 /* TSC rate migration: */
146 bool save_tsc_khz;
679dd1a9
IM
147 /* generate legacy CPU hotplug AML */
148 bool legacy_cpu_hotplug;
d5747cac
IM
149};
150
d5747cac
IM
151#define TYPE_PC_MACHINE "generic-pc-machine"
152#define PC_MACHINE(obj) \
153 OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE)
154#define PC_MACHINE_GET_CLASS(obj) \
155 OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE)
156#define PC_MACHINE_CLASS(klass) \
157 OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE)
158
87ecb68b
PB
159/* PC-style peripherals (also used by other machines). */
160
f854ecc7
MT
161#define ACPI_PM_PROP_S3_DISABLED "disable_s3"
162#define ACPI_PM_PROP_S4_DISABLED "disable_s4"
163#define ACPI_PM_PROP_S4_VAL "s4_val"
164#define ACPI_PM_PROP_SCI_INT "sci_int"
165#define ACPI_PM_PROP_ACPI_ENABLE_CMD "acpi_enable_cmd"
166#define ACPI_PM_PROP_ACPI_DISABLE_CMD "acpi_disable_cmd"
167#define ACPI_PM_PROP_PM_IO_BASE "pm_io_base"
168#define ACPI_PM_PROP_GPE0_BLK "gpe0_blk"
169#define ACPI_PM_PROP_GPE0_BLK_LEN "gpe0_blk_len"
92055797 170#define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
f854ecc7 171
87ecb68b 172/* parallel.c */
07dc7880
MA
173
174void parallel_hds_isa_init(ISABus *bus, int n);
defdb20e 175
63858cd9 176bool parallel_mm_init(MemoryRegion *address_space,
a8170e5e 177 hwaddr base, int it_shift, qemu_irq irq,
defdb20e 178 CharDriverState *chr);
87ecb68b
PB
179
180/* i8259.c */
181
9aa78c42 182extern DeviceState *isa_pic;
48a18b3c 183qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq);
10b61882 184qemu_irq *kvm_i8259_init(ISABus *bus);
9aa78c42
JK
185int pic_read_irq(DeviceState *d);
186int pic_get_output(DeviceState *d);
87ecb68b 187
d665d696
PB
188/* ioapic.c */
189
190void kvm_ioapic_dump_state(Monitor *mon, const QDict *qdict);
6bde8fd6 191void ioapic_dump_state(Monitor *mon, const QDict *qdict);
d665d696 192
b881fbe9 193/* Global System Interrupts */
96051119 194
b881fbe9 195#define GSI_NUM_PINS IOAPIC_NUM_PINS
845773ab 196
b881fbe9 197typedef struct GSIState {
43a0db35 198 qemu_irq i8259_irq[ISA_NUM_IRQS];
b881fbe9
JK
199 qemu_irq ioapic_irq[IOAPIC_NUM_PINS];
200} GSIState;
201
202void gsi_handler(void *opaque, int n, int level);
845773ab 203
87ecb68b 204/* vmport.c */
936a6447 205#define TYPE_VMPORT "vmport"
d67f679d
JK
206typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address);
207
48a18b3c 208static inline void vmport_init(ISABus *bus)
6872ef61 209{
936a6447 210 isa_create_simple(bus, TYPE_VMPORT);
6872ef61 211}
d67f679d
JK
212
213void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque);
86d86414
BS
214void vmmouse_get_data(uint32_t *data);
215void vmmouse_set_data(const uint32_t *data);
87ecb68b 216
87ecb68b 217/* pckbd.c */
3115b9e2 218#define I8042_A20_LINE "a20"
87ecb68b 219
87ecb68b 220void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
dbff76ac 221 MemoryRegion *region, ram_addr_t size,
a8170e5e 222 hwaddr mask);
956a3e6b 223void i8042_isa_mouse_fake_event(void *opaque);
d80fe99d 224void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out);
87ecb68b 225
87ecb68b
PB
226/* pc.c */
227extern int fd_bootchk;
228
355023f2 229bool pc_machine_is_smm_enabled(PCMachineState *pcms);
8e78eb28 230void pc_register_ferr_irq(qemu_irq irq);
845773ab
IY
231void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
232
4884b7bf 233void pc_cpus_init(PCMachineState *pcms);
c649983b 234void pc_hot_add_cpu(const int64_t id, Error **errp);
f7e4dd6c 235void pc_acpi_init(const char *default_dsdt);
3459a625 236
e4e8ba04 237void pc_guest_info_init(PCMachineState *pcms);
3459a625 238
39848901
IM
239#define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start"
240#define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end"
241#define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
242#define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end"
243#define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size"
401f2f3e
EV
244#define PCI_HOST_BELOW_4G_MEM_SIZE "below-4g-mem-size"
245#define PCI_HOST_ABOVE_4G_MEM_SIZE "above-4g-mem-size"
1466cef3
MT
246#define DEFAULT_PCI_HOLE64_SIZE (~0x0ULL)
247
39848901 248
83d08f26
MT
249void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
250 MemoryRegion *pci_address_space);
39848901 251
7bc35e0f 252void xen_load_linux(PCMachineState *pcms);
5934e216
EH
253void pc_memory_init(PCMachineState *pcms,
254 MemoryRegion *system_memory,
255 MemoryRegion *rom_memory,
256 MemoryRegion **ram_memory);
0b0cc076 257qemu_irq pc_allocate_cpu_irq(void);
48a18b3c
HP
258DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
259void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
1611977c 260 ISADevice **rtc_state,
fd53c87c 261 bool create_fdctrl,
7a10ef51 262 bool no_vmport,
3a87d009 263 uint32_t hpet_irqs);
48a18b3c 264void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd);
23d30407 265void pc_cmos_init(PCMachineState *pcms,
220a8846 266 BusState *ide0, BusState *ide1,
63ffb564 267 ISADevice *s);
9011a1a7 268void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus);
845773ab 269void pc_pci_device_init(PCIBus *pci_bus);
8e78eb28 270
f885f1ea 271typedef void (*cpu_set_smm_t)(int smm, void *arg);
f885f1ea 272
a39e3564
JB
273void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
274
424e4a87 275ISADevice *pc_find_fdc0(void);
bda05509 276int cmos_get_fd_drive_type(FloppyDriveType fd0);
424e4a87 277
305ae888
GS
278#define FW_CFG_IO_BASE 0x510
279
d812b3d6
EV
280#define PORT92_A20_LINE "a20"
281
9d5e77a2 282/* acpi_piix.c */
53b67b30 283
a5c82852
AF
284I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
285 qemu_irq sci_irq, qemu_irq smi_irq,
61e66c62 286 int smm_enabled, DeviceState **piix4_pm);
87ecb68b 287
16b29ae1
AL
288/* hpet.c */
289extern int no_hpet;
290
87ecb68b 291/* piix_pci.c */
0a3bacf3
JQ
292struct PCII440FXState;
293typedef struct PCII440FXState PCII440FXState;
294
7bb836e4
MT
295#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
296#define TYPE_I440FX_PCI_DEVICE "i440FX"
297
595a4f07
TC
298#define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX"
299
7bb836e4
MT
300PCIBus *i440fx_init(const char *host_type, const char *pci_type,
301 PCII440FXState **pi440fx_state, int *piix_devfn,
60573079 302 ISABus **isa_bus, qemu_irq *pic,
aee97b84
AK
303 MemoryRegion *address_space_mem,
304 MemoryRegion *address_space_io,
ae0a5466 305 ram_addr_t ram_size,
ddaaefb4 306 ram_addr_t below_4g_mem_size,
39848901 307 ram_addr_t above_4g_mem_size,
ae0a5466
AK
308 MemoryRegion *pci_memory,
309 MemoryRegion *ram_memory);
87ecb68b 310
277e9340 311PCIBus *find_i440fx(void);
823e675a 312/* piix4.c */
b1d8e52e 313extern PCIDevice *piix4_dev;
142e9787 314int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
87ecb68b
PB
315
316/* vga.c */
cb5a7aa8 317enum vga_retrace_method {
318 VGA_RETRACE_DUMB,
319 VGA_RETRACE_PRECISE
320};
321
322extern enum vga_retrace_method vga_retrace_method;
87ecb68b 323
a8170e5e
AK
324int isa_vga_mm_init(hwaddr vram_base,
325 hwaddr ctrl_base, int it_shift,
be20f9e9 326 MemoryRegion *address_space);
87ecb68b 327
87ecb68b 328/* ne2000.c */
48a18b3c 329static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd)
60a14ad3 330{
4a17cc4f
AF
331 DeviceState *dev;
332 ISADevice *isadev;
87ecb68b 333
60a14ad3
BS
334 qemu_check_nic_model(nd, "ne2k_isa");
335
4a17cc4f
AF
336 isadev = isa_try_create(bus, "ne2k_isa");
337 if (!isadev) {
cd1b8a8b
BS
338 return false;
339 }
4a17cc4f
AF
340 dev = DEVICE(isadev);
341 qdev_prop_set_uint32(dev, "iobase", base);
342 qdev_prop_set_uint32(dev, "irq", irq);
343 qdev_set_nic_properties(dev, nd);
344 qdev_init_nofail(dev);
cd1b8a8b 345 return true;
60a14ad3 346}
87ecb68b 347
cbc5b5f3 348/* pc_sysfw.c */
6dd2a5c9
PB
349void pc_system_firmware_init(MemoryRegion *rom_memory,
350 bool isapc_ram_fw);
cbc5b5f3 351
3ab135f3 352/* pvpanic.c */
309cd62d 353uint16_t pvpanic_port(void);
3ab135f3 354
ac35f13b
IM
355/* acpi-build.c */
356void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
357 CPUArchIdList *apic_ids, GArray *entry);
358
4c5b10b7
JS
359/* e820 types */
360#define E820_RAM 1
361#define E820_RESERVED 2
362#define E820_ACPI 3
363#define E820_NVS 4
364#define E820_UNUSABLE 5
365
366int e820_add_entry(uint64_t, uint64_t, uint32_t);
7bf8ef19
GS
367int e820_get_num_entries(void);
368bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
4c5b10b7 369
14c985cf 370#define PC_COMPAT_2_8 \
152fcbec
IM
371
372#define PC_COMPAT_2_7 \
373 HW_COMPAT_2_7 \
14c985cf
LM
374 {\
375 .driver = TYPE_X86_CPU,\
376 .property = "l3-cache",\
377 .value = "off",\
c39c0edf
EH
378 },\
379 {\
380 .driver = TYPE_X86_CPU,\
381 .property = "full-cpuid-auto-level",\
382 .value = "off",\
339892d7
EY
383 },\
384 {\
385 .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
386 .property = "family",\
387 .value = "15",\
388 },\
389 {\
390 .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
391 .property = "model",\
392 .value = "6",\
393 },\
394 {\
395 .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
396 .property = "stepping",\
397 .value = "1",\
f9f885b7
DDAG
398 },\
399 {\
400 .driver = "isa-pcspk",\
401 .property = "migrate",\
402 .value = "off",\
14c985cf
LM
403 },
404
d86c1451 405#define PC_COMPAT_2_6 \
5232d00a
RK
406 HW_COMPAT_2_6 \
407 {\
b2a575a1
MM
408 .driver = "fw_cfg_io",\
409 .property = "dma_enabled",\
410 .value = "off",\
411 },{\
5232d00a
RK
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,\
534 .property = "level",\
535 .value = stringify(4),\
536 },{\
537 .driver = "kvm64" "-" TYPE_X86_CPU,\
538 .property = "level",\
539 .value = stringify(5),\
540 },{\
541 .driver = "pentium3" "-" TYPE_X86_CPU,\
542 .property = "level",\
543 .value = stringify(2),\
544 },{\
545 .driver = "n270" "-" TYPE_X86_CPU,\
546 .property = "level",\
547 .value = stringify(5),\
548 },{\
549 .driver = "Conroe" "-" TYPE_X86_CPU,\
550 .property = "level",\
551 .value = stringify(4),\
552 },{\
553 .driver = "Penryn" "-" TYPE_X86_CPU,\
554 .property = "level",\
555 .value = stringify(4),\
556 },{\
557 .driver = "Nehalem" "-" TYPE_X86_CPU,\
558 .property = "level",\
559 .value = stringify(4),\
560 },{\
561 .driver = "n270" "-" TYPE_X86_CPU,\
562 .property = "xlevel",\
563 .value = stringify(0x8000000a),\
564 },{\
565 .driver = "Penryn" "-" TYPE_X86_CPU,\
566 .property = "xlevel",\
567 .value = stringify(0x8000000a),\
568 },{\
569 .driver = "Conroe" "-" TYPE_X86_CPU,\
570 .property = "xlevel",\
571 .value = stringify(0x8000000a),\
572 },{\
573 .driver = "Nehalem" "-" TYPE_X86_CPU,\
574 .property = "xlevel",\
575 .value = stringify(0x8000000a),\
576 },{\
577 .driver = "Westmere" "-" TYPE_X86_CPU,\
578 .property = "xlevel",\
579 .value = stringify(0x8000000a),\
580 },{\
581 .driver = "SandyBridge" "-" TYPE_X86_CPU,\
582 .property = "xlevel",\
583 .value = stringify(0x8000000a),\
584 },{\
585 .driver = "IvyBridge" "-" TYPE_X86_CPU,\
586 .property = "xlevel",\
587 .value = stringify(0x8000000a),\
588 },{\
589 .driver = "Haswell" "-" TYPE_X86_CPU,\
590 .property = "xlevel",\
591 .value = stringify(0x8000000a),\
592 },{\
593 .driver = "Haswell-noTSX" "-" TYPE_X86_CPU,\
594 .property = "xlevel",\
595 .value = stringify(0x8000000a),\
596 },{\
597 .driver = "Broadwell" "-" TYPE_X86_CPU,\
598 .property = "xlevel",\
599 .value = stringify(0x8000000a),\
600 },{\
601 .driver = "Broadwell-noTSX" "-" TYPE_X86_CPU,\
602 .property = "xlevel",\
603 .value = stringify(0x8000000a),\
604 },
42134ac9
EH
605
606#define PC_COMPAT_2_2 \
276a65ba 607 HW_COMPAT_2_2 \
cd6c1b70 608 PC_CPU_MODEL_IDS("2.3.0") \
276a65ba
EH
609 {\
610 .driver = "kvm64" "-" TYPE_X86_CPU,\
611 .property = "vme",\
612 .value = "off",\
613 },\
614 {\
615 .driver = "kvm32" "-" TYPE_X86_CPU,\
616 .property = "vme",\
617 .value = "off",\
618 },\
619 {\
620 .driver = "Conroe" "-" TYPE_X86_CPU,\
621 .property = "vme",\
622 .value = "off",\
623 },\
624 {\
625 .driver = "Penryn" "-" TYPE_X86_CPU,\
626 .property = "vme",\
627 .value = "off",\
628 },\
629 {\
630 .driver = "Nehalem" "-" TYPE_X86_CPU,\
631 .property = "vme",\
632 .value = "off",\
633 },\
634 {\
635 .driver = "Westmere" "-" TYPE_X86_CPU,\
636 .property = "vme",\
637 .value = "off",\
638 },\
639 {\
640 .driver = "SandyBridge" "-" TYPE_X86_CPU,\
641 .property = "vme",\
642 .value = "off",\
643 },\
644 {\
645 .driver = "Haswell" "-" TYPE_X86_CPU,\
646 .property = "vme",\
647 .value = "off",\
648 },\
649 {\
650 .driver = "Broadwell" "-" TYPE_X86_CPU,\
651 .property = "vme",\
652 .value = "off",\
653 },\
654 {\
655 .driver = "Opteron_G1" "-" TYPE_X86_CPU,\
656 .property = "vme",\
657 .value = "off",\
658 },\
659 {\
660 .driver = "Opteron_G2" "-" TYPE_X86_CPU,\
661 .property = "vme",\
662 .value = "off",\
663 },\
664 {\
665 .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
666 .property = "vme",\
667 .value = "off",\
668 },\
669 {\
670 .driver = "Opteron_G4" "-" TYPE_X86_CPU,\
671 .property = "vme",\
672 .value = "off",\
673 },\
674 {\
675 .driver = "Opteron_G5" "-" TYPE_X86_CPU,\
676 .property = "vme",\
677 .value = "off",\
678 },\
679 {\
680 .driver = "Haswell" "-" TYPE_X86_CPU,\
681 .property = "f16c",\
682 .value = "off",\
683 },\
684 {\
685 .driver = "Haswell" "-" TYPE_X86_CPU,\
686 .property = "rdrand",\
687 .value = "off",\
688 },\
689 {\
690 .driver = "Broadwell" "-" TYPE_X86_CPU,\
691 .property = "f16c",\
692 .value = "off",\
693 },\
694 {\
695 .driver = "Broadwell" "-" TYPE_X86_CPU,\
696 .property = "rdrand",\
697 .value = "off",\
698 },
42134ac9
EH
699
700#define PC_COMPAT_2_1 \
276a65ba 701 HW_COMPAT_2_1 \
cd6c1b70 702 PC_CPU_MODEL_IDS("2.1.0") \
276a65ba
EH
703 {\
704 .driver = "coreduo" "-" TYPE_X86_CPU,\
705 .property = "vmx",\
706 .value = "on",\
707 },\
708 {\
709 .driver = "core2duo" "-" TYPE_X86_CPU,\
710 .property = "vmx",\
711 .value = "on",\
712 },
42134ac9 713
9df11c9f 714#define PC_COMPAT_2_0 \
cd6c1b70 715 PC_CPU_MODEL_IDS("2.0.0") \
276a65ba
EH
716 {\
717 .driver = "virtio-scsi-pci",\
718 .property = "any_layout",\
719 .value = "off",\
720 },{\
721 .driver = "PIIX4_PM",\
722 .property = "memory-hotplug-support",\
723 .value = "off",\
724 },\
725 {\
726 .driver = "apic",\
727 .property = "version",\
728 .value = stringify(0x11),\
729 },\
730 {\
731 .driver = "nec-usb-xhci",\
732 .property = "superspeed-ports-first",\
733 .value = "off",\
734 },\
735 {\
736 .driver = "nec-usb-xhci",\
737 .property = "force-pcie-endcap",\
738 .value = "on",\
739 },\
740 {\
741 .driver = "pci-serial",\
742 .property = "prog_if",\
743 .value = stringify(0),\
744 },\
745 {\
746 .driver = "pci-serial-2x",\
747 .property = "prog_if",\
748 .value = stringify(0),\
749 },\
750 {\
751 .driver = "pci-serial-4x",\
752 .property = "prog_if",\
753 .value = stringify(0),\
754 },\
755 {\
756 .driver = "virtio-net-pci",\
757 .property = "guest_announce",\
758 .value = "off",\
759 },\
760 {\
761 .driver = "ICH9-LPC",\
762 .property = "memory-hotplug-support",\
763 .value = "off",\
764 },{\
765 .driver = "xio3130-downstream",\
766 .property = COMPAT_PROP_PCP,\
767 .value = "off",\
768 },{\
769 .driver = "ioh3420",\
770 .property = COMPAT_PROP_PCP,\
771 .value = "off",\
772 },
9df11c9f 773
5319dc7b 774#define PC_COMPAT_1_7 \
cd6c1b70 775 PC_CPU_MODEL_IDS("1.7.0") \
276a65ba
EH
776 {\
777 .driver = TYPE_USB_DEVICE,\
778 .property = "msos-desc",\
779 .value = "no",\
780 },\
781 {\
782 .driver = "PIIX4_PM",\
783 .property = "acpi-pci-hotplug-with-bridge-support",\
784 .value = "off",\
785 },\
786 {\
787 .driver = "hpet",\
788 .property = HPET_INTCAP,\
789 .value = stringify(4),\
790 },
5319dc7b 791
e9845f09 792#define PC_COMPAT_1_6 \
cd6c1b70 793 PC_CPU_MODEL_IDS("1.6.0") \
276a65ba
EH
794 {\
795 .driver = "e1000",\
796 .property = "mitigation",\
797 .value = "off",\
798 },{\
799 .driver = "qemu64-" TYPE_X86_CPU,\
800 .property = "model",\
801 .value = stringify(2),\
802 },{\
803 .driver = "qemu32-" TYPE_X86_CPU,\
804 .property = "model",\
805 .value = stringify(3),\
806 },{\
807 .driver = "i440FX-pcihost",\
808 .property = "short_root_bus",\
809 .value = stringify(1),\
810 },{\
811 .driver = "q35-pcihost",\
812 .property = "short_root_bus",\
813 .value = stringify(1),\
814 },
e9845f09 815
ffce9ebb 816#define PC_COMPAT_1_5 \
cd6c1b70 817 PC_CPU_MODEL_IDS("1.5.0") \
276a65ba
EH
818 {\
819 .driver = "Conroe-" TYPE_X86_CPU,\
820 .property = "model",\
821 .value = stringify(2),\
822 },{\
823 .driver = "Conroe-" TYPE_X86_CPU,\
824 .property = "level",\
825 .value = stringify(2),\
826 },{\
827 .driver = "Penryn-" TYPE_X86_CPU,\
828 .property = "model",\
829 .value = stringify(2),\
830 },{\
831 .driver = "Penryn-" TYPE_X86_CPU,\
832 .property = "level",\
833 .value = stringify(2),\
834 },{\
835 .driver = "Nehalem-" TYPE_X86_CPU,\
836 .property = "model",\
837 .value = stringify(2),\
838 },{\
839 .driver = "Nehalem-" TYPE_X86_CPU,\
840 .property = "level",\
841 .value = stringify(2),\
842 },{\
843 .driver = "virtio-net-pci",\
844 .property = "any_layout",\
845 .value = "off",\
846 },{\
847 .driver = TYPE_X86_CPU,\
848 .property = "pmu",\
849 .value = "on",\
850 },{\
851 .driver = "i440FX-pcihost",\
852 .property = "short_root_bus",\
853 .value = stringify(0),\
854 },{\
855 .driver = "q35-pcihost",\
856 .property = "short_root_bus",\
857 .value = stringify(0),\
858 },
ffce9ebb 859
bf3caa3d 860#define PC_COMPAT_1_4 \
cd6c1b70 861 PC_CPU_MODEL_IDS("1.4.0") \
276a65ba
EH
862 {\
863 .driver = "scsi-hd",\
864 .property = "discard_granularity",\
865 .value = stringify(0),\
866 },{\
867 .driver = "scsi-cd",\
868 .property = "discard_granularity",\
869 .value = stringify(0),\
870 },{\
871 .driver = "scsi-disk",\
872 .property = "discard_granularity",\
873 .value = stringify(0),\
874 },{\
875 .driver = "ide-hd",\
876 .property = "discard_granularity",\
877 .value = stringify(0),\
878 },{\
879 .driver = "ide-cd",\
880 .property = "discard_granularity",\
881 .value = stringify(0),\
882 },{\
883 .driver = "ide-drive",\
884 .property = "discard_granularity",\
885 .value = stringify(0),\
886 },{\
887 .driver = "virtio-blk-pci",\
888 .property = "discard_granularity",\
889 .value = stringify(0),\
890 },{\
891 .driver = "virtio-serial-pci",\
892 .property = "vectors",\
893 /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\
894 .value = stringify(0xFFFFFFFF),\
895 },{ \
896 .driver = "virtio-net-pci", \
897 .property = "ctrl_guest_offloads", \
898 .value = "off", \
899 },{\
900 .driver = "e1000",\
901 .property = "romfile",\
902 .value = "pxe-e1000.rom",\
903 },{\
904 .driver = "ne2k_pci",\
905 .property = "romfile",\
906 .value = "pxe-ne2k_pci.rom",\
907 },{\
908 .driver = "pcnet",\
909 .property = "romfile",\
910 .value = "pxe-pcnet.rom",\
911 },{\
912 .driver = "rtl8139",\
913 .property = "romfile",\
914 .value = "pxe-rtl8139.rom",\
915 },{\
916 .driver = "virtio-net-pci",\
917 .property = "romfile",\
918 .value = "pxe-virtio.rom",\
919 },{\
920 .driver = "486-" TYPE_X86_CPU,\
921 .property = "model",\
922 .value = stringify(0),\
923 },\
924 {\
925 .driver = "n270" "-" TYPE_X86_CPU,\
926 .property = "movbe",\
927 .value = "off",\
928 },\
929 {\
930 .driver = "Westmere" "-" TYPE_X86_CPU,\
931 .property = "pclmulqdq",\
932 .value = "off",\
933 },
bf3caa3d 934
25519b06 935#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
865906f7
EH
936 static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
937 { \
938 MachineClass *mc = MACHINE_CLASS(oc); \
939 optsfn(mc); \
865906f7
EH
940 mc->init = initfn; \
941 } \
942 static const TypeInfo pc_machine_type_##suffix = { \
943 .name = namestr TYPE_MACHINE_SUFFIX, \
944 .parent = TYPE_PC_MACHINE, \
945 .class_init = pc_machine_##suffix##_class_init, \
946 }; \
61f219df
EH
947 static void pc_machine_init_##suffix(void) \
948 { \
865906f7 949 type_register(&pc_machine_type_##suffix); \
61f219df 950 } \
0e6aac87 951 type_init(pc_machine_init_##suffix)
61f219df 952
bd8107d7 953extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
87ecb68b 954#endif