7f1c5b
From 1973257ed781a93943f27f1518933e8c09c50f88 Mon Sep 17 00:00:00 2001
a83cc2
From: Miroslav Rezanina <mrezanin@redhat.com>
a83cc2
Date: Fri, 19 Oct 2018 13:47:32 +0200
a83cc2
Subject: Add s390x machine types
a83cc2
a83cc2
Adding changes to add RHEL machine types for s390x architecture.
a83cc2
a83cc2
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
77609c
--
7f1c5b
7f1c5b
Rebase changes (7.1.0 rc0):
7f1c5b
- Moved adding rhel_old_machine_deprecation variable to general machine types commit
7f1c5b
b697b4
Merged patches (6.1.0):
77609c
- 64a9a5c971 hw/s390x: Remove the RHEL7-only machine type
77609c
- 395516d62b redhat: s390x: add rhel-8.5.0 compat machine
b697b4
29b115
Merged patches (6.2.0):
b697b4
- 3bf66f4520 redhat: Add s390x machine type compatibility update for 6.1 rebase
29b115
29b115
Merged patches (7.0.0):
29b115
- e6ff4de4f7 redhat: Add s390x machine type compatibility handling for the rebase to v6.2
29b115
- 4b0efa7e21 redhat: Add rhel8.6.0 and rhel9.0.0 machine types for s390x
29b115
- dcc64971bf RHEL: mark old machine types as deprecated (partialy)
7f1c5b
7f1c5b
Merged patches (7.1.0 rc0):
7f1c5b
- 1d6439527a WRB: Introduce RHEL 9.0.0 hw compat structure (only hw/s390x/s390-virtio-ccw.c chunk)
7f1c5b
- c8ad21ca31 redhat: Update s390x machine type compatibility for rebase to QEMU 7.0.0
7f1c5b
- 5bcf8d874c target/s390x: deprecate CPUs older than z14
7f1c5b
7f1c5b
Merged patches (7.2.0 rc0):
7f1c5b
- 0be2889fa2 Introduce upstream 7.0 compat changes (only applicable parts)
a83cc2
---
7f1c5b
 hw/s390x/s390-virtio-ccw.c       | 108 +++++++++++++++++++++++++++++++
7f1c5b
 target/s390x/cpu_models.c        |  11 ++++
7f1c5b
 target/s390x/cpu_models.h        |   2 +
7f1c5b
 target/s390x/cpu_models_sysemu.c |   2 +
7f1c5b
 4 files changed, 123 insertions(+)
a83cc2
a83cc2
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
7f1c5b
index 2e64ffab45..8d5221fbb1 100644
a83cc2
--- a/hw/s390x/s390-virtio-ccw.c
a83cc2
+++ b/hw/s390x/s390-virtio-ccw.c
7f1c5b
@@ -823,6 +823,7 @@ bool css_migration_enabled(void)
a83cc2
     }                                                                         \
a83cc2
     type_init(ccw_machine_register_##suffix)
a83cc2
 
a83cc2
+#if 0 /* Disabled for Red Hat Enterprise Linux */
7f1c5b
 static void ccw_machine_7_2_instance_options(MachineState *machine)
a83cc2
 {
a83cc2
 }
7f1c5b
@@ -1186,6 +1187,113 @@ static void ccw_machine_2_4_class_options(MachineClass *mc)
a83cc2
     compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
a83cc2
 }
a83cc2
 DEFINE_CCW_MACHINE(2_4, "2.4", false);
