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
);
157 static void s390_memory_init(ram_addr_t mem_size
)
159 MemoryRegion
*sysmem
= get_system_memory();
160 MemoryRegion
*ram
= g_new(MemoryRegion
, 1);
161 Error
*local_err
= NULL
;
163 /* allocate RAM for core */
164 memory_region_allocate_system_memory(ram
, NULL
, "s390.ram", mem_size
);
165 memory_region_add_subregion(sysmem
, 0, ram
);
168 * Configure the maximum page size. As no memory devices were created
169 * yet, this is the page size of initial memory only.
171 s390_set_max_pagesize(qemu_maxrampagesize(), &local_err
);
173 error_report_err(local_err
);
176 /* Initialize storage key device */
178 /* Initialize storage attributes device */
179 s390_stattrib_init();
182 static void s390_init_ipl_dev(const char *kernel_filename
,
183 const char *kernel_cmdline
,
184 const char *initrd_filename
, const char *firmware
,
185 const char *netboot_fw
, bool enforce_bios
)
187 Object
*new = object_new(TYPE_S390_IPL
);
188 DeviceState
*dev
= DEVICE(new);
189 char *netboot_fw_prop
;
191 if (kernel_filename
) {
192 qdev_prop_set_string(dev
, "kernel", kernel_filename
);
194 if (initrd_filename
) {
195 qdev_prop_set_string(dev
, "initrd", initrd_filename
);
197 qdev_prop_set_string(dev
, "cmdline", kernel_cmdline
);
198 qdev_prop_set_string(dev
, "firmware", firmware
);
199 qdev_prop_set_bit(dev
, "enforce_bios", enforce_bios
);
200 netboot_fw_prop
= object_property_get_str(new, "netboot_fw", &error_abort
);
201 if (!strlen(netboot_fw_prop
)) {
202 qdev_prop_set_string(dev
, "netboot_fw", netboot_fw
);
204 g_free(netboot_fw_prop
);
205 object_property_add_child(qdev_get_machine(), TYPE_S390_IPL
,
208 qdev_init_nofail(dev
);
211 static void s390_create_virtio_net(BusState
*bus
, const char *name
)
215 for (i
= 0; i
< nb_nics
; i
++) {
216 NICInfo
*nd
= &nd_table
[i
];
220 nd
->model
= g_strdup("virtio");
223 qemu_check_nic_model(nd
, "virtio");
225 dev
= qdev_create(bus
, name
);
226 qdev_set_nic_properties(dev
, nd
);
227 qdev_init_nofail(dev
);
231 static void s390_create_sclpconsole(const char *type
, Chardev
*chardev
)
235 dev
= qdev_create(sclp_get_event_facility_bus(), type
);
236 qdev_prop_set_chr(dev
, "chardev", chardev
);
237 qdev_init_nofail(dev
);
240 static void ccw_init(MachineState
*machine
)
243 VirtualCssBus
*css_bus
;
247 /* init memory + setup max page size. Required for the CPU model */
248 s390_memory_init(machine
->ram_size
);
250 /* init CPUs (incl. CPU model) early so s390_has_feature() works */
251 s390_init_cpus(machine
);
255 /* init the SIGP facility */
258 /* create AP bridge and bus(es) */
262 css_bus
= virtual_css_bus_init();
263 s390_init_ipl_dev(machine
->kernel_filename
, machine
->kernel_cmdline
,
264 machine
->initrd_filename
, "s390-ccw.img",
265 "s390-netboot.img", true);
267 dev
= qdev_create(NULL
, TYPE_S390_PCI_HOST_BRIDGE
);
268 object_property_add_child(qdev_get_machine(), TYPE_S390_PCI_HOST_BRIDGE
,
270 qdev_init_nofail(dev
);
272 /* register hypercalls */
273 virtio_ccw_register_hcalls();
275 s390_enable_css_support(s390_cpu_addr2state(0));
277 ret
= css_create_css_image(VIRTUAL_CSSID
, true);
280 if (css_migration_enabled()) {
281 css_register_vmstate();
284 /* Create VirtIO network adapters */
285 s390_create_virtio_net(BUS(css_bus
), "virtio-net-ccw");
289 s390_create_sclpconsole("sclpconsole", serial_hd(0));
292 s390_create_sclpconsole("sclplmconsole", serial_hd(1));
295 /* init the TOD clock */
299 static void s390_cpu_plug(HotplugHandler
*hotplug_dev
,
300 DeviceState
*dev
, Error
**errp
)
302 MachineState
*ms
= MACHINE(hotplug_dev
);
303 S390CPU
*cpu
= S390_CPU(dev
);
305 g_assert(!ms
->possible_cpus
->cpus
[cpu
->env
.core_id
].cpu
);
306 ms
->possible_cpus
->cpus
[cpu
->env
.core_id
].cpu
= OBJECT(dev
);
308 if (dev
->hotplugged
) {
309 raise_irq_cpu_hotplug();
313 static inline void s390_do_cpu_ipl(CPUState
*cs
, run_on_cpu_data arg
)
315 S390CPU
*cpu
= S390_CPU(cs
);
317 s390_ipl_prepare_cpu(cpu
);
318 s390_cpu_set_state(S390_CPU_STATE_OPERATING
, cpu
);
321 static void s390_machine_reset(MachineState
*machine
)
323 enum s390_reset reset_type
;
326 /* get the reset parameters, reset them once done */
327 s390_ipl_get_reset_request(&cs
, &reset_type
);
329 /* all CPUs are paused and synchronized at this point */
332 switch (reset_type
) {
333 case S390_RESET_EXTERNAL
:
334 case S390_RESET_REIPL
:
335 qemu_devices_reset();
338 /* configure and start the ipl CPU only */
339 run_on_cpu(cs
, s390_do_cpu_ipl
, RUN_ON_CPU_NULL
);
341 case S390_RESET_MODIFIED_CLEAR
:
343 run_on_cpu(t
, s390_do_cpu_full_reset
, RUN_ON_CPU_NULL
);
347 run_on_cpu(cs
, s390_do_cpu_load_normal
, RUN_ON_CPU_NULL
);
349 case S390_RESET_LOAD_NORMAL
:
351 run_on_cpu(t
, s390_do_cpu_reset
, RUN_ON_CPU_NULL
);
354 run_on_cpu(cs
, s390_do_cpu_initial_reset
, RUN_ON_CPU_NULL
);
355 run_on_cpu(cs
, s390_do_cpu_load_normal
, RUN_ON_CPU_NULL
);
358 g_assert_not_reached();
360 s390_ipl_clear_reset_request();
363 static void s390_machine_device_plug(HotplugHandler
*hotplug_dev
,
364 DeviceState
*dev
, Error
**errp
)
366 if (object_dynamic_cast(OBJECT(dev
), TYPE_CPU
)) {
367 s390_cpu_plug(hotplug_dev
, dev
, errp
);
371 static void s390_machine_device_unplug_request(HotplugHandler
*hotplug_dev
,
372 DeviceState
*dev
, Error
**errp
)
374 if (object_dynamic_cast(OBJECT(dev
), TYPE_CPU
)) {
375 error_setg(errp
, "CPU hot unplug not supported on this machine");
380 static CpuInstanceProperties
s390_cpu_index_to_props(MachineState
*ms
,
383 MachineClass
*mc
= MACHINE_GET_CLASS(ms
);
384 const CPUArchIdList
*possible_cpus
= mc
->possible_cpu_arch_ids(ms
);
386 assert(cpu_index
< possible_cpus
->len
);
387 return possible_cpus
->cpus
[cpu_index
].props
;
390 static const CPUArchIdList
*s390_possible_cpu_arch_ids(MachineState
*ms
)
393 unsigned int max_cpus
= ms
->smp
.max_cpus
;
395 if (ms
->possible_cpus
) {
396 g_assert(ms
->possible_cpus
&& ms
->possible_cpus
->len
== max_cpus
);
397 return ms
->possible_cpus
;
400 ms
->possible_cpus
= g_malloc0(sizeof(CPUArchIdList
) +
401 sizeof(CPUArchId
) * max_cpus
);
402 ms
->possible_cpus
->len
= max_cpus
;
403 for (i
= 0; i
< ms
->possible_cpus
->len
; i
++) {
404 ms
->possible_cpus
->cpus
[i
].type
= ms
->cpu_type
;
405 ms
->possible_cpus
->cpus
[i
].vcpus_count
= 1;
406 ms
->possible_cpus
->cpus
[i
].arch_id
= i
;
407 ms
->possible_cpus
->cpus
[i
].props
.has_core_id
= true;
408 ms
->possible_cpus
->cpus
[i
].props
.core_id
= i
;
411 return ms
->possible_cpus
;
414 static HotplugHandler
*s390_get_hotplug_handler(MachineState
*machine
,
417 if (object_dynamic_cast(OBJECT(dev
), TYPE_CPU
)) {
418 return HOTPLUG_HANDLER(machine
);
423 static void s390_hot_add_cpu(MachineState
*machine
,
424 const int64_t id
, Error
**errp
)
428 g_assert(machine
->possible_cpus
->cpus
[0].cpu
);
429 oc
= OBJECT_CLASS(CPU_GET_CLASS(machine
->possible_cpus
->cpus
[0].cpu
));
431 s390x_new_cpu(object_class_get_name(oc
), id
, errp
);
434 static void s390_nmi(NMIState
*n
, int cpu_index
, Error
**errp
)
436 CPUState
*cs
= qemu_get_cpu(cpu_index
);
438 s390_cpu_restart(S390_CPU(cs
));
441 static void ccw_machine_class_init(ObjectClass
*oc
, void *data
)
443 MachineClass
*mc
= MACHINE_CLASS(oc
);
444 NMIClass
*nc
= NMI_CLASS(oc
);
445 HotplugHandlerClass
*hc
= HOTPLUG_HANDLER_CLASS(oc
);
446 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
448 s390mc
->ri_allowed
= true;
449 s390mc
->cpu_model_allowed
= true;
450 s390mc
->css_migration_enabled
= true;
451 s390mc
->hpage_1m_allowed
= true;
453 mc
->reset
= s390_machine_reset
;
454 mc
->hot_add_cpu
= s390_hot_add_cpu
;
455 mc
->block_default_type
= IF_VIRTIO
;
460 mc
->max_cpus
= S390_MAX_CPUS
;
461 mc
->has_hotpluggable_cpus
= true;
462 assert(!mc
->get_hotplug_handler
);
463 mc
->get_hotplug_handler
= s390_get_hotplug_handler
;
464 mc
->cpu_index_to_instance_props
= s390_cpu_index_to_props
;
465 mc
->possible_cpu_arch_ids
= s390_possible_cpu_arch_ids
;
466 /* it is overridden with 'host' cpu *in kvm_arch_init* */
467 mc
->default_cpu_type
= S390_CPU_TYPE_NAME("qemu");
468 hc
->plug
= s390_machine_device_plug
;
469 hc
->unplug_request
= s390_machine_device_unplug_request
;
470 nc
->nmi_monitor_handler
= s390_nmi
;
473 static inline bool machine_get_aes_key_wrap(Object
*obj
, Error
**errp
)
475 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
477 return ms
->aes_key_wrap
;
480 static inline void machine_set_aes_key_wrap(Object
*obj
, bool value
,
483 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
485 ms
->aes_key_wrap
= value
;
488 static inline bool machine_get_dea_key_wrap(Object
*obj
, Error
**errp
)
490 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
492 return ms
->dea_key_wrap
;
495 static inline void machine_set_dea_key_wrap(Object
*obj
, bool value
,
498 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
500 ms
->dea_key_wrap
= value
;
503 static S390CcwMachineClass
*current_mc
;
505 static S390CcwMachineClass
*get_machine_class(void)
507 if (unlikely(!current_mc
)) {
509 * No s390 ccw machine was instantiated, we are likely to
510 * be called for the 'none' machine. The properties will
511 * have their after-initialization values.
513 current_mc
= S390_MACHINE_CLASS(
514 object_class_by_name(TYPE_S390_CCW_MACHINE
));
519 bool ri_allowed(void)
521 /* for "none" machine this results in true */
522 return get_machine_class()->ri_allowed
;
525 bool cpu_model_allowed(void)
527 /* for "none" machine this results in true */
528 return get_machine_class()->cpu_model_allowed
;
531 bool hpage_1m_allowed(void)
533 /* for "none" machine this results in true */
534 return get_machine_class()->hpage_1m_allowed
;
537 static char *machine_get_loadparm(Object
*obj
, Error
**errp
)
539 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
541 return g_memdup(ms
->loadparm
, sizeof(ms
->loadparm
));
544 static void machine_set_loadparm(Object
*obj
, const char *val
, Error
**errp
)
546 S390CcwMachineState
*ms
= S390_CCW_MACHINE(obj
);
549 for (i
= 0; i
< sizeof(ms
->loadparm
) && val
[i
]; i
++) {
550 uint8_t c
= qemu_toupper(val
[i
]); /* mimic HMC */
552 if (('A' <= c
&& c
<= 'Z') || ('0' <= c
&& c
<= '9') || (c
== '.') ||
556 error_setg(errp
, "LOADPARM: invalid character '%c' (ASCII 0x%02x)",
562 for (; i
< sizeof(ms
->loadparm
); i
++) {
563 ms
->loadparm
[i
] = ' '; /* pad right with spaces */
566 static inline void s390_machine_initfn(Object
*obj
)
568 object_property_add_bool(obj
, "aes-key-wrap",
569 machine_get_aes_key_wrap
,
570 machine_set_aes_key_wrap
, NULL
);
571 object_property_set_description(obj
, "aes-key-wrap",
572 "enable/disable AES key wrapping using the CPACF wrapping key",
574 object_property_set_bool(obj
, true, "aes-key-wrap", NULL
);
576 object_property_add_bool(obj
, "dea-key-wrap",
577 machine_get_dea_key_wrap
,
578 machine_set_dea_key_wrap
, NULL
);
579 object_property_set_description(obj
, "dea-key-wrap",
580 "enable/disable DEA key wrapping using the CPACF wrapping key",
582 object_property_set_bool(obj
, true, "dea-key-wrap", NULL
);
583 object_property_add_str(obj
, "loadparm",
584 machine_get_loadparm
, machine_set_loadparm
, NULL
);
585 object_property_set_description(obj
, "loadparm",
586 "Up to 8 chars in set of [A-Za-z0-9. ] (lower case chars converted"
587 " to upper case) to pass to machine loader, boot manager,"
592 static const TypeInfo ccw_machine_info
= {
593 .name
= TYPE_S390_CCW_MACHINE
,
594 .parent
= TYPE_MACHINE
,
596 .instance_size
= sizeof(S390CcwMachineState
),
597 .instance_init
= s390_machine_initfn
,
598 .class_size
= sizeof(S390CcwMachineClass
),
599 .class_init
= ccw_machine_class_init
,
600 .interfaces
= (InterfaceInfo
[]) {
602 { TYPE_HOTPLUG_HANDLER
},
607 bool css_migration_enabled(void)
609 return get_machine_class()->css_migration_enabled
;
612 #define DEFINE_CCW_MACHINE(suffix, verstr, latest) \
613 static void ccw_machine_##suffix##_class_init(ObjectClass *oc, \
616 MachineClass *mc = MACHINE_CLASS(oc); \
617 ccw_machine_##suffix##_class_options(mc); \
618 mc->desc = "VirtIO-ccw based S390 machine v" verstr; \
620 mc->alias = "s390-ccw-virtio"; \
621 mc->is_default = 1; \
624 static void ccw_machine_##suffix##_instance_init(Object *obj) \
626 MachineState *machine = MACHINE(obj); \
627 current_mc = S390_MACHINE_CLASS(MACHINE_GET_CLASS(machine)); \
628 ccw_machine_##suffix##_instance_options(machine); \
630 static const TypeInfo ccw_machine_##suffix##_info = { \
631 .name = MACHINE_TYPE_NAME("s390-ccw-virtio-" verstr), \
632 .parent = TYPE_S390_CCW_MACHINE, \
633 .class_init = ccw_machine_##suffix##_class_init, \
634 .instance_init = ccw_machine_##suffix##_instance_init, \
636 static void ccw_machine_register_##suffix(void) \
638 type_register_static(&ccw_machine_##suffix##_info); \
640 type_init(ccw_machine_register_##suffix)
642 static void ccw_machine_4_2_instance_options(MachineState
*machine
)
646 static void ccw_machine_4_2_class_options(MachineClass
*mc
)
649 DEFINE_CCW_MACHINE(4_2
, "4.2", true);
651 static void ccw_machine_4_1_instance_options(MachineState
*machine
)
653 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V4_1
};
654 ccw_machine_4_2_instance_options(machine
);
655 s390_set_qemu_cpu_model(0x2964, 13, 2, qemu_cpu_feat
);
658 static void ccw_machine_4_1_class_options(MachineClass
*mc
)
660 ccw_machine_4_2_class_options(mc
);
661 compat_props_add(mc
->compat_props
, hw_compat_4_1
, hw_compat_4_1_len
);
663 DEFINE_CCW_MACHINE(4_1
, "4.1", false);
665 static void ccw_machine_4_0_instance_options(MachineState
*machine
)
667 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V4_0
};
668 ccw_machine_4_1_instance_options(machine
);
669 s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat
);
672 static void ccw_machine_4_0_class_options(MachineClass
*mc
)
674 ccw_machine_4_1_class_options(mc
);
675 compat_props_add(mc
->compat_props
, hw_compat_4_0
, hw_compat_4_0_len
);
677 DEFINE_CCW_MACHINE(4_0
, "4.0", false);
679 static void ccw_machine_3_1_instance_options(MachineState
*machine
)
681 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V3_1
};
682 ccw_machine_4_0_instance_options(machine
);
683 s390_cpudef_featoff_greater(14, 1, S390_FEAT_MULTIPLE_EPOCH
);
684 s390_cpudef_group_featoff_greater(14, 1, S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF
);
685 s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat
);
688 static void ccw_machine_3_1_class_options(MachineClass
*mc
)
690 ccw_machine_4_0_class_options(mc
);
691 compat_props_add(mc
->compat_props
, hw_compat_3_1
, hw_compat_3_1_len
);
693 DEFINE_CCW_MACHINE(3_1
, "3.1", false);
695 static void ccw_machine_3_0_instance_options(MachineState
*machine
)
697 ccw_machine_3_1_instance_options(machine
);
700 static void ccw_machine_3_0_class_options(MachineClass
*mc
)
702 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
704 s390mc
->hpage_1m_allowed
= false;
705 ccw_machine_3_1_class_options(mc
);
706 compat_props_add(mc
->compat_props
, hw_compat_3_0
, hw_compat_3_0_len
);
708 DEFINE_CCW_MACHINE(3_0
, "3.0", false);
710 static void ccw_machine_2_12_instance_options(MachineState
*machine
)
712 ccw_machine_3_0_instance_options(machine
);
713 s390_cpudef_featoff_greater(11, 1, S390_FEAT_PPA15
);
714 s390_cpudef_featoff_greater(11, 1, S390_FEAT_BPB
);
717 static void ccw_machine_2_12_class_options(MachineClass
*mc
)
719 ccw_machine_3_0_class_options(mc
);
720 compat_props_add(mc
->compat_props
, hw_compat_2_12
, hw_compat_2_12_len
);
722 DEFINE_CCW_MACHINE(2_12
, "2.12", false);
724 static void ccw_machine_2_11_instance_options(MachineState
*machine
)
726 static const S390FeatInit qemu_cpu_feat
= { S390_FEAT_LIST_QEMU_V2_11
};
727 ccw_machine_2_12_instance_options(machine
);
729 /* before 2.12 we emulated the very first z900 */
730 s390_set_qemu_cpu_model(0x2064, 7, 1, qemu_cpu_feat
);
733 static void ccw_machine_2_11_class_options(MachineClass
*mc
)
735 static GlobalProperty compat
[] = {
736 { TYPE_SCLP_EVENT_FACILITY
, "allow_all_mask_sizes", "off", },
739 ccw_machine_2_12_class_options(mc
);
740 compat_props_add(mc
->compat_props
, hw_compat_2_11
, hw_compat_2_11_len
);
741 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
743 DEFINE_CCW_MACHINE(2_11
, "2.11", false);
745 static void ccw_machine_2_10_instance_options(MachineState
*machine
)
747 ccw_machine_2_11_instance_options(machine
);
750 static void ccw_machine_2_10_class_options(MachineClass
*mc
)
752 ccw_machine_2_11_class_options(mc
);
753 compat_props_add(mc
->compat_props
, hw_compat_2_10
, hw_compat_2_10_len
);
755 DEFINE_CCW_MACHINE(2_10
, "2.10", false);
757 static void ccw_machine_2_9_instance_options(MachineState
*machine
)
759 ccw_machine_2_10_instance_options(machine
);
760 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ESOP
);
761 s390_cpudef_featoff_greater(12, 1, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2
);
762 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ZPCI
);
763 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_INT_SUPPRESSION
);
764 s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_EVENT_NOTIFICATION
);
767 static void ccw_machine_2_9_class_options(MachineClass
*mc
)
769 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
770 static GlobalProperty compat
[] = {
771 { TYPE_S390_STATTRIB
, "migration-enabled", "off", },
774 ccw_machine_2_10_class_options(mc
);
775 compat_props_add(mc
->compat_props
, hw_compat_2_9
, hw_compat_2_9_len
);
776 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
777 s390mc
->css_migration_enabled
= false;
779 DEFINE_CCW_MACHINE(2_9
, "2.9", false);
781 static void ccw_machine_2_8_instance_options(MachineState
*machine
)
783 ccw_machine_2_9_instance_options(machine
);
786 static void ccw_machine_2_8_class_options(MachineClass
*mc
)
788 static GlobalProperty compat
[] = {
789 { TYPE_S390_FLIC_COMMON
, "adapter_routes_max_batch", "64", },
792 ccw_machine_2_9_class_options(mc
);
793 compat_props_add(mc
->compat_props
, hw_compat_2_8
, hw_compat_2_8_len
);
794 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
796 DEFINE_CCW_MACHINE(2_8
, "2.8", false);
798 static void ccw_machine_2_7_instance_options(MachineState
*machine
)
800 ccw_machine_2_8_instance_options(machine
);
803 static void ccw_machine_2_7_class_options(MachineClass
*mc
)
805 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
807 s390mc
->cpu_model_allowed
= false;
808 ccw_machine_2_8_class_options(mc
);
809 compat_props_add(mc
->compat_props
, hw_compat_2_7
, hw_compat_2_7_len
);
811 DEFINE_CCW_MACHINE(2_7
, "2.7", false);
813 static void ccw_machine_2_6_instance_options(MachineState
*machine
)
815 ccw_machine_2_7_instance_options(machine
);
818 static void ccw_machine_2_6_class_options(MachineClass
*mc
)
820 S390CcwMachineClass
*s390mc
= S390_MACHINE_CLASS(mc
);
821 static GlobalProperty compat
[] = {
822 { TYPE_S390_IPL
, "iplbext_migration", "off", },
823 { TYPE_VIRTUAL_CSS_BRIDGE
, "css_dev_path", "off", },
826 s390mc
->ri_allowed
= false;
827 ccw_machine_2_7_class_options(mc
);
828 compat_props_add(mc
->compat_props
, hw_compat_2_6
, hw_compat_2_6_len
);
829 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
831 DEFINE_CCW_MACHINE(2_6
, "2.6", false);
833 static void ccw_machine_2_5_instance_options(MachineState
*machine
)
835 ccw_machine_2_6_instance_options(machine
);
838 static void ccw_machine_2_5_class_options(MachineClass
*mc
)
840 ccw_machine_2_6_class_options(mc
);
841 compat_props_add(mc
->compat_props
, hw_compat_2_5
, hw_compat_2_5_len
);
843 DEFINE_CCW_MACHINE(2_5
, "2.5", false);
845 static void ccw_machine_2_4_instance_options(MachineState
*machine
)
847 ccw_machine_2_5_instance_options(machine
);
850 static void ccw_machine_2_4_class_options(MachineClass
*mc
)
852 static GlobalProperty compat
[] = {
853 { TYPE_S390_SKEYS
, "migration-enabled", "off", },
854 { "virtio-blk-ccw", "max_revision", "0", },
855 { "virtio-balloon-ccw", "max_revision", "0", },
856 { "virtio-serial-ccw", "max_revision", "0", },
857 { "virtio-9p-ccw", "max_revision", "0", },
858 { "virtio-rng-ccw", "max_revision", "0", },
859 { "virtio-net-ccw", "max_revision", "0", },
860 { "virtio-scsi-ccw", "max_revision", "0", },
861 { "vhost-scsi-ccw", "max_revision", "0", },
864 ccw_machine_2_5_class_options(mc
);
865 compat_props_add(mc
->compat_props
, hw_compat_2_4
, hw_compat_2_4_len
);
866 compat_props_add(mc
->compat_props
, compat
, G_N_ELEMENTS(compat
));
868 DEFINE_CCW_MACHINE(2_4
, "2.4", false);
870 static void ccw_machine_register_types(void)
872 type_register_static(&ccw_machine_info
);
875 type_init(ccw_machine_register_types
)