xref: /openbmc/qemu/include/hw/i386/pc.h (revision 80e5db30)
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                       CharDriverState *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 #define PC_COMPAT_2_7 \
386     HW_COMPAT_2_7 \
387     {\
388         .driver   = TYPE_X86_CPU,\
389         .property = "l3-cache",\
390         .value    = "off",\
391     },\
392     {\
393         .driver   = TYPE_X86_CPU,\
394         .property = "full-cpuid-auto-level",\
395         .value    = "off",\
396     },\
397     {\
398         .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
399         .property = "family",\
400         .value    = "15",\
401     },\
402     {\
403         .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
404         .property = "model",\
405         .value    = "6",\
406     },\
407     {\
408         .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
409         .property = "stepping",\
410         .value    = "1",\
411     },\
412     {\
413         .driver   = "isa-pcspk",\
414         .property = "migrate",\
415         .value    = "off",\
416     },
417 
418 #define PC_COMPAT_2_6 \
419     HW_COMPAT_2_6 \
420     {\
421         .driver   = "fw_cfg_io",\
422         .property = "dma_enabled",\
423         .value    = "off",\
424     },{\
425         .driver   = TYPE_X86_CPU,\
426         .property = "cpuid-0xb",\
427         .value    = "off",\
428     },{\
429         .driver   = "vmxnet3",\
430         .property = "romfile",\
431         .value    = "",\
432     },\
433     {\
434         .driver = TYPE_X86_CPU,\
435         .property = "fill-mtrr-mask",\
436         .value = "off",\
437     },\
438     {\
439         .driver   = "apic-common",\
440         .property = "legacy-instance-id",\
441         .value    = "on",\
442     },
443 
444 #define PC_COMPAT_2_5 \
445     HW_COMPAT_2_5
446 
447 /* Helper for setting model-id for CPU models that changed model-id
448  * depending on QEMU versions up to QEMU 2.4.
449  */
450 #define PC_CPU_MODEL_IDS(v) \
451     {\
452         .driver   = "qemu32-" TYPE_X86_CPU,\
453         .property = "model-id",\
454         .value    = "QEMU Virtual CPU version " v,\
455     },\
456     {\
457         .driver   = "qemu64-" TYPE_X86_CPU,\
458         .property = "model-id",\
459         .value    = "QEMU Virtual CPU version " v,\
460     },\
461     {\
462         .driver   = "athlon-" TYPE_X86_CPU,\
463         .property = "model-id",\
464         .value    = "QEMU Virtual CPU version " v,\
465     },
466 
467 #define PC_COMPAT_2_4 \
468     HW_COMPAT_2_4 \
469     PC_CPU_MODEL_IDS("2.4.0") \
470     {\
471         .driver   = "Haswell-" TYPE_X86_CPU,\
472         .property = "abm",\
473         .value    = "off",\
474     },\
475     {\
476         .driver   = "Haswell-noTSX-" TYPE_X86_CPU,\
477         .property = "abm",\
478         .value    = "off",\
479     },\
480     {\
481         .driver   = "Broadwell-" TYPE_X86_CPU,\
482         .property = "abm",\
483         .value    = "off",\
484     },\
485     {\
486         .driver   = "Broadwell-noTSX-" TYPE_X86_CPU,\
487         .property = "abm",\
488         .value    = "off",\
489     },\
490     {\
491         .driver   = "host" "-" TYPE_X86_CPU,\
492         .property = "host-cache-info",\
493         .value    = "on",\
494     },\
495     {\
496         .driver   = TYPE_X86_CPU,\
497         .property = "check",\
498         .value    = "off",\
499     },\
500     {\
501         .driver   = "qemu64" "-" TYPE_X86_CPU,\
502         .property = "sse4a",\
503         .value    = "on",\
504     },\
505     {\
506         .driver   = "qemu64" "-" TYPE_X86_CPU,\
507         .property = "abm",\
508         .value    = "on",\
509     },\
510     {\
511         .driver   = "qemu64" "-" TYPE_X86_CPU,\
512         .property = "popcnt",\
513         .value    = "on",\
514     },\
515     {\
516         .driver   = "qemu32" "-" TYPE_X86_CPU,\
517         .property = "popcnt",\
518         .value    = "on",\
519     },{\
520         .driver   = "Opteron_G2" "-" TYPE_X86_CPU,\
521         .property = "rdtscp",\
522         .value    = "on",\
523     },{\
524         .driver   = "Opteron_G3" "-" TYPE_X86_CPU,\
525         .property = "rdtscp",\
526         .value    = "on",\
527     },{\
528         .driver   = "Opteron_G4" "-" TYPE_X86_CPU,\
529         .property = "rdtscp",\
530         .value    = "on",\
531     },{\
532         .driver   = "Opteron_G5" "-" TYPE_X86_CPU,\
533         .property = "rdtscp",\
534         .value    = "on",\
535     },
536 
537 
538 #define PC_COMPAT_2_3 \
539     HW_COMPAT_2_3 \
540     PC_CPU_MODEL_IDS("2.3.0") \
541     {\
542         .driver   = TYPE_X86_CPU,\
543         .property = "arat",\
544         .value    = "off",\
545     },{\
546         .driver   = "qemu64" "-" TYPE_X86_CPU,\
547         .property = "level",\
548         .value    = stringify(4),\
549     },{\
550         .driver   = "kvm64" "-" TYPE_X86_CPU,\
551         .property = "level",\
552         .value    = stringify(5),\
553     },{\
554         .driver   = "pentium3" "-" TYPE_X86_CPU,\
555         .property = "level",\
556         .value    = stringify(2),\
557     },{\
558         .driver   = "n270" "-" TYPE_X86_CPU,\
559         .property = "level",\
560         .value    = stringify(5),\
561     },{\
562         .driver   = "Conroe" "-" TYPE_X86_CPU,\
563         .property = "level",\
564         .value    = stringify(4),\
565     },{\
566         .driver   = "Penryn" "-" TYPE_X86_CPU,\
567         .property = "level",\
568         .value    = stringify(4),\
569     },{\
570         .driver   = "Nehalem" "-" TYPE_X86_CPU,\
571         .property = "level",\
572         .value    = stringify(4),\
573     },{\
574         .driver   = "n270" "-" TYPE_X86_CPU,\
575         .property = "xlevel",\
576         .value    = stringify(0x8000000a),\
577     },{\
578         .driver   = "Penryn" "-" TYPE_X86_CPU,\
579         .property = "xlevel",\
580         .value    = stringify(0x8000000a),\
581     },{\
582         .driver   = "Conroe" "-" TYPE_X86_CPU,\
583         .property = "xlevel",\
584         .value    = stringify(0x8000000a),\
585     },{\
586         .driver   = "Nehalem" "-" TYPE_X86_CPU,\
587         .property = "xlevel",\
588         .value    = stringify(0x8000000a),\
589     },{\
590         .driver   = "Westmere" "-" TYPE_X86_CPU,\
591         .property = "xlevel",\
592         .value    = stringify(0x8000000a),\
593     },{\
594         .driver   = "SandyBridge" "-" TYPE_X86_CPU,\
595         .property = "xlevel",\
596         .value    = stringify(0x8000000a),\
597     },{\
598         .driver   = "IvyBridge" "-" TYPE_X86_CPU,\
599         .property = "xlevel",\
600         .value    = stringify(0x8000000a),\
601     },{\
602         .driver   = "Haswell" "-" TYPE_X86_CPU,\
603         .property = "xlevel",\
604         .value    = stringify(0x8000000a),\
605     },{\
606         .driver   = "Haswell-noTSX" "-" TYPE_X86_CPU,\
607         .property = "xlevel",\
608         .value    = stringify(0x8000000a),\
609     },{\
610         .driver   = "Broadwell" "-" TYPE_X86_CPU,\
611         .property = "xlevel",\
612         .value    = stringify(0x8000000a),\
613     },{\
614         .driver   = "Broadwell-noTSX" "-" TYPE_X86_CPU,\
615         .property = "xlevel",\
616         .value    = stringify(0x8000000a),\
617     },
618 
619 #define PC_COMPAT_2_2 \
620     HW_COMPAT_2_2 \
621     PC_CPU_MODEL_IDS("2.3.0") \
622     {\
623         .driver = "kvm64" "-" TYPE_X86_CPU,\
624         .property = "vme",\
625         .value = "off",\
626     },\
627     {\
628         .driver = "kvm32" "-" TYPE_X86_CPU,\
629         .property = "vme",\
630         .value = "off",\
631     },\
632     {\
633         .driver = "Conroe" "-" TYPE_X86_CPU,\
634         .property = "vme",\
635         .value = "off",\
636     },\
637     {\
638         .driver = "Penryn" "-" TYPE_X86_CPU,\
639         .property = "vme",\
640         .value = "off",\
641     },\
642     {\
643         .driver = "Nehalem" "-" TYPE_X86_CPU,\
644         .property = "vme",\
645         .value = "off",\
646     },\
647     {\
648         .driver = "Westmere" "-" TYPE_X86_CPU,\
649         .property = "vme",\
650         .value = "off",\
651     },\
652     {\
653         .driver = "SandyBridge" "-" TYPE_X86_CPU,\
654         .property = "vme",\
655         .value = "off",\
656     },\
657     {\
658         .driver = "Haswell" "-" TYPE_X86_CPU,\
659         .property = "vme",\
660         .value = "off",\
661     },\
662     {\
663         .driver = "Broadwell" "-" TYPE_X86_CPU,\
664         .property = "vme",\
665         .value = "off",\
666     },\
667     {\
668         .driver = "Opteron_G1" "-" TYPE_X86_CPU,\
669         .property = "vme",\
670         .value = "off",\
671     },\
672     {\
673         .driver = "Opteron_G2" "-" TYPE_X86_CPU,\
674         .property = "vme",\
675         .value = "off",\
676     },\
677     {\
678         .driver = "Opteron_G3" "-" TYPE_X86_CPU,\
679         .property = "vme",\
680         .value = "off",\
681     },\
682     {\
683         .driver = "Opteron_G4" "-" TYPE_X86_CPU,\
684         .property = "vme",\
685         .value = "off",\
686     },\
687     {\
688         .driver = "Opteron_G5" "-" TYPE_X86_CPU,\
689         .property = "vme",\
690         .value = "off",\
691     },\
692     {\
693         .driver = "Haswell" "-" TYPE_X86_CPU,\
694         .property = "f16c",\
695         .value = "off",\
696     },\
697     {\
698         .driver = "Haswell" "-" TYPE_X86_CPU,\
699         .property = "rdrand",\
700         .value = "off",\
701     },\
702     {\
703         .driver = "Broadwell" "-" TYPE_X86_CPU,\
704         .property = "f16c",\
705         .value = "off",\
706     },\
707     {\
708         .driver = "Broadwell" "-" TYPE_X86_CPU,\
709         .property = "rdrand",\
710         .value = "off",\
711     },
712 
713 #define PC_COMPAT_2_1 \
714     HW_COMPAT_2_1 \
715     PC_CPU_MODEL_IDS("2.1.0") \
716     {\
717         .driver = "coreduo" "-" TYPE_X86_CPU,\
718         .property = "vmx",\
719         .value = "on",\
720     },\
721     {\
722         .driver = "core2duo" "-" TYPE_X86_CPU,\
723         .property = "vmx",\
724         .value = "on",\
725     },
726 
727 #define PC_COMPAT_2_0 \
728     PC_CPU_MODEL_IDS("2.0.0") \
729     {\
730         .driver   = "virtio-scsi-pci",\
731         .property = "any_layout",\
732         .value    = "off",\
733     },{\
734         .driver   = "PIIX4_PM",\
735         .property = "memory-hotplug-support",\
736         .value    = "off",\
737     },\
738     {\
739         .driver   = "apic",\
740         .property = "version",\
741         .value    = stringify(0x11),\
742     },\
743     {\
744         .driver   = "nec-usb-xhci",\
745         .property = "superspeed-ports-first",\
746         .value    = "off",\
747     },\
748     {\
749         .driver   = "nec-usb-xhci",\
750         .property = "force-pcie-endcap",\
751         .value    = "on",\
752     },\
753     {\
754         .driver   = "pci-serial",\
755         .property = "prog_if",\
756         .value    = stringify(0),\
757     },\
758     {\
759         .driver   = "pci-serial-2x",\
760         .property = "prog_if",\
761         .value    = stringify(0),\
762     },\
763     {\
764         .driver   = "pci-serial-4x",\
765         .property = "prog_if",\
766         .value    = stringify(0),\
767     },\
768     {\
769         .driver   = "virtio-net-pci",\
770         .property = "guest_announce",\
771         .value    = "off",\
772     },\
773     {\
774         .driver   = "ICH9-LPC",\
775         .property = "memory-hotplug-support",\
776         .value    = "off",\
777     },{\
778         .driver   = "xio3130-downstream",\
779         .property = COMPAT_PROP_PCP,\
780         .value    = "off",\
781     },{\
782         .driver   = "ioh3420",\
783         .property = COMPAT_PROP_PCP,\
784         .value    = "off",\
785     },
786 
787 #define PC_COMPAT_1_7 \
788     PC_CPU_MODEL_IDS("1.7.0") \
789     {\
790         .driver   = TYPE_USB_DEVICE,\
791         .property = "msos-desc",\
792         .value    = "no",\
793     },\
794     {\
795         .driver   = "PIIX4_PM",\
796         .property = "acpi-pci-hotplug-with-bridge-support",\
797         .value    = "off",\
798     },\
799     {\
800         .driver   = "hpet",\
801         .property = HPET_INTCAP,\
802         .value    = stringify(4),\
803     },
804 
805 #define PC_COMPAT_1_6 \
806     PC_CPU_MODEL_IDS("1.6.0") \
807     {\
808         .driver   = "e1000",\
809         .property = "mitigation",\
810         .value    = "off",\
811     },{\
812         .driver   = "qemu64-" TYPE_X86_CPU,\
813         .property = "model",\
814         .value    = stringify(2),\
815     },{\
816         .driver   = "qemu32-" TYPE_X86_CPU,\
817         .property = "model",\
818         .value    = stringify(3),\
819     },{\
820         .driver   = "i440FX-pcihost",\
821         .property = "short_root_bus",\
822         .value    = stringify(1),\
823     },{\
824         .driver   = "q35-pcihost",\
825         .property = "short_root_bus",\
826         .value    = stringify(1),\
827     },
828 
829 #define PC_COMPAT_1_5 \
830     PC_CPU_MODEL_IDS("1.5.0") \
831     {\
832         .driver   = "Conroe-" TYPE_X86_CPU,\
833         .property = "model",\
834         .value    = stringify(2),\
835     },{\
836         .driver   = "Conroe-" TYPE_X86_CPU,\
837         .property = "level",\
838         .value    = stringify(2),\
839     },{\
840         .driver   = "Penryn-" TYPE_X86_CPU,\
841         .property = "model",\
842         .value    = stringify(2),\
843     },{\
844         .driver   = "Penryn-" TYPE_X86_CPU,\
845         .property = "level",\
846         .value    = stringify(2),\
847     },{\
848         .driver   = "Nehalem-" TYPE_X86_CPU,\
849         .property = "model",\
850         .value    = stringify(2),\
851     },{\
852         .driver   = "Nehalem-" TYPE_X86_CPU,\
853         .property = "level",\
854         .value    = stringify(2),\
855     },{\
856         .driver   = "virtio-net-pci",\
857         .property = "any_layout",\
858         .value    = "off",\
859     },{\
860         .driver = TYPE_X86_CPU,\
861         .property = "pmu",\
862         .value = "on",\
863     },{\
864         .driver   = "i440FX-pcihost",\
865         .property = "short_root_bus",\
866         .value    = stringify(0),\
867     },{\
868         .driver   = "q35-pcihost",\
869         .property = "short_root_bus",\
870         .value    = stringify(0),\
871     },
872 
873 #define PC_COMPAT_1_4 \
874     PC_CPU_MODEL_IDS("1.4.0") \
875     {\
876         .driver   = "scsi-hd",\
877         .property = "discard_granularity",\
878         .value    = stringify(0),\
879     },{\
880         .driver   = "scsi-cd",\
881         .property = "discard_granularity",\
882         .value    = stringify(0),\
883     },{\
884         .driver   = "scsi-disk",\
885         .property = "discard_granularity",\
886         .value    = stringify(0),\
887     },{\
888         .driver   = "ide-hd",\
889         .property = "discard_granularity",\
890         .value    = stringify(0),\
891     },{\
892         .driver   = "ide-cd",\
893         .property = "discard_granularity",\
894         .value    = stringify(0),\
895     },{\
896         .driver   = "ide-drive",\
897         .property = "discard_granularity",\
898         .value    = stringify(0),\
899     },{\
900         .driver   = "virtio-blk-pci",\
901         .property = "discard_granularity",\
902         .value    = stringify(0),\
903     },{\
904         .driver   = "virtio-serial-pci",\
905         .property = "vectors",\
906         /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */\
907         .value    = stringify(0xFFFFFFFF),\
908     },{ \
909         .driver   = "virtio-net-pci", \
910         .property = "ctrl_guest_offloads", \
911         .value    = "off", \
912     },{\
913         .driver   = "e1000",\
914         .property = "romfile",\
915         .value    = "pxe-e1000.rom",\
916     },{\
917         .driver   = "ne2k_pci",\
918         .property = "romfile",\
919         .value    = "pxe-ne2k_pci.rom",\
920     },{\
921         .driver   = "pcnet",\
922         .property = "romfile",\
923         .value    = "pxe-pcnet.rom",\
924     },{\
925         .driver   = "rtl8139",\
926         .property = "romfile",\
927         .value    = "pxe-rtl8139.rom",\
928     },{\
929         .driver   = "virtio-net-pci",\
930         .property = "romfile",\
931         .value    = "pxe-virtio.rom",\
932     },{\
933         .driver   = "486-" TYPE_X86_CPU,\
934         .property = "model",\
935         .value    = stringify(0),\
936     },\
937     {\
938         .driver = "n270" "-" TYPE_X86_CPU,\
939         .property = "movbe",\
940         .value = "off",\
941     },\
942     {\
943         .driver = "Westmere" "-" TYPE_X86_CPU,\
944         .property = "pclmulqdq",\
945         .value = "off",\
946     },
947 
948 #define DEFINE_PC_MACHINE(suffix, namestr, initfn, optsfn) \
949     static void pc_machine_##suffix##_class_init(ObjectClass *oc, void *data) \
950     { \
951         MachineClass *mc = MACHINE_CLASS(oc); \
952         optsfn(mc); \
953         mc->init = initfn; \
954     } \
955     static const TypeInfo pc_machine_type_##suffix = { \
956         .name       = namestr TYPE_MACHINE_SUFFIX, \
957         .parent     = TYPE_PC_MACHINE, \
958         .class_init = pc_machine_##suffix##_class_init, \
959     }; \
960     static void pc_machine_init_##suffix(void) \
961     { \
962         type_register(&pc_machine_type_##suffix); \
963     } \
964     type_init(pc_machine_init_##suffix)
965 
966 extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id);
967 #endif
968