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"
43 #include "sysemu/sysemu.h"
45 S390CPU
*s390_cpu_addr2state(uint16_t cpu_addr
)
47 static MachineState
*ms
;
50 ms
= MACHINE(qdev_get_machine());
51 g_assert(ms
->possible_cpus
);
54 /* CPU address corresponds to the core_id and the index */
55 if (cpu_addr
>= ms
->possible_cpus
->len
) {
58 return S390_CPU(ms
->possible_cpus
->cpus
[cpu_addr
].cpu
);
61 static S390CPU
*s390x_new_cpu(const char *typename
, uint32_t core_id
,
64 S390CPU
*cpu
= S390_CPU(object_new(typename
));
67 object_property_set_int(OBJECT(cpu
), core_id
, "core-id", &err
);
71 object_property_set_bool(OBJECT(cpu
), true, "realized", &err
);
74 object_unref(OBJECT(cpu
));
76 error_propagate(errp
, err
);
82 static void s390_init_cpus(MachineState
*machine
)
84 MachineClass
*mc
= MACHINE_GET_CLASS(machine
);
87 /* initialize possible_cpus */
88 mc
->possible_cpu_arch_ids(machine
);
90 for (i
= 0; i
< machine
->smp
.cpus
; i
++) {
91 s390x_new_cpu(machine
->cpu_type
, i
, &error_fatal
);
95 static const char *const reset_dev_types
[] = {
96 TYPE_VIRTUAL_CSS_BRIDGE
,
97 "s390-sclp-event-facility",
102 static void subsystem_reset(void)
107 for (i
= 0; i
< ARRAY_SIZE(reset_dev_types
); i
++) {
108 dev
= DEVICE(object_resolve_path_type("", reset_dev_types
[i
], NULL
));
115 static int virtio_ccw_hcall_notify(const uint64_t *args
)
117 uint64_t subch_id
= args
[0];
118 uint64_t queue
= args
[1];
120 int cssid
, ssid
, schid
, m
;
122 if (ioinst_disassemble_sch_ident(subch_id
, &m
, &cssid
, &ssid
, &schid
)) {
125 sch
= css_find_subch(m
, cssid
, ssid
, schid
);
126 if (!sch
|| !css_subch_visible(sch
)) {
129 if (queue
>= VIRTIO_QUEUE_MAX
) {
132 virtio_queue_notify(virtio_ccw_get_vdev(sch
), queue
);
137 static int virtio_ccw_hcall_early_printk(const uint64_t *args
)
139 uint64_t mem
= args
[0];
141 if (mem
< ram_size
) {
148 static void virtio_ccw_register_hcalls(void)
150 s390_register_virtio_hypercall(KVM_S390_VIRTIO_CCW_NOTIFY
,
151 virtio_ccw_hcall_notify
);
152 /* Tolerate early printk. */
153 s390_register_virtio_hypercall(KVM_S390_VIRTIO_NOTIFY
,
154 virtio_ccw_hcall_early_printk
);
158 * KVM does only support memory slots up to KVM_MEM_MAX_NR_PAGES pages
159 * as the dirty bitmap must be managed by bitops that take an int as
160 * position indicator. If we have a guest beyond that we will split off
161 * new subregions. The split must happen on a segment boundary (1MB).
163 #define KVM_MEM_MAX_NR_PAGES ((1ULL << 31) - 1)
164 #define SEG_MSK (~0xfffffULL)
165 #define KVM_SLOT_MAX_BYTES ((KVM_MEM_MAX_NR_PAGES * TARGET_PAGE_SIZE) & SEG_MSK)
166 static void s390_memory_init(ram_addr_t mem_size
)
168 MemoryRegion
*sysmem
= get_system_memory();
169 ram_addr_t chunk
, offset
= 0;
170 unsigned int number
= 0;
171 Error
*local_err
= NULL
;
174 /* allocate RAM for core */
175 name
= g_strdup_printf("s390.ram");
177 MemoryRegion
*ram
= g_new(MemoryRegion
, 1);
178 uint64_t size
= mem_size
;
180 /* KVM does not allow memslots >= 8 TB */
181 chunk
= MIN(size
, KVM_SLOT_MAX_BYTES
);
182 memory_region_allocate_system_memory(ram
, NULL
, name
, chunk
);
183 memory_region_add_subregion(sysmem
, offset
, ram
);
187 name
= g_strdup_printf("s390.ram.%u", ++number
);
192 * Configure the maximum page size. As no memory devices were created
193 * yet, this is the page size of initial memory only.
195 s390_set_max_pagesize(qemu_maxrampagesize(), &local_err
);
197 error_report_err(local_err
);
200 /* Initialize storage key device */
202 /* Initialize storage attributes device */
203 s390_stattrib_init();
206 static void s390_init_ipl_dev(const char *kernel_filename
,
207 const char *kernel_cmdline
,
208 const char *initrd_filename
, const char *firmware
,
209 const char *netboot_fw
, bool enforce_bios
)
211 Object
*new = object_new(TYPE_S390_IPL
);
212 DeviceState
*dev
= DEVICE(new);
213 char *netboot_fw_prop
;
215 if (kernel_filename
) {
216 qdev_prop_set_string(dev
, "kernel", kernel_filename
);
218 if (initrd_filename
) {
219 qdev_prop_set_string(dev
, "initrd", initrd_filename
);
221 qdev_prop_set_string(dev
, "cmdline", kernel_cmdline
);
222 qdev_prop_set_string(dev
, "firmware", firmware
);
223 qdev_prop_set_bit(dev
, "enforce_bios", enforce_bios
);
224 netboot_fw_prop
= object_property_get_str(new, "netboot_fw", &error_abort
);
225 if (!strlen(netboot_fw_prop
)) {
226 qdev_prop_set_string(dev
, "netboot_fw", netboot_fw
);
228 g_free(netboot_fw_prop
);
229 object_property_add_child(qdev_get_machine(), TYPE_S390_IPL
,
232 qdev_init_nofail(dev
);
235 static void s390_create_virtio_net(BusState
*bus
, const char *name
)
239 for (i
= 0; i
< nb_nics
; i
++) {
240 NICInfo
*nd
= &nd_table
[i
];
244 nd
->model
= g_strdup("virtio");
247 qemu_check_nic_model(nd
, "virtio");
249 dev
= qdev_create(bus
, name
);
250 qdev_set_nic_properties(dev
, nd
);
251 qdev_init_nofail(dev
);
255 static void s390_create_sclpconsole(const char *type
, Chardev
*chardev
)
259 dev
= qdev_create(sclp_get_event_facility_bus(), type
);
260 qdev_prop_set_chr(dev
, "chardev", chardev
);
261 qdev_init_nofail(dev
);
264 static void ccw_init(MachineState
*machine
)
267 VirtualCssBus
*css_bus
;
271 /* init memory + setup max page size. Required for the CPU model */
272 s390_memory_init(machine
->ram_size
);
274 /* init CPUs (incl. CPU model) early so s390_has_feature() works */
275 s390_init_cpus(machine
);
279 /* init the SIGP facility */
282 /* create AP bridge and bus(es) */
286 css_bus
= virtual_css_bus_init();
287 s390_init_ipl_dev(machine
->kernel_filename
, machine
->kernel_cmdline
,
288 machine
->initrd_filename
, "s390-ccw.img",
289 "s390-netboot.img", true);
291 dev
= qdev_create(NULL
, TYPE_S390_PCI_HOST_BRIDGE
);
292 object_property_add_child(qdev_get_machine(), TYPE_S390_PCI_HOST_BRIDGE
,
294 qdev_init_nofail(dev
);
296 /* register hypercalls */
297 virtio_ccw_register_hcalls();
299 s390_enable_css_support(s390_cpu_addr2state(0));
301 ret
= css_create_css_image(VIRTUAL_CSSID
, true);
304 if (css_migration_enabled()) {
305 css_register_vmstate();
308 /* Create VirtIO network adapters */
309 s390_create_virtio_net(BUS(css_bus
), "virtio-net-ccw");
313 s390_create_sclpconsole("sclpconsole", serial_hd(0));
316 s390_create_sclpconsole("sclplmconsole", serial_hd(1));
319 /* init the TOD clock */
323 static void s390_cpu_plug(HotplugHandler
*hotplug_dev
,
324 DeviceState
*dev
, Error
**errp
)
326 MachineState
*ms
= MACHINE(hotplug_dev
);
327 S390CPU
*cpu
= S390_CPU(dev
);
329 g_assert(!ms
->possible_cpus
->cpus
[cpu
->env
.core_id
].cpu
);
330 ms
->possible_cpus
->cpus
[cpu
->env
.core_id
].cpu
= OBJECT(dev
);
332 if (dev
->hotplugged
) {
333 raise_irq_cpu_hotplug();
337 static inline void s390_do_cpu_ipl(CPUState
*cs
, run_on_cpu_data arg
)
339 S390CPU
*cpu
= S390_CPU(cs
);
341 s390_ipl_prepare_cpu(cpu
);
342 s390_cpu_set_state(S390_CPU_STATE_OPERATING
, cpu
);
345 static void s390_machine_reset(MachineState
*machine
)
347 enum s390_reset reset_type
;
350 /* get the reset parameters, reset them once done */
351 s390_ipl_get_reset_request(&cs
, &reset_type
);
353 /* all CPUs are paused and synchronized at this point */
356 switch (reset_type
) {
357 case S390_RESET_EXTERNAL
:
358 case S390_RESET_REIPL
:
359 qemu_devices_reset();
362 /* configure and start the ipl CPU only */
363 run_on_cpu(cs
, s390_do_cpu_ipl
, RUN_ON_CPU_NULL
);
365 case S390_RESET_MODIFIED_CLEAR
:
367 run_on_cpu(t
, s390_do_cpu_full_reset
, RUN_ON_CPU_NULL
);
371 run_on_cpu(cs
, s390_do_cpu_load_normal
, RUN_ON_CPU_NULL
);
373 case S390_RESET_LOAD_NORMAL
:
375 run_on_cpu(t
, s390_do_cpu_reset
, RUN_ON_CPU_NULL
);
378 run_on_cpu(cs
, s390_do_cpu_initial_reset
, RUN_ON_CPU_NULL
);
379 run_on_cpu(cs
, s390_do_cpu_load_normal
, RUN_ON_CPU_NULL
);
382 g_assert_not_reached();
384 s390_ipl_clear_reset_request();
387 static void s390_machine_device_plug(HotplugHandler
*hotplug_dev
,
388 DeviceState
*dev
, Error
**errp
)
390 if (object_dynamic_cast(OBJECT(dev
), TYPE_CPU
)) {
391 s390_cpu_plug(hotplug_dev
, dev
, errp
);
395 static void s390_machine_device_unplug_request(HotplugHandler
*hotplug_dev
,
396 DeviceState
*dev
, Error
**errp
)
398 if (object_dynamic_cast(OBJECT(dev
), TYPE_CPU
)) {
399 error_setg(errp
, "CPU hot unplug not supported on this machine");
404 static CpuInstanceProperties
s390_cpu_index_to_props(MachineState
*ms
,
407 MachineClass
*mc
= MACHINE_GET_CLASS(ms
);
408 const CPUArchIdList
*possible_cpus
= mc
->possible_cpu_arch_ids(ms
);
410 assert(cpu_index
< possible_cpus
->len
);
411 return possible_cpus
->cpus
[cpu_index
].props
;
414 static const CPUArchIdList
*s390_possible_cpu_arch_ids(MachineState
*ms
)
417 unsigned int max_cpus
= ms
->smp
.max_cpus
;
419 if (ms
->possible_cpus
) {
420 g_assert(ms
->possible_cpus
&& ms
->possible_cpus
->len
== max_cpus
);
421 return ms
->possible_cpus
;
424 ms
->possible_cpus
= g_malloc0(sizeof(CPUArchIdList
) +
425 sizeof(CPUArchId
) * max_cpus
);
426 ms
->possible_cpus
->len
= max_cpus
;
427 for (i
= 0; i
< ms
->possible_cpus
->len
; i
++) {
428 ms
->possible_cpus
->cpus
[i
].type
= ms
->cpu_type
;
429 ms
->possible_cpus
->cpus
[i
].vcpus_count
= 1;
430 ms
->possible_cpus
->cpus
[i
].arch_id
= i
;
431 ms
->possible_cpus
->cpus
[i
].props
.has_core_id
= true;
432 ms
->possible_cpus
->cpus
[i
].props
.core_id
= i
;
435 return ms
->possible_cpus
;
438 static HotplugHandler
*s390_get_hotplug_handler(MachineState
*machine
,
441 if (object_dynamic_cast(OBJECT(dev
), TYPE_CPU
)) {
442 return HOTPLUG_HANDLER(machine
);
447 static void s390_hot_add_cpu(MachineState
*machine
,
448 const int64_t id
, Error
**errp
)
452 g_assert(machine
->possible_cpus
->cpus
[0].cpu
);
453 oc
= OBJECT_CLASS(CPU_GET_CLASS(machine
->possible_cpus
->cpus
[0].cpu
));
455 s390x_new_cpu(object_class_get_name(oc
), id
, errp
);
458 static void s390_nmi(NMIState
*n
, int cpu_index
, Error
**errp
)
460 CPUState
*cs
= qemu_get_cpu(cpu_index
);
462 s390_cpu_restart(S390_CPU(cs
));
465 static void ccw_machine_class_init(ObjectClass
*oc
, void *data
)
467 MachineClass
*mc
= MACHINE_CLASS(oc
);
468 NMIClass
*nc
= NMI_CLASS(oc
);
469 HotplugHandlerClass
*hc
= HOTPLUG_HANDLER_CLASS(oc
);
470 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
472 s390mc
->ri_allowed
= true;
473 s390mc
->cpu_model_allowed
= true;
474 s390mc
->css_migration_enabled
= true;
475 s390mc
->hpage_1m_allowed
= true;
477 mc
->reset
= s390_machine_reset
;
478 mc
->hot_add_cpu
= s390_hot_add_cpu
;
479 mc
->block_default_type
= IF_VIRTIO
;
484 mc
->max_cpus
= S390_MAX_CPUS
;
485 mc
->has_hotpluggable_cpus
= true;
486 assert(!mc
->get_hotplug_handler
);
487 mc
->get_hotplug_handler
= s390_get_hotplug_handler
;
488 mc
->cpu_index_to_instance_props
= s390_cpu_index_to_props
;
489 mc
->possible_cpu_arch_ids
= s390_possible_cpu_arch_ids
;
490 /* it is overridden with 'host' cpu *in kvm_arch_init* */
491 mc
->default_cpu_type
= S390_CPU_TYPE_NAME("qemu");
492 hc
->plug
= s390_machine_device_plug
;
493 hc
->unplug_request
= s390_machine_device_unplug_request
;
494 nc
->nmi_monitor_handler
= s390_nmi
;
497 static inline bool machine_get_aes_key_wrap(Object
*obj
, Error
**errp
)
499 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
501 return ms
->aes_key_wrap
;
504 static inline void machine_set_aes_key_wrap(Object
*obj
, bool value
,
507 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
509 ms
->aes_key_wrap
= value
;
512 static inline bool machine_get_dea_key_wrap(Object
*obj
, Error
**errp
)
514 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
516 return ms
->dea_key_wrap
;
519 static inline void machine_set_dea_key_wrap(Object
*obj
, bool value
,
522 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
524 ms
->dea_key_wrap
= value
;
527 static S390CcwMachineClass
*current_mc
;
529 static S390CcwMachineClass
*get_machine_class(void)
531 if (unlikely(!current_mc
)) {
533 * No s390 ccw machine was instantiated, we are likely to
534 * be called for the 'none' machine. The properties will
535 * have their after-initialization values.
537 current_mc
= S390_MACHINE_CLASS(
538 object_class_by_name(TYPE_S390_CCW_MACHINE
));
543 bool ri_allowed(void)
545 /* for "none" machine this results in true */
546 return get_machine_class()->ri_allowed
;
549 bool cpu_model_allowed(void)
551 /* for "none" machine this results in true */
552 return get_machine_class()->cpu_model_allowed
;
555 bool hpage_1m_allowed(void)
557 /* for "none" machine this results in true */
558 return get_machine_class()->hpage_1m_allowed
;
561 static char *machine_get_loadparm(Object
*obj
, Error
**errp
)
563 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
565 return g_memdup(ms
->loadparm
, sizeof(ms
->loadparm
));
568 static void machine_set_loadparm(Object
*obj
, const char *val
, Error
**errp
)
570 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
573 for (i
= 0; i
< sizeof(ms
->loadparm
) && val
[i
]; i
++) {
574 uint8_t c
= qemu_toupper(val
[i
]); /* mimic HMC */
576 if (('A' <= c
&& c
<= 'Z') || ('0' <= c
&& c
<= '9') || (c
== '.') ||
580 error_setg(errp
, "LOADPARM: invalid character '%c' (ASCII 0x%02x)",
586 for (; i
< sizeof(ms
->loadparm
); i
++) {
587 ms
->loadparm
[i
] = ' '; /* pad right with spaces */
590 static inline void s390_machine_initfn(Object
*obj
)
592 object_property_add_bool(obj
, "aes-key-wrap",
593 machine_get_aes_key_wrap
,
594 machine_set_aes_key_wrap
, NULL
);
595 object_property_set_description(obj
, "aes-key-wrap",
596 "enable/disable AES key wrapping using the CPACF wrapping key",
598 object_property_set_bool(obj
, true, "aes-key-wrap", NULL
);
600 object_property_add_bool(obj
, "dea-key-wrap",
601 machine_get_dea_key_wrap
,
602 machine_set_dea_key_wrap
, NULL
);
603 object_property_set_description(obj
, "dea-key-wrap",
604 "enable/disable DEA key wrapping using the CPACF wrapping key",
606 object_property_set_bool(obj
, true, "dea-key-wrap", NULL
);
607 object_property_add_str(obj
, "loadparm",
608 machine_get_loadparm
, machine_set_loadparm
, NULL
);
609 object_property_set_description(obj
, "loadparm",
610 "Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted"
611 " to upper case) to pass to machine loader, boot manager,"
616 static const TypeInfo ccw_machine_info
= {
617 .name
= TYPE_S390_CCW_MACHINE
,
618 .parent
= TYPE_MACHINE
,
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
[]) {
626 { TYPE_HOTPLUG_HANDLER
},
631 bool css_migration_enabled(void)
633 return get_machine_class()->css_migration_enabled
;
636 #define DEFINE_CCW_MACHINE(suffix, verstr, latest) \
637 static void ccw_machine_##suffix##_class_init(ObjectClass *oc, \
640 MachineClass *mc = MACHINE_CLASS(oc); \
641 ccw_machine_##suffix##_class_options(mc); \
642 mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
644 mc->alias = "s390-ccw-virtio"; \
645 mc->is_default = 1; \
648 static void ccw_machine_##suffix##_instance_init(Object *obj) \
650 MachineState *machine = MACHINE(obj); \
651 current_mc = S390_MACHINE_CLASS(MACHINE_GET_CLASS(machine)); \
652 ccw_machine_##suffix##_instance_options(machine); \
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, \
660 static void ccw_machine_register_##suffix(void) \
662 type_register_static(&ccw_machine_##suffix##_info); \
664 type_init(ccw_machine_register_##suffix)
666 static void ccw_machine_4_1_instance_options(MachineState
*machine
)
670 static void ccw_machine_4_1_class_options(MachineClass
*mc
)
673 DEFINE_CCW_MACHINE(4_1
, "4.1", true);
675 static void ccw_machine_4_0_instance_options(MachineState
*machine
)
677 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V4_0
};
678 ccw_machine_4_1_instance_options(machine
);
679 s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat
);
682 static void ccw_machine_4_0_class_options(MachineClass
*mc
)
684 ccw_machine_4_1_class_options(mc
);
685 compat_props_add(mc
->compat_props
, hw_compat_4_0
, hw_compat_4_0_len
);
687 DEFINE_CCW_MACHINE(4_0
, "4.0", false);
689 static void ccw_machine_3_1_instance_options(MachineState
*machine
)
691 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V3_1
};
692 ccw_machine_4_0_instance_options(machine
);
693 s390_cpudef_featoff_greater(14, 1, S390_FEAT_MULTIPLE_EPOCH
);
694 s390_cpudef_group_featoff_greater(14, 1, S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF
);
695 s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat
);
698 static void ccw_machine_3_1_class_options(MachineClass
*mc
)
700 ccw_machine_4_0_class_options(mc
);
701 compat_props_add(mc
->compat_props
, hw_compat_3_1
, hw_compat_3_1_len
);
703 DEFINE_CCW_MACHINE(3_1
, "3.1", false);
705 static void ccw_machine_3_0_instance_options(MachineState
*machine
)
707 ccw_machine_3_1_instance_options(machine
);
710 static void ccw_machine_3_0_class_options(MachineClass
*mc
)
712 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
714 s390mc
->hpage_1m_allowed
= false;
715 ccw_machine_3_1_class_options(mc
);
716 compat_props_add(mc
->compat_props
, hw_compat_3_0
, hw_compat_3_0_len
);
718 DEFINE_CCW_MACHINE(3_0
, "3.0", false);
720 static void ccw_machine_2_12_instance_options(MachineState
*machine
)
722 ccw_machine_3_0_instance_options(machine
);
723 s390_cpudef_featoff_greater(11, 1, S390_FEAT_PPA15
);
724 s390_cpudef_featoff_greater(11, 1, S390_FEAT_BPB
);
727 static void ccw_machine_2_12_class_options(MachineClass
*mc
)
729 ccw_machine_3_0_class_options(mc
);
730 compat_props_add(mc
->compat_props
, hw_compat_2_12
, hw_compat_2_12_len
);
732 DEFINE_CCW_MACHINE(2_12
, "2.12", false);
734 static void ccw_machine_2_11_instance_options(MachineState
*machine
)
736 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V2_11
};
737 ccw_machine_2_12_instance_options(machine
);
739 /* before 2.12 we emulated the very first z900 */
740 s390_set_qemu_cpu_model(0x2064, 7, 1, qemu_cpu_feat
);
743 static void ccw_machine_2_11_class_options(MachineClass
*mc
)
745 static GlobalProperty compat
[] = {
746 { TYPE_SCLP_EVENT_FACILITY
, "allow_all_mask_sizes", "off", },
749 ccw_machine_2_12_class_options(mc
);
750 compat_props_add(mc
->compat_props
, hw_compat_2_11
, hw_compat_2_11_len
);
751 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
753 DEFINE_CCW_MACHINE(2_11
, "2.11", false);
755 static void ccw_machine_2_10_instance_options(MachineState
*machine
)
757 ccw_machine_2_11_instance_options(machine
);
760 static void ccw_machine_2_10_class_options(MachineClass
*mc
)
762 ccw_machine_2_11_class_options(mc
);
763 compat_props_add(mc
->compat_props
, hw_compat_2_10
, hw_compat_2_10_len
);
765 DEFINE_CCW_MACHINE(2_10
, "2.10", false);
767 static void ccw_machine_2_9_instance_options(MachineState
*machine
)
769 ccw_machine_2_10_instance_options(machine
);
770 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ESOP
);
771 s390_cpudef_featoff_greater(12, 1, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2
);
772 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ZPCI
);
773 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_INT_SUPPRESSION
);
774 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_EVENT_NOTIFICATION
);
777 static void ccw_machine_2_9_class_options(MachineClass
*mc
)
779 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
780 static GlobalProperty compat
[] = {
781 { TYPE_S390_STATTRIB
, "migration-enabled", "off", },
784 ccw_machine_2_10_class_options(mc
);
785 compat_props_add(mc
->compat_props
, hw_compat_2_9
, hw_compat_2_9_len
);
786 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
787 s390mc
->css_migration_enabled
= false;
789 DEFINE_CCW_MACHINE(2_9
, "2.9", false);
791 static void ccw_machine_2_8_instance_options(MachineState
*machine
)
793 ccw_machine_2_9_instance_options(machine
);
796 static void ccw_machine_2_8_class_options(MachineClass
*mc
)
798 static GlobalProperty compat
[] = {
799 { TYPE_S390_FLIC_COMMON
, "adapter_routes_max_batch", "64", },
802 ccw_machine_2_9_class_options(mc
);
803 compat_props_add(mc
->compat_props
, hw_compat_2_8
, hw_compat_2_8_len
);
804 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
806 DEFINE_CCW_MACHINE(2_8
, "2.8", false);
808 static void ccw_machine_2_7_instance_options(MachineState
*machine
)
810 ccw_machine_2_8_instance_options(machine
);
813 static void ccw_machine_2_7_class_options(MachineClass
*mc
)
815 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
817 s390mc
->cpu_model_allowed
= false;
818 ccw_machine_2_8_class_options(mc
);
819 compat_props_add(mc
->compat_props
, hw_compat_2_7
, hw_compat_2_7_len
);
821 DEFINE_CCW_MACHINE(2_7
, "2.7", false);
823 static void ccw_machine_2_6_instance_options(MachineState
*machine
)
825 ccw_machine_2_7_instance_options(machine
);
828 static void ccw_machine_2_6_class_options(MachineClass
*mc
)
830 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
831 static GlobalProperty compat
[] = {
832 { TYPE_S390_IPL
, "iplbext_migration", "off", },
833 { TYPE_VIRTUAL_CSS_BRIDGE
, "css_dev_path", "off", },
836 s390mc
->ri_allowed
= false;
837 ccw_machine_2_7_class_options(mc
);
838 compat_props_add(mc
->compat_props
, hw_compat_2_6
, hw_compat_2_6_len
);
839 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
841 DEFINE_CCW_MACHINE(2_6
, "2.6", false);
843 static void ccw_machine_2_5_instance_options(MachineState
*machine
)
845 ccw_machine_2_6_instance_options(machine
);
848 static void ccw_machine_2_5_class_options(MachineClass
*mc
)
850 ccw_machine_2_6_class_options(mc
);
851 compat_props_add(mc
->compat_props
, hw_compat_2_5
, hw_compat_2_5_len
);
853 DEFINE_CCW_MACHINE(2_5
, "2.5", false);
855 static void ccw_machine_2_4_instance_options(MachineState
*machine
)
857 ccw_machine_2_5_instance_options(machine
);
860 static void ccw_machine_2_4_class_options(MachineClass
*mc
)
862 static GlobalProperty compat
[] = {
863 { TYPE_S390_SKEYS
, "migration-enabled", "off", },
864 { "virtio-blk-ccw", "max_revision", "0", },
865 { "virtio-balloon-ccw", "max_revision", "0", },
866 { "virtio-serial-ccw", "max_revision", "0", },
867 { "virtio-9p-ccw", "max_revision", "0", },
868 { "virtio-rng-ccw", "max_revision", "0", },
869 { "virtio-net-ccw", "max_revision", "0", },
870 { "virtio-scsi-ccw", "max_revision", "0", },
871 { "vhost-scsi-ccw", "max_revision", "0", },
874 ccw_machine_2_5_class_options(mc
);
875 compat_props_add(mc
->compat_props
, hw_compat_2_4
, hw_compat_2_4_len
);
876 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
878 DEFINE_CCW_MACHINE(2_4
, "2.4", false);
880 static void ccw_machine_register_types(void)
882 type_register_static(&ccw_machine_info
);
885 type_init(ccw_machine_register_types
)