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