586cba
From 8459c305914e2a7a19dcd1662d54a89def7acfa6 Mon Sep 17 00:00:00 2001
586cba
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
586cba
Date: Thu, 17 Mar 2022 17:59:22 +0000
586cba
Subject: [PATCH 05/18] target/s390x: deprecate CPUs older than z14
586cba
MIME-Version: 1.0
586cba
Content-Type: text/plain; charset=UTF-8
586cba
Content-Transfer-Encoding: 8bit
586cba
586cba
RH-Author: Daniel P. Berrangé <berrange@redhat.com>
586cba
RH-MergeRequest: 94: i386, aarch64, s390x: deprecate many named CPU models
586cba
RH-Commit: [5/6] 2da9e06cf452287673f94f880a7eb8b2b37b7278 (berrange/centos-src-qemu)
586cba
RH-Bugzilla: 2060839
586cba
RH-Acked-by: Thomas Huth <thuth@redhat.com>
586cba
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
586cba
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
586cba
586cba
RHEL-9 is compiled with the z14 ABI. We use this as a baseline to
586cba
select which CPUs we want to support, such that there is at least one
586cba
supported guest CPU that can be launched for every physical
586cba
machine capable of running RHEL-9 KVM.
586cba
586cba
Supported CPUs:
586cba
586cba
      gen15a-base
586cba
      gen15a
586cba
      gen15b-base
586cba
      gen15b
586cba
      gen16a-base
586cba
      gen16a
586cba
      gen16b-base
586cba
      gen16b
586cba
      max
586cba
      qemu
586cba
      z14.2-base
586cba
      z14.2
586cba
      z14-base
586cba
      z14
586cba
      z14ZR1-base
586cba
      z14ZR1
586cba
586cba
Deprecated CPUs:
586cba
586cba
      z10BC.2-base
586cba
      z10BC.2
586cba
      z10BC-base
586cba
      z10BC
586cba
      z10EC.2-base
586cba
      z10EC.2
586cba
      z10EC.3-base
586cba
      z10EC.3
586cba
      z10EC-base
586cba
      z10EC
586cba
      z114-base
586cba
      z114
586cba
      z13.2-base
586cba
      z13.2
586cba
      z13-base
586cba
      z13s-base
586cba
      z13s
586cba
      z13
586cba
      z196.2-base
586cba
      z196.2
586cba
      z196-base
586cba
      z196
586cba
      z800-base
586cba
      z800
586cba
      z890.2-base
586cba
      z890.2
586cba
      z890.3-base
586cba
      z890.3
586cba
      z890-base
586cba
      z890
586cba
      z900.2-base
586cba
      z900.2
586cba
      z900.3-base
586cba
      z900.3
586cba
      z900-base
586cba
      z900
586cba
      z990.2-base
586cba
      z990.2
586cba
      z990.3-base
586cba
      z990.3
586cba
      z990.4-base
586cba
      z990.4
586cba
      z990.5-base
586cba
      z990.5
586cba
      z990-base
586cba
      z990
586cba
      z9BC.2-base
586cba
      z9BC.2
586cba
      z9BC-base
586cba
      z9BC
586cba
      z9EC.2-base
586cba
      z9EC.2
586cba
      z9EC.3-base
586cba
      z9EC.3
586cba
      z9EC-base
586cba
      z9EC
586cba
      zBC12-base
586cba
      zBC12
586cba
      zEC12.2-base
586cba
      zEC12.2
586cba
      zEC12-base
586cba
      zEC12
586cba
586cba
https://bugzilla.redhat.com/show_bug.cgi?id=2060839
586cba
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
586cba
---
586cba
 target/s390x/cpu_models.c        | 11 +++++++++++
586cba
 target/s390x/cpu_models.h        |  2 ++
586cba
 target/s390x/cpu_models_sysemu.c |  2 ++
586cba
 3 files changed, 15 insertions(+)
586cba
586cba
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
586cba
index 6d71428056..9b9fc41676 100644
586cba
--- a/target/s390x/cpu_models.c
586cba
+++ b/target/s390x/cpu_models.c
586cba
@@ -45,6 +45,9 @@
586cba
  * of a following release have been a superset of the previous release. With
