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