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