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