1 /* 2 * virtio ccw machine 3 * 4 * Copyright 2012, 2020 IBM Corp. 5 * Copyright (c) 2009 Alexander Graf <agraf@suse.de> 6 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> 7 * Janosch Frank <frankja@linux.ibm.com> 8 * 9 * This work is licensed under the terms of the GNU GPL, version 2 or (at 10 * your option) any later version. See the COPYING file in the top-level 11 * directory. 12 */ 13 14 #include "qemu/osdep.h" 15 #include "qapi/error.h" 16 #include "exec/ram_addr.h" 17 #include "hw/s390x/s390-virtio-hcall.h" 18 #include "hw/s390x/sclp.h" 19 #include "hw/s390x/s390_flic.h" 20 #include "hw/s390x/ioinst.h" 21 #include "hw/s390x/css.h" 22 #include "virtio-ccw.h" 23 #include "qemu/config-file.h" 24 #include "qemu/ctype.h" 25 #include "qemu/error-report.h" 26 #include "qemu/option.h" 27 #include "qemu/qemu-print.h" 28 #include "qemu/units.h" 29 #include "hw/s390x/s390-pci-bus.h" 30 #include "sysemu/reset.h" 31 #include "hw/s390x/storage-keys.h" 32 #include "hw/s390x/storage-attributes.h" 33 #include "hw/s390x/event-facility.h" 34 #include "ipl.h" 35 #include "hw/s390x/s390-virtio-ccw.h" 36 #include "hw/s390x/css-bridge.h" 37 #include "hw/s390x/ap-bridge.h" 38 #include "migration/register.h" 39 #include "cpu_models.h" 40 #include "hw/nmi.h" 41 #include "hw/qdev-properties.h" 42 #include "hw/s390x/tod.h" 43 #include "sysemu/sysemu.h" 44 #include "sysemu/cpus.h" 45 #include "target/s390x/kvm/pv.h" 46 #include "migration/blocker.h" 47 #include "qapi/visitor.h" 48 #include "hw/s390x/cpu-topology.h" 49 50 static Error *pv_mig_blocker; 51 52 S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) 53 { 54 static MachineState *ms; 55 56 if (!ms) { 57 ms = MACHINE(qdev_get_machine()); 58 g_assert(ms->possible_cpus); 59 } 60 61 /* CPU address corresponds to the core_id and the index */ 62 if (cpu_addr >= ms->possible_cpus->len) { 63 return NULL; 64 } 65 return S390_CPU(ms->possible_cpus->cpus[cpu_addr].cpu); 66 } 67 68 static S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id, 69 Error **errp) 70 { 71 S390CPU *cpu = S390_CPU(object_new(typename)); 72 S390CPU *ret = NULL; 73 74 if (!object_property_set_int(OBJECT(cpu), "core-id", core_id, errp)) { 75 goto out; 76 } 77 if (!qdev_realize(DEVICE(cpu), NULL, errp)) { 78 goto out; 79 } 80 ret = cpu; 81 82 out: 83 object_unref(OBJECT(cpu)); 84 return ret; 85 } 86 87 static void s390_init_cpus(MachineState *machine) 88 { 89 MachineClass *mc = MACHINE_GET_CLASS(machine); 90 S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); 91 int i; 92 93 if (machine->smp.threads > s390mc->max_threads) { 94 error_report("S390 does not support more than %d threads.", 95 s390mc->max_threads); 96 exit(1); 97 } 98 99 /* initialize possible_cpus */ 100 mc->possible_cpu_arch_ids(machine); 101 102 for (i = 0; i < machine->smp.cpus; i++) { 103 s390x_new_cpu(machine->cpu_type, i, &error_fatal); 104 } 105 } 106 107 static const char *const reset_dev_types[] = { 108 TYPE_VIRTUAL_CSS_BRIDGE, 109 "s390-sclp-event-facility", 110 "s390-flic", 111 "diag288", 112 TYPE_S390_PCI_HOST_BRIDGE, 113 TYPE_AP_BRIDGE, 114 }; 115 116 static void subsystem_reset(void) 117 { 118 DeviceState *dev; 119 int i; 120 121 /* 122 * ISM firmware is sensitive to unexpected changes to the IOMMU, which can 123 * occur during reset of the vfio-pci device (unmap of entire aperture). 124 * Ensure any passthrough ISM devices are reset now, while CPUs are paused 125 * but before vfio-pci cleanup occurs. 126 */ 127 s390_pci_ism_reset(); 128 129 for (i = 0; i < ARRAY_SIZE(reset_dev_types); i++) { 130 dev = DEVICE(object_resolve_path_type("", reset_dev_types[i], NULL)); 131 if (dev) { 132 device_cold_reset(dev); 133 } 134 } 135 if (s390_has_topology()) { 136 s390_topology_reset(); 137 } 138 } 139 140 static int virtio_ccw_hcall_notify(const uint64_t *args) 141 { 142 uint64_t subch_id = args[0]; 143 uint64_t queue = args[1]; 144 SubchDev *sch; 145 int cssid, ssid, schid, m; 146 147 if (ioinst_disassemble_sch_ident(subch_id, &m, &cssid, &ssid, &schid)) { 148 return -EINVAL; 149 } 150 sch = css_find_subch(m, cssid, ssid, schid); 151 if (!sch || !css_subch_visible(sch)) { 152 return -EINVAL; 153 } 154 if (queue >= VIRTIO_QUEUE_MAX) { 155 return -EINVAL; 156 } 157 virtio_queue_notify(virtio_ccw_get_vdev(sch), queue); 158 return 0; 159 160 } 161 162 static int virtio_ccw_hcall_early_printk(const uint64_t *args) 163 { 164 uint64_t mem = args[0]; 165 MachineState *ms = MACHINE(qdev_get_machine()); 166 167 if (mem < ms->ram_size) { 168 /* Early printk */ 169 return 0; 170 } 171 return -EINVAL; 172 } 173 174 static void virtio_ccw_register_hcalls(void) 175 { 176 s390_register_virtio_hypercall(KVM_S390_VIRTIO_CCW_NOTIFY, 177 virtio_ccw_hcall_notify); 178 /* Tolerate early printk. */ 179 s390_register_virtio_hypercall(KVM_S390_VIRTIO_NOTIFY, 180 virtio_ccw_hcall_early_printk); 181 } 182 183 static void s390_memory_init(MemoryRegion *ram) 184 { 185 MemoryRegion *sysmem = get_system_memory(); 186 187 /* allocate RAM for core */ 188 memory_region_add_subregion(sysmem, 0, ram); 189 190 /* 191 * Configure the maximum page size. As no memory devices were created 192 * yet, this is the page size of initial memory only. 193 */ 194 s390_set_max_pagesize(qemu_maxrampagesize(), &error_fatal); 195 /* Initialize storage key device */ 196 s390_skeys_init(); 197 /* Initialize storage attributes device */ 198 s390_stattrib_init(); 199 } 200 201 static void s390_init_ipl_dev(const char *kernel_filename, 202 const char *kernel_cmdline, 203 const char *initrd_filename, const char *firmware, 204 const char *netboot_fw, bool enforce_bios) 205 { 206 Object *new = object_new(TYPE_S390_IPL); 207 DeviceState *dev = DEVICE(new); 208 char *netboot_fw_prop; 209 210 if (kernel_filename) { 211 qdev_prop_set_string(dev, "kernel", kernel_filename); 212 } 213 if (initrd_filename) { 214 qdev_prop_set_string(dev, "initrd", initrd_filename); 215 } 216 qdev_prop_set_string(dev, "cmdline", kernel_cmdline); 217 qdev_prop_set_string(dev, "firmware", firmware); 218 qdev_prop_set_bit(dev, "enforce_bios", enforce_bios); 219 netboot_fw_prop = object_property_get_str(new, "netboot_fw", &error_abort); 220 if (!strlen(netboot_fw_prop)) { 221 qdev_prop_set_string(dev, "netboot_fw", netboot_fw); 222 } 223 g_free(netboot_fw_prop); 224 object_property_add_child(qdev_get_machine(), TYPE_S390_IPL, 225 new); 226 object_unref(new); 227 qdev_realize(dev, NULL, &error_fatal); 228 } 229 230 static void s390_create_virtio_net(BusState *bus, const char *name) 231 { 232 int i; 233 234 for (i = 0; i < nb_nics; i++) { 235 NICInfo *nd = &nd_table[i]; 236 DeviceState *dev; 237 238 qemu_check_nic_model(nd, "virtio"); 239 240 dev = qdev_new(name); 241 qdev_set_nic_properties(dev, nd); 242 qdev_realize_and_unref(dev, bus, &error_fatal); 243 } 244 } 245 246 static void s390_create_sclpconsole(const char *type, Chardev *chardev) 247 { 248 DeviceState *dev; 249 250 dev = qdev_new(type); 251 qdev_prop_set_chr(dev, "chardev", chardev); 252 qdev_realize_and_unref(dev, sclp_get_event_facility_bus(), &error_fatal); 253 } 254 255 static void ccw_init(MachineState *machine) 256 { 257 MachineClass *mc = MACHINE_GET_CLASS(machine); 258 int ret; 259 VirtualCssBus *css_bus; 260 DeviceState *dev; 261 262 s390_sclp_init(); 263 /* init memory + setup max page size. Required for the CPU model */ 264 s390_memory_init(machine->ram); 265 266 /* init CPUs (incl. CPU model) early so s390_has_feature() works */ 267 s390_init_cpus(machine); 268 269 /* Need CPU model to be determined before we can set up PV */ 270 s390_pv_init(machine->cgs, &error_fatal); 271 272 s390_flic_init(); 273 274 /* init the SIGP facility */ 275 s390_init_sigp(); 276 277 /* create AP bridge and bus(es) */ 278 s390_init_ap(); 279 280 /* get a BUS */ 281 css_bus = virtual_css_bus_init(); 282 s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline, 283 machine->initrd_filename, 284 machine->firmware ?: "s390-ccw.img", 285 "s390-netboot.img", true); 286 287 dev = qdev_new(TYPE_S390_PCI_HOST_BRIDGE); 288 object_property_add_child(qdev_get_machine(), TYPE_S390_PCI_HOST_BRIDGE, 289 OBJECT(dev)); 290 sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); 291 292 /* register hypercalls */ 293 virtio_ccw_register_hcalls(); 294 295 s390_enable_css_support(s390_cpu_addr2state(0)); 296 297 ret = css_create_css_image(VIRTUAL_CSSID, true); 298 299 assert(ret == 0); 300 if (css_migration_enabled()) { 301 css_register_vmstate(); 302 } 303 304 /* Create VirtIO network adapters */ 305 s390_create_virtio_net(BUS(css_bus), mc->default_nic); 306 307 /* init consoles */ 308 if (serial_hd(0)) { 309 s390_create_sclpconsole("sclpconsole", serial_hd(0)); 310 } 311 if (serial_hd(1)) { 312 s390_create_sclpconsole("sclplmconsole", serial_hd(1)); 313 } 314 315 /* init the TOD clock */ 316 s390_init_tod(); 317 } 318 319 static void s390_cpu_plug(HotplugHandler *hotplug_dev, 320 DeviceState *dev, Error **errp) 321 { 322 MachineState *ms = MACHINE(hotplug_dev); 323 S390CPU *cpu = S390_CPU(dev); 324 ERRP_GUARD(); 325 326 g_assert(!ms->possible_cpus->cpus[cpu->env.core_id].cpu); 327 ms->possible_cpus->cpus[cpu->env.core_id].cpu = OBJECT(dev); 328 329 if (s390_has_topology()) { 330 s390_topology_setup_cpu(ms, cpu, errp); 331 if (*errp) { 332 return; 333 } 334 } 335 336 if (dev->hotplugged) { 337 raise_irq_cpu_hotplug(); 338 } 339 } 340 341 static inline void s390_do_cpu_ipl(CPUState *cs, run_on_cpu_data arg) 342 { 343 S390CPU *cpu = S390_CPU(cs); 344 345 s390_ipl_prepare_cpu(cpu); 346 s390_cpu_set_state(S390_CPU_STATE_OPERATING, cpu); 347 } 348 349 static void s390_machine_unprotect(S390CcwMachineState *ms) 350 { 351 if (!s390_pv_vm_try_disable_async(ms)) { 352 s390_pv_vm_disable(); 353 } 354 ms->pv = false; 355 migrate_del_blocker(&pv_mig_blocker); 356 ram_block_discard_disable(false); 357 } 358 359 static int s390_machine_protect(S390CcwMachineState *ms) 360 { 361 Error *local_err = NULL; 362 int rc; 363 364 /* 365 * Discarding of memory in RAM blocks does not work as expected with 366 * protected VMs. Sharing and unsharing pages would be required. Disable 367 * it for now, until until we have a solution to make at least Linux 368 * guests either support it (e.g., virtio-balloon) or fail gracefully. 369 */ 370 rc = ram_block_discard_disable(true); 371 if (rc) { 372 error_report("protected VMs: cannot disable RAM discard"); 373 return rc; 374 } 375 376 error_setg(&pv_mig_blocker, 377 "protected VMs are currently not migratable."); 378 rc = migrate_add_blocker(&pv_mig_blocker, &local_err); 379 if (rc) { 380 ram_block_discard_disable(false); 381 error_report_err(local_err); 382 return rc; 383 } 384 385 /* Create SE VM */ 386 rc = s390_pv_vm_enable(); 387 if (rc) { 388 ram_block_discard_disable(false); 389 migrate_del_blocker(&pv_mig_blocker); 390 return rc; 391 } 392 393 ms->pv = true; 394 395 /* Will return 0 if API is not available since it's not vital */ 396 rc = s390_pv_query_info(); 397 if (rc) { 398 goto out_err; 399 } 400 401 /* Set SE header and unpack */ 402 rc = s390_ipl_prepare_pv_header(&local_err); 403 if (rc) { 404 goto out_err; 405 } 406 407 /* Decrypt image */ 408 rc = s390_ipl_pv_unpack(); 409 if (rc) { 410 goto out_err; 411 } 412 413 /* Verify integrity */ 414 rc = s390_pv_verify(); 415 if (rc) { 416 goto out_err; 417 } 418 return rc; 419 420 out_err: 421 if (local_err) { 422 error_report_err(local_err); 423 } 424 s390_machine_unprotect(ms); 425 return rc; 426 } 427 428 static void s390_pv_prepare_reset(S390CcwMachineState *ms) 429 { 430 CPUState *cs; 431 432 if (!s390_is_pv()) { 433 return; 434 } 435 /* Unsharing requires all cpus to be stopped */ 436 CPU_FOREACH(cs) { 437 s390_cpu_set_state(S390_CPU_STATE_STOPPED, S390_CPU(cs)); 438 } 439 s390_pv_unshare(); 440 s390_pv_prep_reset(); 441 } 442 443 static void s390_machine_reset(MachineState *machine, ShutdownCause reason) 444 { 445 S390CcwMachineState *ms = S390_CCW_MACHINE(machine); 446 enum s390_reset reset_type; 447 CPUState *cs, *t; 448 S390CPU *cpu; 449 450 /* get the reset parameters, reset them once done */ 451 s390_ipl_get_reset_request(&cs, &reset_type); 452 453 /* all CPUs are paused and synchronized at this point */ 454 s390_cmma_reset(); 455 456 cpu = S390_CPU(cs); 457 458 switch (reset_type) { 459 case S390_RESET_EXTERNAL: 460 case S390_RESET_REIPL: 461 /* 462 * Reset the subsystem which includes a AP reset. If a PV 463 * guest had APQNs attached the AP reset is a prerequisite to 464 * unprotecting since the UV checks if all APQNs are reset. 465 */ 466 subsystem_reset(); 467 if (s390_is_pv()) { 468 s390_machine_unprotect(ms); 469 } 470 471 /* 472 * Device reset includes CPU clear resets so this has to be 473 * done AFTER the unprotect call above. 474 */ 475 qemu_devices_reset(reason); 476 s390_crypto_reset(); 477 478 /* configure and start the ipl CPU only */ 479 run_on_cpu(cs, s390_do_cpu_ipl, RUN_ON_CPU_NULL); 480 break; 481 case S390_RESET_MODIFIED_CLEAR: 482 /* 483 * Subsystem reset needs to be done before we unshare memory 484 * and lose access to VIRTIO structures in guest memory. 485 */ 486 subsystem_reset(); 487 s390_crypto_reset(); 488 s390_pv_prepare_reset(ms); 489 CPU_FOREACH(t) { 490 run_on_cpu(t, s390_do_cpu_full_reset, RUN_ON_CPU_NULL); 491 } 492 run_on_cpu(cs, s390_do_cpu_load_normal, RUN_ON_CPU_NULL); 493 break; 494 case S390_RESET_LOAD_NORMAL: 495 /* 496 * Subsystem reset needs to be done before we unshare memory 497 * and lose access to VIRTIO structures in guest memory. 498 */ 499 subsystem_reset(); 500 s390_pv_prepare_reset(ms); 501 CPU_FOREACH(t) { 502 if (t == cs) { 503 continue; 504 } 505 run_on_cpu(t, s390_do_cpu_reset, RUN_ON_CPU_NULL); 506 } 507 run_on_cpu(cs, s390_do_cpu_initial_reset, RUN_ON_CPU_NULL); 508 run_on_cpu(cs, s390_do_cpu_load_normal, RUN_ON_CPU_NULL); 509 break; 510 case S390_RESET_PV: /* Subcode 10 */ 511 subsystem_reset(); 512 s390_crypto_reset(); 513 514 CPU_FOREACH(t) { 515 if (t == cs) { 516 continue; 517 } 518 run_on_cpu(t, s390_do_cpu_full_reset, RUN_ON_CPU_NULL); 519 } 520 run_on_cpu(cs, s390_do_cpu_reset, RUN_ON_CPU_NULL); 521 522 if (s390_machine_protect(ms)) { 523 s390_pv_inject_reset_error(cs); 524 /* 525 * Continue after the diag308 so the guest knows something 526 * went wrong. 527 */ 528 s390_cpu_set_state(S390_CPU_STATE_OPERATING, cpu); 529 return; 530 } 531 532 run_on_cpu(cs, s390_do_cpu_load_normal, RUN_ON_CPU_NULL); 533 break; 534 default: 535 g_assert_not_reached(); 536 } 537 538 CPU_FOREACH(t) { 539 run_on_cpu(t, s390_do_cpu_set_diag318, RUN_ON_CPU_HOST_ULONG(0)); 540 } 541 s390_ipl_clear_reset_request(); 542 } 543 544 static void s390_machine_device_plug(HotplugHandler *hotplug_dev, 545 DeviceState *dev, Error **errp) 546 { 547 if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { 548 s390_cpu_plug(hotplug_dev, dev, errp); 549 } 550 } 551 552 static void s390_machine_device_unplug_request(HotplugHandler *hotplug_dev, 553 DeviceState *dev, Error **errp) 554 { 555 if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { 556 error_setg(errp, "CPU hot unplug not supported on this machine"); 557 return; 558 } 559 } 560 561 static CpuInstanceProperties s390_cpu_index_to_props(MachineState *ms, 562 unsigned cpu_index) 563 { 564 MachineClass *mc = MACHINE_GET_CLASS(ms); 565 const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids(ms); 566 567 assert(cpu_index < possible_cpus->len); 568 return possible_cpus->cpus[cpu_index].props; 569 } 570 571 static const CPUArchIdList *s390_possible_cpu_arch_ids(MachineState *ms) 572 { 573 int i; 574 unsigned int max_cpus = ms->smp.max_cpus; 575 576 if (ms->possible_cpus) { 577 g_assert(ms->possible_cpus && ms->possible_cpus->len == max_cpus); 578 return ms->possible_cpus; 579 } 580 581 ms->possible_cpus = g_malloc0(sizeof(CPUArchIdList) + 582 sizeof(CPUArchId) * max_cpus); 583 ms->possible_cpus->len = max_cpus; 584 for (i = 0; i < ms->possible_cpus->len; i++) { 585 CpuInstanceProperties *props = &ms->possible_cpus->cpus[i].props; 586 587 ms->possible_cpus->cpus[i].type = ms->cpu_type; 588 ms->possible_cpus->cpus[i].vcpus_count = 1; 589 ms->possible_cpus->cpus[i].arch_id = i; 590 591 props->has_core_id = true; 592 props->core_id = i; 593 props->has_socket_id = true; 594 props->socket_id = s390_std_socket(i, &ms->smp); 595 props->has_book_id = true; 596 props->book_id = s390_std_book(i, &ms->smp); 597 props->has_drawer_id = true; 598 props->drawer_id = s390_std_drawer(i, &ms->smp); 599 } 600 601 return ms->possible_cpus; 602 } 603 604 static HotplugHandler *s390_get_hotplug_handler(MachineState *machine, 605 DeviceState *dev) 606 { 607 if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { 608 return HOTPLUG_HANDLER(machine); 609 } 610 return NULL; 611 } 612 613 static void s390_nmi(NMIState *n, int cpu_index, Error **errp) 614 { 615 CPUState *cs = qemu_get_cpu(cpu_index); 616 617 s390_cpu_restart(S390_CPU(cs)); 618 } 619 620 static ram_addr_t s390_fixup_ram_size(ram_addr_t sz) 621 { 622 /* same logic as in sclp.c */ 623 int increment_size = 20; 624 ram_addr_t newsz; 625 626 while ((sz >> increment_size) > MAX_STORAGE_INCREMENTS) { 627 increment_size++; 628 } 629 newsz = sz >> increment_size << increment_size; 630 631 if (sz != newsz) { 632 qemu_printf("Ram size %" PRIu64 "MB was fixed up to %" PRIu64 633 "MB to match machine restrictions. Consider updating " 634 "the guest definition.\n", (uint64_t) (sz / MiB), 635 (uint64_t) (newsz / MiB)); 636 } 637 return newsz; 638 } 639 640 static inline bool machine_get_aes_key_wrap(Object *obj, Error **errp) 641 { 642 S390CcwMachineState *ms = S390_CCW_MACHINE(obj); 643 644 return ms->aes_key_wrap; 645 } 646 647 static inline void machine_set_aes_key_wrap(Object *obj, bool value, 648 Error **errp) 649 { 650 S390CcwMachineState *ms = S390_CCW_MACHINE(obj); 651 652 ms->aes_key_wrap = value; 653 } 654 655 static inline bool machine_get_dea_key_wrap(Object *obj, Error **errp) 656 { 657 S390CcwMachineState *ms = S390_CCW_MACHINE(obj); 658 659 return ms->dea_key_wrap; 660 } 661 662 static inline void machine_set_dea_key_wrap(Object *obj, bool value, 663 Error **errp) 664 { 665 S390CcwMachineState *ms = S390_CCW_MACHINE(obj); 666 667 ms->dea_key_wrap = value; 668 } 669 670 static S390CcwMachineClass *current_mc; 671 672 /* 673 * Get the class of the s390-ccw-virtio machine that is currently in use. 674 * Note: libvirt is using the "none" machine to probe for the features of the 675 * host CPU, so in case this is called with the "none" machine, the function 676 * returns the TYPE_S390_CCW_MACHINE base class. In this base class, all the 677 * various "*_allowed" variables are enabled, so that the *_allowed() wrappers 678 * below return the correct default value for the "none" machine. 679 * 680 * Attention! Do *not* add additional new wrappers for CPU features (e.g. like 681 * the ri_allowed() wrapper) via this mechanism anymore. CPU features should 682 * be handled via the CPU models, i.e. checking with cpu_model_allowed() during 683 * CPU initialization and s390_has_feat() later should be sufficient. 684 */ 685 static S390CcwMachineClass *get_machine_class(void) 686 { 687 if (unlikely(!current_mc)) { 688 /* 689 * No s390 ccw machine was instantiated, we are likely to 690 * be called for the 'none' machine. The properties will 691 * have their after-initialization values. 692 */ 693 current_mc = S390_CCW_MACHINE_CLASS( 694 object_class_by_name(TYPE_S390_CCW_MACHINE)); 695 } 696 return current_mc; 697 } 698 699 bool ri_allowed(void) 700 { 701 return get_machine_class()->ri_allowed; 702 } 703 704 bool cpu_model_allowed(void) 705 { 706 return get_machine_class()->cpu_model_allowed; 707 } 708 709 bool hpage_1m_allowed(void) 710 { 711 return get_machine_class()->hpage_1m_allowed; 712 } 713 714 static void machine_get_loadparm(Object *obj, Visitor *v, 715 const char *name, void *opaque, 716 Error **errp) 717 { 718 S390CcwMachineState *ms = S390_CCW_MACHINE(obj); 719 char *str = g_strndup((char *) ms->loadparm, sizeof(ms->loadparm)); 720 721 visit_type_str(v, name, &str, errp); 722 g_free(str); 723 } 724 725 static void machine_set_loadparm(Object *obj, Visitor *v, 726 const char *name, void *opaque, 727 Error **errp) 728 { 729 S390CcwMachineState *ms = S390_CCW_MACHINE(obj); 730 char *val; 731 int i; 732 733 if (!visit_type_str(v, name, &val, errp)) { 734 return; 735 } 736 737 for (i = 0; i < sizeof(ms->loadparm) && val[i]; i++) { 738 uint8_t c = qemu_toupper(val[i]); /* mimic HMC */ 739 740 if (('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || (c == '.') || 741 (c == ' ')) { 742 ms->loadparm[i] = c; 743 } else { 744 error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%02x)", 745 c, c); 746 return; 747 } 748 } 749 750 for (; i < sizeof(ms->loadparm); i++) { 751 ms->loadparm[i] = ' '; /* pad right with spaces */ 752 } 753 } 754 755 static void ccw_machine_class_init(ObjectClass *oc, void *data) 756 { 757 MachineClass *mc = MACHINE_CLASS(oc); 758 NMIClass *nc = NMI_CLASS(oc); 759 HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); 760 S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); 761 762 s390mc->ri_allowed = true; 763 s390mc->cpu_model_allowed = true; 764 s390mc->css_migration_enabled = true; 765 s390mc->hpage_1m_allowed = true; 766 s390mc->max_threads = 1; 767 mc->init = ccw_init; 768 mc->reset = s390_machine_reset; 769 mc->block_default_type = IF_VIRTIO; 770 mc->no_cdrom = 1; 771 mc->no_floppy = 1; 772 mc->no_parallel = 1; 773 mc->no_sdcard = 1; 774 mc->max_cpus = S390_MAX_CPUS; 775 mc->has_hotpluggable_cpus = true; 776 mc->smp_props.books_supported = true; 777 mc->smp_props.drawers_supported = true; 778 assert(!mc->get_hotplug_handler); 779 mc->get_hotplug_handler = s390_get_hotplug_handler; 780 mc->cpu_index_to_instance_props = s390_cpu_index_to_props; 781 mc->possible_cpu_arch_ids = s390_possible_cpu_arch_ids; 782 /* it is overridden with 'host' cpu *in kvm_arch_init* */ 783 mc->default_cpu_type = S390_CPU_TYPE_NAME("qemu"); 784 hc->plug = s390_machine_device_plug; 785 hc->unplug_request = s390_machine_device_unplug_request; 786 nc->nmi_monitor_handler = s390_nmi; 787 mc->default_ram_id = "s390.ram"; 788 mc->default_nic = "virtio-net-ccw"; 789 790 object_class_property_add_bool(oc, "aes-key-wrap", 791 machine_get_aes_key_wrap, 792 machine_set_aes_key_wrap); 793 object_class_property_set_description(oc, "aes-key-wrap", 794 "enable/disable AES key wrapping using the CPACF wrapping key"); 795 796 object_class_property_add_bool(oc, "dea-key-wrap", 797 machine_get_dea_key_wrap, 798 machine_set_dea_key_wrap); 799 object_class_property_set_description(oc, "dea-key-wrap", 800 "enable/disable DEA key wrapping using the CPACF wrapping key"); 801 802 object_class_property_add(oc, "loadparm", "loadparm", 803 machine_get_loadparm, machine_set_loadparm, 804 NULL, NULL); 805 object_class_property_set_description(oc, "loadparm", 806 "Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted" 807 " to upper case) to pass to machine loader, boot manager," 808 " and guest kernel"); 809 } 810 811 static inline void s390_machine_initfn(Object *obj) 812 { 813 S390CcwMachineState *ms = S390_CCW_MACHINE(obj); 814 815 ms->aes_key_wrap = true; 816 ms->dea_key_wrap = true; 817 } 818 819 static const TypeInfo ccw_machine_info = { 820 .name = TYPE_S390_CCW_MACHINE, 821 .parent = TYPE_MACHINE, 822 .abstract = true, 823 .instance_size = sizeof(S390CcwMachineState), 824 .instance_init = s390_machine_initfn, 825 .class_size = sizeof(S390CcwMachineClass), 826 .class_init = ccw_machine_class_init, 827 .interfaces = (InterfaceInfo[]) { 828 { TYPE_NMI }, 829 { TYPE_HOTPLUG_HANDLER}, 830 { } 831 }, 832 }; 833 834 bool css_migration_enabled(void) 835 { 836 return get_machine_class()->css_migration_enabled; 837 } 838 839 #define DEFINE_CCW_MACHINE(suffix, verstr, latest) \ 840 static void ccw_machine_##suffix##_class_init(ObjectClass *oc, \ 841 void *data) \ 842 { \ 843 MachineClass *mc = MACHINE_CLASS(oc); \ 844 ccw_machine_##suffix##_class_options(mc); \ 845 mc->desc = "Virtual s390x machine (version " verstr ")"; \ 846 if (latest) { \ 847 mc->alias = "s390-ccw-virtio"; \ 848 mc->is_default = true; \ 849 } \ 850 } \ 851 static void ccw_machine_##suffix##_instance_init(Object *obj) \ 852 { \ 853 MachineState *machine = MACHINE(obj); \ 854 current_mc = S390_CCW_MACHINE_CLASS(MACHINE_GET_CLASS(machine)); \ 855 ccw_machine_##suffix##_instance_options(machine); \ 856 } \ 857 static const TypeInfo ccw_machine_##suffix##_info = { \ 858 .name = MACHINE_TYPE_NAME("s390-ccw-virtio-" verstr), \ 859 .parent = TYPE_S390_CCW_MACHINE, \ 860 .class_init = ccw_machine_##suffix##_class_init, \ 861 .instance_init = ccw_machine_##suffix##_instance_init, \ 862 }; \ 863 static void ccw_machine_register_##suffix(void) \ 864 { \ 865 type_register_static(&ccw_machine_##suffix##_info); \ 866 } \ 867 type_init(ccw_machine_register_##suffix) 868 869 static void ccw_machine_9_0_instance_options(MachineState *machine) 870 { 871 } 872 873 static void ccw_machine_9_0_class_options(MachineClass *mc) 874 { 875 } 876 DEFINE_CCW_MACHINE(9_0, "9.0", true); 877 878 static void ccw_machine_8_2_instance_options(MachineState *machine) 879 { 880 ccw_machine_9_0_instance_options(machine); 881 } 882 883 static void ccw_machine_8_2_class_options(MachineClass *mc) 884 { 885 ccw_machine_9_0_class_options(mc); 886 compat_props_add(mc->compat_props, hw_compat_8_2, hw_compat_8_2_len); 887 } 888 DEFINE_CCW_MACHINE(8_2, "8.2", false); 889 890 static void ccw_machine_8_1_instance_options(MachineState *machine) 891 { 892 ccw_machine_8_2_instance_options(machine); 893 } 894 895 static void ccw_machine_8_1_class_options(MachineClass *mc) 896 { 897 ccw_machine_8_2_class_options(mc); 898 compat_props_add(mc->compat_props, hw_compat_8_1, hw_compat_8_1_len); 899 mc->smp_props.drawers_supported = false; 900 mc->smp_props.books_supported = false; 901 } 902 DEFINE_CCW_MACHINE(8_1, "8.1", false); 903 904 static void ccw_machine_8_0_instance_options(MachineState *machine) 905 { 906 ccw_machine_8_1_instance_options(machine); 907 } 908 909 static void ccw_machine_8_0_class_options(MachineClass *mc) 910 { 911 ccw_machine_8_1_class_options(mc); 912 compat_props_add(mc->compat_props, hw_compat_8_0, hw_compat_8_0_len); 913 } 914 DEFINE_CCW_MACHINE(8_0, "8.0", false); 915 916 static void ccw_machine_7_2_instance_options(MachineState *machine) 917 { 918 ccw_machine_8_0_instance_options(machine); 919 } 920 921 static void ccw_machine_7_2_class_options(MachineClass *mc) 922 { 923 ccw_machine_8_0_class_options(mc); 924 compat_props_add(mc->compat_props, hw_compat_7_2, hw_compat_7_2_len); 925 } 926 DEFINE_CCW_MACHINE(7_2, "7.2", false); 927 928 static void ccw_machine_7_1_instance_options(MachineState *machine) 929 { 930 static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V7_1 }; 931 932 ccw_machine_7_2_instance_options(machine); 933 s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAIE); 934 s390_set_qemu_cpu_model(0x8561, 15, 1, qemu_cpu_feat); 935 } 936 937 static void ccw_machine_7_1_class_options(MachineClass *mc) 938 { 939 S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); 940 static GlobalProperty compat[] = { 941 { TYPE_S390_PCI_DEVICE, "interpret", "off", }, 942 { TYPE_S390_PCI_DEVICE, "forwarding-assist", "off", }, 943 }; 944 945 ccw_machine_7_2_class_options(mc); 946 compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len); 947 compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); 948 s390mc->max_threads = S390_MAX_CPUS; 949 } 950 DEFINE_CCW_MACHINE(7_1, "7.1", false); 951 952 static void ccw_machine_7_0_instance_options(MachineState *machine) 953 { 954 static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V7_0 }; 955 956 ccw_machine_7_1_instance_options(machine); 957 s390_set_qemu_cpu_model(0x8561, 15, 1, qemu_cpu_feat); 958 } 959 960 static void ccw_machine_7_0_class_options(MachineClass *mc) 961 { 962 ccw_machine_7_1_class_options(mc); 963 compat_props_add(mc->compat_props, hw_compat_7_0, hw_compat_7_0_len); 964 } 965 DEFINE_CCW_MACHINE(7_0, "7.0", false); 966 967 static void ccw_machine_6_2_instance_options(MachineState *machine) 968 { 969 static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V6_2 }; 970 971 ccw_machine_7_0_instance_options(machine); 972 s390_set_qemu_cpu_model(0x3906, 14, 2, qemu_cpu_feat); 973 } 974 975 static void ccw_machine_6_2_class_options(MachineClass *mc) 976 { 977 ccw_machine_7_0_class_options(mc); 978 compat_props_add(mc->compat_props, hw_compat_6_2, hw_compat_6_2_len); 979 } 980 DEFINE_CCW_MACHINE(6_2, "6.2", false); 981 982 static void ccw_machine_6_1_instance_options(MachineState *machine) 983 { 984 ccw_machine_6_2_instance_options(machine); 985 s390_cpudef_featoff_greater(16, 1, S390_FEAT_NNPA); 986 s390_cpudef_featoff_greater(16, 1, S390_FEAT_VECTOR_PACKED_DECIMAL_ENH2); 987 s390_cpudef_featoff_greater(16, 1, S390_FEAT_BEAR_ENH); 988 s390_cpudef_featoff_greater(16, 1, S390_FEAT_RDP); 989 s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAI); 990 } 991 992 static void ccw_machine_6_1_class_options(MachineClass *mc) 993 { 994 ccw_machine_6_2_class_options(mc); 995 compat_props_add(mc->compat_props, hw_compat_6_1, hw_compat_6_1_len); 996 mc->smp_props.prefer_sockets = true; 997 } 998 DEFINE_CCW_MACHINE(6_1, "6.1", false); 999 1000 static void ccw_machine_6_0_instance_options(MachineState *machine) 1001 { 1002 static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V6_0 }; 1003 1004 ccw_machine_6_1_instance_options(machine); 1005 s390_set_qemu_cpu_model(0x2964, 13, 2, qemu_cpu_feat); 1006 } 1007 1008 static void ccw_machine_6_0_class_options(MachineClass *mc) 1009 { 1010 ccw_machine_6_1_class_options(mc); 1011 compat_props_add(mc->compat_props, hw_compat_6_0, hw_compat_6_0_len); 1012 } 1013 DEFINE_CCW_MACHINE(6_0, "6.0", false); 1014 1015 static void ccw_machine_5_2_instance_options(MachineState *machine) 1016 { 1017 ccw_machine_6_0_instance_options(machine); 1018 } 1019 1020 static void ccw_machine_5_2_class_options(MachineClass *mc) 1021 { 1022 ccw_machine_6_0_class_options(mc); 1023 compat_props_add(mc->compat_props, hw_compat_5_2, hw_compat_5_2_len); 1024 } 1025 DEFINE_CCW_MACHINE(5_2, "5.2", false); 1026 1027 static void ccw_machine_5_1_instance_options(MachineState *machine) 1028 { 1029 ccw_machine_5_2_instance_options(machine); 1030 } 1031 1032 static void ccw_machine_5_1_class_options(MachineClass *mc) 1033 { 1034 ccw_machine_5_2_class_options(mc); 1035 compat_props_add(mc->compat_props, hw_compat_5_1, hw_compat_5_1_len); 1036 } 1037 DEFINE_CCW_MACHINE(5_1, "5.1", false); 1038 1039 static void ccw_machine_5_0_instance_options(MachineState *machine) 1040 { 1041 ccw_machine_5_1_instance_options(machine); 1042 } 1043 1044 static void ccw_machine_5_0_class_options(MachineClass *mc) 1045 { 1046 ccw_machine_5_1_class_options(mc); 1047 compat_props_add(mc->compat_props, hw_compat_5_0, hw_compat_5_0_len); 1048 } 1049 DEFINE_CCW_MACHINE(5_0, "5.0", false); 1050 1051 static void ccw_machine_4_2_instance_options(MachineState *machine) 1052 { 1053 ccw_machine_5_0_instance_options(machine); 1054 } 1055 1056 static void ccw_machine_4_2_class_options(MachineClass *mc) 1057 { 1058 ccw_machine_5_0_class_options(mc); 1059 mc->fixup_ram_size = s390_fixup_ram_size; 1060 compat_props_add(mc->compat_props, hw_compat_4_2, hw_compat_4_2_len); 1061 } 1062 DEFINE_CCW_MACHINE(4_2, "4.2", false); 1063 1064 static void ccw_machine_4_1_instance_options(MachineState *machine) 1065 { 1066 static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V4_1 }; 1067 ccw_machine_4_2_instance_options(machine); 1068 s390_set_qemu_cpu_model(0x2964, 13, 2, qemu_cpu_feat); 1069 } 1070 1071 static void ccw_machine_4_1_class_options(MachineClass *mc) 1072 { 1073 ccw_machine_4_2_class_options(mc); 1074 compat_props_add(mc->compat_props, hw_compat_4_1, hw_compat_4_1_len); 1075 } 1076 DEFINE_CCW_MACHINE(4_1, "4.1", false); 1077 1078 static void ccw_machine_4_0_instance_options(MachineState *machine) 1079 { 1080 static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V4_0 }; 1081 ccw_machine_4_1_instance_options(machine); 1082 s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat); 1083 } 1084 1085 static void ccw_machine_4_0_class_options(MachineClass *mc) 1086 { 1087 ccw_machine_4_1_class_options(mc); 1088 compat_props_add(mc->compat_props, hw_compat_4_0, hw_compat_4_0_len); 1089 } 1090 DEFINE_CCW_MACHINE(4_0, "4.0", false); 1091 1092 static void ccw_machine_3_1_instance_options(MachineState *machine) 1093 { 1094 static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V3_1 }; 1095 ccw_machine_4_0_instance_options(machine); 1096 s390_cpudef_featoff_greater(14, 1, S390_FEAT_MULTIPLE_EPOCH); 1097 s390_cpudef_group_featoff_greater(14, 1, S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF); 1098 s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat); 1099 } 1100 1101 static void ccw_machine_3_1_class_options(MachineClass *mc) 1102 { 1103 ccw_machine_4_0_class_options(mc); 1104 compat_props_add(mc->compat_props, hw_compat_3_1, hw_compat_3_1_len); 1105 } 1106 DEFINE_CCW_MACHINE(3_1, "3.1", false); 1107 1108 static void ccw_machine_3_0_instance_options(MachineState *machine) 1109 { 1110 ccw_machine_3_1_instance_options(machine); 1111 } 1112 1113 static void ccw_machine_3_0_class_options(MachineClass *mc) 1114 { 1115 S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); 1116 1117 s390mc->hpage_1m_allowed = false; 1118 ccw_machine_3_1_class_options(mc); 1119 compat_props_add(mc->compat_props, hw_compat_3_0, hw_compat_3_0_len); 1120 } 1121 DEFINE_CCW_MACHINE(3_0, "3.0", false); 1122 1123 static void ccw_machine_2_12_instance_options(MachineState *machine) 1124 { 1125 ccw_machine_3_0_instance_options(machine); 1126 s390_cpudef_featoff_greater(11, 1, S390_FEAT_PPA15); 1127 s390_cpudef_featoff_greater(11, 1, S390_FEAT_BPB); 1128 } 1129 1130 static void ccw_machine_2_12_class_options(MachineClass *mc) 1131 { 1132 ccw_machine_3_0_class_options(mc); 1133 compat_props_add(mc->compat_props, hw_compat_2_12, hw_compat_2_12_len); 1134 } 1135 DEFINE_CCW_MACHINE(2_12, "2.12", false); 1136 1137 static void ccw_machine_2_11_instance_options(MachineState *machine) 1138 { 1139 static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V2_11 }; 1140 ccw_machine_2_12_instance_options(machine); 1141 1142 /* before 2.12 we emulated the very first z900 */ 1143 s390_set_qemu_cpu_model(0x2064, 7, 1, qemu_cpu_feat); 1144 } 1145 1146 static void ccw_machine_2_11_class_options(MachineClass *mc) 1147 { 1148 static GlobalProperty compat[] = { 1149 { TYPE_SCLP_EVENT_FACILITY, "allow_all_mask_sizes", "off", }, 1150 }; 1151 1152 ccw_machine_2_12_class_options(mc); 1153 compat_props_add(mc->compat_props, hw_compat_2_11, hw_compat_2_11_len); 1154 compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); 1155 } 1156 DEFINE_CCW_MACHINE(2_11, "2.11", false); 1157 1158 static void ccw_machine_2_10_instance_options(MachineState *machine) 1159 { 1160 ccw_machine_2_11_instance_options(machine); 1161 } 1162 1163 static void ccw_machine_2_10_class_options(MachineClass *mc) 1164 { 1165 ccw_machine_2_11_class_options(mc); 1166 compat_props_add(mc->compat_props, hw_compat_2_10, hw_compat_2_10_len); 1167 } 1168 DEFINE_CCW_MACHINE(2_10, "2.10", false); 1169 1170 static void ccw_machine_2_9_instance_options(MachineState *machine) 1171 { 1172 ccw_machine_2_10_instance_options(machine); 1173 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ESOP); 1174 s390_cpudef_featoff_greater(12, 1, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2); 1175 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ZPCI); 1176 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_INT_SUPPRESSION); 1177 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_EVENT_NOTIFICATION); 1178 } 1179 1180 static void ccw_machine_2_9_class_options(MachineClass *mc) 1181 { 1182 S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); 1183 static GlobalProperty compat[] = { 1184 { TYPE_S390_STATTRIB, "migration-enabled", "off", }, 1185 }; 1186 1187 ccw_machine_2_10_class_options(mc); 1188 compat_props_add(mc->compat_props, hw_compat_2_9, hw_compat_2_9_len); 1189 compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); 1190 s390mc->css_migration_enabled = false; 1191 } 1192 DEFINE_CCW_MACHINE(2_9, "2.9", false); 1193 1194 static void ccw_machine_2_8_instance_options(MachineState *machine) 1195 { 1196 ccw_machine_2_9_instance_options(machine); 1197 } 1198 1199 static void ccw_machine_2_8_class_options(MachineClass *mc) 1200 { 1201 static GlobalProperty compat[] = { 1202 { TYPE_S390_FLIC_COMMON, "adapter_routes_max_batch", "64", }, 1203 }; 1204 1205 ccw_machine_2_9_class_options(mc); 1206 compat_props_add(mc->compat_props, hw_compat_2_8, hw_compat_2_8_len); 1207 compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); 1208 } 1209 DEFINE_CCW_MACHINE(2_8, "2.8", false); 1210 1211 static void ccw_machine_2_7_instance_options(MachineState *machine) 1212 { 1213 ccw_machine_2_8_instance_options(machine); 1214 } 1215 1216 static void ccw_machine_2_7_class_options(MachineClass *mc) 1217 { 1218 S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); 1219 1220 s390mc->cpu_model_allowed = false; 1221 ccw_machine_2_8_class_options(mc); 1222 compat_props_add(mc->compat_props, hw_compat_2_7, hw_compat_2_7_len); 1223 } 1224 DEFINE_CCW_MACHINE(2_7, "2.7", false); 1225 1226 static void ccw_machine_2_6_instance_options(MachineState *machine) 1227 { 1228 ccw_machine_2_7_instance_options(machine); 1229 } 1230 1231 static void ccw_machine_2_6_class_options(MachineClass *mc) 1232 { 1233 S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); 1234 static GlobalProperty compat[] = { 1235 { TYPE_S390_IPL, "iplbext_migration", "off", }, 1236 { TYPE_VIRTUAL_CSS_BRIDGE, "css_dev_path", "off", }, 1237 }; 1238 1239 s390mc->ri_allowed = false; 1240 ccw_machine_2_7_class_options(mc); 1241 compat_props_add(mc->compat_props, hw_compat_2_6, hw_compat_2_6_len); 1242 compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); 1243 } 1244 DEFINE_CCW_MACHINE(2_6, "2.6", false); 1245 1246 static void ccw_machine_2_5_instance_options(MachineState *machine) 1247 { 1248 ccw_machine_2_6_instance_options(machine); 1249 } 1250 1251 static void ccw_machine_2_5_class_options(MachineClass *mc) 1252 { 1253 ccw_machine_2_6_class_options(mc); 1254 compat_props_add(mc->compat_props, hw_compat_2_5, hw_compat_2_5_len); 1255 } 1256 DEFINE_CCW_MACHINE(2_5, "2.5", false); 1257 1258 static void ccw_machine_2_4_instance_options(MachineState *machine) 1259 { 1260 ccw_machine_2_5_instance_options(machine); 1261 } 1262 1263 static void ccw_machine_2_4_class_options(MachineClass *mc) 1264 { 1265 static GlobalProperty compat[] = { 1266 { TYPE_S390_SKEYS, "migration-enabled", "off", }, 1267 { "virtio-blk-ccw", "max_revision", "0", }, 1268 { "virtio-balloon-ccw", "max_revision", "0", }, 1269 { "virtio-serial-ccw", "max_revision", "0", }, 1270 { "virtio-9p-ccw", "max_revision", "0", }, 1271 { "virtio-rng-ccw", "max_revision", "0", }, 1272 { "virtio-net-ccw", "max_revision", "0", }, 1273 { "virtio-scsi-ccw", "max_revision", "0", }, 1274 { "vhost-scsi-ccw", "max_revision", "0", }, 1275 }; 1276 1277 ccw_machine_2_5_class_options(mc); 1278 compat_props_add(mc->compat_props, hw_compat_2_4, hw_compat_2_4_len); 1279 compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); 1280 } 1281 DEFINE_CCW_MACHINE(2_4, "2.4", false); 1282 1283 static void ccw_machine_register_types(void) 1284 { 1285 type_register_static(&ccw_machine_info); 1286 } 1287 1288 type_init(ccw_machine_register_types) 1289