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