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