a83cc2
+#endif
a83cc2
+
7f1c5b
+
29b115
+static void ccw_machine_rhel900_instance_options(MachineState *machine)
29b115
+{
7f1c5b
+    static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V6_2 };
7f1c5b
+
7f1c5b
+    s390_set_qemu_cpu_model(0x3906, 14, 2, qemu_cpu_feat);
29b115
+}
29b115
+
29b115
+static void ccw_machine_rhel900_class_options(MachineClass *mc)
29b115
+{
7f1c5b
+    compat_props_add(mc->compat_props, hw_compat_rhel_9_1, hw_compat_rhel_9_1_len);
7f1c5b
+    compat_props_add(mc->compat_props, hw_compat_rhel_9_0, hw_compat_rhel_9_0_len);
29b115
+}
29b115
+DEFINE_CCW_MACHINE(rhel900, "rhel9.0.0", true);
29b115
+
29b115
+static void ccw_machine_rhel860_instance_options(MachineState *machine)
29b115
+{
29b115
+    /* Note: The -rhel8.6.0 and -rhel9.0.0 machines are technically identical */
29b115
+    ccw_machine_rhel900_instance_options(machine);
29b115
+}
29b115
+
29b115
+static void ccw_machine_rhel860_class_options(MachineClass *mc)
29b115
+{
29b115
+    ccw_machine_rhel900_class_options(mc);
29b115
+
29b115
+    /* All RHEL machines for prior major releases are deprecated */
29b115
+    mc->deprecation_reason = rhel_old_machine_deprecation;
29b115
+}
29b115
+DEFINE_CCW_MACHINE(rhel860, "rhel8.6.0", false);
29b115
+
77609c
+static void ccw_machine_rhel850_instance_options(MachineState *machine)
77609c
+{
29b115
+    static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V6_0 };
29b115
+
29b115
+    ccw_machine_rhel860_instance_options(machine);
29b115
+
29b115
+    s390_set_qemu_cpu_model(0x2964, 13, 2, qemu_cpu_feat);
29b115
+
29b115
+    s390_cpudef_featoff_greater(16, 1, S390_FEAT_NNPA);
29b115
+    s390_cpudef_featoff_greater(16, 1, S390_FEAT_VECTOR_PACKED_DECIMAL_ENH2);
29b115
+    s390_cpudef_featoff_greater(16, 1, S390_FEAT_BEAR_ENH);
29b115
+    s390_cpudef_featoff_greater(16, 1, S390_FEAT_RDP);
29b115
+    s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAI);
77609c
+}
77609c
+
77609c
+static void ccw_machine_rhel850_class_options(MachineClass *mc)
77609c
+{
29b115
+    ccw_machine_rhel860_class_options(mc);
b697b4
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_5, hw_compat_rhel_8_5_len);
29b115
+    mc->smp_props.prefer_sockets = true;
77609c
+}
29b115
+DEFINE_CCW_MACHINE(rhel850, "rhel8.5.0", false);
77609c
+
a83cc2
+static void ccw_machine_rhel840_instance_options(MachineState *machine)
a83cc2
+{
77609c
+    ccw_machine_rhel850_instance_options(machine);
a83cc2
+}
a83cc2
+
a83cc2
+static void ccw_machine_rhel840_class_options(MachineClass *mc)
a83cc2
+{
77609c
+    ccw_machine_rhel850_class_options(mc);
a83cc2
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_4, hw_compat_rhel_8_4_len);
a83cc2
+}
77609c
+DEFINE_CCW_MACHINE(rhel840, "rhel8.4.0", false);
a83cc2
+
a83cc2
+static void ccw_machine_rhel820_instance_options(MachineState *machine)
a83cc2
+{
a83cc2
+    ccw_machine_rhel840_instance_options(machine);
a83cc2
+}
a83cc2
+
a83cc2
+static void ccw_machine_rhel820_class_options(MachineClass *mc)
a83cc2
+{
a83cc2
+    ccw_machine_rhel840_class_options(mc);
a83cc2
+    mc->fixup_ram_size = s390_fixup_ram_size;
a83cc2
+    /* we did not publish a rhel8.3.0 machine */
a83cc2
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_3, hw_compat_rhel_8_3_len);
a83cc2
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_2, hw_compat_rhel_8_2_len);
a83cc2
+}
a83cc2
+DEFINE_CCW_MACHINE(rhel820, "rhel8.2.0", false);
a83cc2
+
a83cc2
+static void ccw_machine_rhel760_instance_options(MachineState *machine)
a83cc2
+{
a83cc2
+    static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V3_1 };
a83cc2
+
a83cc2
+    ccw_machine_rhel820_instance_options(machine);
a83cc2
+
a83cc2
+    s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat);
a83cc2
+
a83cc2
+    /* The multiple-epoch facility was not available with rhel7.6.0 on z14GA1 */
a83cc2
+    s390_cpudef_featoff(14, 1, S390_FEAT_MULTIPLE_EPOCH);
a83cc2
+    s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_QSIE);
a83cc2
+    s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_QTOUE);
a83cc2
+    s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_STOE);
a83cc2
+    s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_STOUE);
a83cc2
+}
a83cc2
+
a83cc2
+static void ccw_machine_rhel760_class_options(MachineClass *mc)
a83cc2
+{
a83cc2
+    ccw_machine_rhel820_class_options(mc);
a83cc2
+    /* We never published the s390x version of RHEL-AV 8.0 and 8.1, so add this here */
a83cc2
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_1, hw_compat_rhel_8_1_len);
a83cc2
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len);
a83cc2
+    compat_props_add(mc->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len);
a83cc2
+}
a83cc2
+DEFINE_CCW_MACHINE(rhel760, "rhel7.6.0", false);
a83cc2
 
a83cc2
 static void ccw_machine_register_types(void)
