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 "hw/s390x/storage-keys.h"
31 #include "hw/s390x/storage-attributes.h"
32 #include "hw/s390x/event-facility.h"
34 #include "hw/s390x/s390-virtio-ccw.h"
35 #include "hw/s390x/css-bridge.h"
36 #include "hw/s390x/ap-bridge.h"
37 #include "migration/register.h"
38 #include "cpu_models.h"
40 #include "hw/s390x/tod.h"
42 S390CPU
*s390_cpu_addr2state(uint16_t cpu_addr
)
44 static MachineState
*ms
;
47 ms
= MACHINE(qdev_get_machine());
48 g_assert(ms
->possible_cpus
);
51 /* CPU address corresponds to the core_id and the index */
52 if (cpu_addr
>= ms
->possible_cpus
->len
) {
55 return S390_CPU(ms
->possible_cpus
->cpus
[cpu_addr
].cpu
);
58 static S390CPU
*s390x_new_cpu(const char *typename
, uint32_t core_id
,
61 S390CPU
*cpu
= S390_CPU(object_new(typename
));
64 object_property_set_int(OBJECT(cpu
), core_id
, "core-id", &err
);
68 object_property_set_bool(OBJECT(cpu
), true, "realized", &err
);
71 object_unref(OBJECT(cpu
));
73 error_propagate(errp
, err
);
79 static void s390_init_cpus(MachineState
*machine
)
81 MachineClass
*mc
= MACHINE_GET_CLASS(machine
);
84 /* initialize possible_cpus */
85 mc
->possible_cpu_arch_ids(machine
);
87 for (i
= 0; i
< smp_cpus
; i
++) {
88 s390x_new_cpu(machine
->cpu_type
, i
, &error_fatal
);
92 static const char *const reset_dev_types
[] = {
93 TYPE_VIRTUAL_CSS_BRIDGE
,
94 "s390-sclp-event-facility",
99 static void subsystem_reset(void)
104 for (i
= 0; i
< ARRAY_SIZE(reset_dev_types
); i
++) {
105 dev
= DEVICE(object_resolve_path_type("", reset_dev_types
[i
], NULL
));
112 static int virtio_ccw_hcall_notify(const uint64_t *args
)
114 uint64_t subch_id
= args
[0];
115 uint64_t queue
= args
[1];
117 int cssid
, ssid
, schid
, m
;
119 if (ioinst_disassemble_sch_ident(subch_id
, &m
, &cssid
, &ssid
, &schid
)) {
122 sch
= css_find_subch(m
, cssid
, ssid
, schid
);
123 if (!sch
|| !css_subch_visible(sch
)) {
126 if (queue
>= VIRTIO_QUEUE_MAX
) {
129 virtio_queue_notify(virtio_ccw_get_vdev(sch
), queue
);
134 static int virtio_ccw_hcall_early_printk(const uint64_t *args
)
136 uint64_t mem
= args
[0];
138 if (mem
< ram_size
) {
145 static void virtio_ccw_register_hcalls(void)
147 s390_register_virtio_hypercall(KVM_S390_VIRTIO_CCW_NOTIFY
,
148 virtio_ccw_hcall_notify
);
149 /* Tolerate early printk. */
150 s390_register_virtio_hypercall(KVM_S390_VIRTIO_NOTIFY
,
151 virtio_ccw_hcall_early_printk
);
155 * KVM does only support memory slots up to KVM_MEM_MAX_NR_PAGES pages
156 * as the dirty bitmap must be managed by bitops that take an int as
157 * position indicator. If we have a guest beyond that we will split off
158 * new subregions. The split must happen on a segment boundary (1MB).
160 #define KVM_MEM_MAX_NR_PAGES ((1ULL << 31) - 1)
161 #define SEG_MSK (~0xfffffULL)
162 #define KVM_SLOT_MAX_BYTES ((KVM_MEM_MAX_NR_PAGES * TARGET_PAGE_SIZE) & SEG_MSK)
163 static void s390_memory_init(ram_addr_t mem_size
)
165 MemoryRegion
*sysmem
= get_system_memory();
166 ram_addr_t chunk
, offset
= 0;
167 unsigned int number
= 0;
168 Error
*local_err
= NULL
;
171 /* allocate RAM for core */
172 name
= g_strdup_printf("s390.ram");
174 MemoryRegion
*ram
= g_new(MemoryRegion
, 1);
175 uint64_t size
= mem_size
;
177 /* KVM does not allow memslots >= 8 TB */
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
);
184 name
= g_strdup_printf("s390.ram.%u", ++number
);
189 * Configure the maximum page size. As no memory devices were created
190 * yet, this is the page size of initial memory only.
192 s390_set_max_pagesize(qemu_maxrampagesize(), &local_err
);
194 error_report_err(local_err
);
197 /* Initialize storage key device */
199 /* Initialize storage attributes device */
200 s390_stattrib_init();
203 static void s390_init_ipl_dev(const char *kernel_filename
,
204 const char *kernel_cmdline
,
205 const char *initrd_filename
, const char *firmware
,
206 const char *netboot_fw
, bool enforce_bios
)
208 Object
*new = object_new(TYPE_S390_IPL
);
209 DeviceState
*dev
= DEVICE(new);
210 char *netboot_fw_prop
;
212 if (kernel_filename
) {
213 qdev_prop_set_string(dev
, "kernel", kernel_filename
);
215 if (initrd_filename
) {
216 qdev_prop_set_string(dev
, "initrd", initrd_filename
);
218 qdev_prop_set_string(dev
, "cmdline", kernel_cmdline
);
219 qdev_prop_set_string(dev
, "firmware", firmware
);
220 qdev_prop_set_bit(dev
, "enforce_bios", enforce_bios
);
221 netboot_fw_prop
= object_property_get_str(new, "netboot_fw", &error_abort
);
222 if (!strlen(netboot_fw_prop
)) {
223 qdev_prop_set_string(dev
, "netboot_fw", netboot_fw
);
225 g_free(netboot_fw_prop
);
226 object_property_add_child(qdev_get_machine(), TYPE_S390_IPL
,
229 qdev_init_nofail(dev
);
232 static void s390_create_virtio_net(BusState
*bus
, const char *name
)
236 for (i
= 0; i
< nb_nics
; i
++) {
237 NICInfo
*nd
= &nd_table
[i
];
241 nd
->model
= g_strdup("virtio");
244 qemu_check_nic_model(nd
, "virtio");
246 dev
= qdev_create(bus
, name
);
247 qdev_set_nic_properties(dev
, nd
);
248 qdev_init_nofail(dev
);
252 static void s390_create_sclpconsole(const char *type
, Chardev
*chardev
)
256 dev
= qdev_create(sclp_get_event_facility_bus(), type
);
257 qdev_prop_set_chr(dev
, "chardev", chardev
);
258 qdev_init_nofail(dev
);
261 static void ccw_init(MachineState
*machine
)
264 VirtualCssBus
*css_bus
;
268 /* init memory + setup max page size. Required for the CPU model */
269 s390_memory_init(machine
->ram_size
);
271 /* init CPUs (incl. CPU model) early so s390_has_feature() works */
272 s390_init_cpus(machine
);
276 /* init the SIGP facility */
279 /* create AP bridge and bus(es) */
283 css_bus
= virtual_css_bus_init();
284 s390_init_ipl_dev(machine
->kernel_filename
, machine
->kernel_cmdline
,
285 machine
->initrd_filename
, "s390-ccw.img",
286 "s390-netboot.img", true);
288 dev
= qdev_create(NULL
, TYPE_S390_PCI_HOST_BRIDGE
);
289 object_property_add_child(qdev_get_machine(), TYPE_S390_PCI_HOST_BRIDGE
,
291 qdev_init_nofail(dev
);
293 /* register hypercalls */
294 virtio_ccw_register_hcalls();
296 s390_enable_css_support(s390_cpu_addr2state(0));
298 ret
= css_create_css_image(VIRTUAL_CSSID
, true);
301 if (css_migration_enabled()) {
302 css_register_vmstate();
305 /* Create VirtIO network adapters */
306 s390_create_virtio_net(BUS(css_bus
), "virtio-net-ccw");
310 s390_create_sclpconsole("sclpconsole", serial_hd(0));
313 s390_create_sclpconsole("sclplmconsole", serial_hd(1));
316 /* init the TOD clock */
320 static void s390_cpu_plug(HotplugHandler
*hotplug_dev
,
321 DeviceState
*dev
, Error
**errp
)
323 MachineState
*ms
= MACHINE(hotplug_dev
);
324 S390CPU
*cpu
= S390_CPU(dev
);
326 g_assert(!ms
->possible_cpus
->cpus
[cpu
->env
.core_id
].cpu
);
327 ms
->possible_cpus
->cpus
[cpu
->env
.core_id
].cpu
= OBJECT(dev
);
329 if (dev
->hotplugged
) {
330 raise_irq_cpu_hotplug();
334 static inline void s390_do_cpu_ipl(CPUState
*cs
, run_on_cpu_data arg
)
336 S390CPU
*cpu
= S390_CPU(cs
);
338 s390_ipl_prepare_cpu(cpu
);
339 s390_cpu_set_state(S390_CPU_STATE_OPERATING
, cpu
);
342 static void s390_machine_reset(MachineState
*machine
)
344 enum s390_reset reset_type
;
347 /* get the reset parameters, reset them once done */
348 s390_ipl_get_reset_request(&cs
, &reset_type
);
350 /* all CPUs are paused and synchronized at this point */
353 switch (reset_type
) {
354 case S390_RESET_EXTERNAL
:
355 case S390_RESET_REIPL
:
356 qemu_devices_reset();
359 /* configure and start the ipl CPU only */
360 run_on_cpu(cs
, s390_do_cpu_ipl
, RUN_ON_CPU_NULL
);
362 case S390_RESET_MODIFIED_CLEAR
:
364 run_on_cpu(t
, s390_do_cpu_full_reset
, RUN_ON_CPU_NULL
);
368 run_on_cpu(cs
, s390_do_cpu_load_normal
, RUN_ON_CPU_NULL
);
370 case S390_RESET_LOAD_NORMAL
:
372 run_on_cpu(t
, s390_do_cpu_reset
, RUN_ON_CPU_NULL
);
375 run_on_cpu(cs
, s390_do_cpu_initial_reset
, RUN_ON_CPU_NULL
);
376 run_on_cpu(cs
, s390_do_cpu_load_normal
, RUN_ON_CPU_NULL
);
379 g_assert_not_reached();
381 s390_ipl_clear_reset_request();
384 static void s390_machine_device_plug(HotplugHandler
*hotplug_dev
,
385 DeviceState
*dev
, Error
**errp
)
387 if (object_dynamic_cast(OBJECT(dev
), TYPE_CPU
)) {
388 s390_cpu_plug(hotplug_dev
, dev
, errp
);
392 static void s390_machine_device_unplug_request(HotplugHandler
*hotplug_dev
,
393 DeviceState
*dev
, Error
**errp
)
395 if (object_dynamic_cast(OBJECT(dev
), TYPE_CPU
)) {
396 error_setg(errp
, "CPU hot unplug not supported on this machine");
401 static CpuInstanceProperties
s390_cpu_index_to_props(MachineState
*ms
,
404 MachineClass
*mc
= MACHINE_GET_CLASS(ms
);
405 const CPUArchIdList
*possible_cpus
= mc
->possible_cpu_arch_ids(ms
);
407 assert(cpu_index
< possible_cpus
->len
);
408 return possible_cpus
->cpus
[cpu_index
].props
;
411 static const CPUArchIdList
*s390_possible_cpu_arch_ids(MachineState
*ms
)
415 if (ms
->possible_cpus
) {
416 g_assert(ms
->possible_cpus
&& ms
->possible_cpus
->len
== max_cpus
);
417 return ms
->possible_cpus
;
420 ms
->possible_cpus
= g_malloc0(sizeof(CPUArchIdList
) +
421 sizeof(CPUArchId
) * max_cpus
);
422 ms
->possible_cpus
->len
= max_cpus
;
423 for (i
= 0; i
< ms
->possible_cpus
->len
; i
++) {
424 ms
->possible_cpus
->cpus
[i
].type
= ms
->cpu_type
;
425 ms
->possible_cpus
->cpus
[i
].vcpus_count
= 1;
426 ms
->possible_cpus
->cpus
[i
].arch_id
= i
;
427 ms
->possible_cpus
->cpus
[i
].props
.has_core_id
= true;
428 ms
->possible_cpus
->cpus
[i
].props
.core_id
= i
;
431 return ms
->possible_cpus
;
434 static HotplugHandler
*s390_get_hotplug_handler(MachineState
*machine
,
437 if (object_dynamic_cast(OBJECT(dev
), TYPE_CPU
)) {
438 return HOTPLUG_HANDLER(machine
);
443 static void s390_hot_add_cpu(MachineState
*machine
,
444 const int64_t id
, Error
**errp
)
448 g_assert(machine
->possible_cpus
->cpus
[0].cpu
);
449 oc
= OBJECT_CLASS(CPU_GET_CLASS(machine
->possible_cpus
->cpus
[0].cpu
));
451 s390x_new_cpu(object_class_get_name(oc
), id
, errp
);
454 static void s390_nmi(NMIState
*n
, int cpu_index
, Error
**errp
)
456 CPUState
*cs
= qemu_get_cpu(cpu_index
);
458 s390_cpu_restart(S390_CPU(cs
));
461 static void ccw_machine_class_init(ObjectClass
*oc
, void *data
)
463 MachineClass
*mc
= MACHINE_CLASS(oc
);
464 NMIClass
*nc
= NMI_CLASS(oc
);
465 HotplugHandlerClass
*hc
= HOTPLUG_HANDLER_CLASS(oc
);
466 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
468 s390mc
->ri_allowed
= true;
469 s390mc
->cpu_model_allowed
= true;
470 s390mc
->css_migration_enabled
= true;
471 s390mc
->hpage_1m_allowed
= true;
473 mc
->reset
= s390_machine_reset
;
474 mc
->hot_add_cpu
= s390_hot_add_cpu
;
475 mc
->block_default_type
= IF_VIRTIO
;
480 mc
->max_cpus
= S390_MAX_CPUS
;
481 mc
->has_hotpluggable_cpus
= true;
482 assert(!mc
->get_hotplug_handler
);
483 mc
->get_hotplug_handler
= s390_get_hotplug_handler
;
484 mc
->cpu_index_to_instance_props
= s390_cpu_index_to_props
;
485 mc
->possible_cpu_arch_ids
= s390_possible_cpu_arch_ids
;
486 /* it is overridden with 'host' cpu *in kvm_arch_init* */
487 mc
->default_cpu_type
= S390_CPU_TYPE_NAME("qemu");
488 hc
->plug
= s390_machine_device_plug
;
489 hc
->unplug_request
= s390_machine_device_unplug_request
;
490 nc
->nmi_monitor_handler
= s390_nmi
;
493 static inline bool machine_get_aes_key_wrap(Object
*obj
, Error
**errp
)
495 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
497 return ms
->aes_key_wrap
;
500 static inline void machine_set_aes_key_wrap(Object
*obj
, bool value
,
503 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
505 ms
->aes_key_wrap
= value
;
508 static inline bool machine_get_dea_key_wrap(Object
*obj
, Error
**errp
)
510 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
512 return ms
->dea_key_wrap
;
515 static inline void machine_set_dea_key_wrap(Object
*obj
, bool value
,
518 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
520 ms
->dea_key_wrap
= value
;
523 static S390CcwMachineClass
*current_mc
;
525 static S390CcwMachineClass
*get_machine_class(void)
527 if (unlikely(!current_mc
)) {
529 * No s390 ccw machine was instantiated, we are likely to
530 * be called for the 'none' machine. The properties will
531 * have their after-initialization values.
533 current_mc
= S390_MACHINE_CLASS(
534 object_class_by_name(TYPE_S390_CCW_MACHINE
));
539 bool ri_allowed(void)
541 /* for "none" machine this results in true */
542 return get_machine_class()->ri_allowed
;
545 bool cpu_model_allowed(void)
547 /* for "none" machine this results in true */
548 return get_machine_class()->cpu_model_allowed
;
551 bool hpage_1m_allowed(void)
553 /* for "none" machine this results in true */
554 return get_machine_class()->hpage_1m_allowed
;
557 static char *machine_get_loadparm(Object
*obj
, Error
**errp
)
559 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
561 return g_memdup(ms
->loadparm
, sizeof(ms
->loadparm
));
564 static void machine_set_loadparm(Object
*obj
, const char *val
, Error
**errp
)
566 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
569 for (i
= 0; i
< sizeof(ms
->loadparm
) && val
[i
]; i
++) {
570 uint8_t c
= qemu_toupper(val
[i
]); /* mimic HMC */
572 if (('A' <= c
&& c
<= 'Z') || ('0' <= c
&& c
<= '9') || (c
== '.') ||
576 error_setg(errp
, "LOADPARM: invalid character '%c' (ASCII 0x%02x)",
582 for (; i
< sizeof(ms
->loadparm
); i
++) {
583 ms
->loadparm
[i
] = ' '; /* pad right with spaces */
586 static inline void s390_machine_initfn(Object
*obj
)
588 object_property_add_bool(obj
, "aes-key-wrap",
589 machine_get_aes_key_wrap
,
590 machine_set_aes_key_wrap
, NULL
);
591 object_property_set_description(obj
, "aes-key-wrap",
592 "enable/disable AES key wrapping using the CPACF wrapping key",
594 object_property_set_bool(obj
, true, "aes-key-wrap", NULL
);
596 object_property_add_bool(obj
, "dea-key-wrap",
597 machine_get_dea_key_wrap
,
598 machine_set_dea_key_wrap
, NULL
);
599 object_property_set_description(obj
, "dea-key-wrap",
600 "enable/disable DEA key wrapping using the CPACF wrapping key",
602 object_property_set_bool(obj
, true, "dea-key-wrap", NULL
);
603 object_property_add_str(obj
, "loadparm",
604 machine_get_loadparm
, machine_set_loadparm
, NULL
);
605 object_property_set_description(obj
, "loadparm",
606 "Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted"
607 " to upper case) to pass to machine loader, boot manager,"
612 static const TypeInfo ccw_machine_info
= {
613 .name
= TYPE_S390_CCW_MACHINE
,
614 .parent
= TYPE_MACHINE
,
616 .instance_size
= sizeof(S390CcwMachineState
),
617 .instance_init
= s390_machine_initfn
,
618 .class_size
= sizeof(S390CcwMachineClass
),
619 .class_init
= ccw_machine_class_init
,
620 .interfaces
= (InterfaceInfo
[]) {
622 { TYPE_HOTPLUG_HANDLER
},
627 bool css_migration_enabled(void)
629 return get_machine_class()->css_migration_enabled
;
632 #define DEFINE_CCW_MACHINE(suffix, verstr, latest) \
633 static void ccw_machine_##suffix##_class_init(ObjectClass *oc, \
636 MachineClass *mc = MACHINE_CLASS(oc); \
637 ccw_machine_##suffix##_class_options(mc); \
638 mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
640 mc->alias = "s390-ccw-virtio"; \
641 mc->is_default = 1; \
644 static void ccw_machine_##suffix##_instance_init(Object *obj) \
646 MachineState *machine = MACHINE(obj); \
647 current_mc = S390_MACHINE_CLASS(MACHINE_GET_CLASS(machine)); \
648 ccw_machine_##suffix##_instance_options(machine); \
650 static const TypeInfo ccw_machine_##suffix##_info = { \
651 .name = MACHINE_TYPE_NAME("s390-ccw-virtio-" verstr), \
652 .parent = TYPE_S390_CCW_MACHINE, \
653 .class_init = ccw_machine_##suffix##_class_init, \
654 .instance_init = ccw_machine_##suffix##_instance_init, \
656 static void ccw_machine_register_##suffix(void) \
658 type_register_static(&ccw_machine_##suffix##_info); \
660 type_init(ccw_machine_register_##suffix)
662 static void ccw_machine_4_1_instance_options(MachineState
*machine
)
666 static void ccw_machine_4_1_class_options(MachineClass
*mc
)
669 DEFINE_CCW_MACHINE(4_1
, "4.1", true);
671 static void ccw_machine_4_0_instance_options(MachineState
*machine
)
673 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V4_0
};
674 ccw_machine_4_1_instance_options(machine
);
675 s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat
);
678 static void ccw_machine_4_0_class_options(MachineClass
*mc
)
680 ccw_machine_4_1_class_options(mc
);
681 compat_props_add(mc
->compat_props
, hw_compat_4_0
, hw_compat_4_0_len
);
683 DEFINE_CCW_MACHINE(4_0
, "4.0", false);
685 static void ccw_machine_3_1_instance_options(MachineState
*machine
)
687 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V3_1
};
688 ccw_machine_4_0_instance_options(machine
);
689 s390_cpudef_featoff_greater(14, 1, S390_FEAT_MULTIPLE_EPOCH
);
690 s390_cpudef_group_featoff_greater(14, 1, S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF
);
691 s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat
);
694 static void ccw_machine_3_1_class_options(MachineClass
*mc
)
696 ccw_machine_4_0_class_options(mc
);
697 compat_props_add(mc
->compat_props
, hw_compat_3_1
, hw_compat_3_1_len
);
699 DEFINE_CCW_MACHINE(3_1
, "3.1", false);
701 static void ccw_machine_3_0_instance_options(MachineState
*machine
)
703 ccw_machine_3_1_instance_options(machine
);
706 static void ccw_machine_3_0_class_options(MachineClass
*mc
)
708 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
710 s390mc
->hpage_1m_allowed
= false;
711 ccw_machine_3_1_class_options(mc
);
712 compat_props_add(mc
->compat_props
, hw_compat_3_0
, hw_compat_3_0_len
);
714 DEFINE_CCW_MACHINE(3_0
, "3.0", false);
716 static void ccw_machine_2_12_instance_options(MachineState
*machine
)
718 ccw_machine_3_0_instance_options(machine
);
719 s390_cpudef_featoff_greater(11, 1, S390_FEAT_PPA15
);
720 s390_cpudef_featoff_greater(11, 1, S390_FEAT_BPB
);
723 static void ccw_machine_2_12_class_options(MachineClass
*mc
)
725 ccw_machine_3_0_class_options(mc
);
726 compat_props_add(mc
->compat_props
, hw_compat_2_12
, hw_compat_2_12_len
);
728 DEFINE_CCW_MACHINE(2_12
, "2.12", false);
730 static void ccw_machine_2_11_instance_options(MachineState
*machine
)
732 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V2_11
};
733 ccw_machine_2_12_instance_options(machine
);
735 /* before 2.12 we emulated the very first z900 */
736 s390_set_qemu_cpu_model(0x2064, 7, 1, qemu_cpu_feat
);
739 static void ccw_machine_2_11_class_options(MachineClass
*mc
)
741 static GlobalProperty compat
[] = {
742 { TYPE_SCLP_EVENT_FACILITY
, "allow_all_mask_sizes", "off", },
745 ccw_machine_2_12_class_options(mc
);
746 compat_props_add(mc
->compat_props
, hw_compat_2_11
, hw_compat_2_11_len
);
747 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
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 compat_props_add(mc
->compat_props
, hw_compat_2_10
, hw_compat_2_10_len
);
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
);
776 static GlobalProperty compat
[] = {
777 { TYPE_S390_STATTRIB
, "migration-enabled", "off", },
780 ccw_machine_2_10_class_options(mc
);
781 compat_props_add(mc
->compat_props
, hw_compat_2_9
, hw_compat_2_9_len
);
782 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
783 s390mc
->css_migration_enabled
= false;
785 DEFINE_CCW_MACHINE(2_9
, "2.9", false);
787 static void ccw_machine_2_8_instance_options(MachineState
*machine
)
789 ccw_machine_2_9_instance_options(machine
);
792 static void ccw_machine_2_8_class_options(MachineClass
*mc
)
794 static GlobalProperty compat
[] = {
795 { TYPE_S390_FLIC_COMMON
, "adapter_routes_max_batch", "64", },
798 ccw_machine_2_9_class_options(mc
);
799 compat_props_add(mc
->compat_props
, hw_compat_2_8
, hw_compat_2_8_len
);
800 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
802 DEFINE_CCW_MACHINE(2_8
, "2.8", false);
804 static void ccw_machine_2_7_instance_options(MachineState
*machine
)
806 ccw_machine_2_8_instance_options(machine
);
809 static void ccw_machine_2_7_class_options(MachineClass
*mc
)
811 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
813 s390mc
->cpu_model_allowed
= false;
814 ccw_machine_2_8_class_options(mc
);
815 compat_props_add(mc
->compat_props
, hw_compat_2_7
, hw_compat_2_7_len
);
817 DEFINE_CCW_MACHINE(2_7
, "2.7", false);
819 static void ccw_machine_2_6_instance_options(MachineState
*machine
)
821 ccw_machine_2_7_instance_options(machine
);
824 static void ccw_machine_2_6_class_options(MachineClass
*mc
)
826 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
827 static GlobalProperty compat
[] = {
828 { TYPE_S390_IPL
, "iplbext_migration", "off", },
829 { TYPE_VIRTUAL_CSS_BRIDGE
, "css_dev_path", "off", },
832 s390mc
->ri_allowed
= false;
833 ccw_machine_2_7_class_options(mc
);
834 compat_props_add(mc
->compat_props
, hw_compat_2_6
, hw_compat_2_6_len
);
835 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
837 DEFINE_CCW_MACHINE(2_6
, "2.6", false);
839 static void ccw_machine_2_5_instance_options(MachineState
*machine
)
841 ccw_machine_2_6_instance_options(machine
);
844 static void ccw_machine_2_5_class_options(MachineClass
*mc
)
846 ccw_machine_2_6_class_options(mc
);
847 compat_props_add(mc
->compat_props
, hw_compat_2_5
, hw_compat_2_5_len
);
849 DEFINE_CCW_MACHINE(2_5
, "2.5", false);
851 static void ccw_machine_2_4_instance_options(MachineState
*machine
)
853 ccw_machine_2_5_instance_options(machine
);
856 static void ccw_machine_2_4_class_options(MachineClass
*mc
)
858 static GlobalProperty compat
[] = {
859 { TYPE_S390_SKEYS
, "migration-enabled", "off", },
860 { "virtio-blk-ccw", "max_revision", "0", },
861 { "virtio-balloon-ccw", "max_revision", "0", },
862 { "virtio-serial-ccw", "max_revision", "0", },
863 { "virtio-9p-ccw", "max_revision", "0", },
864 { "virtio-rng-ccw", "max_revision", "0", },
865 { "virtio-net-ccw", "max_revision", "0", },
866 { "virtio-scsi-ccw", "max_revision", "0", },
867 { "vhost-scsi-ccw", "max_revision", "0", },
870 ccw_machine_2_5_class_options(mc
);
871 compat_props_add(mc
->compat_props
, hw_compat_2_4
, hw_compat_2_4_len
);
872 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
874 DEFINE_CCW_MACHINE(2_4
, "2.4", false);
876 static void ccw_machine_register_types(void)
878 type_register_static(&ccw_machine_info
);
881 type_init(ccw_machine_register_types
)