1
2
3
4
5
6
7
8
9
10
11
12
13#include "qemu/osdep.h"
14#include "qapi/error.h"
15#include "qemu-common.h"
16#include "cpu.h"
17#include "hw/boards.h"
18#include "exec/address-spaces.h"
19#include "hw/s390x/s390-virtio-hcall.h"
20#include "hw/s390x/sclp.h"
21#include "hw/s390x/s390_flic.h"
22#include "hw/s390x/ioinst.h"
23#include "hw/s390x/css.h"
24#include "virtio-ccw.h"
25#include "qemu/config-file.h"
26#include "qemu/error-report.h"
27#include "s390-pci-bus.h"
28#include "hw/s390x/storage-keys.h"
29#include "hw/s390x/storage-attributes.h"
30#include "hw/compat.h"
31#include "ipl.h"
32#include "hw/s390x/s390-virtio-ccw.h"
33#include "hw/s390x/css-bridge.h"
34#include "migration/register.h"
35#include "cpu_models.h"
36#include "qapi/qmp/qerror.h"
37#include "hw/nmi.h"
38
39S390CPU *s390_cpu_addr2state(uint16_t cpu_addr)
40{
41 static MachineState *ms;
42
43 if (!ms) {
44 ms = MACHINE(qdev_get_machine());
45 g_assert(ms->possible_cpus);
46 }
47
48
49 if (cpu_addr >= ms->possible_cpus->len) {
50 return NULL;
51 }
52 return S390_CPU(ms->possible_cpus->cpus[cpu_addr].cpu);
53}
54
55static S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id,
56 Error **errp)
57{
58 S390CPU *cpu = S390_CPU(object_new(typename));
59 Error *err = NULL;
60
61 object_property_set_int(OBJECT(cpu), core_id, "core-id", &err);
62 if (err != NULL) {
63 goto out;
64 }
65 object_property_set_bool(OBJECT(cpu), true, "realized", &err);
66
67out:
68 object_unref(OBJECT(cpu));
69 if (err) {
70 error_propagate(errp, err);
71 cpu = NULL;
72 }
73 return cpu;
74}
75
76static void s390_init_cpus(MachineState *machine)
77{
78 MachineClass *mc = MACHINE_GET_CLASS(machine);
79 int i;
80
81 if (tcg_enabled() && max_cpus > 1) {
82 error_report("WARNING: SMP support on s390x is experimental!");
83 }
84
85
86 mc->possible_cpu_arch_ids(machine);
87
88 for (i = 0; i < smp_cpus; i++) {
89 s390x_new_cpu(machine->cpu_type, i, &error_fatal);
90 }
91}
92
93static const char *const reset_dev_types[] = {
94 TYPE_VIRTUAL_CSS_BRIDGE,
95 "s390-sclp-event-facility",
96 "s390-flic",
97 "diag288",
98};
99
100void subsystem_reset(void)
101{
102 DeviceState *dev;
103 int i;
104
105 for (i = 0; i < ARRAY_SIZE(reset_dev_types); i++) {
106 dev = DEVICE(object_resolve_path_type("", reset_dev_types[i], NULL));
107 if (dev) {
108 qdev_reset_all(dev);
109 }
110 }
111}
112
113static int virtio_ccw_hcall_notify(const uint64_t *args)
114{
115 uint64_t subch_id = args[0];
116 uint64_t queue = args[1];
117 SubchDev *sch;
118 int cssid, ssid, schid, m;
119
120 if (ioinst_disassemble_sch_ident(subch_id, &m, &cssid, &ssid, &schid)) {
121 return -EINVAL;
122 }
123 sch = css_find_subch(m, cssid, ssid, schid);
124 if (!sch || !css_subch_visible(sch)) {
125 return -EINVAL;
126 }
127 if (queue >= VIRTIO_QUEUE_MAX) {
128 return -EINVAL;
129 }
130 virtio_queue_notify(virtio_ccw_get_vdev(sch), queue);
131 return 0;
132
133}
134
135static int virtio_ccw_hcall_early_printk(const uint64_t *args)
136{
137 uint64_t mem = args[0];
138
139 if (mem < ram_size) {
140
141 return 0;
142 }
143 return -EINVAL;
144}
145
146static void virtio_ccw_register_hcalls(void)
147{
148 s390_register_virtio_hypercall(KVM_S390_VIRTIO_CCW_NOTIFY,
149 virtio_ccw_hcall_notify);
150
151 s390_register_virtio_hypercall(KVM_S390_VIRTIO_NOTIFY,
152 virtio_ccw_hcall_early_printk);
153}
154
155
156
157
158
159
160
161#define KVM_MEM_MAX_NR_PAGES ((1ULL << 31) - 1)
162#define SEG_MSK (~0xfffffULL)
163#define KVM_SLOT_MAX_BYTES ((KVM_MEM_MAX_NR_PAGES * TARGET_PAGE_SIZE) & SEG_MSK)
164static void s390_memory_init(ram_addr_t mem_size)
165{
166 MemoryRegion *sysmem = get_system_memory();
167 ram_addr_t chunk, offset = 0;
168 unsigned int number = 0;
169 gchar *name;
170
171
172 name = g_strdup_printf("s390.ram");
173 while (mem_size) {
174 MemoryRegion *ram = g_new(MemoryRegion, 1);
175 uint64_t size = mem_size;
176
177
178 chunk = MIN(size, KVM_SLOT_MAX_BYTES);
179 memory_region_allocate_system_memory(ram, NULL, name, chunk);
180 memory_region_add_subregion(sysmem, offset, ram);
181 mem_size -= chunk;
182 offset += chunk;
183 g_free(name);
184 name = g_strdup_printf("s390.ram.%u", ++number);
185 }
186 g_free(name);
187
188
189 s390_skeys_init();
190
191 s390_stattrib_init();
192}
193
194#define S390_TOD_CLOCK_VALUE_MISSING 0x00
195#define S390_TOD_CLOCK_VALUE_PRESENT 0x01
196
197static void gtod_save(QEMUFile *f, void *opaque)
198{
199 uint64_t tod_low;
200 uint8_t tod_high;
201 int r;
202
203 r = s390_get_clock(&tod_high, &tod_low);
204 if (r) {
205 warn_report("Unable to get guest clock for migration: %s",
206 strerror(-r));
207 error_printf("Guest clock will not be migrated "
208 "which could cause the guest to hang.");
209 qemu_put_byte(f, S390_TOD_CLOCK_VALUE_MISSING);
210 return;
211 }
212
213 qemu_put_byte(f, S390_TOD_CLOCK_VALUE_PRESENT);
214 qemu_put_byte(f, tod_high);
215 qemu_put_be64(f, tod_low);
216}
217
218static int gtod_load(QEMUFile *f, void *opaque, int version_id)
219{
220 uint64_t tod_low;
221 uint8_t tod_high;
222 int r;
223
224 if (qemu_get_byte(f) == S390_TOD_CLOCK_VALUE_MISSING) {
225 warn_report("Guest clock was not migrated. This could "
226 "cause the guest to hang.");
227 return 0;
228 }
229
230 tod_high = qemu_get_byte(f);
231 tod_low = qemu_get_be64(f);
232
233 r = s390_set_clock(&tod_high, &tod_low);
234 if (r) {
235 error_report("Unable to set KVM guest TOD clock: %s", strerror(-r));
236 }
237
238 return r;
239}
240
241static SaveVMHandlers savevm_gtod = {
242 .save_state = gtod_save,
243 .load_state = gtod_load,
244};
245
246static void s390_init_ipl_dev(const char *kernel_filename,
247 const char *kernel_cmdline,
248 const char *initrd_filename, const char *firmware,
249 const char *netboot_fw, bool enforce_bios)
250{
251 Object *new = object_new(TYPE_S390_IPL);
252 DeviceState *dev = DEVICE(new);
253
254 if (kernel_filename) {
255 qdev_prop_set_string(dev, "kernel", kernel_filename);
256 }
257 if (initrd_filename) {
258 qdev_prop_set_string(dev, "initrd", initrd_filename);
259 }
260 qdev_prop_set_string(dev, "cmdline", kernel_cmdline);
261 qdev_prop_set_string(dev, "firmware", firmware);
262 qdev_prop_set_string(dev, "netboot_fw", netboot_fw);
263 qdev_prop_set_bit(dev, "enforce_bios", enforce_bios);
264 object_property_add_child(qdev_get_machine(), TYPE_S390_IPL,
265 new, NULL);
266 object_unref(new);
267 qdev_init_nofail(dev);
268}
269
270static void s390_create_virtio_net(BusState *bus, const char *name)
271{
272 int i;
273
274 for (i = 0; i < nb_nics; i++) {
275 NICInfo *nd = &nd_table[i];
276 DeviceState *dev;
277
278 if (!nd->model) {
279 nd->model = g_strdup("virtio");
280 }
281
282 qemu_check_nic_model(nd, "virtio");
283
284 dev = qdev_create(bus, name);
285 qdev_set_nic_properties(dev, nd);
286 qdev_init_nofail(dev);
287 }
288}
289
290static void ccw_init(MachineState *machine)
291{
292 int ret;
293 VirtualCssBus *css_bus;
294 DeviceState *dev;
295
296 s390_sclp_init();
297 s390_memory_init(machine->ram_size);
298
299
300 s390_init_cpus(machine);
301
302 s390_flic_init();
303
304
305 s390_init_sigp();
306
307
308 css_bus = virtual_css_bus_init();
309 s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline,
310 machine->initrd_filename, "s390-ccw.img",
311 "s390-netboot.img", true);
312
313
314
315
316
317 dev = qdev_create(NULL, TYPE_S390_PCI_HOST_BRIDGE);
318 object_property_add_child(qdev_get_machine(), TYPE_S390_PCI_HOST_BRIDGE,
319 OBJECT(dev), NULL);
320 qdev_init_nofail(dev);
321
322
323 virtio_ccw_register_hcalls();
324
325 s390_enable_css_support(s390_cpu_addr2state(0));
326
327
328
329
330
331 if (css_bus->squash_mcss) {
332 ret = css_create_css_image(0, true);
333 } else {
334 ret = css_create_css_image(VIRTUAL_CSSID, true);
335 }
336 assert(ret == 0);
337 if (css_migration_enabled()) {
338 css_register_vmstate();
339 }
340
341
342 s390_create_virtio_net(BUS(css_bus), "virtio-net-ccw");
343
344
345 register_savevm_live(NULL, "todclock", 0, 1, &savevm_gtod, NULL);
346}
347
348static void s390_cpu_plug(HotplugHandler *hotplug_dev,
349 DeviceState *dev, Error **errp)
350{
351 MachineState *ms = MACHINE(hotplug_dev);
352 S390CPU *cpu = S390_CPU(dev);
353
354 g_assert(!ms->possible_cpus->cpus[cpu->env.core_id].cpu);
355 ms->possible_cpus->cpus[cpu->env.core_id].cpu = OBJECT(dev);
356
357 if (dev->hotplugged) {
358 raise_irq_cpu_hotplug();
359 }
360}
361
362static void s390_machine_reset(void)
363{
364 S390CPU *ipl_cpu = S390_CPU(qemu_get_cpu(0));
365
366 s390_cmma_reset();
367 qemu_devices_reset();
368 s390_crypto_reset();
369
370
371 s390_ipl_prepare_cpu(ipl_cpu);
372 s390_cpu_set_state(CPU_STATE_OPERATING, ipl_cpu);
373}
374
375static void s390_machine_device_plug(HotplugHandler *hotplug_dev,
376 DeviceState *dev, Error **errp)
377{
378 if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
379 s390_cpu_plug(hotplug_dev, dev, errp);
380 }
381}
382
383static void s390_machine_device_unplug_request(HotplugHandler *hotplug_dev,
384 DeviceState *dev, Error **errp)
385{
386 if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
387 error_setg(errp, "CPU hot unplug not supported on this machine");
388 return;
389 }
390}
391
392static CpuInstanceProperties s390_cpu_index_to_props(MachineState *machine,
393 unsigned cpu_index)
394{
395 g_assert(machine->possible_cpus && cpu_index < machine->possible_cpus->len);
396
397 return machine->possible_cpus->cpus[cpu_index].props;
398}
399
400static const CPUArchIdList *s390_possible_cpu_arch_ids(MachineState *ms)
401{
402 int i;
403
404 if (ms->possible_cpus) {
405 g_assert(ms->possible_cpus && ms->possible_cpus->len == max_cpus);
406 return ms->possible_cpus;
407 }
408
409 ms->possible_cpus = g_malloc0(sizeof(CPUArchIdList) +
410 sizeof(CPUArchId) * max_cpus);
411 ms->possible_cpus->len = max_cpus;
412 for (i = 0; i < ms->possible_cpus->len; i++) {
413 ms->possible_cpus->cpus[i].vcpus_count = 1;
414 ms->possible_cpus->cpus[i].arch_id = i;
415 ms->possible_cpus->cpus[i].props.has_core_id = true;
416 ms->possible_cpus->cpus[i].props.core_id = i;
417 }
418
419 return ms->possible_cpus;
420}
421
422static HotplugHandler *s390_get_hotplug_handler(MachineState *machine,
423 DeviceState *dev)
424{
425 if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
426 return HOTPLUG_HANDLER(machine);
427 }
428 return NULL;
429}
430
431static void s390_hot_add_cpu(const int64_t id, Error **errp)
432{
433 MachineState *machine = MACHINE(qdev_get_machine());
434 ObjectClass *oc;
435
436 g_assert(machine->possible_cpus->cpus[0].cpu);
437 oc = OBJECT_CLASS(CPU_GET_CLASS(machine->possible_cpus->cpus[0].cpu));
438
439 s390x_new_cpu(object_class_get_name(oc), id, errp);
440}
441
442static void s390_nmi(NMIState *n, int cpu_index, Error **errp)
443{
444 CPUState *cs = qemu_get_cpu(cpu_index);
445
446 s390_cpu_restart(S390_CPU(cs));
447}
448
449static void ccw_machine_class_init(ObjectClass *oc, void *data)
450{
451 MachineClass *mc = MACHINE_CLASS(oc);
452 NMIClass *nc = NMI_CLASS(oc);
453 HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
454 S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc);
455
456 s390mc->ri_allowed = true;
457 s390mc->cpu_model_allowed = true;
458 s390mc->css_migration_enabled = true;
459 mc->init = ccw_init;
460 mc->reset = s390_machine_reset;
461 mc->hot_add_cpu = s390_hot_add_cpu;
462 mc->block_default_type = IF_VIRTIO;
463 mc->no_cdrom = 1;
464 mc->no_floppy = 1;
465 mc->no_serial = 1;
466 mc->no_parallel = 1;
467 mc->no_sdcard = 1;
468 mc->use_sclp = 1;
469 mc->max_cpus = S390_MAX_CPUS;
470 mc->has_hotpluggable_cpus = true;
471 mc->get_hotplug_handler = s390_get_hotplug_handler;
472 mc->cpu_index_to_instance_props = s390_cpu_index_to_props;
473 mc->possible_cpu_arch_ids = s390_possible_cpu_arch_ids;
474
475 mc->default_cpu_type = S390_CPU_TYPE_NAME("qemu");
476 hc->plug = s390_machine_device_plug;
477 hc->unplug_request = s390_machine_device_unplug_request;
478 nc->nmi_monitor_handler = s390_nmi;
479}
480
481static inline bool machine_get_aes_key_wrap(Object *obj, Error **errp)
482{
483 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
484
485 return ms->aes_key_wrap;
486}
487
488static inline void machine_set_aes_key_wrap(Object *obj, bool value,
489 Error **errp)
490{
491 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
492
493 ms->aes_key_wrap = value;
494}
495
496static inline bool machine_get_dea_key_wrap(Object *obj, Error **errp)
497{
498 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
499
500 return ms->dea_key_wrap;
501}
502
503static inline void machine_set_dea_key_wrap(Object *obj, bool value,
504 Error **errp)
505{
506 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
507
508 ms->dea_key_wrap = value;
509}
510
511static S390CcwMachineClass *current_mc;
512
513static S390CcwMachineClass *get_machine_class(void)
514{
515 if (unlikely(!current_mc)) {
516
517
518
519
520
521 current_mc = S390_MACHINE_CLASS(
522 object_class_by_name(TYPE_S390_CCW_MACHINE));
523 }
524 return current_mc;
525}
526
527bool ri_allowed(void)
528{
529
530 return get_machine_class()->ri_allowed;
531}
532
533bool cpu_model_allowed(void)
534{
535
536 return get_machine_class()->cpu_model_allowed;
537}
538
539static char *machine_get_loadparm(Object *obj, Error **errp)
540{
541 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
542
543 return g_memdup(ms->loadparm, sizeof(ms->loadparm));
544}
545
546static void machine_set_loadparm(Object *obj, const char *val, Error **errp)
547{
548 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
549 int i;
550
551 for (i = 0; i < sizeof(ms->loadparm) && val[i]; i++) {
552 uint8_t c = qemu_toupper(val[i]);
553
554 if (('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || (c == '.') ||
555 (c == ' ')) {
556 ms->loadparm[i] = c;
557 } else {
558 error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%02x)",
559 c, c);
560 return;
561 }
562 }
563
564 for (; i < sizeof(ms->loadparm); i++) {
565 ms->loadparm[i] = ' ';
566 }
567}
568static inline bool machine_get_squash_mcss(Object *obj, Error **errp)
569{
570 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
571
572 return ms->s390_squash_mcss;
573}
574
575static inline void machine_set_squash_mcss(Object *obj, bool value,
576 Error **errp)
577{
578 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
579
580 ms->s390_squash_mcss = value;
581}
582
583static inline void s390_machine_initfn(Object *obj)
584{
585 object_property_add_bool(obj, "aes-key-wrap",
586 machine_get_aes_key_wrap,
587 machine_set_aes_key_wrap, NULL);
588 object_property_set_description(obj, "aes-key-wrap",
589 "enable/disable AES key wrapping using the CPACF wrapping key",
590 NULL);
591 object_property_set_bool(obj, true, "aes-key-wrap", NULL);
592
593 object_property_add_bool(obj, "dea-key-wrap",
594 machine_get_dea_key_wrap,
595 machine_set_dea_key_wrap, NULL);
596 object_property_set_description(obj, "dea-key-wrap",
597 "enable/disable DEA key wrapping using the CPACF wrapping key",
598 NULL);
599 object_property_set_bool(obj, true, "dea-key-wrap", NULL);
600 object_property_add_str(obj, "loadparm",
601 machine_get_loadparm, machine_set_loadparm, NULL);
602 object_property_set_description(obj, "loadparm",
603 "Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted"
604 " to upper case) to pass to machine loader, boot manager,"
605 " and guest kernel",
606 NULL);
607 object_property_add_bool(obj, "s390-squash-mcss",
608 machine_get_squash_mcss,
609 machine_set_squash_mcss, NULL);
610 object_property_set_description(obj, "s390-squash-mcss",
611 "enable/disable squashing subchannels into the default css",
612 NULL);
613 object_property_set_bool(obj, false, "s390-squash-mcss", NULL);
614}
615
616static const TypeInfo ccw_machine_info = {
617 .name = TYPE_S390_CCW_MACHINE,
618 .parent = TYPE_MACHINE,
619 .abstract = true,
620 .instance_size = sizeof(S390CcwMachineState),
621 .instance_init = s390_machine_initfn,
622 .class_size = sizeof(S390CcwMachineClass),
623 .class_init = ccw_machine_class_init,
624 .interfaces = (InterfaceInfo[]) {
625 { TYPE_NMI },
626 { TYPE_HOTPLUG_HANDLER},
627 { }
628 },
629};
630
631bool css_migration_enabled(void)
632{
633 return get_machine_class()->css_migration_enabled;
634}
635
636#define DEFINE_CCW_MACHINE(suffix, verstr, latest) \
637 static void ccw_machine_##suffix##_class_init(ObjectClass *oc, \
638 void *data) \
639 { \
640 MachineClass *mc = MACHINE_CLASS(oc); \
641 ccw_machine_##suffix##_class_options(mc); \
642 mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
643 if (latest) { \
644 mc->alias = "s390-ccw-virtio"; \
645 mc->is_default = 1; \
646 } \
647 } \
648 static void ccw_machine_##suffix##_instance_init(Object *obj) \
649 { \
650 MachineState *machine = MACHINE(obj); \
651 current_mc = S390_MACHINE_CLASS(MACHINE_GET_CLASS(machine)); \
652 ccw_machine_##suffix##_instance_options(machine); \
653 } \
654 static const TypeInfo ccw_machine_##suffix##_info = { \
655 .name = MACHINE_TYPE_NAME("s390-ccw-virtio-" verstr), \
656 .parent = TYPE_S390_CCW_MACHINE, \
657 .class_init = ccw_machine_##suffix##_class_init, \
658 .instance_init = ccw_machine_##suffix##_instance_init, \
659 }; \
660 static void ccw_machine_register_##suffix(void) \
661 { \
662 type_register_static(&ccw_machine_##suffix##_info); \
663 } \
664 type_init(ccw_machine_register_##suffix)
665
666#define CCW_COMPAT_2_10 \
667 HW_COMPAT_2_10
668
669#define CCW_COMPAT_2_9 \
670 HW_COMPAT_2_9 \
671 {\
672 .driver = TYPE_S390_STATTRIB,\
673 .property = "migration-enabled",\
674 .value = "off",\
675 },
676
677#define CCW_COMPAT_2_8 \
678 HW_COMPAT_2_8 \
679 {\
680 .driver = TYPE_S390_FLIC_COMMON,\
681 .property = "adapter_routes_max_batch",\
682 .value = "64",\
683 },
684
685#define CCW_COMPAT_2_7 \
686 HW_COMPAT_2_7
687
688#define CCW_COMPAT_2_6 \
689 HW_COMPAT_2_6 \
690 {\
691 .driver = TYPE_S390_IPL,\
692 .property = "iplbext_migration",\
693 .value = "off",\
694 }, {\
695 .driver = TYPE_VIRTUAL_CSS_BRIDGE,\
696 .property = "css_dev_path",\
697 .value = "off",\
698 },
699
700#define CCW_COMPAT_2_5 \
701 HW_COMPAT_2_5
702
703#define CCW_COMPAT_2_4 \
704 HW_COMPAT_2_4 \
705 {\
706 .driver = TYPE_S390_SKEYS,\
707 .property = "migration-enabled",\
708 .value = "off",\
709 },{\
710 .driver = "virtio-blk-ccw",\
711 .property = "max_revision",\
712 .value = "0",\
713 },{\
714 .driver = "virtio-balloon-ccw",\
715 .property = "max_revision",\
716 .value = "0",\
717 },{\
718 .driver = "virtio-serial-ccw",\
719 .property = "max_revision",\
720 .value = "0",\
721 },{\
722 .driver = "virtio-9p-ccw",\
723 .property = "max_revision",\
724 .value = "0",\
725 },{\
726 .driver = "virtio-rng-ccw",\
727 .property = "max_revision",\
728 .value = "0",\
729 },{\
730 .driver = "virtio-net-ccw",\
731 .property = "max_revision",\
732 .value = "0",\
733 },{\
734 .driver = "virtio-scsi-ccw",\
735 .property = "max_revision",\
736 .value = "0",\
737 },{\
738 .driver = "vhost-scsi-ccw",\
739 .property = "max_revision",\
740 .value = "0",\
741 },
742
743static void ccw_machine_2_11_instance_options(MachineState *machine)
744{
745}
746
747static void ccw_machine_2_11_class_options(MachineClass *mc)
748{
749}
750DEFINE_CCW_MACHINE(2_11, "2.11", true);
751
752static void ccw_machine_2_10_instance_options(MachineState *machine)
753{
754 ccw_machine_2_11_instance_options(machine);
755}
756
757static void ccw_machine_2_10_class_options(MachineClass *mc)
758{
759 ccw_machine_2_11_class_options(mc);
760 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_10);
761}
762DEFINE_CCW_MACHINE(2_10, "2.10", false);
763
764static void ccw_machine_2_9_instance_options(MachineState *machine)
765{
766 ccw_machine_2_10_instance_options(machine);
767 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ESOP);
768 s390_cpudef_featoff_greater(12, 1, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2);
769 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ZPCI);
770 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_INT_SUPPRESSION);
771 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_EVENT_NOTIFICATION);
772}
773
774static void ccw_machine_2_9_class_options(MachineClass *mc)
775{
776 S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc);
777
778 ccw_machine_2_10_class_options(mc);
779 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_9);
780 s390mc->css_migration_enabled = false;
781}
782DEFINE_CCW_MACHINE(2_9, "2.9", false);
783
784static void ccw_machine_2_8_instance_options(MachineState *machine)
785{
786 ccw_machine_2_9_instance_options(machine);
787}
788
789static void ccw_machine_2_8_class_options(MachineClass *mc)
790{
791 ccw_machine_2_9_class_options(mc);
792 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_8);
793}
794DEFINE_CCW_MACHINE(2_8, "2.8", false);
795
796static void ccw_machine_2_7_instance_options(MachineState *machine)
797{
798 ccw_machine_2_8_instance_options(machine);
799}
800
801static void ccw_machine_2_7_class_options(MachineClass *mc)
802{
803 S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc);
804
805 s390mc->cpu_model_allowed = false;
806 ccw_machine_2_8_class_options(mc);
807 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_7);
808}
809DEFINE_CCW_MACHINE(2_7, "2.7", false);
810
811static void ccw_machine_2_6_instance_options(MachineState *machine)
812{
813 ccw_machine_2_7_instance_options(machine);
814}
815
816static void ccw_machine_2_6_class_options(MachineClass *mc)
817{
818 S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc);
819
820 s390mc->ri_allowed = false;
821 ccw_machine_2_7_class_options(mc);
822 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_6);
823}
824DEFINE_CCW_MACHINE(2_6, "2.6", false);
825
826static void ccw_machine_2_5_instance_options(MachineState *machine)
827{
828 ccw_machine_2_6_instance_options(machine);
829}
830
831static void ccw_machine_2_5_class_options(MachineClass *mc)
832{
833 ccw_machine_2_6_class_options(mc);
834 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_5);
835}
836DEFINE_CCW_MACHINE(2_5, "2.5", false);
837
838static void ccw_machine_2_4_instance_options(MachineState *machine)
839{
840 ccw_machine_2_5_instance_options(machine);
841}
842
843static void ccw_machine_2_4_class_options(MachineClass *mc)
844{
845 ccw_machine_2_5_class_options(mc);
846 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_4);
847}
848DEFINE_CCW_MACHINE(2_4, "2.4", false);
849
850static void ccw_machine_register_types(void)
851{
852 type_register_static(&ccw_machine_info);
853}
854
855type_init(ccw_machine_register_types)
856