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