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