a83cc2
 {
7f1c5b
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
7f1c5b
index c3a4f80633..739770dc15 100644
7f1c5b
--- a/target/s390x/cpu_models.c
7f1c5b
+++ b/target/s390x/cpu_models.c
7f1c5b
@@ -45,6 +45,9 @@
7f1c5b
  * of a following release have been a superset of the previous release. With
7f1c5b
  * generation 15 one base feature and one optional feature have been deprecated.
7f1c5b
  */
7f1c5b
+
7f1c5b
+#define RHEL_CPU_DEPRECATION "use at least 'z14', or 'host' / 'qemu' / 'max'"
29b115
+
7f1c5b
 static S390CPUDef s390_cpu_defs[] = {
7f1c5b
     CPUDEF_INIT(0x2064, 7, 1, 38, 0x00000000U, "z900", "IBM zSeries 900 GA1"),
7f1c5b
     CPUDEF_INIT(0x2064, 7, 2, 38, 0x00000000U, "z900.2", "IBM zSeries 900 GA2"),
7f1c5b
@@ -854,22 +857,30 @@ static void s390_host_cpu_model_class_init(ObjectClass *oc, void *data)
7f1c5b
 static void s390_base_cpu_model_class_init(ObjectClass *oc, void *data)
7f1c5b
 {
7f1c5b
     S390CPUClass *xcc = S390_CPU_CLASS(oc);
7f1c5b
+    CPUClass *cc = CPU_CLASS(oc);
7f1c5b
 
7f1c5b
     /* all base models are migration safe */
7f1c5b
     xcc->cpu_def = (const S390CPUDef *) data;
7f1c5b
     xcc->is_migration_safe = true;
7f1c5b
     xcc->is_static = true;
7f1c5b
     xcc->desc = xcc->cpu_def->desc;
7f1c5b
+    if (xcc->cpu_def->gen < 14) {
7f1c5b
+        cc->deprecation_note = RHEL_CPU_DEPRECATION;
7f1c5b
+    }
7f1c5b
 }
7f1c5b
 
7f1c5b
 static void s390_cpu_model_class_init(ObjectClass *oc, void *data)
7f1c5b
 {
7f1c5b
     S390CPUClass *xcc = S390_CPU_CLASS(oc);
7f1c5b
+    CPUClass *cc = CPU_CLASS(oc);
7f1c5b
 
7f1c5b
     /* model that can change between QEMU versions */
7f1c5b
     xcc->cpu_def = (const S390CPUDef *) data;
7f1c5b
     xcc->is_migration_safe = true;
7f1c5b
     xcc->desc = xcc->cpu_def->desc;
7f1c5b
+    if (xcc->cpu_def->gen < 14) {
7f1c5b
+        cc->deprecation_note = RHEL_CPU_DEPRECATION;
7f1c5b
+    }
7f1c5b
 }
7f1c5b
 
7f1c5b
 static void s390_qemu_cpu_model_class_init(ObjectClass *oc, void *data)
7f1c5b
diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h
7f1c5b
index fb1adc8b21..d76745afa9 100644
7f1c5b
--- a/target/s390x/cpu_models.h
7f1c5b
+++ b/target/s390x/cpu_models.h
7f1c5b
@@ -38,6 +38,8 @@ struct S390CPUDef {
7f1c5b
     S390FeatBitmap full_feat;
7f1c5b
     /* used to init full_feat from generated data */
7f1c5b
     S390FeatInit full_init;
7f1c5b
+    /* if deprecated, provides a suggestion */
7f1c5b
+    const char *deprecation_note;
7f1c5b
 };
7f1c5b
 
7f1c5b
 /* CPU model based on a CPU definition */
7f1c5b
diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c
7f1c5b
index d086b1c39c..1b9cc66405 100644
7f1c5b
--- a/target/s390x/cpu_models_sysemu.c
7f1c5b
+++ b/target/s390x/cpu_models_sysemu.c
7f1c5b
@@ -60,6 +60,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
7f1c5b
     CpuDefinitionInfo *info;
7f1c5b
     char *name = g_strdup(object_class_get_name(klass));
7f1c5b
     S390CPUClass *scc = S390_CPU_CLASS(klass);
7f1c5b
+    CPUClass *cc = CPU_CLASS(klass);
7f1c5b
 
7f1c5b
     /* strip off the -s390x-cpu */
7f1c5b
     g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0;
7f1c5b
@@ -69,6 +70,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
7f1c5b
     info->migration_safe = scc->is_migration_safe;
7f1c5b
     info->q_static = scc->is_static;
7f1c5b
     info->q_typename = g_strdup(object_class_get_name(klass));
7f1c5b
+    info->deprecated = !!cc->deprecation_note;
7f1c5b
     /* check for unavailable features */
7f1c5b
     if (cpu_list_data->model) {
7f1c5b
         Object *obj;
a83cc2
-- 
29b115
2.31.1
a83cc2