s390x: change the QEMU cpu model to a stripped down z12
[qemu/ar7.git] / hw / s390x / s390-virtio-ccw.c
blob466e45343c26d303f4888857bc068b1e85c84694
1 /*
2 * virtio ccw machine
4 * Copyright 2012 IBM Corp.
5 * Copyright (c) 2009 Alexander Graf <agraf@suse.de>
6 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
8 * This work is licensed under the terms of the GNU GPL, version 2 or (at
9 * your option) any later version. See the COPYING file in the top-level
10 * directory.
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"
39 S390CPU *s390_cpu_addr2state(uint16_t cpu_addr)
41 static MachineState *ms;
43 if (!ms) {
44 ms = MACHINE(qdev_get_machine());
45 g_assert(ms->possible_cpus);
48 /* CPU address corresponds to the core_id and the index */
49 if (cpu_addr >= ms->possible_cpus->len) {
50 return NULL;
52 return S390_CPU(ms->possible_cpus->cpus[cpu_addr].cpu);
55 static S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id,
56 Error **errp)
58 S390CPU *cpu = S390_CPU(object_new(typename));
59 Error *err = NULL;
61 object_property_set_int(OBJECT(cpu), core_id, "core-id", &err);
62 if (err != NULL) {
63 goto out;
65 object_property_set_bool(OBJECT(cpu), true, "realized", &err);
67 out:
68 object_unref(OBJECT(cpu));
69 if (err) {
70 error_propagate(errp, err);
71 cpu = NULL;
73 return cpu;
76 static void s390_init_cpus(MachineState *machine)
78 MachineClass *mc = MACHINE_GET_CLASS(machine);
79 int i;
81 if (tcg_enabled() && max_cpus > 1) {
82 error_report("WARNING: SMP support on s390x is experimental!");
85 /* initialize possible_cpus */
86 mc->possible_cpu_arch_ids(machine);
88 for (i = 0; i < smp_cpus; i++) {
89 s390x_new_cpu(machine->cpu_type, i, &error_fatal);
93 static const char *const reset_dev_types[] = {
94 TYPE_VIRTUAL_CSS_BRIDGE,
95 "s390-sclp-event-facility",
96 "s390-flic",
97 "diag288",
100 void subsystem_reset(void)
102 DeviceState *dev;
103 int i;
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);
113 static int virtio_ccw_hcall_notify(const uint64_t *args)
115 uint64_t subch_id = args[0];
116 uint64_t queue = args[1];
117 SubchDev *sch;
118 int cssid, ssid, schid, m;
120 if (ioinst_disassemble_sch_ident(subch_id, &m, &cssid, &ssid, &schid)) {
121 return -EINVAL;
123 sch = css_find_subch(m, cssid, ssid, schid);
124 if (!sch || !css_subch_visible(sch)) {
125 return -EINVAL;
127 if (queue >= VIRTIO_QUEUE_MAX) {
128 return -EINVAL;
130 virtio_queue_notify(virtio_ccw_get_vdev(sch), queue);
131 return 0;
135 static int virtio_ccw_hcall_early_printk(const uint64_t *args)
137 uint64_t mem = args[0];
139 if (mem < ram_size) {
140 /* Early printk */
141 return 0;
143 return -EINVAL;
146 static void virtio_ccw_register_hcalls(void)
148 s390_register_virtio_hypercall(KVM_S390_VIRTIO_CCW_NOTIFY,
149 virtio_ccw_hcall_notify);
150 /* Tolerate early printk. */
151 s390_register_virtio_hypercall(KVM_S390_VIRTIO_NOTIFY,
152 virtio_ccw_hcall_early_printk);
155 static void s390_memory_init(ram_addr_t mem_size)
157 MemoryRegion *sysmem = get_system_memory();
158 MemoryRegion *ram = g_new(MemoryRegion, 1);
160 /* allocate RAM for core */
161 memory_region_allocate_system_memory(ram, NULL, "s390.ram", mem_size);
162 memory_region_add_subregion(sysmem, 0, ram);
164 /* Initialize storage key device */
165 s390_skeys_init();
166 /* Initialize storage attributes device */
167 s390_stattrib_init();
170 #define S390_TOD_CLOCK_VALUE_MISSING 0x00
171 #define S390_TOD_CLOCK_VALUE_PRESENT 0x01
173 static void gtod_save(QEMUFile *f, void *opaque)
175 uint64_t tod_low;
176 uint8_t tod_high;
177 int r;
179 r = s390_get_clock(&tod_high, &tod_low);
180 if (r) {
181 warn_report("Unable to get guest clock for migration: %s",
182 strerror(-r));
183 error_printf("Guest clock will not be migrated "
184 "which could cause the guest to hang.");
185 qemu_put_byte(f, S390_TOD_CLOCK_VALUE_MISSING);
186 return;
189 qemu_put_byte(f, S390_TOD_CLOCK_VALUE_PRESENT);
190 qemu_put_byte(f, tod_high);
191 qemu_put_be64(f, tod_low);
194 static int gtod_load(QEMUFile *f, void *opaque, int version_id)
196 uint64_t tod_low;
197 uint8_t tod_high;
198 int r;
200 if (qemu_get_byte(f) == S390_TOD_CLOCK_VALUE_MISSING) {
201 warn_report("Guest clock was not migrated. This could "
202 "cause the guest to hang.");
203 return 0;
206 tod_high = qemu_get_byte(f);
207 tod_low = qemu_get_be64(f);
209 r = s390_set_clock(&tod_high, &tod_low);
210 if (r) {
211 error_report("Unable to set KVM guest TOD clock: %s", strerror(-r));
214 return r;
217 static SaveVMHandlers savevm_gtod = {
218 .save_state = gtod_save,
219 .load_state = gtod_load,
222 static void s390_init_ipl_dev(const char *kernel_filename,
223 const char *kernel_cmdline,
224 const char *initrd_filename, const char *firmware,
225 const char *netboot_fw, bool enforce_bios)
227 Object *new = object_new(TYPE_S390_IPL);
228 DeviceState *dev = DEVICE(new);
230 if (kernel_filename) {
231 qdev_prop_set_string(dev, "kernel", kernel_filename);
233 if (initrd_filename) {
234 qdev_prop_set_string(dev, "initrd", initrd_filename);
236 qdev_prop_set_string(dev, "cmdline", kernel_cmdline);
237 qdev_prop_set_string(dev, "firmware", firmware);
238 qdev_prop_set_string(dev, "netboot_fw", netboot_fw);
239 qdev_prop_set_bit(dev, "enforce_bios", enforce_bios);
240 object_property_add_child(qdev_get_machine(), TYPE_S390_IPL,
241 new, NULL);
242 object_unref(new);
243 qdev_init_nofail(dev);
246 static void s390_create_virtio_net(BusState *bus, const char *name)
248 int i;
250 for (i = 0; i < nb_nics; i++) {
251 NICInfo *nd = &nd_table[i];
252 DeviceState *dev;
254 if (!nd->model) {
255 nd->model = g_strdup("virtio");
258 qemu_check_nic_model(nd, "virtio");
260 dev = qdev_create(bus, name);
261 qdev_set_nic_properties(dev, nd);
262 qdev_init_nofail(dev);
266 static void ccw_init(MachineState *machine)
268 int ret;
269 VirtualCssBus *css_bus;
270 DeviceState *dev;
272 s390_sclp_init();
273 s390_memory_init(machine->ram_size);
275 /* init CPUs (incl. CPU model) early so s390_has_feature() works */
276 s390_init_cpus(machine);
278 s390_flic_init();
280 /* init the SIGP facility */
281 s390_init_sigp();
283 /* get a BUS */
284 css_bus = virtual_css_bus_init();
285 s390_init_ipl_dev(machine->kernel_filename, machine->kernel_cmdline,
286 machine->initrd_filename, "s390-ccw.img",
287 "s390-netboot.img", true);
290 * We cannot easily make the pci host bridge conditional as older QEMUs
291 * always created it. Doing so would break migration across QEMU versions.
293 dev = qdev_create(NULL, TYPE_S390_PCI_HOST_BRIDGE);
294 object_property_add_child(qdev_get_machine(), TYPE_S390_PCI_HOST_BRIDGE,
295 OBJECT(dev), NULL);
296 qdev_init_nofail(dev);
298 /* register hypercalls */
299 virtio_ccw_register_hcalls();
301 s390_enable_css_support(s390_cpu_addr2state(0));
303 * Non mcss-e enabled guests only see the devices from the default
304 * css, which is determined by the value of the squash_mcss property.
306 if (css_bus->squash_mcss) {
307 ret = css_create_css_image(0, true);
308 } else {
309 ret = css_create_css_image(VIRTUAL_CSSID, true);
311 if (qemu_opt_get(qemu_get_machine_opts(), "s390-squash-mcss")) {
312 warn_report("The machine property 's390-squash-mcss' is deprecated"
313 " (obsoleted by lifting the cssid restrictions).");
316 assert(ret == 0);
317 if (css_migration_enabled()) {
318 css_register_vmstate();
321 /* Create VirtIO network adapters */
322 s390_create_virtio_net(BUS(css_bus), "virtio-net-ccw");
324 /* Register savevm handler for guest TOD clock */
325 register_savevm_live(NULL, "todclock", 0, 1, &savevm_gtod, NULL);
328 static void s390_cpu_plug(HotplugHandler *hotplug_dev,
329 DeviceState *dev, Error **errp)
331 MachineState *ms = MACHINE(hotplug_dev);
332 S390CPU *cpu = S390_CPU(dev);
334 g_assert(!ms->possible_cpus->cpus[cpu->env.core_id].cpu);
335 ms->possible_cpus->cpus[cpu->env.core_id].cpu = OBJECT(dev);
337 if (dev->hotplugged) {
338 raise_irq_cpu_hotplug();
342 static void s390_machine_reset(void)
344 S390CPU *ipl_cpu = S390_CPU(qemu_get_cpu(0));
346 s390_cmma_reset();
347 qemu_devices_reset();
348 s390_crypto_reset();
350 /* all cpus are stopped - configure and start the ipl cpu only */
351 s390_ipl_prepare_cpu(ipl_cpu);
352 s390_cpu_set_state(CPU_STATE_OPERATING, ipl_cpu);
355 static void s390_machine_device_plug(HotplugHandler *hotplug_dev,
356 DeviceState *dev, Error **errp)
358 if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
359 s390_cpu_plug(hotplug_dev, dev, errp);
363 static void s390_machine_device_unplug_request(HotplugHandler *hotplug_dev,
364 DeviceState *dev, Error **errp)
366 if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
367 error_setg(errp, "CPU hot unplug not supported on this machine");
368 return;
372 static CpuInstanceProperties s390_cpu_index_to_props(MachineState *machine,
373 unsigned cpu_index)
375 g_assert(machine->possible_cpus && cpu_index < machine->possible_cpus->len);
377 return machine->possible_cpus->cpus[cpu_index].props;
380 static const CPUArchIdList *s390_possible_cpu_arch_ids(MachineState *ms)
382 int i;
384 if (ms->possible_cpus) {
385 g_assert(ms->possible_cpus && ms->possible_cpus->len == max_cpus);
386 return ms->possible_cpus;
389 ms->possible_cpus = g_malloc0(sizeof(CPUArchIdList) +
390 sizeof(CPUArchId) * max_cpus);
391 ms->possible_cpus->len = max_cpus;
392 for (i = 0; i < ms->possible_cpus->len; i++) {
393 ms->possible_cpus->cpus[i].vcpus_count = 1;
394 ms->possible_cpus->cpus[i].arch_id = i;
395 ms->possible_cpus->cpus[i].props.has_core_id = true;
396 ms->possible_cpus->cpus[i].props.core_id = i;
399 return ms->possible_cpus;
402 static HotplugHandler *s390_get_hotplug_handler(MachineState *machine,
403 DeviceState *dev)
405 if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
406 return HOTPLUG_HANDLER(machine);
408 return NULL;
411 static void s390_hot_add_cpu(const int64_t id, Error **errp)
413 MachineState *machine = MACHINE(qdev_get_machine());
414 ObjectClass *oc;
416 g_assert(machine->possible_cpus->cpus[0].cpu);
417 oc = OBJECT_CLASS(CPU_GET_CLASS(machine->possible_cpus->cpus[0].cpu));
419 s390x_new_cpu(object_class_get_name(oc), id, errp);
422 static void s390_nmi(NMIState *n, int cpu_index, Error **errp)
424 CPUState *cs = qemu_get_cpu(cpu_index);
426 s390_cpu_restart(S390_CPU(cs));
429 static void ccw_machine_class_init(ObjectClass *oc, void *data)
431 MachineClass *mc = MACHINE_CLASS(oc);
432 NMIClass *nc = NMI_CLASS(oc);
433 HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
434 S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc);
436 s390mc->ri_allowed = true;
437 s390mc->cpu_model_allowed = true;
438 s390mc->css_migration_enabled = true;
439 mc->init = ccw_init;
440 mc->reset = s390_machine_reset;
441 mc->hot_add_cpu = s390_hot_add_cpu;
442 mc->block_default_type = IF_VIRTIO;
443 mc->no_cdrom = 1;
444 mc->no_floppy = 1;
445 mc->no_serial = 1;
446 mc->no_parallel = 1;
447 mc->no_sdcard = 1;
448 mc->use_sclp = 1;
449 mc->max_cpus = S390_MAX_CPUS;
450 mc->has_hotpluggable_cpus = true;
451 mc->get_hotplug_handler = s390_get_hotplug_handler;
452 mc->cpu_index_to_instance_props = s390_cpu_index_to_props;
453 mc->possible_cpu_arch_ids = s390_possible_cpu_arch_ids;
454 /* it is overridden with 'host' cpu *in kvm_arch_init* */
455 mc->default_cpu_type = S390_CPU_TYPE_NAME("qemu");
456 hc->plug = s390_machine_device_plug;
457 hc->unplug_request = s390_machine_device_unplug_request;
458 nc->nmi_monitor_handler = s390_nmi;
461 static inline bool machine_get_aes_key_wrap(Object *obj, Error **errp)
463 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
465 return ms->aes_key_wrap;
468 static inline void machine_set_aes_key_wrap(Object *obj, bool value,
469 Error **errp)
471 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
473 ms->aes_key_wrap = value;
476 static inline bool machine_get_dea_key_wrap(Object *obj, Error **errp)
478 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
480 return ms->dea_key_wrap;
483 static inline void machine_set_dea_key_wrap(Object *obj, bool value,
484 Error **errp)
486 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
488 ms->dea_key_wrap = value;
491 static S390CcwMachineClass *current_mc;
493 static S390CcwMachineClass *get_machine_class(void)
495 if (unlikely(!current_mc)) {
497 * No s390 ccw machine was instantiated, we are likely to
498 * be called for the 'none' machine. The properties will
499 * have their after-initialization values.
501 current_mc = S390_MACHINE_CLASS(
502 object_class_by_name(TYPE_S390_CCW_MACHINE));
504 return current_mc;
507 bool ri_allowed(void)
509 /* for "none" machine this results in true */
510 return get_machine_class()->ri_allowed;
513 bool cpu_model_allowed(void)
515 /* for "none" machine this results in true */
516 return get_machine_class()->cpu_model_allowed;
519 static char *machine_get_loadparm(Object *obj, Error **errp)
521 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
523 return g_memdup(ms->loadparm, sizeof(ms->loadparm));
526 static void machine_set_loadparm(Object *obj, const char *val, Error **errp)
528 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
529 int i;
531 for (i = 0; i < sizeof(ms->loadparm) && val[i]; i++) {
532 uint8_t c = qemu_toupper(val[i]); /* mimic HMC */
534 if (('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || (c == '.') ||
535 (c == ' ')) {
536 ms->loadparm[i] = c;
537 } else {
538 error_setg(errp, "LOADPARM: invalid character '%c' (ASCII 0x%02x)",
539 c, c);
540 return;
544 for (; i < sizeof(ms->loadparm); i++) {
545 ms->loadparm[i] = ' '; /* pad right with spaces */
548 static inline bool machine_get_squash_mcss(Object *obj, Error **errp)
550 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
552 return ms->s390_squash_mcss;
555 static inline void machine_set_squash_mcss(Object *obj, bool value,
556 Error **errp)
558 S390CcwMachineState *ms = S390_CCW_MACHINE(obj);
560 ms->s390_squash_mcss = value;
563 static inline void s390_machine_initfn(Object *obj)
565 object_property_add_bool(obj, "aes-key-wrap",
566 machine_get_aes_key_wrap,
567 machine_set_aes_key_wrap, NULL);
568 object_property_set_description(obj, "aes-key-wrap",
569 "enable/disable AES key wrapping using the CPACF wrapping key",
570 NULL);
571 object_property_set_bool(obj, true, "aes-key-wrap", NULL);
573 object_property_add_bool(obj, "dea-key-wrap",
574 machine_get_dea_key_wrap,
575 machine_set_dea_key_wrap, NULL);
576 object_property_set_description(obj, "dea-key-wrap",
577 "enable/disable DEA key wrapping using the CPACF wrapping key",
578 NULL);
579 object_property_set_bool(obj, true, "dea-key-wrap", NULL);
580 object_property_add_str(obj, "loadparm",
581 machine_get_loadparm, machine_set_loadparm, NULL);
582 object_property_set_description(obj, "loadparm",
583 "Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted"
584 " to upper case) to pass to machine loader, boot manager,"
585 " and guest kernel",
586 NULL);
587 object_property_add_bool(obj, "s390-squash-mcss",
588 machine_get_squash_mcss,
589 machine_set_squash_mcss, NULL);
590 object_property_set_description(obj, "s390-squash-mcss", "(deprecated) "
591 "enable/disable squashing subchannels into the default css",
592 NULL);
593 object_property_set_bool(obj, false, "s390-squash-mcss", NULL);
596 static const TypeInfo ccw_machine_info = {
597 .name = TYPE_S390_CCW_MACHINE,
598 .parent = TYPE_MACHINE,
599 .abstract = true,
600 .instance_size = sizeof(S390CcwMachineState),
601 .instance_init = s390_machine_initfn,
602 .class_size = sizeof(S390CcwMachineClass),
603 .class_init = ccw_machine_class_init,
604 .interfaces = (InterfaceInfo[]) {
605 { TYPE_NMI },
606 { TYPE_HOTPLUG_HANDLER},
611 bool css_migration_enabled(void)
613 return get_machine_class()->css_migration_enabled;
616 #define DEFINE_CCW_MACHINE(suffix, verstr, latest) \
617 static void ccw_machine_##suffix##_class_init(ObjectClass *oc, \
618 void *data) \
620 MachineClass *mc = MACHINE_CLASS(oc); \
621 ccw_machine_##suffix##_class_options(mc); \
622 mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
623 if (latest) { \
624 mc->alias = "s390-ccw-virtio"; \
625 mc->is_default = 1; \
628 static void ccw_machine_##suffix##_instance_init(Object *obj) \
630 MachineState *machine = MACHINE(obj); \
631 current_mc = S390_MACHINE_CLASS(MACHINE_GET_CLASS(machine)); \
632 ccw_machine_##suffix##_instance_options(machine); \
634 static const TypeInfo ccw_machine_##suffix##_info = { \
635 .name = MACHINE_TYPE_NAME("s390-ccw-virtio-" verstr), \
636 .parent = TYPE_S390_CCW_MACHINE, \
637 .class_init = ccw_machine_##suffix##_class_init, \
638 .instance_init = ccw_machine_##suffix##_instance_init, \
639 }; \
640 static void ccw_machine_register_##suffix(void) \
642 type_register_static(&ccw_machine_##suffix##_info); \
644 type_init(ccw_machine_register_##suffix)
646 #define CCW_COMPAT_2_11 \
647 HW_COMPAT_2_11
649 #define CCW_COMPAT_2_10 \
650 HW_COMPAT_2_10
652 #define CCW_COMPAT_2_9 \
653 HW_COMPAT_2_9 \
655 .driver = TYPE_S390_STATTRIB,\
656 .property = "migration-enabled",\
657 .value = "off",\
660 #define CCW_COMPAT_2_8 \
661 HW_COMPAT_2_8 \
663 .driver = TYPE_S390_FLIC_COMMON,\
664 .property = "adapter_routes_max_batch",\
665 .value = "64",\
668 #define CCW_COMPAT_2_7 \
669 HW_COMPAT_2_7
671 #define CCW_COMPAT_2_6 \
672 HW_COMPAT_2_6 \
674 .driver = TYPE_S390_IPL,\
675 .property = "iplbext_migration",\
676 .value = "off",\
677 }, {\
678 .driver = TYPE_VIRTUAL_CSS_BRIDGE,\
679 .property = "css_dev_path",\
680 .value = "off",\
683 #define CCW_COMPAT_2_5 \
684 HW_COMPAT_2_5
686 #define CCW_COMPAT_2_4 \
687 HW_COMPAT_2_4 \
689 .driver = TYPE_S390_SKEYS,\
690 .property = "migration-enabled",\
691 .value = "off",\
692 },{\
693 .driver = "virtio-blk-ccw",\
694 .property = "max_revision",\
695 .value = "0",\
696 },{\
697 .driver = "virtio-balloon-ccw",\
698 .property = "max_revision",\
699 .value = "0",\
700 },{\
701 .driver = "virtio-serial-ccw",\
702 .property = "max_revision",\
703 .value = "0",\
704 },{\
705 .driver = "virtio-9p-ccw",\
706 .property = "max_revision",\
707 .value = "0",\
708 },{\
709 .driver = "virtio-rng-ccw",\
710 .property = "max_revision",\
711 .value = "0",\
712 },{\
713 .driver = "virtio-net-ccw",\
714 .property = "max_revision",\
715 .value = "0",\
716 },{\
717 .driver = "virtio-scsi-ccw",\
718 .property = "max_revision",\
719 .value = "0",\
720 },{\
721 .driver = "vhost-scsi-ccw",\
722 .property = "max_revision",\
723 .value = "0",\
726 static void ccw_machine_2_12_instance_options(MachineState *machine)
730 static void ccw_machine_2_12_class_options(MachineClass *mc)
733 DEFINE_CCW_MACHINE(2_12, "2.12", true);
735 static void ccw_machine_2_11_instance_options(MachineState *machine)
737 static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V2_11 };
738 ccw_machine_2_12_instance_options(machine);
740 /* before 2.12 we emulated the very first z900 */
741 s390_set_qemu_cpu_model(0x2064, 7, 1, qemu_cpu_feat);
744 static void ccw_machine_2_11_class_options(MachineClass *mc)
746 ccw_machine_2_12_class_options(mc);
747 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_11);
749 DEFINE_CCW_MACHINE(2_11, "2.11", false);
751 static void ccw_machine_2_10_instance_options(MachineState *machine)
753 ccw_machine_2_11_instance_options(machine);
756 static void ccw_machine_2_10_class_options(MachineClass *mc)
758 ccw_machine_2_11_class_options(mc);
759 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_10);
761 DEFINE_CCW_MACHINE(2_10, "2.10", false);
763 static void ccw_machine_2_9_instance_options(MachineState *machine)
765 ccw_machine_2_10_instance_options(machine);
766 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ESOP);
767 s390_cpudef_featoff_greater(12, 1, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2);
768 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ZPCI);
769 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_INT_SUPPRESSION);
770 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_EVENT_NOTIFICATION);
773 static void ccw_machine_2_9_class_options(MachineClass *mc)
775 S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc);
777 ccw_machine_2_10_class_options(mc);
778 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_9);
779 s390mc->css_migration_enabled = false;
781 DEFINE_CCW_MACHINE(2_9, "2.9", false);
783 static void ccw_machine_2_8_instance_options(MachineState *machine)
785 ccw_machine_2_9_instance_options(machine);
788 static void ccw_machine_2_8_class_options(MachineClass *mc)
790 ccw_machine_2_9_class_options(mc);
791 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_8);
793 DEFINE_CCW_MACHINE(2_8, "2.8", false);
795 static void ccw_machine_2_7_instance_options(MachineState *machine)
797 ccw_machine_2_8_instance_options(machine);
800 static void ccw_machine_2_7_class_options(MachineClass *mc)
802 S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc);
804 s390mc->cpu_model_allowed = false;
805 ccw_machine_2_8_class_options(mc);
806 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_7);
808 DEFINE_CCW_MACHINE(2_7, "2.7", false);
810 static void ccw_machine_2_6_instance_options(MachineState *machine)
812 ccw_machine_2_7_instance_options(machine);
815 static void ccw_machine_2_6_class_options(MachineClass *mc)
817 S390CcwMachineClass *s390mc = S390_MACHINE_CLASS(mc);
819 s390mc->ri_allowed = false;
820 ccw_machine_2_7_class_options(mc);
821 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_6);
823 DEFINE_CCW_MACHINE(2_6, "2.6", false);
825 static void ccw_machine_2_5_instance_options(MachineState *machine)
827 ccw_machine_2_6_instance_options(machine);
830 static void ccw_machine_2_5_class_options(MachineClass *mc)
832 ccw_machine_2_6_class_options(mc);
833 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_5);
835 DEFINE_CCW_MACHINE(2_5, "2.5", false);
837 static void ccw_machine_2_4_instance_options(MachineState *machine)
839 ccw_machine_2_5_instance_options(machine);
842 static void ccw_machine_2_4_class_options(MachineClass *mc)
844 ccw_machine_2_5_class_options(mc);
845 SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_4);
847 DEFINE_CCW_MACHINE(2_4, "2.4", false);
849 static void ccw_machine_register_types(void)
851 type_register_static(&ccw_machine_info);
854 type_init(ccw_machine_register_types)