1df2d8b3eSIsaku Yamahata /* 2df2d8b3eSIsaku Yamahata * Q35 chipset based pc system emulator 3df2d8b3eSIsaku Yamahata * 4df2d8b3eSIsaku Yamahata * Copyright (c) 2003-2004 Fabrice Bellard 5df2d8b3eSIsaku Yamahata * Copyright (c) 2009, 2010 6df2d8b3eSIsaku Yamahata * Isaku Yamahata <yamahata at valinux co jp> 7df2d8b3eSIsaku Yamahata * VA Linux Systems Japan K.K. 8df2d8b3eSIsaku Yamahata * Copyright (C) 2012 Jason Baron <jbaron@redhat.com> 9df2d8b3eSIsaku Yamahata * 10df2d8b3eSIsaku Yamahata * This is based on pc.c, but heavily modified. 11df2d8b3eSIsaku Yamahata * 12df2d8b3eSIsaku Yamahata * Permission is hereby granted, free of charge, to any person obtaining a copy 13df2d8b3eSIsaku Yamahata * of this software and associated documentation files (the "Software"), to deal 14df2d8b3eSIsaku Yamahata * in the Software without restriction, including without limitation the rights 15df2d8b3eSIsaku Yamahata * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16df2d8b3eSIsaku Yamahata * copies of the Software, and to permit persons to whom the Software is 17df2d8b3eSIsaku Yamahata * furnished to do so, subject to the following conditions: 18df2d8b3eSIsaku Yamahata * 19df2d8b3eSIsaku Yamahata * The above copyright notice and this permission notice shall be included in 20df2d8b3eSIsaku Yamahata * all copies or substantial portions of the Software. 21df2d8b3eSIsaku Yamahata * 22df2d8b3eSIsaku Yamahata * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23df2d8b3eSIsaku Yamahata * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24df2d8b3eSIsaku Yamahata * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 25df2d8b3eSIsaku Yamahata * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26df2d8b3eSIsaku Yamahata * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27df2d8b3eSIsaku Yamahata * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28df2d8b3eSIsaku Yamahata * THE SOFTWARE. 29df2d8b3eSIsaku Yamahata */ 30e688df6bSMarkus Armbruster 31b6a0aa05SPeter Maydell #include "qemu/osdep.h" 3283c9f4caSPaolo Bonzini #include "hw/hw.h" 3304920fc0SMichael S. Tsirkin #include "hw/loader.h" 349c17d615SPaolo Bonzini #include "sysemu/arch_init.h" 350d09e41aSPaolo Bonzini #include "hw/i2c/smbus.h" 3683c9f4caSPaolo Bonzini #include "hw/boards.h" 370d09e41aSPaolo Bonzini #include "hw/timer/mc146818rtc.h" 380d09e41aSPaolo Bonzini #include "hw/xen/xen.h" 399c17d615SPaolo Bonzini #include "sysemu/kvm.h" 402099935dSThomas Huth #include "kvm_i386.h" 4183c9f4caSPaolo Bonzini #include "hw/kvm/clock.h" 420d09e41aSPaolo Bonzini #include "hw/pci-host/q35.h" 43022c62cbSPaolo Bonzini #include "exec/address-spaces.h" 44b094f2e0SRita Sinha #include "hw/i386/pc.h" 450d09e41aSPaolo Bonzini #include "hw/i386/ich9.h" 46ef18310dSEduardo Habkost #include "hw/i386/amd_iommu.h" 47ef18310dSEduardo Habkost #include "hw/i386/intel_iommu.h" 4860d8f328SWei Huang #include "hw/smbios/smbios.h" 49df2d8b3eSIsaku Yamahata #include "hw/ide/pci.h" 50df2d8b3eSIsaku Yamahata #include "hw/ide/ahci.h" 51df2d8b3eSIsaku Yamahata #include "hw/usb.h" 52e688df6bSMarkus Armbruster #include "qapi/error.h" 53c87b1520SDon Slutz #include "qemu/error-report.h" 543bfe5716SLaurent Vivier #include "sysemu/numa.h" 55df2d8b3eSIsaku Yamahata 56df2d8b3eSIsaku Yamahata /* ICH9 AHCI has 6 ports */ 57df2d8b3eSIsaku Yamahata #define MAX_SATA_PORTS 6 58df2d8b3eSIsaku Yamahata 59df2d8b3eSIsaku Yamahata /* PC hardware initialisation */ 603ef96221SMarcel Apfelbaum static void pc_q35_init(MachineState *machine) 61df2d8b3eSIsaku Yamahata { 62ec68007aSEduardo Habkost PCMachineState *pcms = PC_MACHINE(machine); 637102fa70SEduardo Habkost PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); 64df2d8b3eSIsaku Yamahata Q35PCIHost *q35_host; 65ce88812fSHu Tao PCIHostState *phb; 66df2d8b3eSIsaku Yamahata PCIBus *host_bus; 67df2d8b3eSIsaku Yamahata PCIDevice *lpc; 68f999c0deSEfimov Vasily DeviceState *lpc_dev; 69df2d8b3eSIsaku Yamahata BusState *idebus[MAX_SATA_PORTS]; 70df2d8b3eSIsaku Yamahata ISADevice *rtc_state; 715fe79386SXiao Guangrong MemoryRegion *system_io = get_system_io(); 72df2d8b3eSIsaku Yamahata MemoryRegion *pci_memory; 73df2d8b3eSIsaku Yamahata MemoryRegion *rom_memory; 74df2d8b3eSIsaku Yamahata MemoryRegion *ram_memory; 75df2d8b3eSIsaku Yamahata GSIState *gsi_state; 76df2d8b3eSIsaku Yamahata ISABus *isa_bus; 77df2d8b3eSIsaku Yamahata qemu_irq *i8259; 78df2d8b3eSIsaku Yamahata int i; 79df2d8b3eSIsaku Yamahata ICH9LPCState *ich9_lpc; 80df2d8b3eSIsaku Yamahata PCIDevice *ahci; 81c87b1520SDon Slutz ram_addr_t lowmem; 82d93162e1SJohn Snow DriveInfo *hd[MAX_SATA_PORTS]; 836cd2234cSLaszlo Ersek MachineClass *mc = MACHINE_GET_CLASS(machine); 84f0513d2cSIgor Mammedov 854e17997dSMichael S. Tsirkin /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory 864e17997dSMichael S. Tsirkin * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping 874e17997dSMichael S. Tsirkin * also known as MMCFG). 884e17997dSMichael S. Tsirkin * If it doesn't, we need to split it in chunks below and above 4G. 894e17997dSMichael S. Tsirkin * In any case, try to make sure that guest addresses aligned at 904e17997dSMichael S. Tsirkin * 1G boundaries get mapped to host addresses aligned at 1G boundaries. 914e17997dSMichael S. Tsirkin */ 923ef96221SMarcel Apfelbaum if (machine->ram_size >= 0xb0000000) { 93533e8bbbSEduardo Habkost lowmem = 0x80000000; 94c87b1520SDon Slutz } else { 95c87b1520SDon Slutz lowmem = 0xb0000000; 96c87b1520SDon Slutz } 97c87b1520SDon Slutz 98a9dd38dbSStefan Weil /* Handle the machine opt max-ram-below-4g. It is basically doing 99c87b1520SDon Slutz * min(qemu limit, user limit). 100c87b1520SDon Slutz */ 1015ec7d098SGerd Hoffmann if (!pcms->max_ram_below_4g) { 1025ec7d098SGerd Hoffmann pcms->max_ram_below_4g = 1ULL << 32; /* default: 4G */; 1035ec7d098SGerd Hoffmann } 104ec68007aSEduardo Habkost if (lowmem > pcms->max_ram_below_4g) { 105ec68007aSEduardo Habkost lowmem = pcms->max_ram_below_4g; 106c87b1520SDon Slutz if (machine->ram_size - lowmem > lowmem && 107c87b1520SDon Slutz lowmem & ((1ULL << 30) - 1)) { 1089e5d2c52SAlistair Francis warn_report("There is possibly poor performance as the ram size " 1099e5d2c52SAlistair Francis " (0x%" PRIx64 ") is more then twice the size of" 1109e5d2c52SAlistair Francis " max-ram-below-4g (%"PRIu64") and" 1119e5d2c52SAlistair Francis " max-ram-below-4g is not a multiple of 1G.", 1129e5d2c52SAlistair Francis (uint64_t)machine->ram_size, pcms->max_ram_below_4g); 113c87b1520SDon Slutz } 114c87b1520SDon Slutz } 115c87b1520SDon Slutz 116c87b1520SDon Slutz if (machine->ram_size >= lowmem) { 117c0aa4e1eSEduardo Habkost pcms->above_4g_mem_size = machine->ram_size - lowmem; 118c0aa4e1eSEduardo Habkost pcms->below_4g_mem_size = lowmem; 119df2d8b3eSIsaku Yamahata } else { 120c0aa4e1eSEduardo Habkost pcms->above_4g_mem_size = 0; 121c0aa4e1eSEduardo Habkost pcms->below_4g_mem_size = machine->ram_size; 122df2d8b3eSIsaku Yamahata } 123df2d8b3eSIsaku Yamahata 124dced4d2fSMarkus Armbruster if (xen_enabled()) { 125dced4d2fSMarkus Armbruster xen_hvm_init(pcms, &ram_memory); 1263c2a9669SDon Slutz } 1273c2a9669SDon Slutz 1284884b7bfSZhu Guihua pc_cpus_init(pcms); 1293c2a9669SDon Slutz 1303c2a9669SDon Slutz kvmclock_create(); 1313c2a9669SDon Slutz 132df2d8b3eSIsaku Yamahata /* pci enabled */ 1337102fa70SEduardo Habkost if (pcmc->pci_enabled) { 134df2d8b3eSIsaku Yamahata pci_memory = g_new(MemoryRegion, 1); 135286690e3SPaolo Bonzini memory_region_init(pci_memory, NULL, "pci", UINT64_MAX); 136df2d8b3eSIsaku Yamahata rom_memory = pci_memory; 137df2d8b3eSIsaku Yamahata } else { 138df2d8b3eSIsaku Yamahata pci_memory = NULL; 139df2d8b3eSIsaku Yamahata rom_memory = get_system_memory(); 140df2d8b3eSIsaku Yamahata } 141df2d8b3eSIsaku Yamahata 1425db3f0deSEduardo Habkost pc_guest_info_init(pcms); 14307fb6176SPaolo Bonzini 1447102fa70SEduardo Habkost if (pcmc->smbios_defaults) { 145b29ad07eSMarkus Armbruster /* These values are guest ABI, do not change */ 146e6667f71SGabriel L. Somlo smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)", 1477102fa70SEduardo Habkost mc->name, pcmc->smbios_legacy_mode, 1487102fa70SEduardo Habkost pcmc->smbios_uuid_encoded, 14986299120SWei Huang SMBIOS_ENTRY_POINT_21); 150b29ad07eSMarkus Armbruster } 151b29ad07eSMarkus Armbruster 152df2d8b3eSIsaku Yamahata /* allocate ram and load rom/bios */ 153df2d8b3eSIsaku Yamahata if (!xen_enabled()) { 15462b160c0SEduardo Habkost pc_memory_init(pcms, get_system_memory(), 1555934e216SEduardo Habkost rom_memory, &ram_memory); 156df2d8b3eSIsaku Yamahata } 157df2d8b3eSIsaku Yamahata 158df2d8b3eSIsaku Yamahata /* irq lines */ 159df2d8b3eSIsaku Yamahata gsi_state = g_malloc0(sizeof(*gsi_state)); 160b094f2e0SRita Sinha if (kvm_ioapic_in_kernel()) { 1617102fa70SEduardo Habkost kvm_pc_setup_irq_routing(pcmc->pci_enabled); 1623e6c0c4cSMarc-André Lureau pcms->gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, 163df2d8b3eSIsaku Yamahata GSI_NUM_PINS); 164df2d8b3eSIsaku Yamahata } else { 1653e6c0c4cSMarc-André Lureau pcms->gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); 166df2d8b3eSIsaku Yamahata } 167df2d8b3eSIsaku Yamahata 168df2d8b3eSIsaku Yamahata /* create pci host bus */ 169df2d8b3eSIsaku Yamahata q35_host = Q35_HOST_DEVICE(qdev_create(NULL, TYPE_Q35_HOST_DEVICE)); 170df2d8b3eSIsaku Yamahata 171c52dc697SIgor Mammedov object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host), NULL); 1728d1c7158SEfimov Vasily object_property_set_link(OBJECT(q35_host), OBJECT(ram_memory), 1738d1c7158SEfimov Vasily MCH_HOST_PROP_RAM_MEM, NULL); 1748d1c7158SEfimov Vasily object_property_set_link(OBJECT(q35_host), OBJECT(pci_memory), 1758d1c7158SEfimov Vasily MCH_HOST_PROP_PCI_MEM, NULL); 1768d1c7158SEfimov Vasily object_property_set_link(OBJECT(q35_host), OBJECT(get_system_memory()), 1778d1c7158SEfimov Vasily MCH_HOST_PROP_SYSTEM_MEM, NULL); 1788d1c7158SEfimov Vasily object_property_set_link(OBJECT(q35_host), OBJECT(system_io), 1798d1c7158SEfimov Vasily MCH_HOST_PROP_IO_MEM, NULL); 1808d1c7158SEfimov Vasily object_property_set_int(OBJECT(q35_host), pcms->below_4g_mem_size, 1818d1c7158SEfimov Vasily PCI_HOST_BELOW_4G_MEM_SIZE, NULL); 1828d1c7158SEfimov Vasily object_property_set_int(OBJECT(q35_host), pcms->above_4g_mem_size, 1838d1c7158SEfimov Vasily PCI_HOST_ABOVE_4G_MEM_SIZE, NULL); 184df2d8b3eSIsaku Yamahata /* pci */ 185df2d8b3eSIsaku Yamahata qdev_init_nofail(DEVICE(q35_host)); 186ce88812fSHu Tao phb = PCI_HOST_BRIDGE(q35_host); 187ce88812fSHu Tao host_bus = phb->bus; 188df2d8b3eSIsaku Yamahata /* create ISA bus */ 189df2d8b3eSIsaku Yamahata lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV, 190df2d8b3eSIsaku Yamahata ICH9_LPC_FUNC), true, 191df2d8b3eSIsaku Yamahata TYPE_ICH9_LPC_DEVICE); 192781bbd6bSIgor Mammedov 193781bbd6bSIgor Mammedov object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP, 194781bbd6bSIgor Mammedov TYPE_HOTPLUG_HANDLER, 195ec68007aSEduardo Habkost (Object **)&pcms->acpi_dev, 196781bbd6bSIgor Mammedov object_property_allow_set_link, 197781bbd6bSIgor Mammedov OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort); 198781bbd6bSIgor Mammedov object_property_set_link(OBJECT(machine), OBJECT(lpc), 199781bbd6bSIgor Mammedov PC_MACHINE_ACPI_DEVICE_PROP, &error_abort); 200781bbd6bSIgor Mammedov 201df2d8b3eSIsaku Yamahata ich9_lpc = ICH9_LPC_DEVICE(lpc); 202f999c0deSEfimov Vasily lpc_dev = DEVICE(lpc); 203f999c0deSEfimov Vasily for (i = 0; i < GSI_NUM_PINS; i++) { 2043e6c0c4cSMarc-André Lureau qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, pcms->gsi[i]); 205f999c0deSEfimov Vasily } 206df2d8b3eSIsaku Yamahata pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc_map_irq, ich9_lpc, 207df2d8b3eSIsaku Yamahata ICH9_LPC_NB_PIRQS); 20891c3f2f0SJason Baron pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq); 209df2d8b3eSIsaku Yamahata isa_bus = ich9_lpc->isa_bus; 210df2d8b3eSIsaku Yamahata 211b094f2e0SRita Sinha if (kvm_pic_in_kernel()) { 212df2d8b3eSIsaku Yamahata i8259 = kvm_i8259_init(isa_bus); 213df2d8b3eSIsaku Yamahata } else if (xen_enabled()) { 214df2d8b3eSIsaku Yamahata i8259 = xen_interrupt_controller_init(); 215df2d8b3eSIsaku Yamahata } else { 2160b0cc076SShannon Zhao i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq()); 217df2d8b3eSIsaku Yamahata } 218df2d8b3eSIsaku Yamahata 219df2d8b3eSIsaku Yamahata for (i = 0; i < ISA_NUM_IRQS; i++) { 220df2d8b3eSIsaku Yamahata gsi_state->i8259_irq[i] = i8259[i]; 221df2d8b3eSIsaku Yamahata } 2228197e24cSMarc-André Lureau g_free(i8259); 2238197e24cSMarc-André Lureau 2247102fa70SEduardo Habkost if (pcmc->pci_enabled) { 225552b48f4SJohn Snow ioapic_init_gsi(gsi_state, "q35"); 226df2d8b3eSIsaku Yamahata } 227df2d8b3eSIsaku Yamahata 2283e6c0c4cSMarc-André Lureau pc_register_ferr_irq(pcms->gsi[13]); 229df2d8b3eSIsaku Yamahata 2307fb1cf16SEric Blake assert(pcms->vmport != ON_OFF_AUTO__MAX); 231ec68007aSEduardo Habkost if (pcms->vmport == ON_OFF_AUTO_AUTO) { 232ec68007aSEduardo Habkost pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON; 233d1048befSDon Slutz } 234d1048befSDon Slutz 235df2d8b3eSIsaku Yamahata /* init basic PC hardware */ 2363e6c0c4cSMarc-André Lureau pc_basic_device_init(isa_bus, pcms->gsi, &rtc_state, !mc->no_floppy, 237feddd2fdSChao Peng (pcms->vmport != ON_OFF_AUTO_ON), pcms->pit, 238feddd2fdSChao Peng 0xff0104); 239df2d8b3eSIsaku Yamahata 240df2d8b3eSIsaku Yamahata /* connect pm stuff to lpc */ 24118d6abaeSEduardo Habkost ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pcms)); 242df2d8b3eSIsaku Yamahata 243272f0428SChao Peng if (pcms->sata) { 244df2d8b3eSIsaku Yamahata /* ahci and SATA device, for q35 1 ahci controller is built-in */ 245df2d8b3eSIsaku Yamahata ahci = pci_create_simple_multifunction(host_bus, 246df2d8b3eSIsaku Yamahata PCI_DEVFN(ICH9_SATA1_DEV, 247df2d8b3eSIsaku Yamahata ICH9_SATA1_FUNC), 248df2d8b3eSIsaku Yamahata true, "ich9-ahci"); 249df2d8b3eSIsaku Yamahata idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0"); 250df2d8b3eSIsaku Yamahata idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1"); 251bbe3179aSJohn Snow g_assert(MAX_SATA_PORTS == ahci_get_num_ports(ahci)); 252bbe3179aSJohn Snow ide_drive_get(hd, ahci_get_num_ports(ahci)); 253d93162e1SJohn Snow ahci_ide_create_devs(ahci, hd); 254272f0428SChao Peng } else { 255272f0428SChao Peng idebus[0] = idebus[1] = NULL; 256272f0428SChao Peng } 257df2d8b3eSIsaku Yamahata 2584bcbe0b6SEduardo Habkost if (machine_usb(machine)) { 259df2d8b3eSIsaku Yamahata /* Should we create 6 UHCI according to ich9 spec? */ 260df2d8b3eSIsaku Yamahata ehci_create_ich9_with_companions(host_bus, 0x1d); 261df2d8b3eSIsaku Yamahata } 262df2d8b3eSIsaku Yamahata 263be232eb0SChao Peng if (pcms->smbus) { 264df2d8b3eSIsaku Yamahata /* TODO: Populate SPD eeprom data. */ 265df2d8b3eSIsaku Yamahata smbus_eeprom_init(ich9_smb_init(host_bus, 266df2d8b3eSIsaku Yamahata PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC), 267df2d8b3eSIsaku Yamahata 0xb100), 268df2d8b3eSIsaku Yamahata 8, NULL, 0); 269be232eb0SChao Peng } 270df2d8b3eSIsaku Yamahata 27188076854SEduardo Habkost pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state); 272df2d8b3eSIsaku Yamahata 273df2d8b3eSIsaku Yamahata /* the rest devices to which pci devfn is automatically assigned */ 274df2d8b3eSIsaku Yamahata pc_vga_init(isa_bus, host_bus); 2754b9c264bSPaolo Bonzini pc_nic_init(pcmc, isa_bus, host_bus); 2765fe79386SXiao Guangrong 2775fe79386SXiao Guangrong if (pcms->acpi_nvdimm_state.is_enabled) { 2785fe79386SXiao Guangrong nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io, 2795fe79386SXiao Guangrong pcms->fw_cfg, OBJECT(pcms)); 2805fe79386SXiao Guangrong } 281df2d8b3eSIsaku Yamahata } 282df2d8b3eSIsaku Yamahata 28399fbeafeSEduardo Habkost #define DEFINE_Q35_MACHINE(suffix, name, compatfn, optionfn) \ 28499fbeafeSEduardo Habkost static void pc_init_##suffix(MachineState *machine) \ 28599fbeafeSEduardo Habkost { \ 28699fbeafeSEduardo Habkost void (*compat)(MachineState *m) = (compatfn); \ 28799fbeafeSEduardo Habkost if (compat) { \ 28899fbeafeSEduardo Habkost compat(machine); \ 28999fbeafeSEduardo Habkost } \ 29099fbeafeSEduardo Habkost pc_q35_init(machine); \ 29199fbeafeSEduardo Habkost } \ 29299fbeafeSEduardo Habkost DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn) 2935cb50e0aSJason Wang 2949953f882SMarkus Armbruster 295865906f7SEduardo Habkost static void pc_q35_machine_options(MachineClass *m) 296fddd179aSEduardo Habkost { 2974b9c264bSPaolo Bonzini PCMachineClass *pcmc = PC_MACHINE_CLASS(m); 2984b9c264bSPaolo Bonzini pcmc->default_nic_model = "e1000e"; 2994b9c264bSPaolo Bonzini 300fddd179aSEduardo Habkost m->family = "pc_q35"; 301fddd179aSEduardo Habkost m->desc = "Standard PC (Q35 + ICH9, 2009)"; 302fddd179aSEduardo Habkost m->units_per_default_bus = 1; 3030b7783a7SEduardo Habkost m->default_machine_opts = "firmware=bios-256k.bin"; 3040b7783a7SEduardo Habkost m->default_display = "std"; 3050b7783a7SEduardo Habkost m->no_floppy = 1; 306ef18310dSEduardo Habkost machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE); 307ef18310dSEduardo Habkost machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE); 30800d0f9fdSIgor Mammedov m->max_cpus = 288; 309fddd179aSEduardo Habkost } 310a0dba644SMichael S. Tsirkin 311*aa78a16dSPeter Maydell static void pc_q35_3_0_machine_options(MachineClass *m) 31287e896abSEduardo Habkost { 31387e896abSEduardo Habkost pc_q35_machine_options(m); 31487e896abSEduardo Habkost m->alias = "q35"; 315a6fd5b0eSMarcel Apfelbaum } 316a6fd5b0eSMarcel Apfelbaum 317*aa78a16dSPeter Maydell DEFINE_Q35_MACHINE(v3_0, "pc-q35-3.0", NULL, 318*aa78a16dSPeter Maydell pc_q35_3_0_machine_options); 319968ee4adSBabu Moger 320968ee4adSBabu Moger static void pc_q35_2_12_machine_options(MachineClass *m) 321968ee4adSBabu Moger { 322*aa78a16dSPeter Maydell pc_q35_3_0_machine_options(m); 323968ee4adSBabu Moger m->alias = NULL; 324968ee4adSBabu Moger SET_MACHINE_COMPAT(m, PC_COMPAT_2_12); 325968ee4adSBabu Moger } 326968ee4adSBabu Moger 327df47ce8aSHaozhong Zhang DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL, 328df47ce8aSHaozhong Zhang pc_q35_2_12_machine_options); 329df47ce8aSHaozhong Zhang 330df47ce8aSHaozhong Zhang static void pc_q35_2_11_machine_options(MachineClass *m) 331df47ce8aSHaozhong Zhang { 3324b9c264bSPaolo Bonzini PCMachineClass *pcmc = PC_MACHINE_CLASS(m); 3334b9c264bSPaolo Bonzini 334df47ce8aSHaozhong Zhang pc_q35_2_12_machine_options(m); 3354b9c264bSPaolo Bonzini pcmc->default_nic_model = "e1000"; 336df47ce8aSHaozhong Zhang SET_MACHINE_COMPAT(m, PC_COMPAT_2_11); 337df47ce8aSHaozhong Zhang } 338df47ce8aSHaozhong Zhang 339a6fd5b0eSMarcel Apfelbaum DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL, 340a6fd5b0eSMarcel Apfelbaum pc_q35_2_11_machine_options); 341a6fd5b0eSMarcel Apfelbaum 342a6fd5b0eSMarcel Apfelbaum static void pc_q35_2_10_machine_options(MachineClass *m) 343a6fd5b0eSMarcel Apfelbaum { 344a6fd5b0eSMarcel Apfelbaum pc_q35_2_11_machine_options(m); 345a6fd5b0eSMarcel Apfelbaum SET_MACHINE_COMPAT(m, PC_COMPAT_2_10); 3463bfe5716SLaurent Vivier m->numa_auto_assign_ram = numa_legacy_auto_assign_ram; 3477b8be49dSDou Liyang m->auto_enable_numa_with_memhp = false; 34887e896abSEduardo Habkost } 34987e896abSEduardo Habkost 350465238d9SPeter Xu DEFINE_Q35_MACHINE(v2_10, "pc-q35-2.10", NULL, 351465238d9SPeter Xu pc_q35_2_10_machine_options); 352465238d9SPeter Xu 353465238d9SPeter Xu static void pc_q35_2_9_machine_options(MachineClass *m) 354465238d9SPeter Xu { 355465238d9SPeter Xu pc_q35_2_10_machine_options(m); 356465238d9SPeter Xu SET_MACHINE_COMPAT(m, PC_COMPAT_2_9); 357465238d9SPeter Xu } 358465238d9SPeter Xu 359d580bd4bSEduardo Habkost DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL, 360d580bd4bSEduardo Habkost pc_q35_2_9_machine_options); 361d580bd4bSEduardo Habkost 362d580bd4bSEduardo Habkost static void pc_q35_2_8_machine_options(MachineClass *m) 363d580bd4bSEduardo Habkost { 364d580bd4bSEduardo Habkost pc_q35_2_9_machine_options(m); 365d580bd4bSEduardo Habkost SET_MACHINE_COMPAT(m, PC_COMPAT_2_8); 366d580bd4bSEduardo Habkost } 367d580bd4bSEduardo Habkost 368a4d3c834SLongpeng(Mike) DEFINE_Q35_MACHINE(v2_8, "pc-q35-2.8", NULL, 369a4d3c834SLongpeng(Mike) pc_q35_2_8_machine_options); 370a4d3c834SLongpeng(Mike) 371a4d3c834SLongpeng(Mike) static void pc_q35_2_7_machine_options(MachineClass *m) 372a4d3c834SLongpeng(Mike) { 373a4d3c834SLongpeng(Mike) pc_q35_2_8_machine_options(m); 37400d0f9fdSIgor Mammedov m->max_cpus = 255; 375a4d3c834SLongpeng(Mike) SET_MACHINE_COMPAT(m, PC_COMPAT_2_7); 376a4d3c834SLongpeng(Mike) } 377a4d3c834SLongpeng(Mike) 378d86c1451SIgor Mammedov DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL, 379d86c1451SIgor Mammedov pc_q35_2_7_machine_options); 380d86c1451SIgor Mammedov 381d86c1451SIgor Mammedov static void pc_q35_2_6_machine_options(MachineClass *m) 382d86c1451SIgor Mammedov { 383679dd1a9SIgor Mammedov PCMachineClass *pcmc = PC_MACHINE_CLASS(m); 384d86c1451SIgor Mammedov pc_q35_2_7_machine_options(m); 385679dd1a9SIgor Mammedov pcmc->legacy_cpu_hotplug = true; 38698e753a6SIgor Mammedov pcmc->linuxboot_dma_enabled = false; 387d86c1451SIgor Mammedov SET_MACHINE_COMPAT(m, PC_COMPAT_2_6); 388d86c1451SIgor Mammedov } 389d86c1451SIgor Mammedov 390240240d5SEduardo Habkost DEFINE_Q35_MACHINE(v2_6, "pc-q35-2.6", NULL, 391240240d5SEduardo Habkost pc_q35_2_6_machine_options); 392240240d5SEduardo Habkost 393240240d5SEduardo Habkost static void pc_q35_2_5_machine_options(MachineClass *m) 394240240d5SEduardo Habkost { 39536f96c4bSHaozhong Zhang PCMachineClass *pcmc = PC_MACHINE_CLASS(m); 396240240d5SEduardo Habkost pc_q35_2_6_machine_options(m); 39736f96c4bSHaozhong Zhang pcmc->save_tsc_khz = false; 398bab47d9aSGerd Hoffmann m->legacy_fw_cfg_order = 1; 399240240d5SEduardo Habkost SET_MACHINE_COMPAT(m, PC_COMPAT_2_5); 400240240d5SEduardo Habkost } 401240240d5SEduardo Habkost 40287e896abSEduardo Habkost DEFINE_Q35_MACHINE(v2_5, "pc-q35-2.5", NULL, 40387e896abSEduardo Habkost pc_q35_2_5_machine_options); 40487e896abSEduardo Habkost 405865906f7SEduardo Habkost static void pc_q35_2_4_machine_options(MachineClass *m) 406fddd179aSEduardo Habkost { 4072f8b5008SIgor Mammedov PCMachineClass *pcmc = PC_MACHINE_CLASS(m); 40887e896abSEduardo Habkost pc_q35_2_5_machine_options(m); 409de796d93SEduardo Habkost m->hw_version = "2.4.0"; 4102f8b5008SIgor Mammedov pcmc->broken_reserved_end = true; 41187e896abSEduardo Habkost SET_MACHINE_COMPAT(m, PC_COMPAT_2_4); 412fddd179aSEduardo Habkost } 413aeca6e8dSGerd Hoffmann 41499fbeafeSEduardo Habkost DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL, 41525519b06SEduardo Habkost pc_q35_2_4_machine_options); 416