2
0

pc_q35.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. /*
  2. * Q35 chipset based pc system emulator
  3. *
  4. * Copyright (c) 2003-2004 Fabrice Bellard
  5. * Copyright (c) 2009, 2010
  6. * Isaku Yamahata <yamahata at valinux co jp>
  7. * VA Linux Systems Japan K.K.
  8. * Copyright (C) 2012 Jason Baron <jbaron@redhat.com>
  9. *
  10. * This is based on pc.c, but heavily modified.
  11. *
  12. * Permission is hereby granted, free of charge, to any person obtaining a copy
  13. * of this software and associated documentation files (the "Software"), to deal
  14. * in the Software without restriction, including without limitation the rights
  15. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16. * copies of the Software, and to permit persons to whom the Software is
  17. * furnished to do so, subject to the following conditions:
  18. *
  19. * The above copyright notice and this permission notice shall be included in
  20. * all copies or substantial portions of the Software.
  21. *
  22. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  24. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  25. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  26. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  27. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  28. * THE SOFTWARE.
  29. */
  30. #include "qemu/osdep.h"
  31. #include "qemu/units.h"
  32. #include "hw/acpi/acpi.h"
  33. #include "hw/char/parallel-isa.h"
  34. #include "hw/loader.h"
  35. #include "hw/i2c/smbus_eeprom.h"
  36. #include "hw/rtc/mc146818rtc.h"
  37. #include "system/tcg.h"
  38. #include "system/kvm.h"
  39. #include "hw/i386/kvm/clock.h"
  40. #include "hw/pci-host/q35.h"
  41. #include "hw/pci/pcie_port.h"
  42. #include "hw/qdev-properties.h"
  43. #include "hw/i386/x86.h"
  44. #include "hw/i386/pc.h"
  45. #include "hw/i386/amd_iommu.h"
  46. #include "hw/i386/intel_iommu.h"
  47. #include "hw/virtio/virtio-iommu.h"
  48. #include "hw/display/ramfb.h"
  49. #include "hw/ide/pci.h"
  50. #include "hw/ide/ahci-pci.h"
  51. #include "hw/intc/ioapic.h"
  52. #include "hw/southbridge/ich9.h"
  53. #include "hw/usb.h"
  54. #include "hw/usb/hcd-uhci.h"
  55. #include "qapi/error.h"
  56. #include "qemu/error-report.h"
  57. #include "system/numa.h"
  58. #include "hw/hyperv/vmbus-bridge.h"
  59. #include "hw/mem/nvdimm.h"
  60. #include "hw/uefi/var-service-api.h"
  61. #include "hw/i386/acpi-build.h"
  62. #include "target/i386/cpu.h"
  63. /* ICH9 AHCI has 6 ports */
  64. #define MAX_SATA_PORTS 6
  65. static GlobalProperty pc_q35_compat_defaults[] = {
  66. { TYPE_VIRTIO_IOMMU_PCI, "aw-bits", "39" },
  67. };
  68. static const size_t pc_q35_compat_defaults_len =
  69. G_N_ELEMENTS(pc_q35_compat_defaults);
  70. struct ehci_companions {
  71. const char *name;
  72. int func;
  73. int port;
  74. };
  75. static const struct ehci_companions ich9_1d[] = {
  76. { .name = TYPE_ICH9_USB_UHCI(1), .func = 0, .port = 0 },
  77. { .name = TYPE_ICH9_USB_UHCI(2), .func = 1, .port = 2 },
  78. { .name = TYPE_ICH9_USB_UHCI(3), .func = 2, .port = 4 },
  79. };
  80. static const struct ehci_companions ich9_1a[] = {
  81. { .name = TYPE_ICH9_USB_UHCI(4), .func = 0, .port = 0 },
  82. { .name = TYPE_ICH9_USB_UHCI(5), .func = 1, .port = 2 },
  83. { .name = TYPE_ICH9_USB_UHCI(6), .func = 2, .port = 4 },
  84. };
  85. static int ehci_create_ich9_with_companions(PCIBus *bus, int slot)
  86. {
  87. const struct ehci_companions *comp;
  88. PCIDevice *ehci, *uhci;
  89. BusState *usbbus;
  90. const char *name;
  91. int i;
  92. switch (slot) {
  93. case 0x1d:
  94. name = "ich9-usb-ehci1";
  95. comp = ich9_1d;
  96. break;
  97. case 0x1a:
  98. name = "ich9-usb-ehci2";
  99. comp = ich9_1a;
  100. break;
  101. default:
  102. return -1;
  103. }
  104. ehci = pci_new_multifunction(PCI_DEVFN(slot, 7), name);
  105. pci_realize_and_unref(ehci, bus, &error_fatal);
  106. usbbus = QLIST_FIRST(&ehci->qdev.child_bus);
  107. for (i = 0; i < 3; i++) {
  108. uhci = pci_new_multifunction(PCI_DEVFN(slot, comp[i].func),
  109. comp[i].name);
  110. qdev_prop_set_string(&uhci->qdev, "masterbus", usbbus->name);
  111. qdev_prop_set_uint32(&uhci->qdev, "firstport", comp[i].port);
  112. pci_realize_and_unref(uhci, bus, &error_fatal);
  113. }
  114. return 0;
  115. }
  116. /* PC hardware initialisation */
  117. static void pc_q35_init(MachineState *machine)
  118. {
  119. PCMachineState *pcms = PC_MACHINE(machine);
  120. PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
  121. X86MachineState *x86ms = X86_MACHINE(machine);
  122. Object *phb;
  123. PCIDevice *lpc;
  124. DeviceState *lpc_dev;
  125. MemoryRegion *system_memory = get_system_memory();
  126. MemoryRegion *system_io = get_system_io();
  127. MemoryRegion *pci_memory = g_new(MemoryRegion, 1);
  128. GSIState *gsi_state;
  129. ISABus *isa_bus;
  130. int i;
  131. ram_addr_t lowmem;
  132. DriveInfo *hd[MAX_SATA_PORTS];
  133. MachineClass *mc = MACHINE_GET_CLASS(machine);
  134. bool acpi_pcihp;
  135. bool keep_pci_slot_hpc;
  136. uint64_t pci_hole64_size = 0;
  137. assert(pcmc->pci_enabled);
  138. /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory
  139. * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
  140. * also known as MMCFG).
  141. * If it doesn't, we need to split it in chunks below and above 4G.
  142. * In any case, try to make sure that guest addresses aligned at
  143. * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
  144. */
  145. if (machine->ram_size >= 0xb0000000) {
  146. lowmem = 0x80000000;
  147. } else {
  148. lowmem = 0xb0000000;
  149. }
  150. /* Handle the machine opt max-ram-below-4g. It is basically doing
  151. * min(qemu limit, user limit).
  152. */
  153. if (!pcms->max_ram_below_4g) {
  154. pcms->max_ram_below_4g = 4 * GiB;
  155. }
  156. if (lowmem > pcms->max_ram_below_4g) {
  157. lowmem = pcms->max_ram_below_4g;
  158. if (machine->ram_size - lowmem > lowmem &&
  159. lowmem & (1 * GiB - 1)) {
  160. warn_report("There is possibly poor performance as the ram size "
  161. " (0x%" PRIx64 ") is more then twice the size of"
  162. " max-ram-below-4g (%"PRIu64") and"
  163. " max-ram-below-4g is not a multiple of 1G.",
  164. (uint64_t)machine->ram_size, pcms->max_ram_below_4g);
  165. }
  166. }
  167. if (machine->ram_size >= lowmem) {
  168. x86ms->above_4g_mem_size = machine->ram_size - lowmem;
  169. x86ms->below_4g_mem_size = lowmem;
  170. } else {
  171. x86ms->above_4g_mem_size = 0;
  172. x86ms->below_4g_mem_size = machine->ram_size;
  173. }
  174. pc_machine_init_sgx_epc(pcms);
  175. x86_cpus_init(x86ms, pcmc->default_cpu_version);
  176. if (kvm_enabled()) {
  177. kvmclock_create(pcmc->kvmclock_create_always);
  178. }
  179. /* create pci host bus */
  180. phb = OBJECT(qdev_new(TYPE_Q35_HOST_DEVICE));
  181. pci_hole64_size = object_property_get_uint(phb,
  182. PCI_HOST_PROP_PCI_HOLE64_SIZE,
  183. &error_abort);
  184. /* allocate ram and load rom/bios */
  185. memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
  186. pc_memory_init(pcms, system_memory, pci_memory, pci_hole64_size);
  187. object_property_add_child(OBJECT(machine), "q35", phb);
  188. object_property_set_link(phb, PCI_HOST_PROP_RAM_MEM,
  189. OBJECT(machine->ram), NULL);
  190. object_property_set_link(phb, PCI_HOST_PROP_PCI_MEM,
  191. OBJECT(pci_memory), NULL);
  192. object_property_set_link(phb, PCI_HOST_PROP_SYSTEM_MEM,
  193. OBJECT(system_memory), NULL);
  194. object_property_set_link(phb, PCI_HOST_PROP_IO_MEM,
  195. OBJECT(system_io), NULL);
  196. object_property_set_int(phb, PCI_HOST_BELOW_4G_MEM_SIZE,
  197. x86ms->below_4g_mem_size, NULL);
  198. object_property_set_int(phb, PCI_HOST_ABOVE_4G_MEM_SIZE,
  199. x86ms->above_4g_mem_size, NULL);
  200. object_property_set_bool(phb, PCI_HOST_BYPASS_IOMMU,
  201. pcms->default_bus_bypass_iommu, NULL);
  202. object_property_set_bool(phb, PCI_HOST_PROP_SMM_RANGES,
  203. x86_machine_is_smm_enabled(x86ms), NULL);
  204. sysbus_realize_and_unref(SYS_BUS_DEVICE(phb), &error_fatal);
  205. /* pci */
  206. pcms->pcibus = PCI_BUS(qdev_get_child_bus(DEVICE(phb), "pcie.0"));
  207. /* irq lines */
  208. gsi_state = pc_gsi_create(&x86ms->gsi, true);
  209. /* create ISA bus */
  210. lpc = pci_new_multifunction(PCI_DEVFN(ICH9_LPC_DEV, ICH9_LPC_FUNC),
  211. TYPE_ICH9_LPC_DEVICE);
  212. lpc_dev = DEVICE(lpc);
  213. qdev_prop_set_bit(lpc_dev, "smm-enabled",
  214. x86_machine_is_smm_enabled(x86ms));
  215. for (i = 0; i < IOAPIC_NUM_PINS; i++) {
  216. qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, x86ms->gsi[i]);
  217. }
  218. pci_realize_and_unref(lpc, pcms->pcibus, &error_fatal);
  219. x86ms->rtc = ISA_DEVICE(object_resolve_path_component(OBJECT(lpc), "rtc"));
  220. object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
  221. TYPE_HOTPLUG_HANDLER,
  222. (Object **)&x86ms->acpi_dev,
  223. object_property_allow_set_link,
  224. OBJ_PROP_LINK_STRONG);
  225. object_property_set_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
  226. OBJECT(lpc), &error_abort);
  227. acpi_pcihp = object_property_get_bool(OBJECT(lpc),
  228. ACPI_PM_PROP_ACPI_PCIHP_BRIDGE,
  229. NULL);
  230. keep_pci_slot_hpc = object_property_get_bool(OBJECT(lpc),
  231. "x-keep-pci-slot-hpc",
  232. NULL);
  233. if (!keep_pci_slot_hpc && acpi_pcihp) {
  234. object_register_sugar_prop(TYPE_PCIE_SLOT,
  235. "x-do-not-expose-native-hotplug-cap",
  236. "true", true);
  237. }
  238. isa_bus = ISA_BUS(qdev_get_child_bus(lpc_dev, "isa.0"));
  239. if (x86ms->pic == ON_OFF_AUTO_ON || x86ms->pic == ON_OFF_AUTO_AUTO) {
  240. pc_i8259_create(isa_bus, gsi_state->i8259_irq);
  241. }
  242. ioapic_init_gsi(gsi_state, OBJECT(phb));
  243. if (tcg_enabled()) {
  244. x86_register_ferr_irq(x86ms->gsi[13]);
  245. }
  246. /* init basic PC hardware */
  247. pc_basic_device_init(pcms, isa_bus, x86ms->gsi, x86ms->rtc, !mc->no_floppy,
  248. 0xff0104);
  249. if (pcms->sata_enabled) {
  250. PCIDevice *pdev;
  251. AHCIPCIState *ich9;
  252. /* ahci and SATA device, for q35 1 ahci controller is built-in */
  253. pdev = pci_create_simple_multifunction(pcms->pcibus,
  254. PCI_DEVFN(ICH9_SATA1_DEV,
  255. ICH9_SATA1_FUNC),
  256. "ich9-ahci");
  257. ich9 = ICH9_AHCI(pdev);
  258. pcms->idebus[0] = qdev_get_child_bus(DEVICE(pdev), "ide.0");
  259. pcms->idebus[1] = qdev_get_child_bus(DEVICE(pdev), "ide.1");
  260. g_assert(MAX_SATA_PORTS == ich9->ahci.ports);
  261. ide_drive_get(hd, ich9->ahci.ports);
  262. ahci_ide_create_devs(&ich9->ahci, hd);
  263. }
  264. if (machine_usb(machine)) {
  265. /* Should we create 6 UHCI according to ich9 spec? */
  266. ehci_create_ich9_with_companions(pcms->pcibus, 0x1d);
  267. }
  268. if (pcms->smbus_enabled) {
  269. PCIDevice *smb;
  270. /* TODO: Populate SPD eeprom data. */
  271. smb = pci_create_simple_multifunction(pcms->pcibus,
  272. PCI_DEVFN(ICH9_SMB_DEV,
  273. ICH9_SMB_FUNC),
  274. TYPE_ICH9_SMB_DEVICE);
  275. pcms->smbus = I2C_BUS(qdev_get_child_bus(DEVICE(smb), "i2c"));
  276. smbus_eeprom_init(pcms->smbus, 8, NULL, 0);
  277. }
  278. /* the rest devices to which pci devfn is automatically assigned */
  279. pc_vga_init(isa_bus, pcms->pcibus);
  280. pc_nic_init(pcmc, isa_bus, pcms->pcibus);
  281. if (machine->nvdimms_state->is_enabled) {
  282. nvdimm_init_acpi_state(machine->nvdimms_state, system_io,
  283. x86_nvdimm_acpi_dsmio,
  284. x86ms->fw_cfg, OBJECT(pcms));
  285. }
  286. }
  287. #define DEFINE_Q35_MACHINE(major, minor) \
  288. DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, NULL, major, minor);
  289. #define DEFINE_Q35_MACHINE_AS_LATEST(major, minor) \
  290. DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, "q35", major, minor);
  291. #define DEFINE_Q35_MACHINE_BUGFIX(major, minor, micro) \
  292. DEFINE_PC_VER_MACHINE(pc_q35, "pc-q35", pc_q35_init, false, NULL, major, minor, micro);
  293. static void pc_q35_machine_options(MachineClass *m)
  294. {
  295. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  296. pcmc->pci_root_uid = 0;
  297. pcmc->default_cpu_version = 1;
  298. m->family = "pc_q35";
  299. m->desc = "Standard PC (Q35 + ICH9, 2009)";
  300. m->units_per_default_bus = 1;
  301. m->default_machine_opts = "firmware=bios-256k.bin";
  302. m->default_display = "std";
  303. m->default_nic = "e1000e";
  304. m->default_kernel_irqchip_split = false;
  305. m->no_floppy = 1;
  306. m->max_cpus = 4096;
  307. m->no_parallel = !module_object_class_by_name(TYPE_ISA_PARALLEL);
  308. machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
  309. machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
  310. machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
  311. machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
  312. machine_class_allow_dynamic_sysbus_dev(m, TYPE_UEFI_VARS_X64);
  313. compat_props_add(m->compat_props,
  314. pc_q35_compat_defaults, pc_q35_compat_defaults_len);
  315. }
  316. static void pc_q35_machine_10_0_options(MachineClass *m)
  317. {
  318. pc_q35_machine_options(m);
  319. }
  320. DEFINE_Q35_MACHINE_AS_LATEST(10, 0);
  321. static void pc_q35_machine_9_2_options(MachineClass *m)
  322. {
  323. pc_q35_machine_10_0_options(m);
  324. compat_props_add(m->compat_props, hw_compat_9_2, hw_compat_9_2_len);
  325. compat_props_add(m->compat_props, pc_compat_9_2, pc_compat_9_2_len);
  326. }
  327. DEFINE_Q35_MACHINE(9, 2);
  328. static void pc_q35_machine_9_1_options(MachineClass *m)
  329. {
  330. pc_q35_machine_9_2_options(m);
  331. compat_props_add(m->compat_props, hw_compat_9_1, hw_compat_9_1_len);
  332. compat_props_add(m->compat_props, pc_compat_9_1, pc_compat_9_1_len);
  333. }
  334. DEFINE_Q35_MACHINE(9, 1);
  335. static void pc_q35_machine_9_0_options(MachineClass *m)
  336. {
  337. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  338. pc_q35_machine_9_1_options(m);
  339. m->smbios_memory_device_size = 16 * GiB;
  340. compat_props_add(m->compat_props, hw_compat_9_0, hw_compat_9_0_len);
  341. compat_props_add(m->compat_props, pc_compat_9_0, pc_compat_9_0_len);
  342. pcmc->isa_bios_alias = false;
  343. }
  344. DEFINE_Q35_MACHINE(9, 0);
  345. static void pc_q35_machine_8_2_options(MachineClass *m)
  346. {
  347. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  348. pc_q35_machine_9_0_options(m);
  349. m->max_cpus = 1024;
  350. compat_props_add(m->compat_props, hw_compat_8_2, hw_compat_8_2_len);
  351. compat_props_add(m->compat_props, pc_compat_8_2, pc_compat_8_2_len);
  352. /* For pc-q35-8.2 and 8.1, use SMBIOS 3.X by default */
  353. pcmc->default_smbios_ep_type = SMBIOS_ENTRY_POINT_TYPE_64;
  354. }
  355. DEFINE_Q35_MACHINE(8, 2);
  356. static void pc_q35_machine_8_1_options(MachineClass *m)
  357. {
  358. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  359. pc_q35_machine_8_2_options(m);
  360. pcmc->broken_32bit_mem_addr_check = true;
  361. compat_props_add(m->compat_props, hw_compat_8_1, hw_compat_8_1_len);
  362. compat_props_add(m->compat_props, pc_compat_8_1, pc_compat_8_1_len);
  363. }
  364. DEFINE_Q35_MACHINE(8, 1);
  365. static void pc_q35_machine_8_0_options(MachineClass *m)
  366. {
  367. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  368. pc_q35_machine_8_1_options(m);
  369. compat_props_add(m->compat_props, hw_compat_8_0, hw_compat_8_0_len);
  370. compat_props_add(m->compat_props, pc_compat_8_0, pc_compat_8_0_len);
  371. /* For pc-q35-8.0 and older, use SMBIOS 2.8 by default */
  372. pcmc->default_smbios_ep_type = SMBIOS_ENTRY_POINT_TYPE_32;
  373. m->max_cpus = 288;
  374. }
  375. DEFINE_Q35_MACHINE(8, 0);
  376. static void pc_q35_machine_7_2_options(MachineClass *m)
  377. {
  378. pc_q35_machine_8_0_options(m);
  379. compat_props_add(m->compat_props, hw_compat_7_2, hw_compat_7_2_len);
  380. compat_props_add(m->compat_props, pc_compat_7_2, pc_compat_7_2_len);
  381. }
  382. DEFINE_Q35_MACHINE(7, 2);
  383. static void pc_q35_machine_7_1_options(MachineClass *m)
  384. {
  385. pc_q35_machine_7_2_options(m);
  386. compat_props_add(m->compat_props, hw_compat_7_1, hw_compat_7_1_len);
  387. compat_props_add(m->compat_props, pc_compat_7_1, pc_compat_7_1_len);
  388. }
  389. DEFINE_Q35_MACHINE(7, 1);
  390. static void pc_q35_machine_7_0_options(MachineClass *m)
  391. {
  392. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  393. pc_q35_machine_7_1_options(m);
  394. pcmc->enforce_amd_1tb_hole = false;
  395. compat_props_add(m->compat_props, hw_compat_7_0, hw_compat_7_0_len);
  396. compat_props_add(m->compat_props, pc_compat_7_0, pc_compat_7_0_len);
  397. }
  398. DEFINE_Q35_MACHINE(7, 0);
  399. static void pc_q35_machine_6_2_options(MachineClass *m)
  400. {
  401. pc_q35_machine_7_0_options(m);
  402. compat_props_add(m->compat_props, hw_compat_6_2, hw_compat_6_2_len);
  403. compat_props_add(m->compat_props, pc_compat_6_2, pc_compat_6_2_len);
  404. }
  405. DEFINE_Q35_MACHINE(6, 2);
  406. static void pc_q35_machine_6_1_options(MachineClass *m)
  407. {
  408. pc_q35_machine_6_2_options(m);
  409. compat_props_add(m->compat_props, hw_compat_6_1, hw_compat_6_1_len);
  410. compat_props_add(m->compat_props, pc_compat_6_1, pc_compat_6_1_len);
  411. m->smp_props.prefer_sockets = true;
  412. }
  413. DEFINE_Q35_MACHINE(6, 1);
  414. static void pc_q35_machine_6_0_options(MachineClass *m)
  415. {
  416. pc_q35_machine_6_1_options(m);
  417. compat_props_add(m->compat_props, hw_compat_6_0, hw_compat_6_0_len);
  418. compat_props_add(m->compat_props, pc_compat_6_0, pc_compat_6_0_len);
  419. }
  420. DEFINE_Q35_MACHINE(6, 0);
  421. static void pc_q35_machine_5_2_options(MachineClass *m)
  422. {
  423. pc_q35_machine_6_0_options(m);
  424. compat_props_add(m->compat_props, hw_compat_5_2, hw_compat_5_2_len);
  425. compat_props_add(m->compat_props, pc_compat_5_2, pc_compat_5_2_len);
  426. }
  427. DEFINE_Q35_MACHINE(5, 2);
  428. static void pc_q35_machine_5_1_options(MachineClass *m)
  429. {
  430. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  431. pc_q35_machine_5_2_options(m);
  432. compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len);
  433. compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len);
  434. pcmc->kvmclock_create_always = false;
  435. pcmc->pci_root_uid = 1;
  436. }
  437. DEFINE_Q35_MACHINE(5, 1);
  438. static void pc_q35_machine_5_0_options(MachineClass *m)
  439. {
  440. pc_q35_machine_5_1_options(m);
  441. m->numa_mem_supported = true;
  442. compat_props_add(m->compat_props, hw_compat_5_0, hw_compat_5_0_len);
  443. compat_props_add(m->compat_props, pc_compat_5_0, pc_compat_5_0_len);
  444. m->auto_enable_numa_with_memdev = false;
  445. }
  446. DEFINE_Q35_MACHINE(5, 0);
  447. static void pc_q35_machine_4_2_options(MachineClass *m)
  448. {
  449. pc_q35_machine_5_0_options(m);
  450. compat_props_add(m->compat_props, hw_compat_4_2, hw_compat_4_2_len);
  451. compat_props_add(m->compat_props, pc_compat_4_2, pc_compat_4_2_len);
  452. }
  453. DEFINE_Q35_MACHINE(4, 2);
  454. static void pc_q35_machine_4_1_options(MachineClass *m)
  455. {
  456. pc_q35_machine_4_2_options(m);
  457. compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len);
  458. compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len);
  459. }
  460. DEFINE_Q35_MACHINE(4, 1);
  461. static void pc_q35_machine_4_0_1_options(MachineClass *m)
  462. {
  463. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  464. pc_q35_machine_4_1_options(m);
  465. pcmc->default_cpu_version = CPU_VERSION_LEGACY;
  466. /*
  467. * This is the default machine for the 4.0-stable branch. It is basically
  468. * a 4.0 that doesn't use split irqchip by default. It MUST hence apply the
  469. * 4.0 compat props.
  470. */
  471. compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
  472. compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
  473. }
  474. DEFINE_Q35_MACHINE_BUGFIX(4, 0, 1);
  475. static void pc_q35_machine_4_0_options(MachineClass *m)
  476. {
  477. pc_q35_machine_4_0_1_options(m);
  478. m->default_kernel_irqchip_split = true;
  479. /* Compat props are applied by the 4.0.1 machine */
  480. }
  481. DEFINE_Q35_MACHINE(4, 0);
  482. static void pc_q35_machine_3_1_options(MachineClass *m)
  483. {
  484. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  485. pc_q35_machine_4_0_options(m);
  486. m->default_kernel_irqchip_split = false;
  487. m->smbus_no_migration_support = true;
  488. pcmc->pvh_enabled = false;
  489. compat_props_add(m->compat_props, hw_compat_3_1, hw_compat_3_1_len);
  490. compat_props_add(m->compat_props, pc_compat_3_1, pc_compat_3_1_len);
  491. }
  492. DEFINE_Q35_MACHINE(3, 1);
  493. static void pc_q35_machine_3_0_options(MachineClass *m)
  494. {
  495. pc_q35_machine_3_1_options(m);
  496. compat_props_add(m->compat_props, hw_compat_3_0, hw_compat_3_0_len);
  497. compat_props_add(m->compat_props, pc_compat_3_0, pc_compat_3_0_len);
  498. }
  499. DEFINE_Q35_MACHINE(3, 0);
  500. static void pc_q35_machine_2_12_options(MachineClass *m)
  501. {
  502. pc_q35_machine_3_0_options(m);
  503. compat_props_add(m->compat_props, hw_compat_2_12, hw_compat_2_12_len);
  504. compat_props_add(m->compat_props, pc_compat_2_12, pc_compat_2_12_len);
  505. }
  506. DEFINE_Q35_MACHINE(2, 12);
  507. static void pc_q35_machine_2_11_options(MachineClass *m)
  508. {
  509. pc_q35_machine_2_12_options(m);
  510. m->default_nic = "e1000";
  511. compat_props_add(m->compat_props, hw_compat_2_11, hw_compat_2_11_len);
  512. compat_props_add(m->compat_props, pc_compat_2_11, pc_compat_2_11_len);
  513. }
  514. DEFINE_Q35_MACHINE(2, 11);
  515. static void pc_q35_machine_2_10_options(MachineClass *m)
  516. {
  517. pc_q35_machine_2_11_options(m);
  518. compat_props_add(m->compat_props, hw_compat_2_10, hw_compat_2_10_len);
  519. compat_props_add(m->compat_props, pc_compat_2_10, pc_compat_2_10_len);
  520. m->auto_enable_numa_with_memhp = false;
  521. }
  522. DEFINE_Q35_MACHINE(2, 10);
  523. static void pc_q35_machine_2_9_options(MachineClass *m)
  524. {
  525. pc_q35_machine_2_10_options(m);
  526. compat_props_add(m->compat_props, hw_compat_2_9, hw_compat_2_9_len);
  527. compat_props_add(m->compat_props, pc_compat_2_9, pc_compat_2_9_len);
  528. }
  529. DEFINE_Q35_MACHINE(2, 9);
  530. static void pc_q35_machine_2_8_options(MachineClass *m)
  531. {
  532. pc_q35_machine_2_9_options(m);
  533. compat_props_add(m->compat_props, hw_compat_2_8, hw_compat_2_8_len);
  534. compat_props_add(m->compat_props, pc_compat_2_8, pc_compat_2_8_len);
  535. }
  536. DEFINE_Q35_MACHINE(2, 8);
  537. static void pc_q35_machine_2_7_options(MachineClass *m)
  538. {
  539. pc_q35_machine_2_8_options(m);
  540. m->max_cpus = 255;
  541. compat_props_add(m->compat_props, hw_compat_2_7, hw_compat_2_7_len);
  542. compat_props_add(m->compat_props, pc_compat_2_7, pc_compat_2_7_len);
  543. }
  544. DEFINE_Q35_MACHINE(2, 7);
  545. static void pc_q35_machine_2_6_options(MachineClass *m)
  546. {
  547. X86MachineClass *x86mc = X86_MACHINE_CLASS(m);
  548. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  549. pc_q35_machine_2_7_options(m);
  550. pcmc->legacy_cpu_hotplug = true;
  551. x86mc->fwcfg_dma_enabled = false;
  552. compat_props_add(m->compat_props, hw_compat_2_6, hw_compat_2_6_len);
  553. compat_props_add(m->compat_props, pc_compat_2_6, pc_compat_2_6_len);
  554. }
  555. DEFINE_Q35_MACHINE(2, 6);
  556. static void pc_q35_machine_2_5_options(MachineClass *m)
  557. {
  558. X86MachineClass *x86mc = X86_MACHINE_CLASS(m);
  559. pc_q35_machine_2_6_options(m);
  560. x86mc->save_tsc_khz = false;
  561. m->legacy_fw_cfg_order = 1;
  562. compat_props_add(m->compat_props, hw_compat_2_5, hw_compat_2_5_len);
  563. compat_props_add(m->compat_props, pc_compat_2_5, pc_compat_2_5_len);
  564. }
  565. DEFINE_Q35_MACHINE(2, 5);
  566. static void pc_q35_machine_2_4_options(MachineClass *m)
  567. {
  568. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  569. pc_q35_machine_2_5_options(m);
  570. m->hw_version = "2.4.0";
  571. pcmc->broken_reserved_end = true;
  572. compat_props_add(m->compat_props, hw_compat_2_4, hw_compat_2_4_len);
  573. compat_props_add(m->compat_props, pc_compat_2_4, pc_compat_2_4_len);
  574. }
  575. DEFINE_Q35_MACHINE(2, 4);