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