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