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
13 #include "qemu/osdep.h"
14 #include "qapi/error.h"
16 #include "hw/boards.h"
17 #include "exec/address-spaces.h"
18 #include "exec/ram_addr.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/ctype.h"
27 #include "qemu/error-report.h"
28 #include "qemu/option.h"
29 #include "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"
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"
41 #include "hw/qdev-properties.h"
42 #include "hw/s390x/tod.h"
44 S390CPU
*s390_cpu_addr2state(uint16_t cpu_addr
)
46 static MachineState
*ms
;
49 ms
= MACHINE(qdev_get_machine());
50 g_assert(ms
->possible_cpus
);
53 /* CPU address corresponds to the core_id and the index */
54 if (cpu_addr
>= ms
->possible_cpus
->len
) {
57 return S390_CPU(ms
->possible_cpus
->cpus
[cpu_addr
].cpu
);
60 static S390CPU
*s390x_new_cpu(const char *typename
, uint32_t core_id
,
63 S390CPU
*cpu
= S390_CPU(object_new(typename
));
66 object_property_set_int(OBJECT(cpu
), core_id
, "core-id", &err
);
70 object_property_set_bool(OBJECT(cpu
), true, "realized", &err
);
73 object_unref(OBJECT(cpu
));
75 error_propagate(errp
, err
);
81 static void s390_init_cpus(MachineState
*machine
)
83 MachineClass
*mc
= MACHINE_GET_CLASS(machine
);
86 /* initialize possible_cpus */
87 mc
->possible_cpu_arch_ids(machine
);
89 for (i
= 0; i
< machine
->smp
.cpus
; i
++) {
90 s390x_new_cpu(machine
->cpu_type
, i
, &error_fatal
);
94 static const char *const reset_dev_types
[] = {
95 TYPE_VIRTUAL_CSS_BRIDGE
,
96 "s390-sclp-event-facility",
101 static void subsystem_reset(void)
106 for (i
= 0; i
< ARRAY_SIZE(reset_dev_types
); i
++) {
107 dev
= DEVICE(object_resolve_path_type("", reset_dev_types
[i
], NULL
));
114 static int virtio_ccw_hcall_notify(const uint64_t *args
)
116 uint64_t subch_id
= args
[0];
117 uint64_t queue
= args
[1];
119 int cssid
, ssid
, schid
, m
;
121 if (ioinst_disassemble_sch_ident(subch_id
, &m
, &cssid
, &ssid
, &schid
)) {
124 sch
= css_find_subch(m
, cssid
, ssid
, schid
);
125 if (!sch
|| !css_subch_visible(sch
)) {
128 if (queue
>= VIRTIO_QUEUE_MAX
) {
131 virtio_queue_notify(virtio_ccw_get_vdev(sch
), queue
);
136 static int virtio_ccw_hcall_early_printk(const uint64_t *args
)
138 uint64_t mem
= args
[0];
140 if (mem
< ram_size
) {
147 static void virtio_ccw_register_hcalls(void)
149 s390_register_virtio_hypercall(KVM_S390_VIRTIO_CCW_NOTIFY
,
150 virtio_ccw_hcall_notify
);
151 /* Tolerate early printk. */
152 s390_register_virtio_hypercall(KVM_S390_VIRTIO_NOTIFY
,
153 virtio_ccw_hcall_early_printk
);
157 * KVM does only support memory slots up to KVM_MEM_MAX_NR_PAGES pages
158 * as the dirty bitmap must be managed by bitops that take an int as
159 * position indicator. If we have a guest beyond that we will split off
160 * new subregions. The split must happen on a segment boundary (1MB).
162 #define KVM_MEM_MAX_NR_PAGES ((1ULL << 31) - 1)
163 #define SEG_MSK (~0xfffffULL)
164 #define KVM_SLOT_MAX_BYTES ((KVM_MEM_MAX_NR_PAGES * TARGET_PAGE_SIZE) & SEG_MSK)
165 static void s390_memory_init(ram_addr_t mem_size
)
167 MemoryRegion
*sysmem
= get_system_memory();
168 ram_addr_t chunk
, offset
= 0;
169 unsigned int number
= 0;
170 Error
*local_err
= NULL
;
173 /* allocate RAM for core */
174 name
= g_strdup_printf("s390.ram");
176 MemoryRegion
*ram
= g_new(MemoryRegion
, 1);
177 uint64_t size
= mem_size
;
179 /* KVM does not allow memslots >= 8 TB */
180 chunk
= MIN(size
, KVM_SLOT_MAX_BYTES
);
181 memory_region_allocate_system_memory(ram
, NULL
, name
, chunk
);
182 memory_region_add_subregion(sysmem
, offset
, ram
);
186 name
= g_strdup_printf("s390.ram.%u", ++number
);
191 * Configure the maximum page size. As no memory devices were created
192 * yet, this is the page size of initial memory only.
194 s390_set_max_pagesize(qemu_maxrampagesize(), &local_err
);
196 error_report_err(local_err
);
199 /* Initialize storage key device */
201 /* Initialize storage attributes device */
202 s390_stattrib_init();
205 static void s390_init_ipl_dev(const char *kernel_filename
,
206 const char *kernel_cmdline
,
207 const char *initrd_filename
, const char *firmware
,
208 const char *netboot_fw
, bool enforce_bios
)
210 Object
*new = object_new(TYPE_S390_IPL
);
211 DeviceState
*dev
= DEVICE(new);
212 char *netboot_fw_prop
;
214 if (kernel_filename
) {
215 qdev_prop_set_string(dev
, "kernel", kernel_filename
);
217 if (initrd_filename
) {
218 qdev_prop_set_string(dev
, "initrd", initrd_filename
);
220 qdev_prop_set_string(dev
, "cmdline", kernel_cmdline
);
221 qdev_prop_set_string(dev
, "firmware", firmware
);
222 qdev_prop_set_bit(dev
, "enforce_bios", enforce_bios
);
223 netboot_fw_prop
= object_property_get_str(new, "netboot_fw", &error_abort
);
224 if (!strlen(netboot_fw_prop
)) {
225 qdev_prop_set_string(dev
, "netboot_fw", netboot_fw
);
227 g_free(netboot_fw_prop
);
228 object_property_add_child(qdev_get_machine(), TYPE_S390_IPL
,
231 qdev_init_nofail(dev
);
234 static void s390_create_virtio_net(BusState
*bus
, const char *name
)
238 for (i
= 0; i
< nb_nics
; i
++) {
239 NICInfo
*nd
= &nd_table
[i
];
243 nd
->model
= g_strdup("virtio");
246 qemu_check_nic_model(nd
, "virtio");
248 dev
= qdev_create(bus
, name
);
249 qdev_set_nic_properties(dev
, nd
);
250 qdev_init_nofail(dev
);
254 static void s390_create_sclpconsole(const char *type
, Chardev
*chardev
)
258 dev
= qdev_create(sclp_get_event_facility_bus(), type
);
259 qdev_prop_set_chr(dev
, "chardev", chardev
);
260 qdev_init_nofail(dev
);
263 static void ccw_init(MachineState
*machine
)
266 VirtualCssBus
*css_bus
;
270 /* init memory + setup max page size. Required for the CPU model */
271 s390_memory_init(machine
->ram_size
);
273 /* init CPUs (incl. CPU model) early so s390_has_feature() works */
274 s390_init_cpus(machine
);
278 /* init the SIGP facility */
281 /* create AP bridge and bus(es) */
285 css_bus
= virtual_css_bus_init();
286 s390_init_ipl_dev(machine
->kernel_filename
, machine
->kernel_cmdline
,
287 machine
->initrd_filename
, "s390-ccw.img",
288 "s390-netboot.img", true);
290 dev
= qdev_create(NULL
, TYPE_S390_PCI_HOST_BRIDGE
);
291 object_property_add_child(qdev_get_machine(), TYPE_S390_PCI_HOST_BRIDGE
,
293 qdev_init_nofail(dev
);
295 /* register hypercalls */
296 virtio_ccw_register_hcalls();
298 s390_enable_css_support(s390_cpu_addr2state(0));
300 ret
= css_create_css_image(VIRTUAL_CSSID
, true);
303 if (css_migration_enabled()) {
304 css_register_vmstate();
307 /* Create VirtIO network adapters */
308 s390_create_virtio_net(BUS(css_bus
), "virtio-net-ccw");
312 s390_create_sclpconsole("sclpconsole", serial_hd(0));
315 s390_create_sclpconsole("sclplmconsole", serial_hd(1));
318 /* init the TOD clock */
322 static void s390_cpu_plug(HotplugHandler
*hotplug_dev
,
323 DeviceState
*dev
, Error
**errp
)
325 MachineState
*ms
= MACHINE(hotplug_dev
);
326 S390CPU
*cpu
= S390_CPU(dev
);
328 g_assert(!ms
->possible_cpus
->cpus
[cpu
->env
.core_id
].cpu
);
329 ms
->possible_cpus
->cpus
[cpu
->env
.core_id
].cpu
= OBJECT(dev
);
331 if (dev
->hotplugged
) {
332 raise_irq_cpu_hotplug();
336 static inline void s390_do_cpu_ipl(CPUState
*cs
, run_on_cpu_data arg
)
338 S390CPU
*cpu
= S390_CPU(cs
);
340 s390_ipl_prepare_cpu(cpu
);
341 s390_cpu_set_state(S390_CPU_STATE_OPERATING
, cpu
);
344 static void s390_machine_reset(MachineState
*machine
)
346 enum s390_reset reset_type
;
349 /* get the reset parameters, reset them once done */
350 s390_ipl_get_reset_request(&cs
, &reset_type
);
352 /* all CPUs are paused and synchronized at this point */
355 switch (reset_type
) {
356 case S390_RESET_EXTERNAL
:
357 case S390_RESET_REIPL
:
358 qemu_devices_reset();
361 /* configure and start the ipl CPU only */
362 run_on_cpu(cs
, s390_do_cpu_ipl
, RUN_ON_CPU_NULL
);
364 case S390_RESET_MODIFIED_CLEAR
:
366 run_on_cpu(t
, s390_do_cpu_full_reset
, RUN_ON_CPU_NULL
);
370 run_on_cpu(cs
, s390_do_cpu_load_normal
, RUN_ON_CPU_NULL
);
372 case S390_RESET_LOAD_NORMAL
:
374 run_on_cpu(t
, s390_do_cpu_reset
, RUN_ON_CPU_NULL
);
377 run_on_cpu(cs
, s390_do_cpu_initial_reset
, RUN_ON_CPU_NULL
);
378 run_on_cpu(cs
, s390_do_cpu_load_normal
, RUN_ON_CPU_NULL
);
381 g_assert_not_reached();
383 s390_ipl_clear_reset_request();
386 static void s390_machine_device_plug(HotplugHandler
*hotplug_dev
,
387 DeviceState
*dev
, Error
**errp
)
389 if (object_dynamic_cast(OBJECT(dev
), TYPE_CPU
)) {
390 s390_cpu_plug(hotplug_dev
, dev
, errp
);
394 static void s390_machine_device_unplug_request(HotplugHandler
*hotplug_dev
,
395 DeviceState
*dev
, Error
**errp
)
397 if (object_dynamic_cast(OBJECT(dev
), TYPE_CPU
)) {
398 error_setg(errp
, "CPU hot unplug not supported on this machine");
403 static CpuInstanceProperties
s390_cpu_index_to_props(MachineState
*ms
,
406 MachineClass
*mc
= MACHINE_GET_CLASS(ms
);
407 const CPUArchIdList
*possible_cpus
= mc
->possible_cpu_arch_ids(ms
);
409 assert(cpu_index
< possible_cpus
->len
);
410 return possible_cpus
->cpus
[cpu_index
].props
;
413 static const CPUArchIdList
*s390_possible_cpu_arch_ids(MachineState
*ms
)
416 unsigned int max_cpus
= ms
->smp
.max_cpus
;
418 if (ms
->possible_cpus
) {
419 g_assert(ms
->possible_cpus
&& ms
->possible_cpus
->len
== max_cpus
);
420 return ms
->possible_cpus
;
423 ms
->possible_cpus
= g_malloc0(sizeof(CPUArchIdList
) +
424 sizeof(CPUArchId
) * max_cpus
);
425 ms
->possible_cpus
->len
= max_cpus
;
426 for (i
= 0; i
< ms
->possible_cpus
->len
; i
++) {
427 ms
->possible_cpus
->cpus
[i
].type
= ms
->cpu_type
;
428 ms
->possible_cpus
->cpus
[i
].vcpus_count
= 1;
429 ms
->possible_cpus
->cpus
[i
].arch_id
= i
;
430 ms
->possible_cpus
->cpus
[i
].props
.has_core_id
= true;
431 ms
->possible_cpus
->cpus
[i
].props
.core_id
= i
;
434 return ms
->possible_cpus
;
437 static HotplugHandler
*s390_get_hotplug_handler(MachineState
*machine
,
440 if (object_dynamic_cast(OBJECT(dev
), TYPE_CPU
)) {
441 return HOTPLUG_HANDLER(machine
);
446 static void s390_hot_add_cpu(MachineState
*machine
,
447 const int64_t id
, Error
**errp
)
451 g_assert(machine
->possible_cpus
->cpus
[0].cpu
);
452 oc
= OBJECT_CLASS(CPU_GET_CLASS(machine
->possible_cpus
->cpus
[0].cpu
));
454 s390x_new_cpu(object_class_get_name(oc
), id
, errp
);
457 static void s390_nmi(NMIState
*n
, int cpu_index
, Error
**errp
)
459 CPUState
*cs
= qemu_get_cpu(cpu_index
);
461 s390_cpu_restart(S390_CPU(cs
));
464 static void ccw_machine_class_init(ObjectClass
*oc
, void *data
)
466 MachineClass
*mc
= MACHINE_CLASS(oc
);
467 NMIClass
*nc
= NMI_CLASS(oc
);
468 HotplugHandlerClass
*hc
= HOTPLUG_HANDLER_CLASS(oc
);
469 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
471 s390mc
->ri_allowed
= true;
472 s390mc
->cpu_model_allowed
= true;
473 s390mc
->css_migration_enabled
= true;
474 s390mc
->hpage_1m_allowed
= true;
476 mc
->reset
= s390_machine_reset
;
477 mc
->hot_add_cpu
= s390_hot_add_cpu
;
478 mc
->block_default_type
= IF_VIRTIO
;
483 mc
->max_cpus
= S390_MAX_CPUS
;
484 mc
->has_hotpluggable_cpus
= true;
485 assert(!mc
->get_hotplug_handler
);
486 mc
->get_hotplug_handler
= s390_get_hotplug_handler
;
487 mc
->cpu_index_to_instance_props
= s390_cpu_index_to_props
;
488 mc
->possible_cpu_arch_ids
= s390_possible_cpu_arch_ids
;
489 /* it is overridden with 'host' cpu *in kvm_arch_init* */
490 mc
->default_cpu_type
= S390_CPU_TYPE_NAME("qemu");
491 hc
->plug
= s390_machine_device_plug
;
492 hc
->unplug_request
= s390_machine_device_unplug_request
;
493 nc
->nmi_monitor_handler
= s390_nmi
;
496 static inline bool machine_get_aes_key_wrap(Object
*obj
, Error
**errp
)
498 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
500 return ms
->aes_key_wrap
;
503 static inline void machine_set_aes_key_wrap(Object
*obj
, bool value
,
506 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
508 ms
->aes_key_wrap
= value
;
511 static inline bool machine_get_dea_key_wrap(Object
*obj
, Error
**errp
)
513 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
515 return ms
->dea_key_wrap
;
518 static inline void machine_set_dea_key_wrap(Object
*obj
, bool value
,
521 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
523 ms
->dea_key_wrap
= value
;
526 static S390CcwMachineClass
*current_mc
;
528 static S390CcwMachineClass
*get_machine_class(void)
530 if (unlikely(!current_mc
)) {
532 * No s390 ccw machine was instantiated, we are likely to
533 * be called for the 'none' machine. The properties will
534 * have their after-initialization values.
536 current_mc
= S390_MACHINE_CLASS(
537 object_class_by_name(TYPE_S390_CCW_MACHINE
));
542 bool ri_allowed(void)
544 /* for "none" machine this results in true */
545 return get_machine_class()->ri_allowed
;
548 bool cpu_model_allowed(void)
550 /* for "none" machine this results in true */
551 return get_machine_class()->cpu_model_allowed
;
554 bool hpage_1m_allowed(void)
556 /* for "none" machine this results in true */
557 return get_machine_class()->hpage_1m_allowed
;
560 static char *machine_get_loadparm(Object
*obj
, Error
**errp
)
562 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
564 return g_memdup(ms
->loadparm
, sizeof(ms
->loadparm
));
567 static void machine_set_loadparm(Object
*obj
, const char *val
, Error
**errp
)
569 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
572 for (i
= 0; i
< sizeof(ms
->loadparm
) && val
[i
]; i
++) {
573 uint8_t c
= qemu_toupper(val
[i
]); /* mimic HMC */
575 if (('A' <= c
&& c
<= 'Z') || ('0' <= c
&& c
<= '9') || (c
== '.') ||
579 error_setg(errp
, "LOADPARM: invalid character '%c' (ASCII 0x%02x)",
585 for (; i
< sizeof(ms
->loadparm
); i
++) {
586 ms
->loadparm
[i
] = ' '; /* pad right with spaces */
589 static inline void s390_machine_initfn(Object
*obj
)
591 object_property_add_bool(obj
, "aes-key-wrap",
592 machine_get_aes_key_wrap
,
593 machine_set_aes_key_wrap
, NULL
);
594 object_property_set_description(obj
, "aes-key-wrap",
595 "enable/disable AES key wrapping using the CPACF wrapping key",
597 object_property_set_bool(obj
, true, "aes-key-wrap", NULL
);
599 object_property_add_bool(obj
, "dea-key-wrap",
600 machine_get_dea_key_wrap
,
601 machine_set_dea_key_wrap
, NULL
);
602 object_property_set_description(obj
, "dea-key-wrap",
603 "enable/disable DEA key wrapping using the CPACF wrapping key",
605 object_property_set_bool(obj
, true, "dea-key-wrap", NULL
);
606 object_property_add_str(obj
, "loadparm",
607 machine_get_loadparm
, machine_set_loadparm
, NULL
);
608 object_property_set_description(obj
, "loadparm",
609 "Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted"
610 " to upper case) to pass to machine loader, boot manager,"
615 static const TypeInfo ccw_machine_info
= {
616 .name
= TYPE_S390_CCW_MACHINE
,
617 .parent
= TYPE_MACHINE
,
619 .instance_size
= sizeof(S390CcwMachineState
),
620 .instance_init
= s390_machine_initfn
,
621 .class_size
= sizeof(S390CcwMachineClass
),
622 .class_init
= ccw_machine_class_init
,
623 .interfaces
= (InterfaceInfo
[]) {
625 { TYPE_HOTPLUG_HANDLER
},
630 bool css_migration_enabled(void)
632 return get_machine_class()->css_migration_enabled
;
635 #define DEFINE_CCW_MACHINE(suffix, verstr, latest) \
636 static void ccw_machine_##suffix##_class_init(ObjectClass *oc, \
639 MachineClass *mc = MACHINE_CLASS(oc); \
640 ccw_machine_##suffix##_class_options(mc); \
641 mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
643 mc->alias = "s390-ccw-virtio"; \
644 mc->is_default = 1; \
647 static void ccw_machine_##suffix##_instance_init(Object *obj) \
649 MachineState *machine = MACHINE(obj); \
650 current_mc = S390_MACHINE_CLASS(MACHINE_GET_CLASS(machine)); \
651 ccw_machine_##suffix##_instance_options(machine); \
653 static const TypeInfo ccw_machine_##suffix##_info = { \
654 .name = MACHINE_TYPE_NAME("s390-ccw-virtio-" verstr), \
655 .parent = TYPE_S390_CCW_MACHINE, \
656 .class_init = ccw_machine_##suffix##_class_init, \
657 .instance_init = ccw_machine_##suffix##_instance_init, \
659 static void ccw_machine_register_##suffix(void) \
661 type_register_static(&ccw_machine_##suffix##_info); \
663 type_init(ccw_machine_register_##suffix)
665 static void ccw_machine_4_1_instance_options(MachineState
*machine
)
669 static void ccw_machine_4_1_class_options(MachineClass
*mc
)
672 DEFINE_CCW_MACHINE(4_1
, "4.1", true);
674 static void ccw_machine_4_0_instance_options(MachineState
*machine
)
676 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V4_0
};
677 ccw_machine_4_1_instance_options(machine
);
678 s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat
);
681 static void ccw_machine_4_0_class_options(MachineClass
*mc
)
683 ccw_machine_4_1_class_options(mc
);
684 compat_props_add(mc
->compat_props
, hw_compat_4_0
, hw_compat_4_0_len
);
686 DEFINE_CCW_MACHINE(4_0
, "4.0", false);
688 static void ccw_machine_3_1_instance_options(MachineState
*machine
)
690 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V3_1
};
691 ccw_machine_4_0_instance_options(machine
);
692 s390_cpudef_featoff_greater(14, 1, S390_FEAT_MULTIPLE_EPOCH
);
693 s390_cpudef_group_featoff_greater(14, 1, S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF
);
694 s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat
);
697 static void ccw_machine_3_1_class_options(MachineClass
*mc
)
699 ccw_machine_4_0_class_options(mc
);
700 compat_props_add(mc
->compat_props
, hw_compat_3_1
, hw_compat_3_1_len
);
702 DEFINE_CCW_MACHINE(3_1
, "3.1", false);
704 static void ccw_machine_3_0_instance_options(MachineState
*machine
)
706 ccw_machine_3_1_instance_options(machine
);
709 static void ccw_machine_3_0_class_options(MachineClass
*mc
)
711 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
713 s390mc
->hpage_1m_allowed
= false;
714 ccw_machine_3_1_class_options(mc
);
715 compat_props_add(mc
->compat_props
, hw_compat_3_0
, hw_compat_3_0_len
);
717 DEFINE_CCW_MACHINE(3_0
, "3.0", false);
719 static void ccw_machine_2_12_instance_options(MachineState
*machine
)
721 ccw_machine_3_0_instance_options(machine
);
722 s390_cpudef_featoff_greater(11, 1, S390_FEAT_PPA15
);
723 s390_cpudef_featoff_greater(11, 1, S390_FEAT_BPB
);
726 static void ccw_machine_2_12_class_options(MachineClass
*mc
)
728 ccw_machine_3_0_class_options(mc
);
729 compat_props_add(mc
->compat_props
, hw_compat_2_12
, hw_compat_2_12_len
);
731 DEFINE_CCW_MACHINE(2_12
, "2.12", false);
733 static void ccw_machine_2_11_instance_options(MachineState
*machine
)
735 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V2_11
};
736 ccw_machine_2_12_instance_options(machine
);
738 /* before 2.12 we emulated the very first z900 */
739 s390_set_qemu_cpu_model(0x2064, 7, 1, qemu_cpu_feat
);
742 static void ccw_machine_2_11_class_options(MachineClass
*mc
)
744 static GlobalProperty compat
[] = {
745 { TYPE_SCLP_EVENT_FACILITY
, "allow_all_mask_sizes", "off", },
748 ccw_machine_2_12_class_options(mc
);
749 compat_props_add(mc
->compat_props
, hw_compat_2_11
, hw_compat_2_11_len
);
750 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
752 DEFINE_CCW_MACHINE(2_11
, "2.11", false);
754 static void ccw_machine_2_10_instance_options(MachineState
*machine
)
756 ccw_machine_2_11_instance_options(machine
);
759 static void ccw_machine_2_10_class_options(MachineClass
*mc
)
761 ccw_machine_2_11_class_options(mc
);
762 compat_props_add(mc
->compat_props
, hw_compat_2_10
, hw_compat_2_10_len
);
764 DEFINE_CCW_MACHINE(2_10
, "2.10", false);
766 static void ccw_machine_2_9_instance_options(MachineState
*machine
)
768 ccw_machine_2_10_instance_options(machine
);
769 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ESOP
);
770 s390_cpudef_featoff_greater(12, 1, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2
);
771 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ZPCI
);
772 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_INT_SUPPRESSION
);
773 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_EVENT_NOTIFICATION
);
776 static void ccw_machine_2_9_class_options(MachineClass
*mc
)
778 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
779 static GlobalProperty compat
[] = {
780 { TYPE_S390_STATTRIB
, "migration-enabled", "off", },
783 ccw_machine_2_10_class_options(mc
);
784 compat_props_add(mc
->compat_props
, hw_compat_2_9
, hw_compat_2_9_len
);
785 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
786 s390mc
->css_migration_enabled
= false;
788 DEFINE_CCW_MACHINE(2_9
, "2.9", false);
790 static void ccw_machine_2_8_instance_options(MachineState
*machine
)
792 ccw_machine_2_9_instance_options(machine
);
795 static void ccw_machine_2_8_class_options(MachineClass
*mc
)
797 static GlobalProperty compat
[] = {
798 { TYPE_S390_FLIC_COMMON
, "adapter_routes_max_batch", "64", },
801 ccw_machine_2_9_class_options(mc
);
802 compat_props_add(mc
->compat_props
, hw_compat_2_8
, hw_compat_2_8_len
);
803 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
805 DEFINE_CCW_MACHINE(2_8
, "2.8", false);
807 static void ccw_machine_2_7_instance_options(MachineState
*machine
)
809 ccw_machine_2_8_instance_options(machine
);
812 static void ccw_machine_2_7_class_options(MachineClass
*mc
)
814 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
816 s390mc
->cpu_model_allowed
= false;
817 ccw_machine_2_8_class_options(mc
);
818 compat_props_add(mc
->compat_props
, hw_compat_2_7
, hw_compat_2_7_len
);
820 DEFINE_CCW_MACHINE(2_7
, "2.7", false);
822 static void ccw_machine_2_6_instance_options(MachineState
*machine
)
824 ccw_machine_2_7_instance_options(machine
);
827 static void ccw_machine_2_6_class_options(MachineClass
*mc
)
829 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
830 static GlobalProperty compat
[] = {
831 { TYPE_S390_IPL
, "iplbext_migration", "off", },
832 { TYPE_VIRTUAL_CSS_BRIDGE
, "css_dev_path", "off", },
835 s390mc
->ri_allowed
= false;
836 ccw_machine_2_7_class_options(mc
);
837 compat_props_add(mc
->compat_props
, hw_compat_2_6
, hw_compat_2_6_len
);
838 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
840 DEFINE_CCW_MACHINE(2_6
, "2.6", false);
842 static void ccw_machine_2_5_instance_options(MachineState
*machine
)
844 ccw_machine_2_6_instance_options(machine
);
847 static void ccw_machine_2_5_class_options(MachineClass
*mc
)
849 ccw_machine_2_6_class_options(mc
);
850 compat_props_add(mc
->compat_props
, hw_compat_2_5
, hw_compat_2_5_len
);
852 DEFINE_CCW_MACHINE(2_5
, "2.5", false);
854 static void ccw_machine_2_4_instance_options(MachineState
*machine
)
856 ccw_machine_2_5_instance_options(machine
);
859 static void ccw_machine_2_4_class_options(MachineClass
*mc
)
861 static GlobalProperty compat
[] = {
862 { TYPE_S390_SKEYS
, "migration-enabled", "off", },
863 { "virtio-blk-ccw", "max_revision", "0", },
864 { "virtio-balloon-ccw", "max_revision", "0", },
865 { "virtio-serial-ccw", "max_revision", "0", },
866 { "virtio-9p-ccw", "max_revision", "0", },
867 { "virtio-rng-ccw", "max_revision", "0", },
868 { "virtio-net-ccw", "max_revision", "0", },
869 { "virtio-scsi-ccw", "max_revision", "0", },
870 { "vhost-scsi-ccw", "max_revision", "0", },
873 ccw_machine_2_5_class_options(mc
);
874 compat_props_add(mc
->compat_props
, hw_compat_2_4
, hw_compat_2_4_len
);
875 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
877 DEFINE_CCW_MACHINE(2_4
, "2.4", false);
879 static void ccw_machine_register_types(void)
881 type_register_static(&ccw_machine_info
);
884 type_init(ccw_machine_register_types
)