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