586cba
From 680f343e58a50a99d17bc7dedd3ee90980912023 Mon Sep 17 00:00:00 2001
495e37
From: Miroslav Rezanina <mrezanin@redhat.com>
495e37
Date: Fri, 19 Oct 2018 13:47:32 +0200
495e37
Subject: Add s390x machine types
495e37
495e37
Adding changes to add RHEL machine types for s390x architecture.
495e37
495e37
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
495e37
--
495e37
Merged patches (6.1.0):
495e37
- 64a9a5c971 hw/s390x: Remove the RHEL7-only machine type
495e37
- 395516d62b redhat: s390x: add rhel-8.5.0 compat machine
495e37
586cba
Merged patches (6.2.0):
495e37
- 3bf66f4520 redhat: Add s390x machine type compatibility update for 6.1 rebase
586cba
586cba
Merged patches (7.0.0):
586cba
- e6ff4de4f7 redhat: Add s390x machine type compatibility handling for the rebase to v6.2
586cba
- 4b0efa7e21 redhat: Add rhel8.6.0 and rhel9.0.0 machine types for s390x
586cba
- dcc64971bf RHEL: mark old machine types as deprecated (partialy)
495e37
---
586cba
 hw/core/machine.c          |   6 +++
586cba
 hw/s390x/s390-virtio-ccw.c | 104 ++++++++++++++++++++++++++++++++++++-
586cba
 include/hw/boards.h        |   2 +
586cba
 3 files changed, 111 insertions(+), 1 deletion(-)
495e37
586cba
diff --git a/hw/core/machine.c b/hw/core/machine.c
586cba
index ea430d844e..77202a3570 100644
586cba
--- a/hw/core/machine.c
586cba
+++ b/hw/core/machine.c
586cba
@@ -37,6 +37,12 @@
586cba
 #include "hw/virtio/virtio.h"
586cba
 #include "hw/virtio/virtio-pci.h"
586cba
 
586cba
+/*
586cba
+ * RHEL only: machine types for previous major releases are deprecated
586cba
+ */
586cba
+const char *rhel_old_machine_deprecation =
586cba
+    "machine types for previous major releases are deprecated";
586cba
+
586cba
 /*
586cba
  * Mostly the same as hw_compat_6_0 and hw_compat_6_1
586cba
  */
