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