Add Control-Program Identification (CPI) device to QOM only when the virtual machine supports CPI. CPI is supported from "s390-ccw-virtio-10.0" machine and higher.
Signed-off-by: Shalini Chellathurai Saroja <shal...@linux.ibm.com> --- hw/s390x/s390-virtio-ccw.c | 10 +++++++++- include/hw/s390x/s390-virtio-ccw.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 7f28cbd1de..81832ee638 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -274,6 +274,7 @@ static void s390_create_sclpcpi(SCLPDevice *sclp) static void ccw_init(MachineState *machine) { MachineClass *mc = MACHINE_GET_CLASS(machine); + S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); S390CcwMachineState *ms = S390_CCW_MACHINE(machine); int ret; VirtualCssBus *css_bus; @@ -336,7 +337,10 @@ static void ccw_init(MachineState *machine) s390_init_tod(); /* init SCLP event Control-Program Identification */ - s390_create_sclpcpi(ms->sclp); + if (s390mc->use_cpi) { + s390_create_sclpcpi(ms->sclp); + } + } static void s390_cpu_plug(HotplugHandler *hotplug_dev, @@ -827,6 +831,7 @@ static void ccw_machine_class_init(ObjectClass *oc, void *data) s390mc->hpage_1m_allowed = true; s390mc->max_threads = 1; + s390mc->use_cpi = true; mc->reset = s390_machine_reset; mc->block_default_type = IF_VIRTIO; mc->no_cdrom = 1; @@ -955,6 +960,9 @@ static void ccw_machine_9_2_class_options(MachineClass *mc) { TYPE_S390_PCI_DEVICE, "relaxed-translation", "off", }, }; + S390CcwMachineClass *s390mc = S390_CCW_MACHINE_CLASS(mc); + s390mc->use_cpi = false; + ccw_machine_10_0_class_options(mc); compat_props_add(mc->compat_props, hw_compat_9_2, hw_compat_9_2_len); compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-virtio-ccw.h index 686d9497d2..fc4112fbf5 100644 --- a/include/hw/s390x/s390-virtio-ccw.h +++ b/include/hw/s390x/s390-virtio-ccw.h @@ -55,6 +55,7 @@ struct S390CcwMachineClass { /*< public >*/ bool hpage_1m_allowed; int max_threads; + bool use_cpi; }; /* 1M huge page mappings allowed by the machine */ -- 2.49.0