Blob Blame History Raw
From 8459c305914e2a7a19dcd1662d54a89def7acfa6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
Date: Thu, 17 Mar 2022 17:59:22 +0000
Subject: [PATCH 05/18] target/s390x: deprecate CPUs older than z14
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

RH-Author: Daniel P. Berrangé <berrange@redhat.com>
RH-MergeRequest: 94: i386, aarch64, s390x: deprecate many named CPU models
RH-Commit: [5/6] 2da9e06cf452287673f94f880a7eb8b2b37b7278 (berrange/centos-src-qemu)
RH-Bugzilla: 2060839
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>

RHEL-9 is compiled with the z14 ABI. We use this as a baseline to
select which CPUs we want to support, such that there is at least one
supported guest CPU that can be launched for every physical
machine capable of running RHEL-9 KVM.

Supported CPUs:

      gen15a-base
      gen15a
      gen15b-base
      gen15b
      gen16a-base
      gen16a
      gen16b-base
      gen16b
      max
      qemu
      z14.2-base
      z14.2
      z14-base
      z14
      z14ZR1-base
      z14ZR1

Deprecated CPUs:

      z10BC.2-base
      z10BC.2
      z10BC-base
      z10BC
      z10EC.2-base
      z10EC.2
      z10EC.3-base
      z10EC.3
      z10EC-base
      z10EC
      z114-base
      z114
      z13.2-base
      z13.2
      z13-base
      z13s-base
      z13s
      z13
      z196.2-base
      z196.2
      z196-base
      z196
      z800-base
      z800
      z890.2-base
      z890.2
      z890.3-base
      z890.3
      z890-base
      z890
      z900.2-base
      z900.2
      z900.3-base
      z900.3
      z900-base
      z900
      z990.2-base
      z990.2
      z990.3-base
      z990.3
      z990.4-base
      z990.4
      z990.5-base
      z990.5
      z990-base
      z990
      z9BC.2-base
      z9BC.2
      z9BC-base
      z9BC
      z9EC.2-base
      z9EC.2
      z9EC.3-base
      z9EC.3
      z9EC-base
      z9EC
      zBC12-base
      zBC12
      zEC12.2-base
      zEC12.2
      zEC12-base
      zEC12

https://bugzilla.redhat.com/show_bug.cgi?id=2060839
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 target/s390x/cpu_models.c        | 11 +++++++++++
 target/s390x/cpu_models.h        |  2 ++
 target/s390x/cpu_models_sysemu.c |  2 ++
 3 files changed, 15 insertions(+)

diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 6d71428056..9b9fc41676 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -45,6 +45,9 @@
  * of a following release have been a superset of the previous release. With
  * generation 15 one base feature and one optional feature have been deprecated.
  */
+
+#define RHEL_CPU_DEPRECATION "use at least 'z14', or 'host' / 'qemu' / 'max'"
+
 static S390CPUDef s390_cpu_defs[] = {
     CPUDEF_INIT(0x2064, 7, 1, 38, 0x00000000U, "z900", "IBM zSeries 900 GA1"),
     CPUDEF_INIT(0x2064, 7, 2, 38, 0x00000000U, "z900.2", "IBM zSeries 900 GA2"),
@@ -852,22 +855,30 @@ static void s390_host_cpu_model_class_init(ObjectClass *oc, void *data)
 static void s390_base_cpu_model_class_init(ObjectClass *oc, void *data)
 {
     S390CPUClass *xcc = S390_CPU_CLASS(oc);
+    CPUClass *cc = CPU_CLASS(oc);
 
     /* all base models are migration safe */
     xcc->cpu_def = (const S390CPUDef *) data;
     xcc->is_migration_safe = true;
     xcc->is_static = true;
     xcc->desc = xcc->cpu_def->desc;
+    if (xcc->cpu_def->gen < 14) {
+        cc->deprecation_note = RHEL_CPU_DEPRECATION;
+    }
 }
 
 static void s390_cpu_model_class_init(ObjectClass *oc, void *data)
 {
     S390CPUClass *xcc = S390_CPU_CLASS(oc);
+    CPUClass *cc = CPU_CLASS(oc);
 
     /* model that can change between QEMU versions */
     xcc->cpu_def = (const S390CPUDef *) data;
     xcc->is_migration_safe = true;
     xcc->desc = xcc->cpu_def->desc;
+    if (xcc->cpu_def->gen < 14) {
+        cc->deprecation_note = RHEL_CPU_DEPRECATION;
+    }
 }
 
 static void s390_qemu_cpu_model_class_init(ObjectClass *oc, void *data)
diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h
index 74d1f87e4f..372160bcd7 100644
--- a/target/s390x/cpu_models.h
+++ b/target/s390x/cpu_models.h
@@ -38,6 +38,8 @@ struct S390CPUDef {
     S390FeatBitmap full_feat;
     /* used to init full_feat from generated data */
     S390FeatInit full_init;
+    /* if deprecated, provides a suggestion */
+    const char *deprecation_note;
 };
 
 /* CPU model based on a CPU definition */
diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c
index 6a04ccab1b..f3b7c304ec 100644
--- a/target/s390x/cpu_models_sysemu.c
+++ b/target/s390x/cpu_models_sysemu.c
@@ -61,6 +61,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
     CpuDefinitionInfo *info;
     char *name = g_strdup(object_class_get_name(klass));
     S390CPUClass *scc = S390_CPU_CLASS(klass);
+    CPUClass *cc = CPU_CLASS(klass);
 
     /* strip off the -s390x-cpu */
     g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0;
@@ -70,6 +71,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
     info->migration_safe = scc->is_migration_safe;
     info->q_static = scc->is_static;
     info->q_typename = g_strdup(object_class_get_name(klass));
+    info->deprecated = !!cc->deprecation_note;
     /* check for unavailable features */
     if (cpu_list_data->model) {
         Object *obj;
-- 
2.35.3