586cba
  * generation 15 one base feature and one optional feature have been deprecated.
586cba
  */
586cba
+
586cba
+#define RHEL_CPU_DEPRECATION "use at least 'z14', or 'host' / 'qemu' / 'max'"
586cba
+
586cba
 static S390CPUDef s390_cpu_defs[] = {
586cba
     CPUDEF_INIT(0x2064, 7, 1, 38, 0x00000000U, "z900", "IBM zSeries 900 GA1"),
586cba
     CPUDEF_INIT(0x2064, 7, 2, 38, 0x00000000U, "z900.2", "IBM zSeries 900 GA2"),
586cba
@@ -852,22 +855,30 @@ static void s390_host_cpu_model_class_init(ObjectClass *oc, void *data)
586cba
 static void s390_base_cpu_model_class_init(ObjectClass *oc, void *data)
586cba
 {
586cba
     S390CPUClass *xcc = S390_CPU_CLASS(oc);
586cba
+    CPUClass *cc = CPU_CLASS(oc);
586cba
 
586cba
     /* all base models are migration safe */
586cba
     xcc->cpu_def = (const S390CPUDef *) data;
586cba
     xcc->is_migration_safe = true;
586cba
     xcc->is_static = true;
586cba
     xcc->desc = xcc->cpu_def->desc;
586cba
+    if (xcc->cpu_def->gen < 14) {
586cba
+        cc->deprecation_note = RHEL_CPU_DEPRECATION;
586cba
+    }
586cba
 }
586cba
 
586cba
 static void s390_cpu_model_class_init(ObjectClass *oc, void *data)
586cba
 {
586cba
     S390CPUClass *xcc = S390_CPU_CLASS(oc);
586cba
+    CPUClass *cc = CPU_CLASS(oc);
586cba
 
586cba
     /* model that can change between QEMU versions */
586cba
     xcc->cpu_def = (const S390CPUDef *) data;
586cba
     xcc->is_migration_safe = true;
586cba
     xcc->desc = xcc->cpu_def->desc;
586cba
+    if (xcc->cpu_def->gen < 14) {
586cba
+        cc->deprecation_note = RHEL_CPU_DEPRECATION;
586cba
+    }
586cba
 }
586cba
 
586cba
 static void s390_qemu_cpu_model_class_init(ObjectClass *oc, void *data)
586cba
diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h
586cba
index 74d1f87e4f..372160bcd7 100644
586cba
--- a/target/s390x/cpu_models.h
586cba
+++ b/target/s390x/cpu_models.h
586cba
@@ -38,6 +38,8 @@ struct S390CPUDef {
586cba
     S390FeatBitmap full_feat;
586cba
     /* used to init full_feat from generated data */
586cba
     S390FeatInit full_init;
586cba
+    /* if deprecated, provides a suggestion */
586cba
+    const char *deprecation_note;
586cba
 };
586cba
 
586cba
 /* CPU model based on a CPU definition */
586cba
diff --git a/target/s390x/cpu_models_sysemu.c b/target/s390x/cpu_models_sysemu.c
586cba
index 6a04ccab1b..f3b7c304ec 100644
586cba
--- a/target/s390x/cpu_models_sysemu.c
586cba
+++ b/target/s390x/cpu_models_sysemu.c
586cba
@@ -61,6 +61,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
586cba
     CpuDefinitionInfo *info;
586cba
     char *name = g_strdup(object_class_get_name(klass));
586cba
     S390CPUClass *scc = S390_CPU_CLASS(klass);
586cba
+    CPUClass *cc = CPU_CLASS(klass);
586cba
 
586cba
     /* strip off the -s390x-cpu */
586cba
     g_strrstr(name, "-" TYPE_S390_CPU)[0] = 0;
586cba
@@ -70,6 +71,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
586cba
     info->migration_safe = scc->is_migration_safe;
586cba
     info->q_static = scc->is_static;
586cba
     info->q_typename = g_strdup(object_class_get_name(klass));
586cba
+    info->deprecated = !!cc->deprecation_note;
586cba
     /* check for unavailable features */
586cba
     if (cpu_list_data->model) {
586cba
         Object *obj;
586cba
-- 
586cba
2.35.3
586cba