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