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