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