]> git.proxmox.com Git - mirror_qemu.git/blame - include/hw/i386/pc.h
pc: Move acpi_data_size global to PCMachineClass
[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"
8170dfa0 5#include "qemu/typedefs.h"
022c62cb 6#include "exec/memory.h"
9521d42b 7#include "hw/boards.h"
0d09e41a
PB
8#include "hw/isa/isa.h"
9#include "hw/block/fdc.h"
1422e32d 10#include "net/net.h"
0d09e41a 11#include "hw/i386/ioapic.h"
376253ec 12
3459a625 13#include "qemu/range.h"
b20c9bd5
MT
14#include "qemu/bitmap.h"
15#include "sysemu/sysemu.h"
16#include "hw/pci/pci.h"
d5747cac 17#include "hw/boards.h"
68a27b20 18#include "hw/compat.h"
a7d69ff1 19#include "hw/mem/pc-dimm.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
91aa70ab
IM
39 * @enforce_aligned_dimm: check that DIMM's address/size is aligned by
40 * backend's alignment value if provided
619d11e4 41 */
d5747cac
IM
42struct PCMachineState {
43 /*< private >*/
44 MachineState parent_obj;
619d11e4
IM
45
46 /* <public> */
a7d69ff1 47 MemoryHotplugState hotplug_memory;
781bbd6b
IM
48
49 HotplugHandler *acpi_dev;
2d996150 50 ISADevice *rtc;
c87b1520
DS
51
52 uint64_t max_ram_below_4g;
d1048bef 53 OnOffAuto vmport;
355023f2 54 OnOffAuto smm;
91aa70ab 55 bool enforce_aligned_dimm;
c0aa4e1e 56 ram_addr_t below_4g_mem_size, above_4g_mem_size;
d5747cac
IM
57};
58
781bbd6b 59#define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
bf1e8939 60#define PC_MACHINE_MEMHP_REGION_SIZE "hotplug-memory-region-size"
c87b1520 61#define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
9b23cfb7 62#define PC_MACHINE_VMPORT "vmport"
355023f2 63#define PC_MACHINE_SMM "smm"
91aa70ab 64#define PC_MACHINE_ENFORCE_ALIGNED_DIMM "enforce-aligned-dimm"
781bbd6b 65
95bee274
IM
66/**
67 * PCMachineClass:
68 * @get_hotplug_handler: pointer to parent class callback @get_hotplug_handler
69 */
d5747cac
IM
70struct PCMachineClass {
71 /*< private >*/
72 MachineClass parent_class;
95bee274
IM
73
74 /*< public >*/
2f8b5008 75 bool broken_reserved_end;
95bee274
IM
76 HotplugHandler *(*get_hotplug_handler)(MachineState *machine,
77 DeviceState *dev);
7102fa70
EH
78
79 bool pci_enabled;
80 bool has_acpi_build;
81 bool rsdp_in_ram;
82 bool smbios_defaults;
83 bool smbios_legacy_mode;
84 bool smbios_uuid_encoded;
85 /* Make sure that guest addresses aligned at 1Gbyte boundaries get
86 * mapped to host addresses aligned at 1Gbyte boundaries. This way
87 * we can use 1GByte pages in the host.
88 */
89 bool gigabyte_align;
90 bool has_reserved_memory;
91 bool kvmclock_enabled;
2b0ddf66 92 int legacy_acpi_table_size;
cd4040ec
EH
93 /* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables
94 * and other BIOS datastructures.
95 */
96 unsigned acpi_data_size;
d5747cac
IM
97};
98
d5747cac
IM
99#define TYPE_PC_MACHINE "generic-pc-machine"
100#define PC_MACHINE(obj) \
101 OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE)
102#define PC_MACHINE_GET_CLASS(obj) \
103 OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE)
104#define PC_MACHINE_CLASS(klass) \
105 OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE)
106
87ecb68b
PB
107/* PC-style peripherals (also used by other machines). */
108
3459a625
MT
109typedef struct PcPciInfo {
110 Range w32;
111 Range w64;
112} PcPciInfo;
113
f854ecc7
MT
114#define ACPI_PM_PROP_S3_DISABLED "disable_s3"
115#define ACPI_PM_PROP_S4_DISABLED "disable_s4"
116#define ACPI_PM_PROP_S4_VAL "s4_val"
117#define ACPI_PM_PROP_SCI_INT "sci_int"
118#define ACPI_PM_PROP_ACPI_ENABLE_CMD "acpi_enable_cmd"
119#define ACPI_PM_PROP_ACPI_DISABLE_CMD "acpi_disable_cmd"
120#define ACPI_PM_PROP_PM_IO_BASE "pm_io_base"
121#define ACPI_PM_PROP_GPE0_BLK "gpe0_blk"
122#define ACPI_PM_PROP_GPE0_BLK_LEN "gpe0_blk_len"
92055797 123#define ACPI_PM_PROP_TCO_ENABLED "enable_tco"
f854ecc7 124
3459a625 125struct PcGuestInfo {
6dd2a5c9 126 bool isapc_ram_fw;
f30ee8a9 127 hwaddr ram_size, ram_size_below_4g;
b20c9bd5
MT
128 unsigned apic_id_limit;
129 bool apic_xrupt_override;
130 uint64_t numa_nodes;
131 uint64_t *node_mem;
132 uint64_t *node_cpu;
3459a625 133 FWCfgState *fw_cfg;
07fb6176 134 int legacy_acpi_table_size;
72c194f7 135 bool has_acpi_build;
de268e13 136 bool has_reserved_memory;
384fb32e 137 bool rsdp_in_ram;
3459a625
MT
138};
139
87ecb68b 140/* parallel.c */
07dc7880
MA
141
142void parallel_hds_isa_init(ISABus *bus, int n);
defdb20e 143
63858cd9 144bool parallel_mm_init(MemoryRegion *address_space,
a8170e5e 145 hwaddr base, int it_shift, qemu_irq irq,
defdb20e 146 CharDriverState *chr);
87ecb68b
PB
147
148/* i8259.c */
149
9aa78c42 150extern DeviceState *isa_pic;
48a18b3c 151qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq);
10b61882 152qemu_irq *kvm_i8259_init(ISABus *bus);
9aa78c42
JK
153int pic_read_irq(DeviceState *d);
154int pic_get_output(DeviceState *d);
1ce6be24
MA
155void hmp_info_pic(Monitor *mon, const QDict *qdict);
156void hmp_info_irq(Monitor *mon, const QDict *qdict);
87ecb68b 157
d665d696
PB
158/* ioapic.c */
159
160void kvm_ioapic_dump_state(Monitor *mon, const QDict *qdict);
6bde8fd6 161void ioapic_dump_state(Monitor *mon, const QDict *qdict);
d665d696 162
b881fbe9 163/* Global System Interrupts */
96051119 164
b881fbe9 165#define GSI_NUM_PINS IOAPIC_NUM_PINS
845773ab 166
b881fbe9 167typedef struct GSIState {
43a0db35 168 qemu_irq i8259_irq[ISA_NUM_IRQS];
b881fbe9
JK
169 qemu_irq ioapic_irq[IOAPIC_NUM_PINS];
170} GSIState;
171
172void gsi_handler(void *opaque, int n, int level);
845773ab 173
87ecb68b 174/* vmport.c */
d67f679d
JK
175typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address);
176
48a18b3c 177static inline void vmport_init(ISABus *bus)
6872ef61 178{
48a18b3c 179 isa_create_simple(bus, "vmport");
6872ef61 180}
d67f679d
JK
181
182void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque);
86d86414
BS
183void vmmouse_get_data(uint32_t *data);
184void vmmouse_set_data(const uint32_t *data);
87ecb68b 185
87ecb68b
PB
186/* pckbd.c */
187
188void i8042_init(qemu_irq kbd_irq, qemu_irq mouse_irq, uint32_t io_base);
189void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
dbff76ac 190 MemoryRegion *region, ram_addr_t size,
a8170e5e 191 hwaddr mask);
956a3e6b
BS
192void i8042_isa_mouse_fake_event(void *opaque);
193void i8042_setup_a20_line(ISADevice *dev, qemu_irq *a20_out);
87ecb68b 194
87ecb68b
PB
195/* pc.c */
196extern int fd_bootchk;
197
355023f2 198bool pc_machine_is_smm_enabled(PCMachineState *pcms);
8e78eb28 199void pc_register_ferr_irq(qemu_irq irq);
845773ab
IY
200void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
201
4884b7bf 202void pc_cpus_init(PCMachineState *pcms);
c649983b 203void pc_hot_add_cpu(const int64_t id, Error **errp);
f7e4dd6c 204void pc_acpi_init(const char *default_dsdt);
3459a625 205
b9cfc918 206PcGuestInfo *pc_guest_info_init(PCMachineState *pcms);
3459a625 207
39848901
IM
208#define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start"
209#define PCI_HOST_PROP_PCI_HOLE_END "pci-hole-end"
210#define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
211#define PCI_HOST_PROP_PCI_HOLE64_END "pci-hole64-end"
212#define PCI_HOST_PROP_PCI_HOLE64_SIZE "pci-hole64-size"
1466cef3
MT
213#define DEFAULT_PCI_HOLE64_SIZE (~0x0ULL)
214
39848901 215
83d08f26
MT
216void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
217 MemoryRegion *pci_address_space);
39848901 218
df1f79fd 219FWCfgState *xen_load_linux(PCMachineState *pcms,
b33a5bbf 220 PcGuestInfo *guest_info);
62b160c0 221FWCfgState *pc_memory_init(PCMachineState *pcms,
9521d42b 222 MemoryRegion *system_memory,
a88b362c 223 MemoryRegion *rom_memory,
3459a625
MT
224 MemoryRegion **ram_memory,
225 PcGuestInfo *guest_info);
0b0cc076 226qemu_irq pc_allocate_cpu_irq(void);
48a18b3c
HP
227DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
228void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
1611977c 229 ISADevice **rtc_state,
fd53c87c 230 bool create_fdctrl,
7a10ef51
LPF
231 bool no_vmport,
232 uint32 hpet_irqs);
48a18b3c 233void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd);
23d30407 234void pc_cmos_init(PCMachineState *pcms,
220a8846 235 BusState *ide0, BusState *ide1,
63ffb564 236 ISADevice *s);
9011a1a7 237void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus);
845773ab 238void pc_pci_device_init(PCIBus *pci_bus);
8e78eb28 239
f885f1ea 240typedef void (*cpu_set_smm_t)(int smm, void *arg);
f885f1ea 241
a39e3564
JB
242void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
243
9d5e77a2 244/* acpi_piix.c */
53b67b30 245
a5c82852
AF
246I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
247 qemu_irq sci_irq, qemu_irq smi_irq,
61e66c62 248 int smm_enabled, DeviceState **piix4_pm);
87ecb68b 249void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
87ecb68b 250
16b29ae1
AL
251/* hpet.c */
252extern int no_hpet;
253
87ecb68b 254/* piix_pci.c */
0a3bacf3
JQ
255struct PCII440FXState;
256typedef struct PCII440FXState PCII440FXState;
257
7bb836e4
MT
258#define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
259#define TYPE_I440FX_PCI_DEVICE "i440FX"
260
595a4f07
TC
261#define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX"
262
7bb836e4
MT
263PCIBus *i440fx_init(const char *host_type, const char *pci_type,
264 PCII440FXState **pi440fx_state, int *piix_devfn,
60573079 265 ISABus **isa_bus, qemu_irq *pic,
aee97b84
AK
266 MemoryRegion *address_space_mem,
267 MemoryRegion *address_space_io,
ae0a5466 268 ram_addr_t ram_size,
ddaaefb4 269 ram_addr_t below_4g_mem_size,
39848901 270 ram_addr_t above_4g_mem_size,
ae0a5466
AK
271 MemoryRegion *pci_memory,
272 MemoryRegion *ram_memory);
87ecb68b 273
277e9340 274PCIBus *find_i440fx(void);
823e675a 275/* piix4.c */
b1d8e52e 276extern PCIDevice *piix4_dev;
142e9787 277int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
87ecb68b
PB
278
279/* vga.c */
cb5a7aa8 280enum vga_retrace_method {
281 VGA_RETRACE_DUMB,
282 VGA_RETRACE_PRECISE
283};
284
285extern enum vga_retrace_method vga_retrace_method;
87ecb68b 286
a8170e5e
AK
287int isa_vga_mm_init(hwaddr vram_base,
288 hwaddr ctrl_base, int it_shift,
be20f9e9 289 MemoryRegion *address_space);
87ecb68b 290
87ecb68b 291/* ne2000.c */
48a18b3c 292static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd)
60a14ad3 293{
4a17cc4f
AF
294 DeviceState *dev;
295 ISADevice *isadev;
87ecb68b 296
60a14ad3
BS
297 qemu_check_nic_model(nd, "ne2k_isa");
298
4a17cc4f
AF
299 isadev = isa_try_create(bus, "ne2k_isa");
300 if (!isadev) {
cd1b8a8b
BS
301 return false;
302 }
4a17cc4f
AF
303 dev = DEVICE(isadev);
304 qdev_prop_set_uint32(dev, "iobase", base);
305 qdev_prop_set_uint32(dev, "irq", irq);
306 qdev_set_nic_properties(dev, nd);
307 qdev_init_nofail(dev);
cd1b8a8b 308 return true;
60a14ad3 309}
87ecb68b 310
cbc5b5f3 311/* pc_sysfw.c */
6dd2a5c9
PB
312void pc_system_firmware_init(MemoryRegion *rom_memory,
313 bool isapc_ram_fw);
cbc5b5f3 314
3ab135f3 315/* pvpanic.c */
309cd62d 316uint16_t pvpanic_port(void);
3ab135f3 317
4c5b10b7
JS
318/* e820 types */
319#define E820_RAM 1
320#define E820_RESERVED 2
321#define E820_ACPI 3
322#define E820_NVS 4
323#define E820_UNUSABLE 5
324
325int e820_add_entry(uint64_t, uint64_t, uint32_t);
7bf8ef19
GS
326int e820_get_num_entries(void);
327bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
4c5b10b7 328
87e896ab 329#define PC_COMPAT_2_4 \
becb6667
PB
330 HW_COMPAT_2_4 \
331 {\
332 .driver = "Haswell-" TYPE_X86_CPU,\
333 .property = "abm",\
334 .value = "off",\
335 },\
336 {\
337 .driver = "Haswell-noTSX-" TYPE_X86_CPU,\
338 .property = "abm",\
339 .value = "off",\
340 },\
341 {\
342 .driver = "Broadwell-" TYPE_X86_CPU,\
343 .property = "abm",\
344 .value = "off",\
345 },\
346 {\
347 .driver = "Broadwell-noTSX-" TYPE_X86_CPU,\
348 .property = "abm",\
349 .value = "off",\
e265e3e4
EH
350 },\
351 {\
352 .driver = "host" "-" TYPE_X86_CPU,\
353 .property = "host-cache-info",\
354 .value = "on",\
3e684822
EH
355 },\
356 {\
357 .driver = TYPE_X86_CPU,\
358 .property = "check",\
359 .value = "off",\
0909ad24
EH
360 },\
361 {\
362 .driver = "qemu64" "-" TYPE_X86_CPU,\
363 .property = "sse4a",\
364 .value = "on",\
71195672
EH
365 },\
366 {\
367 .driver = "qemu64" "-" TYPE_X86_CPU,\
368 .property = "abm",\
369 .value = "on",\
6aa91e4a
EH
370 },\
371 {\
372 .driver = "qemu64" "-" TYPE_X86_CPU,\
373 .property = "popcnt",\
374 .value = "on",\
375 },\
376 {\
377 .driver = "qemu32" "-" TYPE_X86_CPU,\
378 .property = "popcnt",\
379 .value = "on",\
33b5e8c0
EH
380 },{\
381 .driver = "Opteron_G2" "-" TYPE_X86_CPU,\
382 .property = "rdtscp",\
383 .value = "on",\
384 },{\
385 .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
386 .property = "rdtscp",\
387 .value = "on",\
388 },{\
389 .driver = "Opteron_G4" "-" TYPE_X86_CPU,\
390 .property = "rdtscp",\
391 .value = "on",\
392 },{\
393 .driver = "Opteron_G5" "-" TYPE_X86_CPU,\
394 .property = "rdtscp",\
395 .value = "on",\
becb6667 396 },
87e896ab 397
33b5e8c0 398
42134ac9 399#define PC_COMPAT_2_3 \
87e896ab 400 PC_COMPAT_2_4 \
28b8e4d0
JK
401 HW_COMPAT_2_3 \
402 {\
403 .driver = TYPE_X86_CPU,\
404 .property = "arat",\
405 .value = "off",\
3046bb5d
RK
406 },{\
407 .driver = "qemu64" "-" TYPE_X86_CPU,\
408 .property = "level",\
409 .value = stringify(4),\
410 },{\
411 .driver = "kvm64" "-" TYPE_X86_CPU,\
412 .property = "level",\
413 .value = stringify(5),\
414 },{\
415 .driver = "pentium3" "-" TYPE_X86_CPU,\
416 .property = "level",\
417 .value = stringify(2),\
418 },{\
419 .driver = "n270" "-" TYPE_X86_CPU,\
420 .property = "level",\
421 .value = stringify(5),\
422 },{\
423 .driver = "Conroe" "-" TYPE_X86_CPU,\
424 .property = "level",\
425 .value = stringify(4),\
426 },{\
427 .driver = "Penryn" "-" TYPE_X86_CPU,\
428 .property = "level",\
429 .value = stringify(4),\
430 },{\
431 .driver = "Nehalem" "-" TYPE_X86_CPU,\
432 .property = "level",\
433 .value = stringify(4),\
434 },{\
435 .driver = "n270" "-" TYPE_X86_CPU,\
436 .property = "xlevel",\
437 .value = stringify(0x8000000a),\
438 },{\
439 .driver = "Penryn" "-" TYPE_X86_CPU,\
440 .property = "xlevel",\
441 .value = stringify(0x8000000a),\
442 },{\
443 .driver = "Conroe" "-" TYPE_X86_CPU,\
444 .property = "xlevel",\
445 .value = stringify(0x8000000a),\
446 },{\
447 .driver = "Nehalem" "-" TYPE_X86_CPU,\
448 .property = "xlevel",\
449 .value = stringify(0x8000000a),\
450 },{\
451 .driver = "Westmere" "-" TYPE_X86_CPU,\
452 .property = "xlevel",\
453 .value = stringify(0x8000000a),\
454 },{\
455 .driver = "SandyBridge" "-" TYPE_X86_CPU,\
456 .property = "xlevel",\
457 .value = stringify(0x8000000a),\
27751aab
RK
458 },{\
459 .driver = "IvyBridge" "-" TYPE_X86_CPU,\
460 .property = "xlevel",\
461 .value = stringify(0x8000000a),\
3046bb5d
RK
462 },{\
463 .driver = "Haswell" "-" TYPE_X86_CPU,\
464 .property = "xlevel",\
465 .value = stringify(0x8000000a),\
466 },{\
467 .driver = "Haswell-noTSX" "-" TYPE_X86_CPU,\
468 .property = "xlevel",\
469 .value = stringify(0x8000000a),\
470 },{\
471 .driver = "Broadwell" "-" TYPE_X86_CPU,\
472 .property = "xlevel",\
473 .value = stringify(0x8000000a),\
474 },{\
475 .driver = "Broadwell-noTSX" "-" TYPE_X86_CPU,\
476 .property = "xlevel",\
477 .value = stringify(0x8000000a),\
28b8e4d0 478 },
42134ac9
EH
479
480#define PC_COMPAT_2_2 \
481 PC_COMPAT_2_3 \
27add381
EH
482 HW_COMPAT_2_2 \
483 {\
484 .driver = "kvm64" "-" TYPE_X86_CPU,\
485 .property = "vme",\
486 .value = "off",\
487 },\
488 {\
489 .driver = "kvm32" "-" TYPE_X86_CPU,\
490 .property = "vme",\
491 .value = "off",\
492 },\
493 {\
494 .driver = "Conroe" "-" TYPE_X86_CPU,\
495 .property = "vme",\
496 .value = "off",\
497 },\
498 {\
499 .driver = "Penryn" "-" TYPE_X86_CPU,\
500 .property = "vme",\
501 .value = "off",\
502 },\
503 {\
504 .driver = "Nehalem" "-" TYPE_X86_CPU,\
505 .property = "vme",\
506 .value = "off",\
507 },\
508 {\
509 .driver = "Westmere" "-" TYPE_X86_CPU,\
510 .property = "vme",\
511 .value = "off",\
512 },\
513 {\
514 .driver = "SandyBridge" "-" TYPE_X86_CPU,\
515 .property = "vme",\
516 .value = "off",\
517 },\
518 {\
519 .driver = "Haswell" "-" TYPE_X86_CPU,\
520 .property = "vme",\
521 .value = "off",\
522 },\
523 {\
524 .driver = "Broadwell" "-" TYPE_X86_CPU,\
525 .property = "vme",\
526 .value = "off",\
527 },\
528 {\
529 .driver = "Opteron_G1" "-" TYPE_X86_CPU,\
530 .property = "vme",\
531 .value = "off",\
532 },\
533 {\
534 .driver = "Opteron_G2" "-" TYPE_X86_CPU,\
535 .property = "vme",\
536 .value = "off",\
537 },\
538 {\
539 .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
540 .property = "vme",\
541 .value = "off",\
542 },\
543 {\
544 .driver = "Opteron_G4" "-" TYPE_X86_CPU,\
545 .property = "vme",\
546 .value = "off",\
547 },\
548 {\
549 .driver = "Opteron_G5" "-" TYPE_X86_CPU,\
550 .property = "vme",\
551 .value = "off",\
552 },\
553 {\
554 .driver = "Haswell" "-" TYPE_X86_CPU,\
555 .property = "f16c",\
556 .value = "off",\
557 },\
558 {\
559 .driver = "Haswell" "-" TYPE_X86_CPU,\
560 .property = "rdrand",\
561 .value = "off",\
562 },\
563 {\
564 .driver = "Broadwell" "-" TYPE_X86_CPU,\
565 .property = "f16c",\
566 .value = "off",\
567 },\
568 {\
569 .driver = "Broadwell" "-" TYPE_X86_CPU,\
570 .property = "rdrand",\
571 .value = "off",\
572 },
42134ac9
EH
573
574#define PC_COMPAT_2_1 \
575 PC_COMPAT_2_2 \
27add381
EH
576 HW_COMPAT_2_1 \
577 {\
578 .driver = "coreduo" "-" TYPE_X86_CPU,\
579 .property = "vmx",\
580 .value = "on",\
581 },\
582 {\
583 .driver = "core2duo" "-" TYPE_X86_CPU,\
584 .property = "vmx",\
585 .value = "on",\
586 },
42134ac9 587
9df11c9f 588#define PC_COMPAT_2_0 \
42134ac9 589 PC_COMPAT_2_1 \
9df11c9f 590 {\
3eff1f46
PB
591 .driver = "virtio-scsi-pci",\
592 .property = "any_layout",\
593 .value = "off",\
594 },{\
34774320
IM
595 .driver = "PIIX4_PM",\
596 .property = "memory-hotplug-support",\
597 .value = "off",\
598 },\
9df11c9f 599 {\
aa93200b
GS
600 .driver = "apic",\
601 .property = "version",\
602 .value = stringify(0x11),\
34774320
IM
603 },\
604 {\
7bafd888
GH
605 .driver = "nec-usb-xhci",\
606 .property = "superspeed-ports-first",\
607 .value = "off",\
13cc2c3e 608 },\
e6043e92
DDAG
609 {\
610 .driver = "nec-usb-xhci",\
611 .property = "force-pcie-endcap",\
612 .value = "on",\
613 },\
13cc2c3e
BZ
614 {\
615 .driver = "pci-serial",\
616 .property = "prog_if",\
617 .value = stringify(0),\
618 },\
619 {\
620 .driver = "pci-serial-2x",\
fa118d1f 621 .property = "prog_if",\
13cc2c3e
BZ
622 .value = stringify(0),\
623 },\
624 {\
625 .driver = "pci-serial-4x",\
626 .property = "prog_if",\
627 .value = stringify(0),\
f57fcf70
JW
628 },\
629 {\
630 .driver = "virtio-net-pci",\
631 .property = "guest_announce",\
632 .value = "off",\
b8f5cfd6
EH
633 },\
634 {\
635 .driver = "ICH9-LPC",\
636 .property = "memory-hotplug-support",\
637 .value = "off",\
638 },{\
639 .driver = "xio3130-downstream",\
640 .property = COMPAT_PROP_PCP,\
641 .value = "off",\
642 },{\
643 .driver = "ioh3420",\
644 .property = COMPAT_PROP_PCP,\
645 .value = "off",\
a7cde24d 646 },
9df11c9f 647
5319dc7b 648#define PC_COMPAT_1_7 \
a7cde24d 649 PC_COMPAT_2_0 \
5319dc7b
GH
650 {\
651 .driver = TYPE_USB_DEVICE,\
652 .property = "msos-desc",\
653 .value = "no",\
9e047b98
MT
654 },\
655 {\
656 .driver = "PIIX4_PM",\
657 .property = "acpi-pci-hotplug-with-bridge-support",\
658 .value = "off",\
b8f5cfd6
EH
659 },\
660 {\
661 .driver = "hpet",\
662 .property = HPET_INTCAP,\
663 .value = stringify(4),\
a7cde24d 664 },
5319dc7b 665
e9845f09 666#define PC_COMPAT_1_6 \
a7cde24d 667 PC_COMPAT_1_7 \
e9845f09
VM
668 {\
669 .driver = "e1000",\
670 .property = "mitigation",\
671 .value = "off",\
f8e6a11a
EH
672 },{\
673 .driver = "qemu64-" TYPE_X86_CPU,\
674 .property = "model",\
675 .value = stringify(2),\
676 },{\
677 .driver = "qemu32-" TYPE_X86_CPU,\
678 .property = "model",\
679 .value = stringify(3),\
04c7d8b8
CR
680 },{\
681 .driver = "i440FX-pcihost",\
682 .property = "short_root_bus",\
683 .value = stringify(1),\
684 },{\
685 .driver = "q35-pcihost",\
686 .property = "short_root_bus",\
687 .value = stringify(1),\
a7cde24d 688 },
e9845f09 689
ffce9ebb 690#define PC_COMPAT_1_5 \
a7cde24d 691 PC_COMPAT_1_6 \
ffce9ebb
EH
692 {\
693 .driver = "Conroe-" TYPE_X86_CPU,\
694 .property = "model",\
695 .value = stringify(2),\
6b11322e
EH
696 },{\
697 .driver = "Conroe-" TYPE_X86_CPU,\
698 .property = "level",\
699 .value = stringify(2),\
ffce9ebb
EH
700 },{\
701 .driver = "Penryn-" TYPE_X86_CPU,\
702 .property = "model",\
703 .value = stringify(2),\
6b11322e
EH
704 },{\
705 .driver = "Penryn-" TYPE_X86_CPU,\
706 .property = "level",\
707 .value = stringify(2),\
ffce9ebb
EH
708 },{\
709 .driver = "Nehalem-" TYPE_X86_CPU,\
710 .property = "model",\
711 .value = stringify(2),\
6b11322e
EH
712 },{\
713 .driver = "Nehalem-" TYPE_X86_CPU,\
714 .property = "level",\
715 .value = stringify(2),\
488f069b
MT
716 },{\
717 .driver = "virtio-net-pci",\
718 .property = "any_layout",\
719 .value = "off",\
9337e3b6
EH
720 },{\
721 .driver = TYPE_X86_CPU,\
722 .property = "pmu",\
723 .value = "on",\
04c7d8b8
CR
724 },{\
725 .driver = "i440FX-pcihost",\
726 .property = "short_root_bus",\
727 .value = stringify(0),\
728 },{\
729 .driver = "q35-pcihost",\
730 .property = "short_root_bus",\
731 .value = stringify(0),\
a7cde24d 732 },
ffce9ebb 733
bf3caa3d 734#define PC_COMPAT_1_4 \
a7cde24d 735 PC_COMPAT_1_5 \
bf3caa3d
PB
736 {\
737 .driver = "scsi-hd",\
738 .property = "discard_granularity",\
739 .value = stringify(0),\
4974920a 740 },{\
bf3caa3d
PB
741 .driver = "scsi-cd",\
742 .property = "discard_granularity",\
743 .value = stringify(0),\
4974920a 744 },{\
bf3caa3d
PB
745 .driver = "scsi-disk",\
746 .property = "discard_granularity",\
747 .value = stringify(0),\
4974920a 748 },{\
bf3caa3d
PB
749 .driver = "ide-hd",\
750 .property = "discard_granularity",\
751 .value = stringify(0),\
4974920a 752 },{\
bf3caa3d
PB
753 .driver = "ide-cd",\
754 .property = "discard_granularity",\
755 .value = stringify(0),\
4974920a 756 },{\
bf3caa3d
PB
757 .driver = "ide-drive",\
758 .property = "discard_granularity",\
759 .value = stringify(0),\
c45e5b5b 760 },{\
bf3caa3d
PB
761 .driver = "virtio-blk-pci",\
762 .property = "discard_granularity",\
763 .value = stringify(0),\
4974920a 764 },{\
554f1997
GH
765 .driver = "virtio-serial-pci",\
766 .property = "vectors",\
767 /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\
768 .value = stringify(0xFFFFFFFF),\
644c9858
DF
769 },{ \
770 .driver = "virtio-net-pci", \
771 .property = "ctrl_guest_offloads", \
772 .value = "off", \
c45e5b5b
GH
773 },{\
774 .driver = "e1000",\
775 .property = "romfile",\
776 .value = "pxe-e1000.rom",\
777 },{\
778 .driver = "ne2k_pci",\
779 .property = "romfile",\
780 .value = "pxe-ne2k_pci.rom",\
781 },{\
782 .driver = "pcnet",\
783 .property = "romfile",\
784 .value = "pxe-pcnet.rom",\
785 },{\
786 .driver = "rtl8139",\
787 .property = "romfile",\
788 .value = "pxe-rtl8139.rom",\
789 },{\
790 .driver = "virtio-net-pci",\
791 .property = "romfile",\
792 .value = "pxe-virtio.rom",\
b2a856d9
AF
793 },{\
794 .driver = "486-" TYPE_X86_CPU,\
795 .property = "model",\
796 .value = stringify(0),\
27add381
EH
797 },\
798 {\
799 .driver = "n270" "-" TYPE_X86_CPU,\
800 .property = "movbe",\
801 .value = "off",\
802 },\
803 {\
804 .driver = "Westmere" "-" TYPE_X86_CPU,\
805 .property = "pclmulqdq",\
806 .value = "off",\
a7cde24d 807 },
bf3caa3d 808
25519b06 809#define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
865906f7
EH
810 static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
811 { \
812 MachineClass *mc = MACHINE_CLASS(oc); \
813 optsfn(mc); \
814 mc->name = namestr; \
815 mc->init = initfn; \
816 } \
817 static const TypeInfo pc_machine_type_##suffix = { \
818 .name = namestr TYPE_MACHINE_SUFFIX, \
819 .parent = TYPE_PC_MACHINE, \
820 .class_init = pc_machine_##suffix##_class_init, \
821 }; \
61f219df
EH
822 static void pc_machine_init_##suffix(void) \
823 { \
865906f7 824 type_register(&pc_machine_type_##suffix); \
61f219df
EH
825 } \
826 machine_init(pc_machine_init_##suffix)
827
25519b06
EH
828#define SET_MACHINE_COMPAT(m, COMPAT) do { \
829 static GlobalProperty props[] = { \
830 COMPAT \
831 { /* end of list */ } \
832 }; \
833 (m)->compat_props = props; \
834} while (0)
835
bd8107d7 836extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
87ecb68b 837#endif