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