xref: /openbmc/qemu/include/hw/i386/pc.h (revision 464e447a)
1 #ifndef HW_PC_H
2 #define HW_PC_H
3 
4 #include "qemu-common.h"
5 #include "exec/memory.h"
6 #include "hw/boards.h"
7 #include "hw/isa/isa.h"
8 #include "hw/block/fdc.h"
9 #include "net/net.h"
10 #include "hw/i386/ioapic.h"
11 
12 #include "qemu/range.h"
13 #include "qemu/bitmap.h"
14 #include "sysemu/sysemu.h"
15 #include "hw/pci/pci.h"
16 #include "hw/compat.h"
17 #include "hw/mem/pc-dimm.h"
18 #include "hw/mem/nvdimm.h"
19 #include "hw/acpi/acpi_dev_interface.h"
20 
21 #define HPET_INTCAP "hpet-intcap"
22 
23 /**
24  * PCMachineState:
25  * @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling
26  * @boot_cpus: number of present VCPUs
27  */
28 struct PCMachineState {
29     /*< private >*/
30     MachineState parent_obj;
31 
32     /* <public> */
33 
34     /* State for other subsystems/APIs: */
35     Notifier machine_done;
36 
37     /* Pointers to devices and objects: */
38     HotplugHandler *acpi_dev;
39     ISADevice *rtc;
40     PCIBus *bus;
41     FWCfgState *fw_cfg;
42     qemu_irq *gsi;
43 
44     /* Configuration options: */
45     uint64_t max_ram_below_4g;
46     OnOffAuto vmport;
47     OnOffAuto smm;
48 
49     AcpiNVDIMMState acpi_nvdimm_state;
50 
51     bool acpi_build_enabled;
52     bool smbus_enabled;
53     bool sata_enabled;
54     bool pit_enabled;
55 
56     /* RAM information (sizes, addresses, configuration): */
57     ram_addr_t below_4g_mem_size, above_4g_mem_size;
58 
59     /* CPU and apic information: */
60     bool apic_xrupt_override;
61     unsigned apic_id_limit;
62     uint16_t boot_cpus;
63 
64     /* NUMA information: */
65     uint64_t numa_nodes;
66     uint64_t *node_mem;
67 
68     /* Address space used by IOAPIC device. All IOAPIC interrupts
69      * will be translated to MSI messages in the address space. */
70     AddressSpace *ioapic_as;
71 };
72 
73 #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device"
74 #define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size"
75 #define PC_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
76 #define PC_MACHINE_VMPORT           "vmport"
77 #define PC_MACHINE_SMM              "smm"
78 #define PC_MACHINE_NVDIMM           "nvdimm"
79 #define PC_MACHINE_NVDIMM_PERSIST   "nvdimm-persistence"
80 #define PC_MACHINE_SMBUS            "smbus"
81 #define PC_MACHINE_SATA             "sata"
82 #define PC_MACHINE_PIT              "pit"
83 
84 /**
85  * PCMachineClass:
86  *
87  * Compat fields:
88  *
89  * @enforce_aligned_dimm: check that DIMM's address/size is aligned by
90  *                        backend's alignment value if provided
91  * @acpi_data_size: Size of the chunk of memory at the top of RAM
92  *                  for the BIOS ACPI tables and other BIOS
93  *                  datastructures.
94  * @gigabyte_align: Make sure that guest addresses aligned at
95  *                  1Gbyte boundaries get mapped to host
96  *                  addresses aligned at 1Gbyte boundaries. This
97  *                  way we can use 1GByte pages in the host.
98  *
99  */
100 struct PCMachineClass {
101     /*< private >*/
102     MachineClass parent_class;
103 
104     /*< public >*/
105 
106     /* Device configuration: */
107     bool pci_enabled;
108     bool kvmclock_enabled;
109     const char *default_nic_model;
110 
111     /* Compat options: */
112 
113     /* ACPI compat: */
114     bool has_acpi_build;
115     bool rsdp_in_ram;
116     int legacy_acpi_table_size;
117     unsigned acpi_data_size;
118 
119     /* SMBIOS compat: */
120     bool smbios_defaults;
121     bool smbios_legacy_mode;
122     bool smbios_uuid_encoded;
123 
124     /* RAM / address space compat: */
125     bool gigabyte_align;
126     bool has_reserved_memory;
127     bool enforce_aligned_dimm;
128     bool broken_reserved_end;
129 
130     /* TSC rate migration: */
131     bool save_tsc_khz;
132     /* generate legacy CPU hotplug AML */
133     bool legacy_cpu_hotplug;
134 
135     /* use DMA capable linuxboot option rom */
136     bool linuxboot_dma_enabled;
137 };
138 
139 #define TYPE_PC_MACHINE "generic-pc-machine"
140 #define PC_MACHINE(obj) \
141     OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE)
142 #define PC_MACHINE_GET_CLASS(obj) \
143     OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE)
144 #define PC_MACHINE_CLASS(klass) \
145     OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE)
146 
147 /* i8259.c */
148 
149 extern DeviceState *isa_pic;
150 qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq);
151 qemu_irq *kvm_i8259_init(ISABus *bus);
152 int pic_read_irq(DeviceState *d);
153 int pic_get_output(DeviceState *d);
154 
155 /* ioapic.c */
156 
157 /* Global System Interrupts */
158 
159 #define GSI_NUM_PINS IOAPIC_NUM_PINS
160 
161 typedef struct GSIState {
162     qemu_irq i8259_irq[ISA_NUM_IRQS];
163     qemu_irq ioapic_irq[IOAPIC_NUM_PINS];
164 } GSIState;
165 
166 void gsi_handler(void *opaque, int n, int level);
167 
168 /* vmport.c */
169 #define TYPE_VMPORT "vmport"
170 typedef uint32_t (VMPortReadFunc)(void *opaque, uint32_t address);
171 
172 static inline void vmport_init(ISABus *bus)
173 {
174     isa_create_simple(bus, TYPE_VMPORT);
175 }
176 
177 void vmport_register(unsigned char command, VMPortReadFunc *func, void *opaque);
178 void vmmouse_get_data(uint32_t *data);
179 void vmmouse_set_data(const uint32_t *data);
180 
181 /* pc.c */
182 extern int fd_bootchk;
183 
184 bool pc_machine_is_smm_enabled(PCMachineState *pcms);
185 void pc_register_ferr_irq(qemu_irq irq);
186 void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
187 
188 void pc_cpus_init(PCMachineState *pcms);
189 void pc_hot_add_cpu(const int64_t id, Error **errp);
190 void pc_acpi_init(const char *default_dsdt);
191 
192 void pc_guest_info_init(PCMachineState *pcms);
193 
194 #define PCI_HOST_PROP_PCI_HOLE_START   "pci-hole-start"
195 #define PCI_HOST_PROP_PCI_HOLE_END     "pci-hole-end"
196 #define PCI_HOST_PROP_PCI_HOLE64_START "pci-hole64-start"
197 #define PCI_HOST_PROP_PCI_HOLE64_END   "pci-hole64-end"
198 #define PCI_HOST_PROP_PCI_HOLE64_SIZE  "pci-hole64-size"
199 #define PCI_HOST_BELOW_4G_MEM_SIZE     "below-4g-mem-size"
200 #define PCI_HOST_ABOVE_4G_MEM_SIZE     "above-4g-mem-size"
201 
202 
203 void pc_pci_as_mapping_init(Object *owner, MemoryRegion *system_memory,
204                             MemoryRegion *pci_address_space);
205 
206 void xen_load_linux(PCMachineState *pcms);
207 void pc_memory_init(PCMachineState *pcms,
208                     MemoryRegion *system_memory,
209                     MemoryRegion *rom_memory,
210                     MemoryRegion **ram_memory);
211 uint64_t pc_pci_hole64_start(void);
212 qemu_irq pc_allocate_cpu_irq(void);
213 DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
214 void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
215                           ISADevice **rtc_state,
216                           bool create_fdctrl,
217                           bool no_vmport,
218                           bool has_pit,
219                           uint32_t hpet_irqs);
220 void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd);
221 void pc_cmos_init(PCMachineState *pcms,
222                   BusState *ide0, BusState *ide1,
223                   ISADevice *s);
224 void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus);
225 void pc_pci_device_init(PCIBus *pci_bus);
226 
227 typedef void (*cpu_set_smm_t)(int smm, void *arg);
228 
229 void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
230 
231 ISADevice *pc_find_fdc0(void);
232 int cmos_get_fd_drive_type(FloppyDriveType fd0);
233 
234 #define FW_CFG_IO_BASE     0x510
235 
236 #define PORT92_A20_LINE "a20"
237 
238 /* acpi_piix.c */
239 
240 I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
241                       qemu_irq sci_irq, qemu_irq smi_irq,
242                       int smm_enabled, DeviceState **piix4_pm);
243 
244 /* hpet.c */
245 extern int no_hpet;
246 
247 /* piix_pci.c */
248 struct PCII440FXState;
249 typedef struct PCII440FXState PCII440FXState;
250 
251 #define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost"
252 #define TYPE_I440FX_PCI_DEVICE "i440FX"
253 
254 #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX"
255 
256 /*
257  * Reset Control Register: PCI-accessible ISA-Compatible Register at address
258  * 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000).
259  */
260 #define RCR_IOPORT 0xcf9
261 
262 PCIBus *i440fx_init(const char *host_type, const char *pci_type,
263                     PCII440FXState **pi440fx_state, int *piix_devfn,
264                     ISABus **isa_bus, qemu_irq *pic,
265                     MemoryRegion *address_space_mem,
266                     MemoryRegion *address_space_io,
267                     ram_addr_t ram_size,
268                     ram_addr_t below_4g_mem_size,
269                     ram_addr_t above_4g_mem_size,
270                     MemoryRegion *pci_memory,
271                     MemoryRegion *ram_memory);
272 
273 PCIBus *find_i440fx(void);
274 /* piix4.c */
275 extern PCIDevice *piix4_dev;
276 int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
277 
278 /* pc_sysfw.c */
279 void pc_system_firmware_init(MemoryRegion *rom_memory,
280                              bool isapc_ram_fw);
281 
282 /* acpi-build.c */
283 void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
284                        const CPUArchIdList *apic_ids, GArray *entry);
285 
286 /* e820 types */
287 #define E820_RAM        1
288 #define E820_RESERVED   2
289 #define E820_ACPI       3
290 #define E820_NVS        4
291 #define E820_UNUSABLE   5
292 
293 int e820_add_entry(uint64_t, uint64_t, uint32_t);
294 int e820_get_num_entries(void);
295 bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
296 
297 #define PC_COMPAT_3_1 \
298     HW_COMPAT_3_1 \
299     {\
300         .driver   = "intel-iommu",\
301         .property = "dma-drain",\
302         .value    = "off",\
303     },
304 
305 #define PC_COMPAT_3_0 \
306     HW_COMPAT_3_0 \
307     {\
308         .driver   = TYPE_X86_CPU,\
309         .property = "x-hv-synic-kvm-only",\
310         .value    = "on",\
311     },{\
312         .driver   = "Skylake-Server" "-" TYPE_X86_CPU,\
313         .property = "pku",\
314         .value    = "off",\
315     },{\
316         .driver   = "Skylake-Server-IBRS" "-" TYPE_X86_CPU,\
317         .property = "pku",\
318         .value    = "off",\
319     },
320 
321 #define PC_COMPAT_2_12 \
322     HW_COMPAT_2_12 \
323     {\
324         .driver   = TYPE_X86_CPU,\
325         .property = "legacy-cache",\
326         .value    = "on",\
327     },{\
328         .driver   = TYPE_X86_CPU,\
329         .property = "topoext",\
330         .value    = "off",\
331     },{\
332         .driver   = "EPYC-" TYPE_X86_CPU,\
333         .property = "xlevel",\
334         .value    = stringify(0x8000000a),\
335     },{\
336         .driver   = "EPYC-IBPB-" TYPE_X86_CPU,\
337         .property = "xlevel",\
338         .value    = stringify(0x8000000a),\
339     },
340 
341 #define PC_COMPAT_2_11 \
342     HW_COMPAT_2_11 \
343     {\
344         .driver   = TYPE_X86_CPU,\
345         .property = "x-migrate-smi-count",\
346         .value    = "off",\
347     },{\
348         .driver   = "Skylake-Server" "-" TYPE_X86_CPU,\
349         .property = "clflushopt",\
350         .value    = "off",\
351     },
352 
353 #define PC_COMPAT_2_10 \
354     HW_COMPAT_2_10 \
355     {\
356         .driver   = TYPE_X86_CPU,\
357         .property = "x-hv-max-vps",\
358         .value    = "0x40",\
359     },{\
360         .driver   = "i440FX-pcihost",\
361         .property = "x-pci-hole64-fix",\
362         .value    = "off",\
363     },{\
364         .driver   = "q35-pcihost",\
365         .property = "x-pci-hole64-fix",\
366         .value    = "off",\
367     },
368 
369 #define PC_COMPAT_2_9 \
370     HW_COMPAT_2_9 \
371     {\
372         .driver   = "mch",\
373         .property = "extended-tseg-mbytes",\
374         .value    = stringify(0),\
375     },\
376 
377 #define PC_COMPAT_2_8 \
378     HW_COMPAT_2_8 \
379     {\
380         .driver   = TYPE_X86_CPU,\
381         .property = "tcg-cpuid",\
382         .value    = "off",\
383     },\
384     {\
385         .driver   = "kvmclock",\
386         .property = "x-mach-use-reliable-get-clock",\
387         .value    = "off",\
388     },\
389     {\
390         .driver   = "ICH9-LPC",\
391         .property = "x-smi-broadcast",\
392         .value    = "off",\
393     },\
394     {\
395         .driver   = TYPE_X86_CPU,\
396         .property = "vmware-cpuid-freq",\
397         .value    = "off",\
398     },\
399     {\
400         .driver   = "Haswell-" TYPE_X86_CPU,\
401         .property = "stepping",\
402         .value    = "1",\
403     },
404 
405 #define PC_COMPAT_2_7 \
406     HW_COMPAT_2_7 \
407     {\
408         .driver   = TYPE_X86_CPU,\
409         .property = "l3-cache",\
410         .value    = "off",\
411     },\
412     {\
413         .driver   = TYPE_X86_CPU,\
414         .property = "full-cpuid-auto-level",\
415         .value    = "off",\
416     },\
417     {\
418         .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
419         .property = "family",\
420         .value    = "15",\
421     },\
422     {\
423         .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
424         .property = "model",\
425         .value    = "6",\
426     },\
427     {\
428         .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
429         .property = "stepping",\
430         .value    = "1",\
431     },\
432     {\
433         .driver   = "isa-pcspk",\
434         .property = "migrate",\
435         .value    = "off",\
436     },
437 
438 #define PC_COMPAT_2_6 \
439     HW_COMPAT_2_6 \
440     {\
441         .driver   = TYPE_X86_CPU,\
442         .property = "cpuid-0xb",\
443         .value    = "off",\
444     },{\
445         .driver   = "vmxnet3",\
446         .property = "romfile",\
447         .value    = "",\
448     },\
449     {\
450         .driver = TYPE_X86_CPU,\
451         .property = "fill-mtrr-mask",\
452         .value = "off",\
453     },\
454     {\
455         .driver   = "apic-common",\
456         .property = "legacy-instance-id",\
457         .value    = "on",\
458     },
459 
460 #define PC_COMPAT_2_5 \
461     HW_COMPAT_2_5
462 
463 /* Helper for setting model-id for CPU models that changed model-id
464  * depending on QEMU versions up to QEMU 2.4.
465  */
466 #define PC_CPU_MODEL_IDS(v) \
467     {\
468         .driver   = "qemu32-" TYPE_X86_CPU,\
469         .property = "model-id",\
470         .value    = "QEMU Virtual CPU version " v,\
471     },\
472     {\
473         .driver   = "qemu64-" TYPE_X86_CPU,\
474         .property = "model-id",\
475         .value    = "QEMU Virtual CPU version " v,\
476     },\
477     {\
478         .driver   = "athlon-" TYPE_X86_CPU,\
479         .property = "model-id",\
480         .value    = "QEMU Virtual CPU version " v,\
481     },
482 
483 #define PC_COMPAT_2_4 \
484     HW_COMPAT_2_4 \
485     PC_CPU_MODEL_IDS("2.4.0") \
486     {\
487         .driver   = "Haswell-" TYPE_X86_CPU,\
488         .property = "abm",\
489         .value    = "off",\
490     },\
491     {\
492         .driver   = "Haswell-noTSX-" TYPE_X86_CPU,\
493         .property = "abm",\
494         .value    = "off",\
495     },\
496     {\
497         .driver   = "Broadwell-" TYPE_X86_CPU,\
498         .property = "abm",\
499         .value    = "off",\
500     },\
501     {\
502         .driver   = "Broadwell-noTSX-" TYPE_X86_CPU,\
503         .property = "abm",\
504         .value    = "off",\
505     },\
506     {\
507         .driver   = "host" "-" TYPE_X86_CPU,\
508         .property = "host-cache-info",\
509         .value    = "on",\
510     },\
511     {\
512         .driver   = TYPE_X86_CPU,\
513         .property = "check",\
514         .value    = "off",\
515     },\
516     {\
517         .driver   = "qemu64" "-" TYPE_X86_CPU,\
518         .property = "sse4a",\
519         .value    = "on",\
520     },\
521     {\
522         .driver   = "qemu64" "-" TYPE_X86_CPU,\
523         .property = "abm",\
524         .value    = "on",\
525     },\
526     {\
527         .driver   = "qemu64" "-" TYPE_X86_CPU,\
528         .property = "popcnt",\
529         .value    = "on",\
530     },\
531     {\
532         .driver   = "qemu32" "-" TYPE_X86_CPU,\
533         .property = "popcnt",\
534         .value    = "on",\
535     },{\
536         .driver   = "Opteron_G2" "-" TYPE_X86_CPU,\
537         .property = "rdtscp",\
538         .value    = "on",\
539     },{\
540         .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
541         .property = "rdtscp",\
542         .value    = "on",\
543     },{\
544         .driver   = "Opteron_G4" "-" TYPE_X86_CPU,\
545         .property = "rdtscp",\
546         .value    = "on",\
547     },{\
548         .driver   = "Opteron_G5" "-" TYPE_X86_CPU,\
549         .property = "rdtscp",\
550         .value    = "on",\
551     },
552 
553 
554 #define PC_COMPAT_2_3 \
555     HW_COMPAT_2_3 \
556     PC_CPU_MODEL_IDS("2.3.0") \
557     {\
558         .driver   = TYPE_X86_CPU,\
559         .property = "arat",\
560         .value    = "off",\
561     },{\
562         .driver   = "qemu64" "-" TYPE_X86_CPU,\
563         .property = "min-level",\
564         .value    = stringify(4),\
565     },{\
566         .driver   = "kvm64" "-" TYPE_X86_CPU,\
567         .property = "min-level",\
568         .value    = stringify(5),\
569     },{\
570         .driver   = "pentium3" "-" TYPE_X86_CPU,\
571         .property = "min-level",\
572         .value    = stringify(2),\
573     },{\
574         .driver   = "n270" "-" TYPE_X86_CPU,\
575         .property = "min-level",\
576         .value    = stringify(5),\
577     },{\
578         .driver   = "Conroe" "-" TYPE_X86_CPU,\
579         .property = "min-level",\
580         .value    = stringify(4),\
581     },{\
582         .driver   = "Penryn" "-" TYPE_X86_CPU,\
583         .property = "min-level",\
584         .value    = stringify(4),\
585     },{\
586         .driver   = "Nehalem" "-" TYPE_X86_CPU,\
587         .property = "min-level",\
588         .value    = stringify(4),\
589     },{\
590         .driver   = "n270" "-" TYPE_X86_CPU,\
591         .property = "min-xlevel",\
592         .value    = stringify(0x8000000a),\
593     },{\
594         .driver   = "Penryn" "-" TYPE_X86_CPU,\
595         .property = "min-xlevel",\
596         .value    = stringify(0x8000000a),\
597     },{\
598         .driver   = "Conroe" "-" TYPE_X86_CPU,\
599         .property = "min-xlevel",\
600         .value    = stringify(0x8000000a),\
601     },{\
602         .driver   = "Nehalem" "-" TYPE_X86_CPU,\
603         .property = "min-xlevel",\
604         .value    = stringify(0x8000000a),\
605     },{\
606         .driver   = "Westmere" "-" TYPE_X86_CPU,\
607         .property = "min-xlevel",\
608         .value    = stringify(0x8000000a),\
609     },{\
610         .driver   = "SandyBridge" "-" TYPE_X86_CPU,\
611         .property = "min-xlevel",\
612         .value    = stringify(0x8000000a),\
613     },{\
614         .driver   = "IvyBridge" "-" TYPE_X86_CPU,\
615         .property = "min-xlevel",\
616         .value    = stringify(0x8000000a),\
617     },{\
618         .driver   = "Haswell" "-" TYPE_X86_CPU,\
619         .property = "min-xlevel",\
620         .value    = stringify(0x8000000a),\
621     },{\
622         .driver   = "Haswell-noTSX" "-" TYPE_X86_CPU,\
623         .property = "min-xlevel",\
624         .value    = stringify(0x8000000a),\
625     },{\
626         .driver   = "Broadwell" "-" TYPE_X86_CPU,\
627         .property = "min-xlevel",\
628         .value    = stringify(0x8000000a),\
629     },{\
630         .driver   = "Broadwell-noTSX" "-" TYPE_X86_CPU,\
631         .property = "min-xlevel",\
632         .value    = stringify(0x8000000a),\
633     },{\
634         .driver = TYPE_X86_CPU,\
635         .property = "kvm-no-smi-migration",\
636         .value    = "on",\
637     },
638 
639 #define PC_COMPAT_2_2 \
640     HW_COMPAT_2_2 \
641     PC_CPU_MODEL_IDS("2.2.0") \
642     {\
643         .driver = "kvm64" "-" TYPE_X86_CPU,\
644         .property = "vme",\
645         .value = "off",\
646     },\
647     {\
648         .driver = "kvm32" "-" TYPE_X86_CPU,\
649         .property = "vme",\
650         .value = "off",\
651     },\
652     {\
653         .driver = "Conroe" "-" TYPE_X86_CPU,\
654         .property = "vme",\
655         .value = "off",\
656     },\
657     {\
658         .driver = "Penryn" "-" TYPE_X86_CPU,\
659         .property = "vme",\
660         .value = "off",\
661     },\
662     {\
663         .driver = "Nehalem" "-" TYPE_X86_CPU,\
664         .property = "vme",\
665         .value = "off",\
666     },\
667     {\
668         .driver = "Westmere" "-" TYPE_X86_CPU,\
669         .property = "vme",\
670         .value = "off",\
671     },\
672     {\
673         .driver = "SandyBridge" "-" TYPE_X86_CPU,\
674         .property = "vme",\
675         .value = "off",\
676     },\
677     {\
678         .driver = "Haswell" "-" TYPE_X86_CPU,\
679         .property = "vme",\
680         .value = "off",\
681     },\
682     {\
683         .driver = "Broadwell" "-" TYPE_X86_CPU,\
684         .property = "vme",\
685         .value = "off",\
686     },\
687     {\
688         .driver = "Opteron_G1" "-" TYPE_X86_CPU,\
689         .property = "vme",\
690         .value = "off",\
691     },\
692     {\
693         .driver = "Opteron_G2" "-" TYPE_X86_CPU,\
694         .property = "vme",\
695         .value = "off",\
696     },\
697     {\
698         .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
699         .property = "vme",\
700         .value = "off",\
701     },\
702     {\
703         .driver = "Opteron_G4" "-" TYPE_X86_CPU,\
704         .property = "vme",\
705         .value = "off",\
706     },\
707     {\
708         .driver = "Opteron_G5" "-" TYPE_X86_CPU,\
709         .property = "vme",\
710         .value = "off",\
711     },\
712     {\
713         .driver = "Haswell" "-" TYPE_X86_CPU,\
714         .property = "f16c",\
715         .value = "off",\
716     },\
717     {\
718         .driver = "Haswell" "-" TYPE_X86_CPU,\
719         .property = "rdrand",\
720         .value = "off",\
721     },\
722     {\
723         .driver = "Broadwell" "-" TYPE_X86_CPU,\
724         .property = "f16c",\
725         .value = "off",\
726     },\
727     {\
728         .driver = "Broadwell" "-" TYPE_X86_CPU,\
729         .property = "rdrand",\
730         .value = "off",\
731     },
732 
733 #define PC_COMPAT_2_1 \
734     HW_COMPAT_2_1 \
735     PC_CPU_MODEL_IDS("2.1.0") \
736     {\
737         .driver = "coreduo" "-" TYPE_X86_CPU,\
738         .property = "vmx",\
739         .value = "on",\
740     },\
741     {\
742         .driver = "core2duo" "-" TYPE_X86_CPU,\
743         .property = "vmx",\
744         .value = "on",\
745     },
746 
747 #define PC_COMPAT_2_0 \
748     PC_CPU_MODEL_IDS("2.0.0") \
749     {\
750         .driver   = "virtio-scsi-pci",\
751         .property = "any_layout",\
752         .value    = "off",\
753     },{\
754         .driver   = "PIIX4_PM",\
755         .property = "memory-hotplug-support",\
756         .value    = "off",\
757     },\
758     {\
759         .driver   = "apic",\
760         .property = "version",\
761         .value    = stringify(0x11),\
762     },\
763     {\
764         .driver   = "nec-usb-xhci",\
765         .property = "superspeed-ports-first",\
766         .value    = "off",\
767     },\
768     {\
769         .driver   = "nec-usb-xhci",\
770         .property = "force-pcie-endcap",\
771         .value    = "on",\
772     },\
773     {\
774         .driver   = "pci-serial",\
775         .property = "prog_if",\
776         .value    = stringify(0),\
777     },\
778     {\
779         .driver   = "pci-serial-2x",\
780         .property = "prog_if",\
781         .value    = stringify(0),\
782     },\
783     {\
784         .driver   = "pci-serial-4x",\
785         .property = "prog_if",\
786         .value    = stringify(0),\
787     },\
788     {\
789         .driver   = "virtio-net-pci",\
790         .property = "guest_announce",\
791         .value    = "off",\
792     },\
793     {\
794         .driver   = "ICH9-LPC",\
795         .property = "memory-hotplug-support",\
796         .value    = "off",\
797     },{\
798         .driver   = "xio3130-downstream",\
799         .property = COMPAT_PROP_PCP,\
800         .value    = "off",\
801     },{\
802         .driver   = "ioh3420",\
803         .property = COMPAT_PROP_PCP,\
804         .value    = "off",\
805     },
806 
807 #define PC_COMPAT_1_7 \
808     PC_CPU_MODEL_IDS("1.7.0") \
809     {\
810         .driver   = TYPE_USB_DEVICE,\
811         .property = "msos-desc",\
812         .value    = "no",\
813     },\
814     {\
815         .driver   = "PIIX4_PM",\
816         .property = "acpi-pci-hotplug-with-bridge-support",\
817         .value    = "off",\
818     },\
819     {\
820         .driver   = "hpet",\
821         .property = HPET_INTCAP,\
822         .value    = stringify(4),\
823     },
824 
825 #define PC_COMPAT_1_6 \
826     PC_CPU_MODEL_IDS("1.6.0") \
827     {\
828         .driver   = "e1000",\
829         .property = "mitigation",\
830         .value    = "off",\
831     },{\
832         .driver   = "qemu64-" TYPE_X86_CPU,\
833         .property = "model",\
834         .value    = stringify(2),\
835     },{\
836         .driver   = "qemu32-" TYPE_X86_CPU,\
837         .property = "model",\
838         .value    = stringify(3),\
839     },{\
840         .driver   = "i440FX-pcihost",\
841         .property = "short_root_bus",\
842         .value    = stringify(1),\
843     },{\
844         .driver   = "q35-pcihost",\
845         .property = "short_root_bus",\
846         .value    = stringify(1),\
847     },
848 
849 #define PC_COMPAT_1_5 \
850     PC_CPU_MODEL_IDS("1.5.0") \
851     {\
852         .driver   = "Conroe-" TYPE_X86_CPU,\
853         .property = "model",\
854         .value    = stringify(2),\
855     },{\
856         .driver   = "Conroe-" TYPE_X86_CPU,\
857         .property = "min-level",\
858         .value    = stringify(2),\
859     },{\
860         .driver   = "Penryn-" TYPE_X86_CPU,\
861         .property = "model",\
862         .value    = stringify(2),\
863     },{\
864         .driver   = "Penryn-" TYPE_X86_CPU,\
865         .property = "min-level",\
866         .value    = stringify(2),\
867     },{\
868         .driver   = "Nehalem-" TYPE_X86_CPU,\
869         .property = "model",\
870         .value    = stringify(2),\
871     },{\
872         .driver   = "Nehalem-" TYPE_X86_CPU,\
873         .property = "min-level",\
874         .value    = stringify(2),\
875     },{\
876         .driver   = "virtio-net-pci",\
877         .property = "any_layout",\
878         .value    = "off",\
879     },{\
880         .driver = TYPE_X86_CPU,\
881         .property = "pmu",\
882         .value = "on",\
883     },{\
884         .driver   = "i440FX-pcihost",\
885         .property = "short_root_bus",\
886         .value    = stringify(0),\
887     },{\
888         .driver   = "q35-pcihost",\
889         .property = "short_root_bus",\
890         .value    = stringify(0),\
891     },
892 
893 #define PC_COMPAT_1_4 \
894     PC_CPU_MODEL_IDS("1.4.0") \
895     {\
896         .driver   = "scsi-hd",\
897         .property = "discard_granularity",\
898         .value    = stringify(0),\
899     },{\
900         .driver   = "scsi-cd",\
901         .property = "discard_granularity",\
902         .value    = stringify(0),\
903     },{\
904         .driver   = "scsi-disk",\
905         .property = "discard_granularity",\
906         .value    = stringify(0),\
907     },{\
908         .driver   = "ide-hd",\
909         .property = "discard_granularity",\
910         .value    = stringify(0),\
911     },{\
912         .driver   = "ide-cd",\
913         .property = "discard_granularity",\
914         .value    = stringify(0),\
915     },{\
916         .driver   = "ide-drive",\
917         .property = "discard_granularity",\
918         .value    = stringify(0),\
919     },{\
920         .driver   = "virtio-blk-pci",\
921         .property = "discard_granularity",\
922         .value    = stringify(0),\
923     },{\
924         .driver   = "virtio-serial-pci",\
925         .property = "vectors",\
926         /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\
927         .value    = stringify(0xFFFFFFFF),\
928     },{ \
929         .driver   = "virtio-net-pci", \
930         .property = "ctrl_guest_offloads", \
931         .value    = "off", \
932     },{\
933         .driver   = "e1000",\
934         .property = "romfile",\
935         .value    = "pxe-e1000.rom",\
936     },{\
937         .driver   = "ne2k_pci",\
938         .property = "romfile",\
939         .value    = "pxe-ne2k_pci.rom",\
940     },{\
941         .driver   = "pcnet",\
942         .property = "romfile",\
943         .value    = "pxe-pcnet.rom",\
944     },{\
945         .driver   = "rtl8139",\
946         .property = "romfile",\
947         .value    = "pxe-rtl8139.rom",\
948     },{\
949         .driver   = "virtio-net-pci",\
950         .property = "romfile",\
951         .value    = "pxe-virtio.rom",\
952     },{\
953         .driver   = "486-" TYPE_X86_CPU,\
954         .property = "model",\
955         .value    = stringify(0),\
956     },\
957     {\
958         .driver = "n270" "-" TYPE_X86_CPU,\
959         .property = "movbe",\
960         .value = "off",\
961     },\
962     {\
963         .driver = "Westmere" "-" TYPE_X86_CPU,\
964         .property = "pclmulqdq",\
965         .value = "off",\
966     },
967 
968 #define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
969     static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
970     { \
971         MachineClass *mc = MACHINE_CLASS(oc); \
972         optsfn(mc); \
973         mc->init = initfn; \
974     } \
975     static const TypeInfo pc_machine_type_##suffix = { \
976         .name       = namestr TYPE_MACHINE_SUFFIX, \
977         .parent     = TYPE_PC_MACHINE, \
978         .class_init = pc_machine_##suffix##_class_init, \
979     }; \
980     static void pc_machine_init_##suffix(void) \
981     { \
982         type_register(&pc_machine_type_##suffix); \
983     } \
984     type_init(pc_machine_init_##suffix)
985 
986 extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
987 #endif
988