pc_q35.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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/loader.h"
  33. #include "sysemu/arch_init.h"
  34. #include "hw/i2c/smbus_eeprom.h"
  35. #include "hw/rtc/mc146818rtc.h"
  36. #include "hw/xen/xen.h"
  37. #include "sysemu/kvm.h"
  38. #include "hw/kvm/clock.h"
  39. #include "hw/pci-host/q35.h"
  40. #include "hw/qdev-properties.h"
  41. #include "exec/address-spaces.h"
  42. #include "hw/i386/x86.h"
  43. #include "hw/i386/pc.h"
  44. #include "hw/i386/ich9.h"
  45. #include "hw/i386/amd_iommu.h"
  46. #include "hw/i386/intel_iommu.h"
  47. #include "hw/display/ramfb.h"
  48. #include "hw/firmware/smbios.h"
  49. #include "hw/ide/pci.h"
  50. #include "hw/ide/ahci.h"
  51. #include "hw/usb.h"
  52. #include "qapi/error.h"
  53. #include "qemu/error-report.h"
  54. #include "sysemu/numa.h"
  55. /* ICH9 AHCI has 6 ports */
  56. #define MAX_SATA_PORTS 6
  57. struct ehci_companions {
  58. const char *name;
  59. int func;
  60. int port;
  61. };
  62. static const struct ehci_companions ich9_1d[] = {
  63. { .name = "ich9-usb-uhci1", .func = 0, .port = 0 },
  64. { .name = "ich9-usb-uhci2", .func = 1, .port = 2 },
  65. { .name = "ich9-usb-uhci3", .func = 2, .port = 4 },
  66. };
  67. static const struct ehci_companions ich9_1a[] = {
  68. { .name = "ich9-usb-uhci4", .func = 0, .port = 0 },
  69. { .name = "ich9-usb-uhci5", .func = 1, .port = 2 },
  70. { .name = "ich9-usb-uhci6", .func = 2, .port = 4 },
  71. };
  72. static int ehci_create_ich9_with_companions(PCIBus *bus, int slot)
  73. {
  74. const struct ehci_companions *comp;
  75. PCIDevice *ehci, *uhci;
  76. BusState *usbbus;
  77. const char *name;
  78. int i;
  79. switch (slot) {
  80. case 0x1d:
  81. name = "ich9-usb-ehci1";
  82. comp = ich9_1d;
  83. break;
  84. case 0x1a:
  85. name = "ich9-usb-ehci2";
  86. comp = ich9_1a;
  87. break;
  88. default:
  89. return -1;
  90. }
  91. ehci = pci_create_multifunction(bus, PCI_DEVFN(slot, 7), true, name);
  92. qdev_init_nofail(&ehci->qdev);
  93. usbbus = QLIST_FIRST(&ehci->qdev.child_bus);
  94. for (i = 0; i < 3; i++) {
  95. uhci = pci_create_multifunction(bus, PCI_DEVFN(slot, comp[i].func),
  96. true, comp[i].name);
  97. qdev_prop_set_string(&uhci->qdev, "masterbus", usbbus->name);
  98. qdev_prop_set_uint32(&uhci->qdev, "firstport", comp[i].port);
  99. qdev_init_nofail(&uhci->qdev);
  100. }
  101. return 0;
  102. }
  103. /* PC hardware initialisation */
  104. static void pc_q35_init(MachineState *machine)
  105. {
  106. PCMachineState *pcms = PC_MACHINE(machine);
  107. PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
  108. X86MachineState *x86ms = X86_MACHINE(machine);
  109. Q35PCIHost *q35_host;
  110. PCIHostState *phb;
  111. PCIBus *host_bus;
  112. PCIDevice *lpc;
  113. DeviceState *lpc_dev;
  114. BusState *idebus[MAX_SATA_PORTS];
  115. ISADevice *rtc_state;
  116. MemoryRegion *system_io = get_system_io();
  117. MemoryRegion *pci_memory;
  118. MemoryRegion *rom_memory;
  119. MemoryRegion *ram_memory;
  120. GSIState *gsi_state;
  121. ISABus *isa_bus;
  122. int i;
  123. ICH9LPCState *ich9_lpc;
  124. PCIDevice *ahci;
  125. ram_addr_t lowmem;
  126. DriveInfo *hd[MAX_SATA_PORTS];
  127. MachineClass *mc = MACHINE_GET_CLASS(machine);
  128. /* Check whether RAM fits below 4G (leaving 1/2 GByte for IO memory
  129. * and 256 Mbytes for PCI Express Enhanced Configuration Access Mapping
  130. * also known as MMCFG).
  131. * If it doesn't, we need to split it in chunks below and above 4G.
  132. * In any case, try to make sure that guest addresses aligned at
  133. * 1G boundaries get mapped to host addresses aligned at 1G boundaries.
  134. */
  135. if (machine->ram_size >= 0xb0000000) {
  136. lowmem = 0x80000000;
  137. } else {
  138. lowmem = 0xb0000000;
  139. }
  140. /* Handle the machine opt max-ram-below-4g. It is basically doing
  141. * min(qemu limit, user limit).
  142. */
  143. if (!x86ms->max_ram_below_4g) {
  144. x86ms->max_ram_below_4g = 4 * GiB;
  145. }
  146. if (lowmem > x86ms->max_ram_below_4g) {
  147. lowmem = x86ms->max_ram_below_4g;
  148. if (machine->ram_size - lowmem > lowmem &&
  149. lowmem & (1 * GiB - 1)) {
  150. warn_report("There is possibly poor performance as the ram size "
  151. " (0x%" PRIx64 ") is more then twice the size of"
  152. " max-ram-below-4g (%"PRIu64") and"
  153. " max-ram-below-4g is not a multiple of 1G.",
  154. (uint64_t)machine->ram_size, x86ms->max_ram_below_4g);
  155. }
  156. }
  157. if (machine->ram_size >= lowmem) {
  158. x86ms->above_4g_mem_size = machine->ram_size - lowmem;
  159. x86ms->below_4g_mem_size = lowmem;
  160. } else {
  161. x86ms->above_4g_mem_size = 0;
  162. x86ms->below_4g_mem_size = machine->ram_size;
  163. }
  164. if (xen_enabled()) {
  165. xen_hvm_init(pcms, &ram_memory);
  166. }
  167. x86_cpus_init(x86ms, pcmc->default_cpu_version);
  168. kvmclock_create();
  169. /* pci enabled */
  170. if (pcmc->pci_enabled) {
  171. pci_memory = g_new(MemoryRegion, 1);
  172. memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
  173. rom_memory = pci_memory;
  174. } else {
  175. pci_memory = NULL;
  176. rom_memory = get_system_memory();
  177. }
  178. pc_guest_info_init(pcms);
  179. if (pcmc->smbios_defaults) {
  180. /* These values are guest ABI, do not change */
  181. smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
  182. mc->name, pcmc->smbios_legacy_mode,
  183. pcmc->smbios_uuid_encoded,
  184. SMBIOS_ENTRY_POINT_21);
  185. }
  186. /* allocate ram and load rom/bios */
  187. if (!xen_enabled()) {
  188. pc_memory_init(pcms, get_system_memory(),
  189. rom_memory, &ram_memory);
  190. }
  191. /* create pci host bus */
  192. q35_host = Q35_HOST_DEVICE(qdev_create(NULL, TYPE_Q35_HOST_DEVICE));
  193. object_property_add_child(qdev_get_machine(), "q35", OBJECT(q35_host), NULL);
  194. object_property_set_link(OBJECT(q35_host), OBJECT(ram_memory),
  195. MCH_HOST_PROP_RAM_MEM, NULL);
  196. object_property_set_link(OBJECT(q35_host), OBJECT(pci_memory),
  197. MCH_HOST_PROP_PCI_MEM, NULL);
  198. object_property_set_link(OBJECT(q35_host), OBJECT(get_system_memory()),
  199. MCH_HOST_PROP_SYSTEM_MEM, NULL);
  200. object_property_set_link(OBJECT(q35_host), OBJECT(system_io),
  201. MCH_HOST_PROP_IO_MEM, NULL);
  202. object_property_set_int(OBJECT(q35_host), x86ms->below_4g_mem_size,
  203. PCI_HOST_BELOW_4G_MEM_SIZE, NULL);
  204. object_property_set_int(OBJECT(q35_host), x86ms->above_4g_mem_size,
  205. PCI_HOST_ABOVE_4G_MEM_SIZE, NULL);
  206. /* pci */
  207. qdev_init_nofail(DEVICE(q35_host));
  208. phb = PCI_HOST_BRIDGE(q35_host);
  209. host_bus = phb->bus;
  210. /* create ISA bus */
  211. lpc = pci_create_simple_multifunction(host_bus, PCI_DEVFN(ICH9_LPC_DEV,
  212. ICH9_LPC_FUNC), true,
  213. TYPE_ICH9_LPC_DEVICE);
  214. object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
  215. TYPE_HOTPLUG_HANDLER,
  216. (Object **)&pcms->acpi_dev,
  217. object_property_allow_set_link,
  218. OBJ_PROP_LINK_STRONG, &error_abort);
  219. object_property_set_link(OBJECT(machine), OBJECT(lpc),
  220. PC_MACHINE_ACPI_DEVICE_PROP, &error_abort);
  221. /* irq lines */
  222. gsi_state = pc_gsi_create(&x86ms->gsi, pcmc->pci_enabled);
  223. ich9_lpc = ICH9_LPC_DEVICE(lpc);
  224. lpc_dev = DEVICE(lpc);
  225. for (i = 0; i < GSI_NUM_PINS; i++) {
  226. qdev_connect_gpio_out_named(lpc_dev, ICH9_GPIO_GSI, i, x86ms->gsi[i]);
  227. }
  228. pci_bus_irqs(host_bus, ich9_lpc_set_irq, ich9_lpc_map_irq, ich9_lpc,
  229. ICH9_LPC_NB_PIRQS);
  230. pci_bus_set_route_irq_fn(host_bus, ich9_route_intx_pin_to_irq);
  231. isa_bus = ich9_lpc->isa_bus;
  232. pc_i8259_create(isa_bus, gsi_state->i8259_irq);
  233. if (pcmc->pci_enabled) {
  234. ioapic_init_gsi(gsi_state, "q35");
  235. }
  236. if (tcg_enabled()) {
  237. x86_register_ferr_irq(x86ms->gsi[13]);
  238. }
  239. assert(pcms->vmport != ON_OFF_AUTO__MAX);
  240. if (pcms->vmport == ON_OFF_AUTO_AUTO) {
  241. pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;
  242. }
  243. /* init basic PC hardware */
  244. pc_basic_device_init(isa_bus, x86ms->gsi, &rtc_state, !mc->no_floppy,
  245. (pcms->vmport != ON_OFF_AUTO_ON), pcms->pit_enabled,
  246. 0xff0104);
  247. /* connect pm stuff to lpc */
  248. ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pcms));
  249. if (pcms->sata_enabled) {
  250. /* ahci and SATA device, for q35 1 ahci controller is built-in */
  251. ahci = pci_create_simple_multifunction(host_bus,
  252. PCI_DEVFN(ICH9_SATA1_DEV,
  253. ICH9_SATA1_FUNC),
  254. true, "ich9-ahci");
  255. idebus[0] = qdev_get_child_bus(&ahci->qdev, "ide.0");
  256. idebus[1] = qdev_get_child_bus(&ahci->qdev, "ide.1");
  257. g_assert(MAX_SATA_PORTS == ahci_get_num_ports(ahci));
  258. ide_drive_get(hd, ahci_get_num_ports(ahci));
  259. ahci_ide_create_devs(ahci, hd);
  260. } else {
  261. idebus[0] = idebus[1] = NULL;
  262. }
  263. if (machine_usb(machine)) {
  264. /* Should we create 6 UHCI according to ich9 spec? */
  265. ehci_create_ich9_with_companions(host_bus, 0x1d);
  266. }
  267. if (pcms->smbus_enabled) {
  268. /* TODO: Populate SPD eeprom data. */
  269. pcms->smbus = ich9_smb_init(host_bus,
  270. PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC),
  271. 0xb100);
  272. smbus_eeprom_init(pcms->smbus, 8, NULL, 0);
  273. }
  274. pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state);
  275. /* the rest devices to which pci devfn is automatically assigned */
  276. pc_vga_init(isa_bus, host_bus);
  277. pc_nic_init(pcmc, isa_bus, host_bus);
  278. if (machine->nvdimms_state->is_enabled) {
  279. nvdimm_init_acpi_state(machine->nvdimms_state, system_io,
  280. x86ms->fw_cfg, OBJECT(pcms));
  281. }
  282. }
  283. #define DEFINE_Q35_MACHINE(suffix, name, compatfn, optionfn) \
  284. static void pc_init_##suffix(MachineState *machine) \
  285. { \
  286. void (*compat)(MachineState *m) = (compatfn); \
  287. if (compat) { \
  288. compat(machine); \
  289. } \
  290. pc_q35_init(machine); \
  291. } \
  292. DEFINE_PC_MACHINE(suffix, name, pc_init_##suffix, optionfn)
  293. static void pc_q35_machine_options(MachineClass *m)
  294. {
  295. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  296. pcmc->default_nic_model = "e1000e";
  297. m->family = "pc_q35";
  298. m->desc = "Standard PC (Q35 + ICH9, 2009)";
  299. m->units_per_default_bus = 1;
  300. m->default_machine_opts = "firmware=bios-256k.bin";
  301. m->default_display = "std";
  302. m->default_kernel_irqchip_split = false;
  303. m->no_floppy = 1;
  304. machine_class_allow_dynamic_sysbus_dev(m, TYPE_AMD_IOMMU_DEVICE);
  305. machine_class_allow_dynamic_sysbus_dev(m, TYPE_INTEL_IOMMU_DEVICE);
  306. machine_class_allow_dynamic_sysbus_dev(m, TYPE_RAMFB_DEVICE);
  307. m->max_cpus = 288;
  308. }
  309. static void pc_q35_4_2_machine_options(MachineClass *m)
  310. {
  311. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  312. pc_q35_machine_options(m);
  313. m->alias = "q35";
  314. pcmc->default_cpu_version = 1;
  315. }
  316. DEFINE_Q35_MACHINE(v4_2, "pc-q35-4.2", NULL,
  317. pc_q35_4_2_machine_options);
  318. static void pc_q35_4_1_machine_options(MachineClass *m)
  319. {
  320. pc_q35_4_2_machine_options(m);
  321. m->alias = NULL;
  322. compat_props_add(m->compat_props, hw_compat_4_1, hw_compat_4_1_len);
  323. compat_props_add(m->compat_props, pc_compat_4_1, pc_compat_4_1_len);
  324. }
  325. DEFINE_Q35_MACHINE(v4_1, "pc-q35-4.1", NULL,
  326. pc_q35_4_1_machine_options);
  327. static void pc_q35_4_0_1_machine_options(MachineClass *m)
  328. {
  329. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  330. pc_q35_4_1_machine_options(m);
  331. m->alias = NULL;
  332. pcmc->default_cpu_version = CPU_VERSION_LEGACY;
  333. /*
  334. * This is the default machine for the 4.0-stable branch. It is basically
  335. * a 4.0 that doesn't use split irqchip by default. It MUST hence apply the
  336. * 4.0 compat props.
  337. */
  338. compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len);
  339. compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len);
  340. }
  341. DEFINE_Q35_MACHINE(v4_0_1, "pc-q35-4.0.1", NULL,
  342. pc_q35_4_0_1_machine_options);
  343. static void pc_q35_4_0_machine_options(MachineClass *m)
  344. {
  345. pc_q35_4_0_1_machine_options(m);
  346. m->default_kernel_irqchip_split = true;
  347. m->alias = NULL;
  348. /* Compat props are applied by the 4.0.1 machine */
  349. }
  350. DEFINE_Q35_MACHINE(v4_0, "pc-q35-4.0", NULL,
  351. pc_q35_4_0_machine_options);
  352. static void pc_q35_3_1_machine_options(MachineClass *m)
  353. {
  354. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  355. pc_q35_4_0_machine_options(m);
  356. m->default_kernel_irqchip_split = false;
  357. pcmc->do_not_add_smb_acpi = true;
  358. m->smbus_no_migration_support = true;
  359. m->alias = NULL;
  360. pcmc->pvh_enabled = false;
  361. compat_props_add(m->compat_props, hw_compat_3_1, hw_compat_3_1_len);
  362. compat_props_add(m->compat_props, pc_compat_3_1, pc_compat_3_1_len);
  363. }
  364. DEFINE_Q35_MACHINE(v3_1, "pc-q35-3.1", NULL,
  365. pc_q35_3_1_machine_options);
  366. static void pc_q35_3_0_machine_options(MachineClass *m)
  367. {
  368. pc_q35_3_1_machine_options(m);
  369. compat_props_add(m->compat_props, hw_compat_3_0, hw_compat_3_0_len);
  370. compat_props_add(m->compat_props, pc_compat_3_0, pc_compat_3_0_len);
  371. }
  372. DEFINE_Q35_MACHINE(v3_0, "pc-q35-3.0", NULL,
  373. pc_q35_3_0_machine_options);
  374. static void pc_q35_2_12_machine_options(MachineClass *m)
  375. {
  376. pc_q35_3_0_machine_options(m);
  377. compat_props_add(m->compat_props, hw_compat_2_12, hw_compat_2_12_len);
  378. compat_props_add(m->compat_props, pc_compat_2_12, pc_compat_2_12_len);
  379. }
  380. DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL,
  381. pc_q35_2_12_machine_options);
  382. static void pc_q35_2_11_machine_options(MachineClass *m)
  383. {
  384. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  385. pc_q35_2_12_machine_options(m);
  386. pcmc->default_nic_model = "e1000";
  387. compat_props_add(m->compat_props, hw_compat_2_11, hw_compat_2_11_len);
  388. compat_props_add(m->compat_props, pc_compat_2_11, pc_compat_2_11_len);
  389. }
  390. DEFINE_Q35_MACHINE(v2_11, "pc-q35-2.11", NULL,
  391. pc_q35_2_11_machine_options);
  392. static void pc_q35_2_10_machine_options(MachineClass *m)
  393. {
  394. pc_q35_2_11_machine_options(m);
  395. compat_props_add(m->compat_props, hw_compat_2_10, hw_compat_2_10_len);
  396. compat_props_add(m->compat_props, pc_compat_2_10, pc_compat_2_10_len);
  397. m->numa_auto_assign_ram = numa_legacy_auto_assign_ram;
  398. m->auto_enable_numa_with_memhp = false;
  399. }
  400. DEFINE_Q35_MACHINE(v2_10, "pc-q35-2.10", NULL,
  401. pc_q35_2_10_machine_options);
  402. static void pc_q35_2_9_machine_options(MachineClass *m)
  403. {
  404. pc_q35_2_10_machine_options(m);
  405. compat_props_add(m->compat_props, hw_compat_2_9, hw_compat_2_9_len);
  406. compat_props_add(m->compat_props, pc_compat_2_9, pc_compat_2_9_len);
  407. }
  408. DEFINE_Q35_MACHINE(v2_9, "pc-q35-2.9", NULL,
  409. pc_q35_2_9_machine_options);
  410. static void pc_q35_2_8_machine_options(MachineClass *m)
  411. {
  412. pc_q35_2_9_machine_options(m);
  413. compat_props_add(m->compat_props, hw_compat_2_8, hw_compat_2_8_len);
  414. compat_props_add(m->compat_props, pc_compat_2_8, pc_compat_2_8_len);
  415. }
  416. DEFINE_Q35_MACHINE(v2_8, "pc-q35-2.8", NULL,
  417. pc_q35_2_8_machine_options);
  418. static void pc_q35_2_7_machine_options(MachineClass *m)
  419. {
  420. pc_q35_2_8_machine_options(m);
  421. m->max_cpus = 255;
  422. compat_props_add(m->compat_props, hw_compat_2_7, hw_compat_2_7_len);
  423. compat_props_add(m->compat_props, pc_compat_2_7, pc_compat_2_7_len);
  424. }
  425. DEFINE_Q35_MACHINE(v2_7, "pc-q35-2.7", NULL,
  426. pc_q35_2_7_machine_options);
  427. static void pc_q35_2_6_machine_options(MachineClass *m)
  428. {
  429. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  430. pc_q35_2_7_machine_options(m);
  431. pcmc->legacy_cpu_hotplug = true;
  432. pcmc->linuxboot_dma_enabled = false;
  433. compat_props_add(m->compat_props, hw_compat_2_6, hw_compat_2_6_len);
  434. compat_props_add(m->compat_props, pc_compat_2_6, pc_compat_2_6_len);
  435. }
  436. DEFINE_Q35_MACHINE(v2_6, "pc-q35-2.6", NULL,
  437. pc_q35_2_6_machine_options);
  438. static void pc_q35_2_5_machine_options(MachineClass *m)
  439. {
  440. X86MachineClass *x86mc = X86_MACHINE_CLASS(m);
  441. pc_q35_2_6_machine_options(m);
  442. x86mc->save_tsc_khz = false;
  443. m->legacy_fw_cfg_order = 1;
  444. compat_props_add(m->compat_props, hw_compat_2_5, hw_compat_2_5_len);
  445. compat_props_add(m->compat_props, pc_compat_2_5, pc_compat_2_5_len);
  446. }
  447. DEFINE_Q35_MACHINE(v2_5, "pc-q35-2.5", NULL,
  448. pc_q35_2_5_machine_options);
  449. static void pc_q35_2_4_machine_options(MachineClass *m)
  450. {
  451. PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
  452. pc_q35_2_5_machine_options(m);
  453. m->hw_version = "2.4.0";
  454. pcmc->broken_reserved_end = true;
  455. compat_props_add(m->compat_props, hw_compat_2_4, hw_compat_2_4_len);
  456. compat_props_add(m->compat_props, pc_compat_2_4, pc_compat_2_4_len);
  457. }
  458. DEFINE_Q35_MACHINE(v2_4, "pc-q35-2.4", NULL,
  459. pc_q35_2_4_machine_options);