495e37
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
586cba
index 90480e7cf9..ec4176a1e0 100644
495e37
--- a/hw/s390x/s390-virtio-ccw.c
495e37
+++ b/hw/s390x/s390-virtio-ccw.c
495e37
@@ -767,7 +767,7 @@ bool css_migration_enabled(void)
495e37
     {                                                                         \
495e37
         MachineClass *mc = MACHINE_CLASS(oc);                                 \
495e37
         ccw_machine_##suffix##_class_options(mc);                             \
495e37
-        mc->desc = "VirtIO-ccw based S390 machine v" verstr;                  \
495e37
+        mc->desc = "VirtIO-ccw based S390 machine " verstr;                   \
495e37
         if (latest) {                                                         \
495e37
             mc->alias = "s390-ccw-virtio";                                    \
495e37
             mc->is_default = true;                                            \
495e37
@@ -791,6 +791,7 @@ bool css_migration_enabled(void)
495e37
     }                                                                         \
495e37
     type_init(ccw_machine_register_##suffix)
495e37
 
495e37
+#if 0 /* Disabled for Red Hat Enterprise Linux */
586cba
 static void ccw_machine_7_0_instance_options(MachineState *machine)
495e37
 {
495e37
 }
586cba
@@ -1115,6 +1116,107 @@ static void ccw_machine_2_4_class_options(MachineClass *mc)
495e37
     compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
495e37
 }
495e37
 DEFINE_CCW_MACHINE(2_4, "2.4", false);
495e37
+#endif
495e37
+
586cba
+static void ccw_machine_rhel900_instance_options(MachineState *machine)
586cba
+{
586cba
+}
586cba
+
586cba
+static void ccw_machine_rhel900_class_options(MachineClass *mc)
586cba
+{
586cba
+}
586cba
+DEFINE_CCW_MACHINE(rhel900, "rhel9.0.0", true);
586cba
+
586cba
+static void ccw_machine_rhel860_instance_options(MachineState *machine)
586cba
+{
586cba
+    /* Note: The -rhel8.6.0 and -rhel9.0.0 machines are technically identical */
586cba
+    ccw_machine_rhel900_instance_options(machine);
586cba
+}
586cba
+
586cba
+static void ccw_machine_rhel860_class_options(MachineClass *mc)
586cba
+{
586cba
+    ccw_machine_rhel900_class_options(mc);
586cba
+
586cba
+    /* All RHEL machines for prior major releases are deprecated */
586cba
+    mc->deprecation_reason = rhel_old_machine_deprecation;
586cba
+}
586cba
+DEFINE_CCW_MACHINE(rhel860, "rhel8.6.0", false);
586cba
+
495e37
+static void ccw_machine_rhel850_instance_options(MachineState *machine)
495e37
+{
586cba
+    static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V6_0 };
586cba
+
586cba
+    ccw_machine_rhel860_instance_options(machine);
586cba
+
586cba
+    s390_set_qemu_cpu_model(0x2964, 13, 2, qemu_cpu_feat);
586cba
+
586cba
+    s390_cpudef_featoff_greater(16, 1, S390_FEAT_NNPA);
586cba
+    s390_cpudef_featoff_greater(16, 1, S390_FEAT_VECTOR_PACKED_DECIMAL_ENH2);
586cba
+    s390_cpudef_featoff_greater(16, 1, S390_FEAT_BEAR_ENH);
586cba
+    s390_cpudef_featoff_greater(16, 1, S390_FEAT_RDP);
586cba
+    s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAI);
495e37
+}
495e37
+
495e37
+static void ccw_machine_rhel850_class_options(MachineClass *mc)
495e37
+{
586cba
+    ccw_machine_rhel860_class_options(mc);
495e37
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_5, hw_compat_rhel_8_5_len);
586cba
+    mc->smp_props.prefer_sockets = true;
495e37
+}
586cba
+DEFINE_CCW_MACHINE(rhel850, "rhel8.5.0", false);
495e37
+
495e37
+static void ccw_machine_rhel840_instance_options(MachineState *machine)
495e37
+{
495e37
+    ccw_machine_rhel850_instance_options(machine);
495e37
+}
495e37
+
495e37
+static void ccw_machine_rhel840_class_options(MachineClass *mc)
495e37
+{
495e37
+    ccw_machine_rhel850_class_options(mc);
495e37
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_4, hw_compat_rhel_8_4_len);
495e37
+}
495e37
+DEFINE_CCW_MACHINE(rhel840, "rhel8.4.0", false);
495e37
+
495e37
+static void ccw_machine_rhel820_instance_options(MachineState *machine)
495e37
+{
495e37
+    ccw_machine_rhel840_instance_options(machine);
495e37
+}
495e37
+
495e37
+static void ccw_machine_rhel820_class_options(MachineClass *mc)
495e37
+{
495e37
+    ccw_machine_rhel840_class_options(mc);
495e37
+    mc->fixup_ram_size = s390_fixup_ram_size;
495e37
+    /* we did not publish a rhel8.3.0 machine */
495e37
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_3, hw_compat_rhel_8_3_len);
495e37
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_2, hw_compat_rhel_8_2_len);
495e37
+}
495e37
+DEFINE_CCW_MACHINE(rhel820, "rhel8.2.0", false);
495e37
+
495e37
+static void ccw_machine_rhel760_instance_options(MachineState *machine)
495e37
+{
495e37
+    static const S390FeatInit qemu_cpu_feat = { S390_FEAT_LIST_QEMU_V3_1 };
495e37
+
495e37
+    ccw_machine_rhel820_instance_options(machine);
495e37
+
495e37
+    s390_set_qemu_cpu_model(0x2827, 12, 2, qemu_cpu_feat);
495e37
+
495e37
+    /* The multiple-epoch facility was not available with rhel7.6.0 on z14GA1 */
495e37
+    s390_cpudef_featoff(14, 1, S390_FEAT_MULTIPLE_EPOCH);
495e37
+    s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_QSIE);
495e37
+    s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_QTOUE);
495e37
+    s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_STOE);
495e37
+    s390_cpudef_featoff(14, 1, S390_FEAT_PTFF_STOUE);
495e37
+}
495e37
+
495e37
+static void ccw_machine_rhel760_class_options(MachineClass *mc)
495e37
+{
495e37
+    ccw_machine_rhel820_class_options(mc);
495e37
+    /* We never published the s390x version of RHEL-AV 8.0 and 8.1, so add this here */
495e37
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_1, hw_compat_rhel_8_1_len);
495e37
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_0, hw_compat_rhel_8_0_len);
495e37
+    compat_props_add(mc->compat_props, hw_compat_rhel_7_6, hw_compat_rhel_7_6_len);
495e37
+}
495e37
+DEFINE_CCW_MACHINE(rhel760, "rhel7.6.0", false);
495e37
 
495e37
 static void ccw_machine_register_types(void)
495e37
 {
586cba
diff --git a/include/hw/boards.h b/include/hw/boards.h
586cba
index c90a19b4d1..bf59275f18 100644
586cba
--- a/include/hw/boards.h
586cba
+++ b/include/hw/boards.h
586cba
@@ -470,4 +470,6 @@ extern const size_t hw_compat_rhel_8_0_len;
586cba
 extern GlobalProperty hw_compat_rhel_7_6[];
586cba
 extern const size_t hw_compat_rhel_7_6_len;
586cba
 
586cba
+extern const char *rhel_old_machine_deprecation;
586cba
+
586cba
 #endif
495e37
-- 
586cba
2.31.1
495e37