xref: /qemu/hw/i386/pc_q35.c (revision 07fb61760cdea7c3f1b9c897513986945bca8e89)
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  */
3083c9f4caSPaolo Bonzini #include "hw/hw.h"
3104920fc0SMichael S. Tsirkin #include "hw/loader.h"
329c17d615SPaolo Bonzini #include "sysemu/arch_init.h"
330d09e41aSPaolo Bonzini #include "hw/i2c/smbus.h"
3483c9f4caSPaolo Bonzini #include "hw/boards.h"
350d09e41aSPaolo Bonzini #include "hw/timer/mc146818rtc.h"
360d09e41aSPaolo Bonzini #include "hw/xen/xen.h"
379c17d615SPaolo Bonzini #include "sysemu/kvm.h"
3883c9f4caSPaolo Bonzini #include "hw/kvm/clock.h"
390d09e41aSPaolo Bonzini #include "hw/pci-host/q35.h"
40022c62cbSPaolo Bonzini #include "exec/address-spaces.h"
410d09e41aSPaolo Bonzini #include "hw/i386/ich9.h"
42b29ad07eSMarkus Armbruster #include "hw/i386/smbios.h"
43df2d8b3eSIsaku Yamahata #include "hw/ide/pci.h"
44df2d8b3eSIsaku Yamahata #include "hw/ide/ahci.h"
45df2d8b3eSIsaku Yamahata #include "hw/usb.h"
46f0513d2cSIgor Mammedov #include "hw/cpu/icc_bus.h"
47c87b1520SDon Slutz #include "qemu/error-report.h"
48df2d8b3eSIsaku Yamahata 
49df2d8b3eSIsaku Yamahata /* ICH9 AHCI has 6 ports */
50df2d8b3eSIsaku Yamahata #define MAX_SATA_PORTS     6
51df2d8b3eSIsaku Yamahata 
527f1bb742SIgor Mammedov static bool has_pci_info;
5372c194f7SMichael S. Tsirkin static bool has_acpi_build = true;
54e6667f71SGabriel L. Somlo static bool smbios_defaults = true;
55c97294ecSGabriel L. Somlo static bool smbios_legacy_mode;
564e17997dSMichael S. Tsirkin /* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
574e17997dSMichael S. Tsirkin  * host addresses aligned at 1Gbyte boundaries.  This way we can use 1GByte
584e17997dSMichael S. Tsirkin  * pages in the host.
594e17997dSMichael S. Tsirkin  */
609a305c8fSGerd Hoffmann static bool gigabyte_align = true;
61de268e13SIgor Mammedov static bool has_reserved_memory = true;
623ab135f3SHu Tao 
63df2d8b3eSIsaku Yamahata /* PC hardware initialisation */
643ef96221SMarcel Apfelbaum static void pc_q35_init(MachineState *machine)
65df2d8b3eSIsaku Yamahata {
66781bbd6bSIgor Mammedov     PCMachineState *pc_machine = PC_MACHINE(machine);
67df2d8b3eSIsaku Yamahata     ram_addr_t below_4g_mem_size, above_4g_mem_size;
68df2d8b3eSIsaku Yamahata     Q35PCIHost *q35_host;
69ce88812fSHu Tao     PCIHostState *phb;
70df2d8b3eSIsaku Yamahata     PCIBus *host_bus;
71df2d8b3eSIsaku Yamahata     PCIDevice *lpc;
72df2d8b3eSIsaku Yamahata     BusState *idebus[MAX_SATA_PORTS];
73df2d8b3eSIsaku Yamahata     ISADevice *rtc_state;
74df2d8b3eSIsaku Yamahata     ISADevice *floppy;
75df2d8b3eSIsaku Yamahata     MemoryRegion *pci_memory;
76df2d8b3eSIsaku Yamahata     MemoryRegion *rom_memory;
77df2d8b3eSIsaku Yamahata     MemoryRegion *ram_memory;
78df2d8b3eSIsaku Yamahata     GSIState *gsi_state;
79df2d8b3eSIsaku Yamahata     ISABus *isa_bus;
80df2d8b3eSIsaku Yamahata     int pci_enabled = 1;
81df2d8b3eSIsaku Yamahata     qemu_irq *cpu_irq;
82df2d8b3eSIsaku Yamahata     qemu_irq *gsi;
83df2d8b3eSIsaku Yamahata     qemu_irq *i8259;
84df2d8b3eSIsaku Yamahata     int i;
85df2d8b3eSIsaku Yamahata     ICH9LPCState *ich9_lpc;
86df2d8b3eSIsaku Yamahata     PCIDevice *ahci;
87f0513d2cSIgor Mammedov     DeviceState *icc_bridge;
883459a625SMichael S. Tsirkin     PcGuestInfo *guest_info;
89c87b1520SDon Slutz     ram_addr_t lowmem;
90f0513d2cSIgor Mammedov 
914e17997dSMichael S. Tsirkin     /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory
924e17997dSMichael S. Tsirkin      * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
934e17997dSMichael S. Tsirkin      * also known as MMCFG).
944e17997dSMichael S. Tsirkin      * If it doesn't, we need to split it in chunks below and above 4G.
954e17997dSMichael S. Tsirkin      * In any case, try to make sure that guest addresses aligned at
964e17997dSMichael S. Tsirkin      * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
974e17997dSMichael S. Tsirkin      * For old machine types, use whatever split we used historically to avoid
984e17997dSMichael S. Tsirkin      * breaking migration.
994e17997dSMichael S. Tsirkin      */
1003ef96221SMarcel Apfelbaum     if (machine->ram_size >= 0xb0000000) {
101c87b1520SDon Slutz         lowmem = gigabyte_align ? 0x80000000 : 0xb0000000;
102c87b1520SDon Slutz     } else {
103c87b1520SDon Slutz         lowmem = 0xb0000000;
104c87b1520SDon Slutz     }
105c87b1520SDon Slutz 
106a9dd38dbSStefan Weil     /* Handle the machine opt max-ram-below-4g.  It is basically doing
107c87b1520SDon Slutz      * min(qemu limit, user limit).
108c87b1520SDon Slutz      */
109c87b1520SDon Slutz     if (lowmem > pc_machine->max_ram_below_4g) {
110c87b1520SDon Slutz         lowmem = pc_machine->max_ram_below_4g;
111c87b1520SDon Slutz         if (machine->ram_size - lowmem > lowmem &&
112c87b1520SDon Slutz             lowmem & ((1ULL << 30) - 1)) {
113c87b1520SDon Slutz             error_report("Warning: Large machine and max_ram_below_4g(%"PRIu64
114c87b1520SDon Slutz                          ") not a multiple of 1G; possible bad performance.",
115c87b1520SDon Slutz                          pc_machine->max_ram_below_4g);
116c87b1520SDon Slutz         }
117c87b1520SDon Slutz     }
118c87b1520SDon Slutz 
119c87b1520SDon Slutz     if (machine->ram_size >= lowmem) {
1203ef96221SMarcel Apfelbaum         above_4g_mem_size = machine->ram_size - lowmem;
1219a305c8fSGerd Hoffmann         below_4g_mem_size = lowmem;
122df2d8b3eSIsaku Yamahata     } else {
123df2d8b3eSIsaku Yamahata         above_4g_mem_size = 0;
1243ef96221SMarcel Apfelbaum         below_4g_mem_size = machine->ram_size;
125df2d8b3eSIsaku Yamahata     }
126df2d8b3eSIsaku Yamahata 
1273c2a9669SDon Slutz     if (xen_enabled() && xen_hvm_init(&below_4g_mem_size, &above_4g_mem_size,
1283c2a9669SDon Slutz                                       &ram_memory) != 0) {
1293c2a9669SDon Slutz         fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
1303c2a9669SDon Slutz         exit(1);
1313c2a9669SDon Slutz     }
1323c2a9669SDon Slutz 
1333c2a9669SDon Slutz     icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
1343c2a9669SDon Slutz     object_property_add_child(qdev_get_machine(), "icc-bridge",
1353c2a9669SDon Slutz                               OBJECT(icc_bridge), NULL);
1363c2a9669SDon Slutz 
1373c2a9669SDon Slutz     pc_cpus_init(machine->cpu_model, icc_bridge);
1383c2a9669SDon Slutz     pc_acpi_init("q35-acpi-dsdt.aml");
1393c2a9669SDon Slutz 
1403c2a9669SDon Slutz     kvmclock_create();
1413c2a9669SDon Slutz 
142df2d8b3eSIsaku Yamahata     /* pci enabled */
143df2d8b3eSIsaku Yamahata     if (pci_enabled) {
144df2d8b3eSIsaku Yamahata         pci_memory = g_new(MemoryRegion, 1);
145286690e3SPaolo Bonzini         memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
146df2d8b3eSIsaku Yamahata         rom_memory = pci_memory;
147df2d8b3eSIsaku Yamahata     } else {
148df2d8b3eSIsaku Yamahata         pci_memory = NULL;
149df2d8b3eSIsaku Yamahata         rom_memory = get_system_memory();
150df2d8b3eSIsaku Yamahata     }
151df2d8b3eSIsaku Yamahata 
1523459a625SMichael S. Tsirkin     guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
153f8c457b8SMichael S. Tsirkin     guest_info->has_pci_info = has_pci_info;
1546dd2a5c9SPaolo Bonzini     guest_info->isapc_ram_fw = false;
15572c194f7SMichael S. Tsirkin     guest_info->has_acpi_build = has_acpi_build;
156de268e13SIgor Mammedov     guest_info->has_reserved_memory = has_reserved_memory;
1573459a625SMichael S. Tsirkin 
158*07fb6176SPaolo Bonzini     /* Migration was not supported in 2.0 for Q35, so do not bother
159*07fb6176SPaolo Bonzini      * with this hack (see hw/i386/acpi-build.c).
160*07fb6176SPaolo Bonzini      */
161*07fb6176SPaolo Bonzini     guest_info->legacy_acpi_table_size = 0;
162*07fb6176SPaolo Bonzini 
163e6667f71SGabriel L. Somlo     if (smbios_defaults) {
1643ef96221SMarcel Apfelbaum         MachineClass *mc = MACHINE_GET_CLASS(machine);
165b29ad07eSMarkus Armbruster         /* These values are guest ABI, do not change */
166e6667f71SGabriel L. Somlo         smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
1673ef96221SMarcel Apfelbaum                             mc->name, smbios_legacy_mode);
168b29ad07eSMarkus Armbruster     }
169b29ad07eSMarkus Armbruster 
170df2d8b3eSIsaku Yamahata     /* allocate ram and load rom/bios */
171df2d8b3eSIsaku Yamahata     if (!xen_enabled()) {
1729521d42bSPaolo Bonzini         pc_memory_init(machine, get_system_memory(),
1733b6fb9caSMarkus Armbruster                        below_4g_mem_size, above_4g_mem_size,
1743459a625SMichael S. Tsirkin                        rom_memory, &ram_memory, guest_info);
175df2d8b3eSIsaku Yamahata     }
176df2d8b3eSIsaku Yamahata 
177df2d8b3eSIsaku Yamahata     /* irq lines */
178df2d8b3eSIsaku Yamahata     gsi_state = g_malloc0(sizeof(*gsi_state));
179df2d8b3eSIsaku Yamahata     if (kvm_irqchip_in_kernel()) {
180df2d8b3eSIsaku Yamahata         kvm_pc_setup_irq_routing(pci_enabled);
181df2d8b3eSIsaku Yamahata         gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
182df2d8b3eSIsaku Yamahata                                  GSI_NUM_PINS);
183df2d8b3eSIsaku Yamahata     } else {
184df2d8b3eSIsaku Yamahata         gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
185df2d8b3eSIsaku Yamahata     }
186df2d8b3eSIsaku Yamahata 
187df2d8b3eSIsaku Yamahata     /* create pci host bus */
188df2d8b3eSIsaku Yamahata     q35_host = Q35_HOST_DEVICE(qdev_create(NULL, TYPE_Q35_HOST_DEVICE));
189df2d8b3eSIsaku Yamahata 
190c52dc697SIgor Mammedov     object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host), NULL);
191df2d8b3eSIsaku Yamahata     q35_host->mch.ram_memory = ram_memory;
192df2d8b3eSIsaku Yamahata     q35_host->mch.pci_address_space = pci_memory;
193df2d8b3eSIsaku Yamahata     q35_host->mch.system_memory = get_system_memory();
194c7e775e4SDong Xu Wang     q35_host->mch.address_space_io = get_system_io();
195df2d8b3eSIsaku Yamahata     q35_host->mch.below_4g_mem_size = below_4g_mem_size;
196df2d8b3eSIsaku Yamahata     q35_host->mch.above_4g_mem_size = above_4g_mem_size;
1973459a625SMichael S. Tsirkin     q35_host->mch.guest_info = guest_info;
198df2d8b3eSIsaku Yamahata     /* pci */
199df2d8b3eSIsaku Yamahata     qdev_init_nofail(DEVICE(q35_host));
200ce88812fSHu Tao     phb = PCI_HOST_BRIDGE(q35_host);
201ce88812fSHu Tao     host_bus = phb->bus;
202df2d8b3eSIsaku Yamahata     /* create ISA bus */
203df2d8b3eSIsaku Yamahata     lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV,
204df2d8b3eSIsaku Yamahata                                           ICH9_LPC_FUNC), true,
205df2d8b3eSIsaku Yamahata                                           TYPE_ICH9_LPC_DEVICE);
206781bbd6bSIgor Mammedov 
207781bbd6bSIgor Mammedov     object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
208781bbd6bSIgor Mammedov                              TYPE_HOTPLUG_HANDLER,
209781bbd6bSIgor Mammedov                              (Object **)&pc_machine->acpi_dev,
210781bbd6bSIgor Mammedov                              object_property_allow_set_link,
211781bbd6bSIgor Mammedov                              OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort);
212781bbd6bSIgor Mammedov     object_property_set_link(OBJECT(machine), OBJECT(lpc),
213781bbd6bSIgor Mammedov                              PC_MACHINE_ACPI_DEVICE_PROP, &error_abort);
214781bbd6bSIgor Mammedov 
215df2d8b3eSIsaku Yamahata     ich9_lpc = ICH9_LPC_DEVICE(lpc);
216df2d8b3eSIsaku Yamahata     ich9_lpc->pic = gsi;
217df2d8b3eSIsaku Yamahata     ich9_lpc->ioapic = gsi_state->ioapic_irq;
218df2d8b3eSIsaku Yamahata     pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc_map_irq, ich9_lpc,
219df2d8b3eSIsaku Yamahata                  ICH9_LPC_NB_PIRQS);
22091c3f2f0SJason Baron     pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq);
221df2d8b3eSIsaku Yamahata     isa_bus = ich9_lpc->isa_bus;
222df2d8b3eSIsaku Yamahata 
223df2d8b3eSIsaku Yamahata     /*end early*/
224df2d8b3eSIsaku Yamahata     isa_bus_irqs(isa_bus, gsi);
225df2d8b3eSIsaku Yamahata 
226df2d8b3eSIsaku Yamahata     if (kvm_irqchip_in_kernel()) {
227df2d8b3eSIsaku Yamahata         i8259 = kvm_i8259_init(isa_bus);
228df2d8b3eSIsaku Yamahata     } else if (xen_enabled()) {
229df2d8b3eSIsaku Yamahata         i8259 = xen_interrupt_controller_init();
230df2d8b3eSIsaku Yamahata     } else {
231df2d8b3eSIsaku Yamahata         cpu_irq = pc_allocate_cpu_irq();
232df2d8b3eSIsaku Yamahata         i8259 = i8259_init(isa_bus, cpu_irq[0]);
233df2d8b3eSIsaku Yamahata     }
234df2d8b3eSIsaku Yamahata 
235df2d8b3eSIsaku Yamahata     for (i = 0; i < ISA_NUM_IRQS; i++) {
236df2d8b3eSIsaku Yamahata         gsi_state->i8259_irq[i] = i8259[i];
237df2d8b3eSIsaku Yamahata     }
238df2d8b3eSIsaku Yamahata     if (pci_enabled) {
239df2d8b3eSIsaku Yamahata         ioapic_init_gsi(gsi_state, NULL);
240df2d8b3eSIsaku Yamahata     }
241f0513d2cSIgor Mammedov     qdev_init_nofail(icc_bridge);
242df2d8b3eSIsaku Yamahata 
243df2d8b3eSIsaku Yamahata     pc_register_ferr_irq(gsi[13]);
244df2d8b3eSIsaku Yamahata 
245df2d8b3eSIsaku Yamahata     /* init basic PC hardware */
2467a10ef51SLiu Ping Fan     pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, false, 0xff0104);
247df2d8b3eSIsaku Yamahata 
248df2d8b3eSIsaku Yamahata     /* connect pm stuff to lpc */
249a3ac6b53SHu Tao     ich9_lpc_pm_init(lpc);
250df2d8b3eSIsaku Yamahata 
251df2d8b3eSIsaku Yamahata     /* ahci and SATA device, for q35 1 ahci controller is built-in */
252df2d8b3eSIsaku Yamahata     ahci = pci_create_simple_multifunction(host_bus,
253df2d8b3eSIsaku Yamahata                                            PCI_DEVFN(ICH9_SATA1_DEV,
254df2d8b3eSIsaku Yamahata                                                      ICH9_SATA1_FUNC),
255df2d8b3eSIsaku Yamahata                                            true, "ich9-ahci");
256df2d8b3eSIsaku Yamahata     idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0");
257df2d8b3eSIsaku Yamahata     idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1");
258df2d8b3eSIsaku Yamahata 
259df2d8b3eSIsaku Yamahata     if (usb_enabled(false)) {
260df2d8b3eSIsaku Yamahata         /* Should we create 6 UHCI according to ich9 spec? */
261df2d8b3eSIsaku Yamahata         ehci_create_ich9_with_companions(host_bus, 0x1d);
262df2d8b3eSIsaku Yamahata     }
263df2d8b3eSIsaku Yamahata 
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);
269df2d8b3eSIsaku Yamahata 
2703ef96221SMarcel Apfelbaum     pc_cmos_init(below_4g_mem_size, above_4g_mem_size, machine->boot_order,
271df2d8b3eSIsaku Yamahata                  floppy, 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);
275df2d8b3eSIsaku Yamahata     pc_nic_init(isa_bus, host_bus);
276df2d8b3eSIsaku Yamahata     if (pci_enabled) {
277df2d8b3eSIsaku Yamahata         pc_pci_device_init(host_bus);
278df2d8b3eSIsaku Yamahata     }
279df2d8b3eSIsaku Yamahata }
280df2d8b3eSIsaku Yamahata 
2813ef96221SMarcel Apfelbaum static void pc_compat_2_0(MachineState *machine)
2823458b2b0SMichael S. Tsirkin {
283c97294ecSGabriel L. Somlo     smbios_legacy_mode = true;
284de268e13SIgor Mammedov     has_reserved_memory = false;
2853458b2b0SMichael S. Tsirkin }
2863458b2b0SMichael S. Tsirkin 
2873ef96221SMarcel Apfelbaum static void pc_compat_1_7(MachineState *machine)
288b29ad07eSMarkus Armbruster {
2893ef96221SMarcel Apfelbaum     pc_compat_2_0(machine);
290e6667f71SGabriel L. Somlo     smbios_defaults = false;
2919a305c8fSGerd Hoffmann     gigabyte_align = false;
292ac41881bSMichael S. Tsirkin     option_rom_has_mr = true;
293ef02ef5fSEduardo Habkost     x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
294b29ad07eSMarkus Armbruster }
295b29ad07eSMarkus Armbruster 
2963ef96221SMarcel Apfelbaum static void pc_compat_1_6(MachineState *machine)
297f8c457b8SMichael S. Tsirkin {
2983ef96221SMarcel Apfelbaum     pc_compat_1_7(machine);
299f8c457b8SMichael S. Tsirkin     has_pci_info = false;
30098bc3ab0SMichael S. Tsirkin     rom_file_has_mr = false;
30172c194f7SMichael S. Tsirkin     has_acpi_build = false;
30289b439f3SEduardo Habkost }
30389b439f3SEduardo Habkost 
3043ef96221SMarcel Apfelbaum static void pc_compat_1_5(MachineState *machine)
30589b439f3SEduardo Habkost {
3063ef96221SMarcel Apfelbaum     pc_compat_1_6(machine);
30789b439f3SEduardo Habkost }
30889b439f3SEduardo Habkost 
3093ef96221SMarcel Apfelbaum static void pc_compat_1_4(MachineState *machine)
31089b439f3SEduardo Habkost {
3113ef96221SMarcel Apfelbaum     pc_compat_1_5(machine);
31289b439f3SEduardo Habkost     x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
31389b439f3SEduardo Habkost     x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
31489b439f3SEduardo Habkost }
31589b439f3SEduardo Habkost 
3163ef96221SMarcel Apfelbaum static void pc_q35_init_2_0(MachineState *machine)
3173458b2b0SMichael S. Tsirkin {
3183ef96221SMarcel Apfelbaum     pc_compat_2_0(machine);
3193ef96221SMarcel Apfelbaum     pc_q35_init(machine);
3203458b2b0SMichael S. Tsirkin }
3213458b2b0SMichael S. Tsirkin 
3223ef96221SMarcel Apfelbaum static void pc_q35_init_1_7(MachineState *machine)
323b29ad07eSMarkus Armbruster {
3243ef96221SMarcel Apfelbaum     pc_compat_1_7(machine);
3253ef96221SMarcel Apfelbaum     pc_q35_init(machine);
326b29ad07eSMarkus Armbruster }
327b29ad07eSMarkus Armbruster 
3283ef96221SMarcel Apfelbaum static void pc_q35_init_1_6(MachineState *machine)
32989b439f3SEduardo Habkost {
3303ef96221SMarcel Apfelbaum     pc_compat_1_6(machine);
3313ef96221SMarcel Apfelbaum     pc_q35_init(machine);
332f8c457b8SMichael S. Tsirkin }
333f8c457b8SMichael S. Tsirkin 
3343ef96221SMarcel Apfelbaum static void pc_q35_init_1_5(MachineState *machine)
3359604f70fSMichael S. Tsirkin {
3363ef96221SMarcel Apfelbaum     pc_compat_1_5(machine);
3373ef96221SMarcel Apfelbaum     pc_q35_init(machine);
3389604f70fSMichael S. Tsirkin }
3399604f70fSMichael S. Tsirkin 
3403ef96221SMarcel Apfelbaum static void pc_q35_init_1_4(MachineState *machine)
3419953f882SMarkus Armbruster {
3423ef96221SMarcel Apfelbaum     pc_compat_1_4(machine);
3433ef96221SMarcel Apfelbaum     pc_q35_init(machine);
3449953f882SMarkus Armbruster }
3459953f882SMarkus Armbruster 
346a0dba644SMichael S. Tsirkin #define PC_Q35_MACHINE_OPTIONS \
347a0dba644SMichael S. Tsirkin     PC_DEFAULT_MACHINE_OPTIONS, \
348a0dba644SMichael S. Tsirkin     .desc = "Standard PC (Q35 + ICH9, 2009)", \
349a0dba644SMichael S. Tsirkin     .hot_add_cpu = pc_hot_add_cpu
350a0dba644SMichael S. Tsirkin 
3513458b2b0SMichael S. Tsirkin #define PC_Q35_2_1_MACHINE_OPTIONS                      \
352bcf2b7d2SGerd Hoffmann     PC_Q35_MACHINE_OPTIONS,                             \
353bcf2b7d2SGerd Hoffmann     .default_machine_opts = "firmware=bios-256k.bin"
354aeca6e8dSGerd Hoffmann 
3553458b2b0SMichael S. Tsirkin static QEMUMachine pc_q35_machine_v2_1 = {
3563458b2b0SMichael S. Tsirkin     PC_Q35_2_1_MACHINE_OPTIONS,
3573458b2b0SMichael S. Tsirkin     .name = "pc-q35-2.1",
3583458b2b0SMichael S. Tsirkin     .alias = "q35",
3593458b2b0SMichael S. Tsirkin     .init = pc_q35_init,
3603458b2b0SMichael S. Tsirkin };
3613458b2b0SMichael S. Tsirkin 
3623458b2b0SMichael S. Tsirkin #define PC_Q35_2_0_MACHINE_OPTIONS PC_Q35_2_1_MACHINE_OPTIONS
3633458b2b0SMichael S. Tsirkin 
364aeca6e8dSGerd Hoffmann static QEMUMachine pc_q35_machine_v2_0 = {
365aeca6e8dSGerd Hoffmann     PC_Q35_2_0_MACHINE_OPTIONS,
366aeca6e8dSGerd Hoffmann     .name = "pc-q35-2.0",
3673458b2b0SMichael S. Tsirkin     .init = pc_q35_init_2_0,
3689df11c9fSGabriel L. Somlo     .compat_props = (GlobalProperty[]) {
369b8f5cfd6SEduardo Habkost         PC_COMPAT_2_0,
3709df11c9fSGabriel L. Somlo         { /* end of list */ }
3719df11c9fSGabriel L. Somlo     },
372aeca6e8dSGerd Hoffmann };
373aeca6e8dSGerd Hoffmann 
374e9845f09SVincenzo Maffione #define PC_Q35_1_7_MACHINE_OPTIONS PC_Q35_MACHINE_OPTIONS
375e9845f09SVincenzo Maffione 
376e9845f09SVincenzo Maffione static QEMUMachine pc_q35_machine_v1_7 = {
377e9845f09SVincenzo Maffione     PC_Q35_1_7_MACHINE_OPTIONS,
378e9845f09SVincenzo Maffione     .name = "pc-q35-1.7",
3797a10ef51SLiu Ping Fan     .init = pc_q35_init_1_7,
3807a10ef51SLiu Ping Fan     .compat_props = (GlobalProperty[]) {
381b8f5cfd6SEduardo Habkost         PC_COMPAT_1_7,
3827a10ef51SLiu Ping Fan         { /* end of list */ }
3837a10ef51SLiu Ping Fan     },
384e9845f09SVincenzo Maffione };
385e9845f09SVincenzo Maffione 
386a0dba644SMichael S. Tsirkin #define PC_Q35_1_6_MACHINE_OPTIONS PC_Q35_MACHINE_OPTIONS
387a0dba644SMichael S. Tsirkin 
38845053fdeSEduardo Habkost static QEMUMachine pc_q35_machine_v1_6 = {
389a0dba644SMichael S. Tsirkin     PC_Q35_1_6_MACHINE_OPTIONS,
39045053fdeSEduardo Habkost     .name = "pc-q35-1.6",
3919604f70fSMichael S. Tsirkin     .init = pc_q35_init_1_6,
392e9845f09SVincenzo Maffione     .compat_props = (GlobalProperty[]) {
393b8f5cfd6SEduardo Habkost         PC_COMPAT_1_6,
394e9845f09SVincenzo Maffione         { /* end of list */ }
395e9845f09SVincenzo Maffione     },
39645053fdeSEduardo Habkost };
39745053fdeSEduardo Habkost 
398bf3caa3dSPaolo Bonzini static QEMUMachine pc_q35_machine_v1_5 = {
399a0dba644SMichael S. Tsirkin     PC_Q35_1_6_MACHINE_OPTIONS,
400bf3caa3dSPaolo Bonzini     .name = "pc-q35-1.5",
401f8c457b8SMichael S. Tsirkin     .init = pc_q35_init_1_5,
402ffce9ebbSEduardo Habkost     .compat_props = (GlobalProperty[]) {
403b8f5cfd6SEduardo Habkost         PC_COMPAT_1_5,
404ffce9ebbSEduardo Habkost         { /* end of list */ }
405ffce9ebbSEduardo Habkost     },
406df2d8b3eSIsaku Yamahata };
407df2d8b3eSIsaku Yamahata 
408a0dba644SMichael S. Tsirkin #define PC_Q35_1_4_MACHINE_OPTIONS \
409a0dba644SMichael S. Tsirkin     PC_Q35_1_6_MACHINE_OPTIONS, \
410a0dba644SMichael S. Tsirkin     .hot_add_cpu = NULL
411a0dba644SMichael S. Tsirkin 
412bf3caa3dSPaolo Bonzini static QEMUMachine pc_q35_machine_v1_4 = {
413a0dba644SMichael S. Tsirkin     PC_Q35_1_4_MACHINE_OPTIONS,
414bf3caa3dSPaolo Bonzini     .name = "pc-q35-1.4",
4159953f882SMarkus Armbruster     .init = pc_q35_init_1_4,
416bf3caa3dSPaolo Bonzini     .compat_props = (GlobalProperty[]) {
417b8f5cfd6SEduardo Habkost         PC_COMPAT_1_4,
418bf3caa3dSPaolo Bonzini         { /* end of list */ }
419bf3caa3dSPaolo Bonzini     },
420bf3caa3dSPaolo Bonzini };
421bf3caa3dSPaolo Bonzini 
422df2d8b3eSIsaku Yamahata static void pc_q35_machine_init(void)
423df2d8b3eSIsaku Yamahata {
424d5747cacSIgor Mammedov     qemu_register_pc_machine(&pc_q35_machine_v2_1);
425d5747cacSIgor Mammedov     qemu_register_pc_machine(&pc_q35_machine_v2_0);
426d5747cacSIgor Mammedov     qemu_register_pc_machine(&pc_q35_machine_v1_7);
427d5747cacSIgor Mammedov     qemu_register_pc_machine(&pc_q35_machine_v1_6);
428d5747cacSIgor Mammedov     qemu_register_pc_machine(&pc_q35_machine_v1_5);
429d5747cacSIgor Mammedov     qemu_register_pc_machine(&pc_q35_machine_v1_4);
430df2d8b3eSIsaku Yamahata }
431df2d8b3eSIsaku Yamahata 
432df2d8b3eSIsaku Yamahata machine_init(pc_q35_machine_init);
433