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