xref: /qemu/hw/i386/pc_q35.c (revision 9df11c9f086e8329cdc06a67314ddce886841a5b)
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"
47df2d8b3eSIsaku Yamahata 
48df2d8b3eSIsaku Yamahata /* ICH9 AHCI has 6 ports */
49df2d8b3eSIsaku Yamahata #define MAX_SATA_PORTS     6
50df2d8b3eSIsaku Yamahata 
517f1bb742SIgor Mammedov static bool has_pci_info;
5272c194f7SMichael S. Tsirkin static bool has_acpi_build = true;
53e6667f71SGabriel L. Somlo static bool smbios_defaults = true;
54c97294ecSGabriel L. Somlo static bool smbios_legacy_mode;
554e17997dSMichael S. Tsirkin /* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
564e17997dSMichael S. Tsirkin  * host addresses aligned at 1Gbyte boundaries.  This way we can use 1GByte
574e17997dSMichael S. Tsirkin  * pages in the host.
584e17997dSMichael S. Tsirkin  */
599a305c8fSGerd Hoffmann static bool gigabyte_align = true;
603ab135f3SHu Tao 
61df2d8b3eSIsaku Yamahata /* PC hardware initialisation */
62df2d8b3eSIsaku Yamahata static void pc_q35_init(QEMUMachineInitArgs *args)
63df2d8b3eSIsaku Yamahata {
64df2d8b3eSIsaku Yamahata     ram_addr_t below_4g_mem_size, above_4g_mem_size;
65df2d8b3eSIsaku Yamahata     Q35PCIHost *q35_host;
66ce88812fSHu Tao     PCIHostState *phb;
67df2d8b3eSIsaku Yamahata     PCIBus *host_bus;
68df2d8b3eSIsaku Yamahata     PCIDevice *lpc;
69df2d8b3eSIsaku Yamahata     BusState *idebus[MAX_SATA_PORTS];
70df2d8b3eSIsaku Yamahata     ISADevice *rtc_state;
71df2d8b3eSIsaku Yamahata     ISADevice *floppy;
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     int pci_enabled = 1;
78df2d8b3eSIsaku Yamahata     qemu_irq *cpu_irq;
79df2d8b3eSIsaku Yamahata     qemu_irq *gsi;
80df2d8b3eSIsaku Yamahata     qemu_irq *i8259;
81df2d8b3eSIsaku Yamahata     int i;
82df2d8b3eSIsaku Yamahata     ICH9LPCState *ich9_lpc;
83df2d8b3eSIsaku Yamahata     PCIDevice *ahci;
84f0513d2cSIgor Mammedov     DeviceState *icc_bridge;
853459a625SMichael S. Tsirkin     PcGuestInfo *guest_info;
86f0513d2cSIgor Mammedov 
87254c1282SAnthony PERARD     if (xen_enabled() && xen_hvm_init(&ram_memory) != 0) {
88254c1282SAnthony PERARD         fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
89254c1282SAnthony PERARD         exit(1);
90254c1282SAnthony PERARD     }
91254c1282SAnthony PERARD 
92f0513d2cSIgor Mammedov     icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
93f0513d2cSIgor Mammedov     object_property_add_child(qdev_get_machine(), "icc-bridge",
94f0513d2cSIgor Mammedov                               OBJECT(icc_bridge), NULL);
95df2d8b3eSIsaku Yamahata 
963b6fb9caSMarkus Armbruster     pc_cpus_init(args->cpu_model, icc_bridge);
97f7e4dd6cSGerd Hoffmann     pc_acpi_init("q35-acpi-dsdt.aml");
98df2d8b3eSIsaku Yamahata 
9921022c92SJan Kiszka     kvmclock_create();
10021022c92SJan Kiszka 
1014e17997dSMichael S. Tsirkin     /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory
1024e17997dSMichael S. Tsirkin      * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
1034e17997dSMichael S. Tsirkin      * also known as MMCFG).
1044e17997dSMichael S. Tsirkin      * If it doesn't, we need to split it in chunks below and above 4G.
1054e17997dSMichael S. Tsirkin      * In any case, try to make sure that guest addresses aligned at
1064e17997dSMichael S. Tsirkin      * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
1074e17997dSMichael S. Tsirkin      * For old machine types, use whatever split we used historically to avoid
1084e17997dSMichael S. Tsirkin      * breaking migration.
1094e17997dSMichael S. Tsirkin      */
1103b6fb9caSMarkus Armbruster     if (args->ram_size >= 0xb0000000) {
1119a305c8fSGerd Hoffmann         ram_addr_t lowmem = gigabyte_align ? 0x80000000 : 0xb0000000;
1129a305c8fSGerd Hoffmann         above_4g_mem_size = args->ram_size - lowmem;
1139a305c8fSGerd Hoffmann         below_4g_mem_size = lowmem;
114df2d8b3eSIsaku Yamahata     } else {
115df2d8b3eSIsaku Yamahata         above_4g_mem_size = 0;
1163b6fb9caSMarkus Armbruster         below_4g_mem_size = args->ram_size;
117df2d8b3eSIsaku Yamahata     }
118df2d8b3eSIsaku Yamahata 
119df2d8b3eSIsaku Yamahata     /* pci enabled */
120df2d8b3eSIsaku Yamahata     if (pci_enabled) {
121df2d8b3eSIsaku Yamahata         pci_memory = g_new(MemoryRegion, 1);
122286690e3SPaolo Bonzini         memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
123df2d8b3eSIsaku Yamahata         rom_memory = pci_memory;
124df2d8b3eSIsaku Yamahata     } else {
125df2d8b3eSIsaku Yamahata         pci_memory = NULL;
126df2d8b3eSIsaku Yamahata         rom_memory = get_system_memory();
127df2d8b3eSIsaku Yamahata     }
128df2d8b3eSIsaku Yamahata 
1293459a625SMichael S. Tsirkin     guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size);
130f8c457b8SMichael S. Tsirkin     guest_info->has_pci_info = has_pci_info;
1316dd2a5c9SPaolo Bonzini     guest_info->isapc_ram_fw = false;
13272c194f7SMichael S. Tsirkin     guest_info->has_acpi_build = has_acpi_build;
1333459a625SMichael S. Tsirkin 
134e6667f71SGabriel L. Somlo     if (smbios_defaults) {
135b29ad07eSMarkus Armbruster         /* These values are guest ABI, do not change */
136e6667f71SGabriel L. Somlo         smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
137c97294ecSGabriel L. Somlo                             args->machine->name, smbios_legacy_mode);
138b29ad07eSMarkus Armbruster     }
139b29ad07eSMarkus Armbruster 
140df2d8b3eSIsaku Yamahata     /* allocate ram and load rom/bios */
141df2d8b3eSIsaku Yamahata     if (!xen_enabled()) {
1423b6fb9caSMarkus Armbruster         pc_memory_init(get_system_memory(),
1433b6fb9caSMarkus Armbruster                        args->kernel_filename, args->kernel_cmdline,
1443b6fb9caSMarkus Armbruster                        args->initrd_filename,
1453b6fb9caSMarkus Armbruster                        below_4g_mem_size, above_4g_mem_size,
1463459a625SMichael S. Tsirkin                        rom_memory, &ram_memory, guest_info);
147df2d8b3eSIsaku Yamahata     }
148df2d8b3eSIsaku Yamahata 
149df2d8b3eSIsaku Yamahata     /* irq lines */
150df2d8b3eSIsaku Yamahata     gsi_state = g_malloc0(sizeof(*gsi_state));
151df2d8b3eSIsaku Yamahata     if (kvm_irqchip_in_kernel()) {
152df2d8b3eSIsaku Yamahata         kvm_pc_setup_irq_routing(pci_enabled);
153df2d8b3eSIsaku Yamahata         gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
154df2d8b3eSIsaku Yamahata                                  GSI_NUM_PINS);
155df2d8b3eSIsaku Yamahata     } else {
156df2d8b3eSIsaku Yamahata         gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
157df2d8b3eSIsaku Yamahata     }
158df2d8b3eSIsaku Yamahata 
159df2d8b3eSIsaku Yamahata     /* create pci host bus */
160df2d8b3eSIsaku Yamahata     q35_host = Q35_HOST_DEVICE(qdev_create(NULL, TYPE_Q35_HOST_DEVICE));
161df2d8b3eSIsaku Yamahata 
162c52dc697SIgor Mammedov     object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host), NULL);
163df2d8b3eSIsaku Yamahata     q35_host->mch.ram_memory = ram_memory;
164df2d8b3eSIsaku Yamahata     q35_host->mch.pci_address_space = pci_memory;
165df2d8b3eSIsaku Yamahata     q35_host->mch.system_memory = get_system_memory();
166c7e775e4SDong Xu Wang     q35_host->mch.address_space_io = get_system_io();
167df2d8b3eSIsaku Yamahata     q35_host->mch.below_4g_mem_size = below_4g_mem_size;
168df2d8b3eSIsaku Yamahata     q35_host->mch.above_4g_mem_size = above_4g_mem_size;
1693459a625SMichael S. Tsirkin     q35_host->mch.guest_info = guest_info;
170df2d8b3eSIsaku Yamahata     /* pci */
171df2d8b3eSIsaku Yamahata     qdev_init_nofail(DEVICE(q35_host));
172ce88812fSHu Tao     phb = PCI_HOST_BRIDGE(q35_host);
173ce88812fSHu Tao     host_bus = phb->bus;
174df2d8b3eSIsaku Yamahata     /* create ISA bus */
175df2d8b3eSIsaku Yamahata     lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV,
176df2d8b3eSIsaku Yamahata                                           ICH9_LPC_FUNC), true,
177df2d8b3eSIsaku Yamahata                                           TYPE_ICH9_LPC_DEVICE);
178df2d8b3eSIsaku Yamahata     ich9_lpc = ICH9_LPC_DEVICE(lpc);
179df2d8b3eSIsaku Yamahata     ich9_lpc->pic = gsi;
180df2d8b3eSIsaku Yamahata     ich9_lpc->ioapic = gsi_state->ioapic_irq;
181df2d8b3eSIsaku Yamahata     pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc_map_irq, ich9_lpc,
182df2d8b3eSIsaku Yamahata                  ICH9_LPC_NB_PIRQS);
18391c3f2f0SJason Baron     pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq);
184df2d8b3eSIsaku Yamahata     isa_bus = ich9_lpc->isa_bus;
185df2d8b3eSIsaku Yamahata 
186df2d8b3eSIsaku Yamahata     /*end early*/
187df2d8b3eSIsaku Yamahata     isa_bus_irqs(isa_bus, gsi);
188df2d8b3eSIsaku Yamahata 
189df2d8b3eSIsaku Yamahata     if (kvm_irqchip_in_kernel()) {
190df2d8b3eSIsaku Yamahata         i8259 = kvm_i8259_init(isa_bus);
191df2d8b3eSIsaku Yamahata     } else if (xen_enabled()) {
192df2d8b3eSIsaku Yamahata         i8259 = xen_interrupt_controller_init();
193df2d8b3eSIsaku Yamahata     } else {
194df2d8b3eSIsaku Yamahata         cpu_irq = pc_allocate_cpu_irq();
195df2d8b3eSIsaku Yamahata         i8259 = i8259_init(isa_bus, cpu_irq[0]);
196df2d8b3eSIsaku Yamahata     }
197df2d8b3eSIsaku Yamahata 
198df2d8b3eSIsaku Yamahata     for (i = 0; i < ISA_NUM_IRQS; i++) {
199df2d8b3eSIsaku Yamahata         gsi_state->i8259_irq[i] = i8259[i];
200df2d8b3eSIsaku Yamahata     }
201df2d8b3eSIsaku Yamahata     if (pci_enabled) {
202df2d8b3eSIsaku Yamahata         ioapic_init_gsi(gsi_state, NULL);
203df2d8b3eSIsaku Yamahata     }
204f0513d2cSIgor Mammedov     qdev_init_nofail(icc_bridge);
205df2d8b3eSIsaku Yamahata 
206df2d8b3eSIsaku Yamahata     pc_register_ferr_irq(gsi[13]);
207df2d8b3eSIsaku Yamahata 
208df2d8b3eSIsaku Yamahata     /* init basic PC hardware */
2097a10ef51SLiu Ping Fan     pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, false, 0xff0104);
210df2d8b3eSIsaku Yamahata 
211df2d8b3eSIsaku Yamahata     /* connect pm stuff to lpc */
212a3ac6b53SHu Tao     ich9_lpc_pm_init(lpc);
213df2d8b3eSIsaku Yamahata 
214df2d8b3eSIsaku Yamahata     /* ahci and SATA device, for q35 1 ahci controller is built-in */
215df2d8b3eSIsaku Yamahata     ahci = pci_create_simple_multifunction(host_bus,
216df2d8b3eSIsaku Yamahata                                            PCI_DEVFN(ICH9_SATA1_DEV,
217df2d8b3eSIsaku Yamahata                                                      ICH9_SATA1_FUNC),
218df2d8b3eSIsaku Yamahata                                            true, "ich9-ahci");
219df2d8b3eSIsaku Yamahata     idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0");
220df2d8b3eSIsaku Yamahata     idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1");
221df2d8b3eSIsaku Yamahata 
222df2d8b3eSIsaku Yamahata     if (usb_enabled(false)) {
223df2d8b3eSIsaku Yamahata         /* Should we create 6 UHCI according to ich9 spec? */
224df2d8b3eSIsaku Yamahata         ehci_create_ich9_with_companions(host_bus, 0x1d);
225df2d8b3eSIsaku Yamahata     }
226df2d8b3eSIsaku Yamahata 
227df2d8b3eSIsaku Yamahata     /* TODO: Populate SPD eeprom data.  */
228df2d8b3eSIsaku Yamahata     smbus_eeprom_init(ich9_smb_init(host_bus,
229df2d8b3eSIsaku Yamahata                                     PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC),
230df2d8b3eSIsaku Yamahata                                     0xb100),
231df2d8b3eSIsaku Yamahata                       8, NULL, 0);
232df2d8b3eSIsaku Yamahata 
233c1654732SMarkus Armbruster     pc_cmos_init(below_4g_mem_size, above_4g_mem_size, args->boot_order,
234df2d8b3eSIsaku Yamahata                  floppy, idebus[0], idebus[1], rtc_state);
235df2d8b3eSIsaku Yamahata 
236df2d8b3eSIsaku Yamahata     /* the rest devices to which pci devfn is automatically assigned */
237df2d8b3eSIsaku Yamahata     pc_vga_init(isa_bus, host_bus);
238df2d8b3eSIsaku Yamahata     pc_nic_init(isa_bus, host_bus);
239df2d8b3eSIsaku Yamahata     if (pci_enabled) {
240df2d8b3eSIsaku Yamahata         pc_pci_device_init(host_bus);
241df2d8b3eSIsaku Yamahata     }
242df2d8b3eSIsaku Yamahata }
243df2d8b3eSIsaku Yamahata 
2443458b2b0SMichael S. Tsirkin static void pc_compat_2_0(QEMUMachineInitArgs *args)
2453458b2b0SMichael S. Tsirkin {
246c97294ecSGabriel L. Somlo     smbios_legacy_mode = true;
2473458b2b0SMichael S. Tsirkin }
2483458b2b0SMichael S. Tsirkin 
249b29ad07eSMarkus Armbruster static void pc_compat_1_7(QEMUMachineInitArgs *args)
250b29ad07eSMarkus Armbruster {
2513458b2b0SMichael S. Tsirkin     pc_compat_2_0(args);
252e6667f71SGabriel L. Somlo     smbios_defaults = false;
2539a305c8fSGerd Hoffmann     gigabyte_align = false;
254ac41881bSMichael S. Tsirkin     option_rom_has_mr = true;
255ef02ef5fSEduardo Habkost     x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
256b29ad07eSMarkus Armbruster }
257b29ad07eSMarkus Armbruster 
25889b439f3SEduardo Habkost static void pc_compat_1_6(QEMUMachineInitArgs *args)
259f8c457b8SMichael S. Tsirkin {
260b29ad07eSMarkus Armbruster     pc_compat_1_7(args);
261f8c457b8SMichael S. Tsirkin     has_pci_info = false;
26298bc3ab0SMichael S. Tsirkin     rom_file_has_mr = false;
26372c194f7SMichael S. Tsirkin     has_acpi_build = false;
26489b439f3SEduardo Habkost }
26589b439f3SEduardo Habkost 
26689b439f3SEduardo Habkost static void pc_compat_1_5(QEMUMachineInitArgs *args)
26789b439f3SEduardo Habkost {
26889b439f3SEduardo Habkost     pc_compat_1_6(args);
26989b439f3SEduardo Habkost }
27089b439f3SEduardo Habkost 
27189b439f3SEduardo Habkost static void pc_compat_1_4(QEMUMachineInitArgs *args)
27289b439f3SEduardo Habkost {
273396f79f4SEduardo Habkost     pc_compat_1_5(args);
27489b439f3SEduardo Habkost     x86_cpu_compat_set_features("n270", FEAT_1_ECX, 0, CPUID_EXT_MOVBE);
27589b439f3SEduardo Habkost     x86_cpu_compat_set_features("Westmere", FEAT_1_ECX, 0, CPUID_EXT_PCLMULQDQ);
27689b439f3SEduardo Habkost }
27789b439f3SEduardo Habkost 
2783458b2b0SMichael S. Tsirkin static void pc_q35_init_2_0(QEMUMachineInitArgs *args)
2793458b2b0SMichael S. Tsirkin {
2803458b2b0SMichael S. Tsirkin     pc_compat_2_0(args);
2813458b2b0SMichael S. Tsirkin     pc_q35_init(args);
2823458b2b0SMichael S. Tsirkin }
2833458b2b0SMichael S. Tsirkin 
284b29ad07eSMarkus Armbruster static void pc_q35_init_1_7(QEMUMachineInitArgs *args)
285b29ad07eSMarkus Armbruster {
286b29ad07eSMarkus Armbruster     pc_compat_1_7(args);
287b29ad07eSMarkus Armbruster     pc_q35_init(args);
288b29ad07eSMarkus Armbruster }
289b29ad07eSMarkus Armbruster 
29089b439f3SEduardo Habkost static void pc_q35_init_1_6(QEMUMachineInitArgs *args)
29189b439f3SEduardo Habkost {
29289b439f3SEduardo Habkost     pc_compat_1_6(args);
293f8c457b8SMichael S. Tsirkin     pc_q35_init(args);
294f8c457b8SMichael S. Tsirkin }
295f8c457b8SMichael S. Tsirkin 
2969604f70fSMichael S. Tsirkin static void pc_q35_init_1_5(QEMUMachineInitArgs *args)
2979604f70fSMichael S. Tsirkin {
29889b439f3SEduardo Habkost     pc_compat_1_5(args);
29989b439f3SEduardo Habkost     pc_q35_init(args);
3009604f70fSMichael S. Tsirkin }
3019604f70fSMichael S. Tsirkin 
3029953f882SMarkus Armbruster static void pc_q35_init_1_4(QEMUMachineInitArgs *args)
3039953f882SMarkus Armbruster {
30489b439f3SEduardo Habkost     pc_compat_1_4(args);
30589b439f3SEduardo Habkost     pc_q35_init(args);
3069953f882SMarkus Armbruster }
3079953f882SMarkus Armbruster 
308a0dba644SMichael S. Tsirkin #define PC_Q35_MACHINE_OPTIONS \
309a0dba644SMichael S. Tsirkin     PC_DEFAULT_MACHINE_OPTIONS, \
310a0dba644SMichael S. Tsirkin     .desc = "Standard PC (Q35 + ICH9, 2009)", \
311a0dba644SMichael S. Tsirkin     .hot_add_cpu = pc_hot_add_cpu
312a0dba644SMichael S. Tsirkin 
3133458b2b0SMichael S. Tsirkin #define PC_Q35_2_1_MACHINE_OPTIONS                      \
314bcf2b7d2SGerd Hoffmann     PC_Q35_MACHINE_OPTIONS,                             \
315bcf2b7d2SGerd Hoffmann     .default_machine_opts = "firmware=bios-256k.bin"
316aeca6e8dSGerd Hoffmann 
3173458b2b0SMichael S. Tsirkin static QEMUMachine pc_q35_machine_v2_1 = {
3183458b2b0SMichael S. Tsirkin     PC_Q35_2_1_MACHINE_OPTIONS,
3193458b2b0SMichael S. Tsirkin     .name = "pc-q35-2.1",
3203458b2b0SMichael S. Tsirkin     .alias = "q35",
3213458b2b0SMichael S. Tsirkin     .init = pc_q35_init,
3223458b2b0SMichael S. Tsirkin };
3233458b2b0SMichael S. Tsirkin 
3243458b2b0SMichael S. Tsirkin #define PC_Q35_2_0_MACHINE_OPTIONS PC_Q35_2_1_MACHINE_OPTIONS
3253458b2b0SMichael S. Tsirkin 
326aeca6e8dSGerd Hoffmann static QEMUMachine pc_q35_machine_v2_0 = {
327aeca6e8dSGerd Hoffmann     PC_Q35_2_0_MACHINE_OPTIONS,
328aeca6e8dSGerd Hoffmann     .name = "pc-q35-2.0",
3293458b2b0SMichael S. Tsirkin     .init = pc_q35_init_2_0,
330*9df11c9fSGabriel L. Somlo     .compat_props = (GlobalProperty[]) {
331*9df11c9fSGabriel L. Somlo         PC_Q35_COMPAT_2_0,
332*9df11c9fSGabriel L. Somlo         { /* end of list */ }
333*9df11c9fSGabriel L. Somlo     },
334aeca6e8dSGerd Hoffmann };
335aeca6e8dSGerd Hoffmann 
336e9845f09SVincenzo Maffione #define PC_Q35_1_7_MACHINE_OPTIONS PC_Q35_MACHINE_OPTIONS
337e9845f09SVincenzo Maffione 
338e9845f09SVincenzo Maffione static QEMUMachine pc_q35_machine_v1_7 = {
339e9845f09SVincenzo Maffione     PC_Q35_1_7_MACHINE_OPTIONS,
340e9845f09SVincenzo Maffione     .name = "pc-q35-1.7",
3417a10ef51SLiu Ping Fan     .init = pc_q35_init_1_7,
3427a10ef51SLiu Ping Fan     .compat_props = (GlobalProperty[]) {
3437a10ef51SLiu Ping Fan         PC_Q35_COMPAT_1_7,
3447a10ef51SLiu Ping Fan         { /* end of list */ }
3457a10ef51SLiu Ping Fan     },
346e9845f09SVincenzo Maffione };
347e9845f09SVincenzo Maffione 
348a0dba644SMichael S. Tsirkin #define PC_Q35_1_6_MACHINE_OPTIONS PC_Q35_MACHINE_OPTIONS
349a0dba644SMichael S. Tsirkin 
35045053fdeSEduardo Habkost static QEMUMachine pc_q35_machine_v1_6 = {
351a0dba644SMichael S. Tsirkin     PC_Q35_1_6_MACHINE_OPTIONS,
35245053fdeSEduardo Habkost     .name = "pc-q35-1.6",
3539604f70fSMichael S. Tsirkin     .init = pc_q35_init_1_6,
354e9845f09SVincenzo Maffione     .compat_props = (GlobalProperty[]) {
3557a10ef51SLiu Ping Fan         PC_Q35_COMPAT_1_6,
356e9845f09SVincenzo Maffione         { /* end of list */ }
357e9845f09SVincenzo Maffione     },
35845053fdeSEduardo Habkost };
35945053fdeSEduardo Habkost 
360bf3caa3dSPaolo Bonzini static QEMUMachine pc_q35_machine_v1_5 = {
361a0dba644SMichael S. Tsirkin     PC_Q35_1_6_MACHINE_OPTIONS,
362bf3caa3dSPaolo Bonzini     .name = "pc-q35-1.5",
363f8c457b8SMichael S. Tsirkin     .init = pc_q35_init_1_5,
364ffce9ebbSEduardo Habkost     .compat_props = (GlobalProperty[]) {
3657a10ef51SLiu Ping Fan         PC_Q35_COMPAT_1_5,
366ffce9ebbSEduardo Habkost         { /* end of list */ }
367ffce9ebbSEduardo Habkost     },
368df2d8b3eSIsaku Yamahata };
369df2d8b3eSIsaku Yamahata 
370a0dba644SMichael S. Tsirkin #define PC_Q35_1_4_MACHINE_OPTIONS \
371a0dba644SMichael S. Tsirkin     PC_Q35_1_6_MACHINE_OPTIONS, \
372a0dba644SMichael S. Tsirkin     .hot_add_cpu = NULL
373a0dba644SMichael S. Tsirkin 
374bf3caa3dSPaolo Bonzini static QEMUMachine pc_q35_machine_v1_4 = {
375a0dba644SMichael S. Tsirkin     PC_Q35_1_4_MACHINE_OPTIONS,
376bf3caa3dSPaolo Bonzini     .name = "pc-q35-1.4",
3779953f882SMarkus Armbruster     .init = pc_q35_init_1_4,
378bf3caa3dSPaolo Bonzini     .compat_props = (GlobalProperty[]) {
379bf3caa3dSPaolo Bonzini         PC_COMPAT_1_4,
380bf3caa3dSPaolo Bonzini         { /* end of list */ }
381bf3caa3dSPaolo Bonzini     },
382bf3caa3dSPaolo Bonzini };
383bf3caa3dSPaolo Bonzini 
384df2d8b3eSIsaku Yamahata static void pc_q35_machine_init(void)
385df2d8b3eSIsaku Yamahata {
3863458b2b0SMichael S. Tsirkin     qemu_register_machine(&pc_q35_machine_v2_1);
387aeca6e8dSGerd Hoffmann     qemu_register_machine(&pc_q35_machine_v2_0);
388e9845f09SVincenzo Maffione     qemu_register_machine(&pc_q35_machine_v1_7);
38945053fdeSEduardo Habkost     qemu_register_machine(&pc_q35_machine_v1_6);
390bf3caa3dSPaolo Bonzini     qemu_register_machine(&pc_q35_machine_v1_5);
391bf3caa3dSPaolo Bonzini     qemu_register_machine(&pc_q35_machine_v1_4);
392df2d8b3eSIsaku Yamahata }
393df2d8b3eSIsaku Yamahata 
394df2d8b3eSIsaku Yamahata machine_init(pc_q35_machine_init);
395