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