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