xref: /openbmc/qemu/include/hw/i386/pc.h (revision 795c40b8)
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 /*
307  * Reset Control Register: PCI-accessible ISA-Compatible Register at address
308  * 0xcf9, provided by the PCI/ISA bridge (PIIX3 PCI function 0, 8086:7000).
309  */
310 #define RCR_IOPORT 0xcf9
311 
312 PCIBus *i440fx_init(const char *host_type, const char *pci_type,
313                     PCII440FXState **pi440fx_state, int *piix_devfn,
314                     ISABus **isa_bus, qemu_irq *pic,
315                     MemoryRegion *address_space_mem,
316                     MemoryRegion *address_space_io,
317                     ram_addr_t ram_size,
318                     ram_addr_t below_4g_mem_size,
319                     ram_addr_t above_4g_mem_size,
320                     MemoryRegion *pci_memory,
321                     MemoryRegion *ram_memory);
322 
323 PCIBus *find_i440fx(void);
324 /* piix4.c */
325 extern PCIDevice *piix4_dev;
326 int piix4_init(PCIBus *bus, ISABus **isa_bus, int devfn);
327 
328 /* vga.c */
329 enum vga_retrace_method {
330     VGA_RETRACE_DUMB,
331     VGA_RETRACE_PRECISE
332 };
333 
334 extern enum vga_retrace_method vga_retrace_method;
335 
336 int isa_vga_mm_init(hwaddr vram_base,
337                     hwaddr ctrl_base, int it_shift,
338                     MemoryRegion *address_space);
339 
340 /* ne2000.c */
341 static inline bool isa_ne2000_init(ISABus *bus, int base, int irq, NICInfo *nd)
342 {
343     DeviceState *dev;
344     ISADevice *isadev;
345 
346     qemu_check_nic_model(nd, "ne2k_isa");
347 
348     isadev = isa_try_create(bus, "ne2k_isa");
349     if (!isadev) {
350         return false;
351     }
352     dev = DEVICE(isadev);
353     qdev_prop_set_uint32(dev, "iobase", base);
354     qdev_prop_set_uint32(dev, "irq",    irq);
355     qdev_set_nic_properties(dev, nd);
356     qdev_init_nofail(dev);
357     return true;
358 }
359 
360 /* pc_sysfw.c */
361 void pc_system_firmware_init(MemoryRegion *rom_memory,
362                              bool isapc_ram_fw);
363 
364 /* pvpanic.c */
365 uint16_t pvpanic_port(void);
366 
367 /* acpi-build.c */
368 void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
369                        const CPUArchIdList *apic_ids, GArray *entry);
370 
371 /* e820 types */
372 #define E820_RAM        1
373 #define E820_RESERVED   2
374 #define E820_ACPI       3
375 #define E820_NVS        4
376 #define E820_UNUSABLE   5
377 
378 int e820_add_entry(uint64_t, uint64_t, uint32_t);
379 int e820_get_num_entries(void);
380 bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
381 
382 #define PC_COMPAT_2_8 \
383     HW_COMPAT_2_8 \
384     {\
385         .driver   = "kvmclock",\
386         .property = "x-mach-use-reliable-get-clock",\
387         .value    = "off",\
388     },\
389     {\
390         .driver   = "ICH9-LPC",\
391         .property = "x-smi-broadcast",\
392         .value    = "off",\
393     },\
394     {\
395         .driver   = TYPE_X86_CPU,\
396         .property = "vmware-cpuid-freq",\
397         .value    = "off",\
398     },\
399     {\
400         .driver   = "Haswell-" TYPE_X86_CPU,\
401         .property = "stepping",\
402         .value    = "1",\
403     },
404 
405 #define PC_COMPAT_2_7 \
406     HW_COMPAT_2_7 \
407     {\
408         .driver   = TYPE_X86_CPU,\
409         .property = "l3-cache",\
410         .value    = "off",\
411     },\
412     {\
413         .driver   = TYPE_X86_CPU,\
414         .property = "full-cpuid-auto-level",\
415         .value    = "off",\
416     },\
417     {\
418         .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
419         .property = "family",\
420         .value    = "15",\
421     },\
422     {\
423         .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
424         .property = "model",\
425         .value    = "6",\
426     },\
427     {\
428         .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
429         .property = "stepping",\
430         .value    = "1",\
431     },\
432     {\
433         .driver   = "isa-pcspk",\
434         .property = "migrate",\
435         .value    = "off",\
436     },
437 
438 #define PC_COMPAT_2_6 \
439     HW_COMPAT_2_6 \
440     {\
441         .driver   = "fw_cfg_io",\
442         .property = "dma_enabled",\
443         .value    = "off",\
444     },{\
445         .driver   = TYPE_X86_CPU,\
446         .property = "cpuid-0xb",\
447         .value    = "off",\
448     },{\
449         .driver   = "vmxnet3",\
450         .property = "romfile",\
451         .value    = "",\
452     },\
453     {\
454         .driver = TYPE_X86_CPU,\
455         .property = "fill-mtrr-mask",\
456         .value = "off",\
457     },\
458     {\
459         .driver   = "apic-common",\
460         .property = "legacy-instance-id",\
461         .value    = "on",\
462     },
463 
464 #define PC_COMPAT_2_5 \
465     HW_COMPAT_2_5
466 
467 /* Helper for setting model-id for CPU models that changed model-id
468  * depending on QEMU versions up to QEMU 2.4.
469  */
470 #define PC_CPU_MODEL_IDS(v) \
471     {\
472         .driver   = "qemu32-" TYPE_X86_CPU,\
473         .property = "model-id",\
474         .value    = "QEMU Virtual CPU version " v,\
475     },\
476     {\
477         .driver   = "qemu64-" TYPE_X86_CPU,\
478         .property = "model-id",\
479         .value    = "QEMU Virtual CPU version " v,\
480     },\
481     {\
482         .driver   = "athlon-" TYPE_X86_CPU,\
483         .property = "model-id",\
484         .value    = "QEMU Virtual CPU version " v,\
485     },
486 
487 #define PC_COMPAT_2_4 \
488     HW_COMPAT_2_4 \
489     PC_CPU_MODEL_IDS("2.4.0") \
490     {\
491         .driver   = "Haswell-" TYPE_X86_CPU,\
492         .property = "abm",\
493         .value    = "off",\
494     },\
495     {\
496         .driver   = "Haswell-noTSX-" TYPE_X86_CPU,\
497         .property = "abm",\
498         .value    = "off",\
499     },\
500     {\
501         .driver   = "Broadwell-" TYPE_X86_CPU,\
502         .property = "abm",\
503         .value    = "off",\
504     },\
505     {\
506         .driver   = "Broadwell-noTSX-" TYPE_X86_CPU,\
507         .property = "abm",\
508         .value    = "off",\
509     },\
510     {\
511         .driver   = "host" "-" TYPE_X86_CPU,\
512         .property = "host-cache-info",\
513         .value    = "on",\
514     },\
515     {\
516         .driver   = TYPE_X86_CPU,\
517         .property = "check",\
518         .value    = "off",\
519     },\
520     {\
521         .driver   = "qemu64" "-" TYPE_X86_CPU,\
522         .property = "sse4a",\
523         .value    = "on",\
524     },\
525     {\
526         .driver   = "qemu64" "-" TYPE_X86_CPU,\
527         .property = "abm",\
528         .value    = "on",\
529     },\
530     {\
531         .driver   = "qemu64" "-" TYPE_X86_CPU,\
532         .property = "popcnt",\
533         .value    = "on",\
534     },\
535     {\
536         .driver   = "qemu32" "-" TYPE_X86_CPU,\
537         .property = "popcnt",\
538         .value    = "on",\
539     },{\
540         .driver   = "Opteron_G2" "-" TYPE_X86_CPU,\
541         .property = "rdtscp",\
542         .value    = "on",\
543     },{\
544         .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
545         .property = "rdtscp",\
546         .value    = "on",\
547     },{\
548         .driver   = "Opteron_G4" "-" TYPE_X86_CPU,\
549         .property = "rdtscp",\
550         .value    = "on",\
551     },{\
552         .driver   = "Opteron_G5" "-" TYPE_X86_CPU,\
553         .property = "rdtscp",\
554         .value    = "on",\
555     },
556 
557 
558 #define PC_COMPAT_2_3 \
559     HW_COMPAT_2_3 \
560     PC_CPU_MODEL_IDS("2.3.0") \
561     {\
562         .driver   = TYPE_X86_CPU,\
563         .property = "arat",\
564         .value    = "off",\
565     },{\
566         .driver   = "qemu64" "-" TYPE_X86_CPU,\
567         .property = "level",\
568         .value    = stringify(4),\
569     },{\
570         .driver   = "kvm64" "-" TYPE_X86_CPU,\
571         .property = "level",\
572         .value    = stringify(5),\
573     },{\
574         .driver   = "pentium3" "-" TYPE_X86_CPU,\
575         .property = "level",\
576         .value    = stringify(2),\
577     },{\
578         .driver   = "n270" "-" TYPE_X86_CPU,\
579         .property = "level",\
580         .value    = stringify(5),\
581     },{\
582         .driver   = "Conroe" "-" TYPE_X86_CPU,\
583         .property = "level",\
584         .value    = stringify(4),\
585     },{\
586         .driver   = "Penryn" "-" TYPE_X86_CPU,\
587         .property = "level",\
588         .value    = stringify(4),\
589     },{\
590         .driver   = "Nehalem" "-" TYPE_X86_CPU,\
591         .property = "level",\
592         .value    = stringify(4),\
593     },{\
594         .driver   = "n270" "-" TYPE_X86_CPU,\
595         .property = "xlevel",\
596         .value    = stringify(0x8000000a),\
597     },{\
598         .driver   = "Penryn" "-" TYPE_X86_CPU,\
599         .property = "xlevel",\
600         .value    = stringify(0x8000000a),\
601     },{\
602         .driver   = "Conroe" "-" TYPE_X86_CPU,\
603         .property = "xlevel",\
604         .value    = stringify(0x8000000a),\
605     },{\
606         .driver   = "Nehalem" "-" TYPE_X86_CPU,\
607         .property = "xlevel",\
608         .value    = stringify(0x8000000a),\
609     },{\
610         .driver   = "Westmere" "-" TYPE_X86_CPU,\
611         .property = "xlevel",\
612         .value    = stringify(0x8000000a),\
613     },{\
614         .driver   = "SandyBridge" "-" TYPE_X86_CPU,\
615         .property = "xlevel",\
616         .value    = stringify(0x8000000a),\
617     },{\
618         .driver   = "IvyBridge" "-" TYPE_X86_CPU,\
619         .property = "xlevel",\
620         .value    = stringify(0x8000000a),\
621     },{\
622         .driver   = "Haswell" "-" TYPE_X86_CPU,\
623         .property = "xlevel",\
624         .value    = stringify(0x8000000a),\
625     },{\
626         .driver   = "Haswell-noTSX" "-" TYPE_X86_CPU,\
627         .property = "xlevel",\
628         .value    = stringify(0x8000000a),\
629     },{\
630         .driver   = "Broadwell" "-" TYPE_X86_CPU,\
631         .property = "xlevel",\
632         .value    = stringify(0x8000000a),\
633     },{\
634         .driver   = "Broadwell-noTSX" "-" TYPE_X86_CPU,\
635         .property = "xlevel",\
636         .value    = stringify(0x8000000a),\
637     },{\
638         .driver = TYPE_X86_CPU,\
639         .property = "kvm-no-smi-migration",\
640         .value    = "on",\
641     },
642 
643 #define PC_COMPAT_2_2 \
644     HW_COMPAT_2_2 \
645     PC_CPU_MODEL_IDS("2.3.0") \
646     {\
647         .driver = "kvm64" "-" TYPE_X86_CPU,\
648         .property = "vme",\
649         .value = "off",\
650     },\
651     {\
652         .driver = "kvm32" "-" TYPE_X86_CPU,\
653         .property = "vme",\
654         .value = "off",\
655     },\
656     {\
657         .driver = "Conroe" "-" TYPE_X86_CPU,\
658         .property = "vme",\
659         .value = "off",\
660     },\
661     {\
662         .driver = "Penryn" "-" TYPE_X86_CPU,\
663         .property = "vme",\
664         .value = "off",\
665     },\
666     {\
667         .driver = "Nehalem" "-" TYPE_X86_CPU,\
668         .property = "vme",\
669         .value = "off",\
670     },\
671     {\
672         .driver = "Westmere" "-" TYPE_X86_CPU,\
673         .property = "vme",\
674         .value = "off",\
675     },\
676     {\
677         .driver = "SandyBridge" "-" TYPE_X86_CPU,\
678         .property = "vme",\
679         .value = "off",\
680     },\
681     {\
682         .driver = "Haswell" "-" TYPE_X86_CPU,\
683         .property = "vme",\
684         .value = "off",\
685     },\
686     {\
687         .driver = "Broadwell" "-" TYPE_X86_CPU,\
688         .property = "vme",\
689         .value = "off",\
690     },\
691     {\
692         .driver = "Opteron_G1" "-" TYPE_X86_CPU,\
693         .property = "vme",\
694         .value = "off",\
695     },\
696     {\
697         .driver = "Opteron_G2" "-" TYPE_X86_CPU,\
698         .property = "vme",\
699         .value = "off",\
700     },\
701     {\
702         .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
703         .property = "vme",\
704         .value = "off",\
705     },\
706     {\
707         .driver = "Opteron_G4" "-" TYPE_X86_CPU,\
708         .property = "vme",\
709         .value = "off",\
710     },\
711     {\
712         .driver = "Opteron_G5" "-" TYPE_X86_CPU,\
713         .property = "vme",\
714         .value = "off",\
715     },\
716     {\
717         .driver = "Haswell" "-" TYPE_X86_CPU,\
718         .property = "f16c",\
719         .value = "off",\
720     },\
721     {\
722         .driver = "Haswell" "-" TYPE_X86_CPU,\
723         .property = "rdrand",\
724         .value = "off",\
725     },\
726     {\
727         .driver = "Broadwell" "-" TYPE_X86_CPU,\
728         .property = "f16c",\
729         .value = "off",\
730     },\
731     {\
732         .driver = "Broadwell" "-" TYPE_X86_CPU,\
733         .property = "rdrand",\
734         .value = "off",\
735     },
736 
737 #define PC_COMPAT_2_1 \
738     HW_COMPAT_2_1 \
739     PC_CPU_MODEL_IDS("2.1.0") \
740     {\
741         .driver = "coreduo" "-" TYPE_X86_CPU,\
742         .property = "vmx",\
743         .value = "on",\
744     },\
745     {\
746         .driver = "core2duo" "-" TYPE_X86_CPU,\
747         .property = "vmx",\
748         .value = "on",\
749     },
750 
751 #define PC_COMPAT_2_0 \
752     PC_CPU_MODEL_IDS("2.0.0") \
753     {\
754         .driver   = "virtio-scsi-pci",\
755         .property = "any_layout",\
756         .value    = "off",\
757     },{\
758         .driver   = "PIIX4_PM",\
759         .property = "memory-hotplug-support",\
760         .value    = "off",\
761     },\
762     {\
763         .driver   = "apic",\
764         .property = "version",\
765         .value    = stringify(0x11),\
766     },\
767     {\
768         .driver   = "nec-usb-xhci",\
769         .property = "superspeed-ports-first",\
770         .value    = "off",\
771     },\
772     {\
773         .driver   = "nec-usb-xhci",\
774         .property = "force-pcie-endcap",\
775         .value    = "on",\
776     },\
777     {\
778         .driver   = "pci-serial",\
779         .property = "prog_if",\
780         .value    = stringify(0),\
781     },\
782     {\
783         .driver   = "pci-serial-2x",\
784         .property = "prog_if",\
785         .value    = stringify(0),\
786     },\
787     {\
788         .driver   = "pci-serial-4x",\
789         .property = "prog_if",\
790         .value    = stringify(0),\
791     },\
792     {\
793         .driver   = "virtio-net-pci",\
794         .property = "guest_announce",\
795         .value    = "off",\
796     },\
797     {\
798         .driver   = "ICH9-LPC",\
799         .property = "memory-hotplug-support",\
800         .value    = "off",\
801     },{\
802         .driver   = "xio3130-downstream",\
803         .property = COMPAT_PROP_PCP,\
804         .value    = "off",\
805     },{\
806         .driver   = "ioh3420",\
807         .property = COMPAT_PROP_PCP,\
808         .value    = "off",\
809     },
810 
811 #define PC_COMPAT_1_7 \
812     PC_CPU_MODEL_IDS("1.7.0") \
813     {\
814         .driver   = TYPE_USB_DEVICE,\
815         .property = "msos-desc",\
816         .value    = "no",\
817     },\
818     {\
819         .driver   = "PIIX4_PM",\
820         .property = "acpi-pci-hotplug-with-bridge-support",\
821         .value    = "off",\
822     },\
823     {\
824         .driver   = "hpet",\
825         .property = HPET_INTCAP,\
826         .value    = stringify(4),\
827     },
828 
829 #define PC_COMPAT_1_6 \
830     PC_CPU_MODEL_IDS("1.6.0") \
831     {\
832         .driver   = "e1000",\
833         .property = "mitigation",\
834         .value    = "off",\
835     },{\
836         .driver   = "qemu64-" TYPE_X86_CPU,\
837         .property = "model",\
838         .value    = stringify(2),\
839     },{\
840         .driver   = "qemu32-" TYPE_X86_CPU,\
841         .property = "model",\
842         .value    = stringify(3),\
843     },{\
844         .driver   = "i440FX-pcihost",\
845         .property = "short_root_bus",\
846         .value    = stringify(1),\
847     },{\
848         .driver   = "q35-pcihost",\
849         .property = "short_root_bus",\
850         .value    = stringify(1),\
851     },
852 
853 #define PC_COMPAT_1_5 \
854     PC_CPU_MODEL_IDS("1.5.0") \
855     {\
856         .driver   = "Conroe-" TYPE_X86_CPU,\
857         .property = "model",\
858         .value    = stringify(2),\
859     },{\
860         .driver   = "Conroe-" TYPE_X86_CPU,\
861         .property = "level",\
862         .value    = stringify(2),\
863     },{\
864         .driver   = "Penryn-" TYPE_X86_CPU,\
865         .property = "model",\
866         .value    = stringify(2),\
867     },{\
868         .driver   = "Penryn-" TYPE_X86_CPU,\
869         .property = "level",\
870         .value    = stringify(2),\
871     },{\
872         .driver   = "Nehalem-" TYPE_X86_CPU,\
873         .property = "model",\
874         .value    = stringify(2),\
875     },{\
876         .driver   = "Nehalem-" TYPE_X86_CPU,\
877         .property = "level",\
878         .value    = stringify(2),\
879     },{\
880         .driver   = "virtio-net-pci",\
881         .property = "any_layout",\
882         .value    = "off",\
883     },{\
884         .driver = TYPE_X86_CPU,\
885         .property = "pmu",\
886         .value = "on",\
887     },{\
888         .driver   = "i440FX-pcihost",\
889         .property = "short_root_bus",\
890         .value    = stringify(0),\
891     },{\
892         .driver   = "q35-pcihost",\
893         .property = "short_root_bus",\
894         .value    = stringify(0),\
895     },
896 
897 #define PC_COMPAT_1_4 \
898     PC_CPU_MODEL_IDS("1.4.0") \
899     {\
900         .driver   = "scsi-hd",\
901         .property = "discard_granularity",\
902         .value    = stringify(0),\
903     },{\
904         .driver   = "scsi-cd",\
905         .property = "discard_granularity",\
906         .value    = stringify(0),\
907     },{\
908         .driver   = "scsi-disk",\
909         .property = "discard_granularity",\
910         .value    = stringify(0),\
911     },{\
912         .driver   = "ide-hd",\
913         .property = "discard_granularity",\
914         .value    = stringify(0),\
915     },{\
916         .driver   = "ide-cd",\
917         .property = "discard_granularity",\
918         .value    = stringify(0),\
919     },{\
920         .driver   = "ide-drive",\
921         .property = "discard_granularity",\
922         .value    = stringify(0),\
923     },{\
924         .driver   = "virtio-blk-pci",\
925         .property = "discard_granularity",\
926         .value    = stringify(0),\
927     },{\
928         .driver   = "virtio-serial-pci",\
929         .property = "vectors",\
930         /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\
931         .value    = stringify(0xFFFFFFFF),\
932     },{ \
933         .driver   = "virtio-net-pci", \
934         .property = "ctrl_guest_offloads", \
935         .value    = "off", \
936     },{\
937         .driver   = "e1000",\
938         .property = "romfile",\
939         .value    = "pxe-e1000.rom",\
940     },{\
941         .driver   = "ne2k_pci",\
942         .property = "romfile",\
943         .value    = "pxe-ne2k_pci.rom",\
944     },{\
945         .driver   = "pcnet",\
946         .property = "romfile",\
947         .value    = "pxe-pcnet.rom",\
948     },{\
949         .driver   = "rtl8139",\
950         .property = "romfile",\
951         .value    = "pxe-rtl8139.rom",\
952     },{\
953         .driver   = "virtio-net-pci",\
954         .property = "romfile",\
955         .value    = "pxe-virtio.rom",\
956     },{\
957         .driver   = "486-" TYPE_X86_CPU,\
958         .property = "model",\
959         .value    = stringify(0),\
960     },\
961     {\
962         .driver = "n270" "-" TYPE_X86_CPU,\
963         .property = "movbe",\
964         .value = "off",\
965     },\
966     {\
967         .driver = "Westmere" "-" TYPE_X86_CPU,\
968         .property = "pclmulqdq",\
969         .value = "off",\
970     },
971 
972 #define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
973     static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
974     { \
975         MachineClass *mc = MACHINE_CLASS(oc); \
976         optsfn(mc); \
977         mc->init = initfn; \
978     } \
979     static const TypeInfo pc_machine_type_##suffix = { \
980         .name       = namestr TYPE_MACHINE_SUFFIX, \
981         .parent     = TYPE_PC_MACHINE, \
982         .class_init = pc_machine_##suffix##_class_init, \
983     }; \
984     static void pc_machine_init_##suffix(void) \
985     { \
986         type_register(&pc_machine_type_##suffix); \
987     } \
988     type_init(pc_machine_init_##suffix)
989 
990 extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
991 #endif
992