thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
29b115
From 1f8528b71d96c01dd6106f11681f4a4e2776ef5f Mon Sep 17 00:00:00 2001
29b115
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
29b115
Date: Mon, 21 Mar 2022 12:05:42 +0000
29b115
Subject: [PATCH 06/18] target/arm: deprecate named CPU models
29b115
MIME-Version: 1.0
29b115
Content-Type: text/plain; charset=UTF-8
29b115
Content-Transfer-Encoding: 8bit
29b115
29b115
RH-Author: Daniel P. Berrangé <berrange@redhat.com>
29b115
RH-MergeRequest: 94: i386, aarch64, s390x: deprecate many named CPU models
29b115
RH-Commit: [6/6] afddeb9e898206fd04499f01c48caf7dc1a8b8ef (berrange/centos-src-qemu)
29b115
RH-Bugzilla: 2060839
29b115
RH-Acked-by: Thomas Huth <thuth@redhat.com>
29b115
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
29b115
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
29b115
29b115
KVM requires use of the 'host' CPU model, so named CPU models are only
29b115
needed for TCG. Since we don't consider TCG to be supported we can
29b115
deprecate all the named CPU models. TCG users can rely on 'max' model.
29b115
29b115
Note: this has the effect of deprecating the default built-in CPU
29b115
model 'cortex-a57'. Applications using QEMU are expected to make an
29b115
explicit choice about which CPU model they want, since no builtin
29b115
default can suit all purposes.
29b115
29b115
https://bugzilla.redhat.com/show_bug.cgi?id=2060839
29b115
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
29b115
---
29b115
 target/arm/cpu-qom.h | 1 +
29b115
 target/arm/cpu.c     | 5 +++++
29b115
 target/arm/cpu.h     | 2 ++
29b115
 target/arm/cpu64.c   | 8 +++++++-
29b115
 target/arm/helper.c  | 2 ++
29b115
 5 files changed, 17 insertions(+), 1 deletion(-)
29b115
29b115
diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
29b115
index 64c44cef2d..82e97249bc 100644
29b115
--- a/target/arm/cpu-qom.h
29b115
+++ b/target/arm/cpu-qom.h
29b115
@@ -35,6 +35,7 @@ typedef struct ARMCPUInfo {
29b115
     const char *name;
29b115
     void (*initfn)(Object *obj);
29b115
     void (*class_init)(ObjectClass *oc, void *data);
29b115
+    const char *deprecation_note;
29b115
 } ARMCPUInfo;
29b115
 
29b115
 void arm_cpu_register(const ARMCPUInfo *info);
29b115
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
29b115
index 5d4ca7a227..c74b0fb462 100644
29b115
--- a/target/arm/cpu.c
29b115
+++ b/target/arm/cpu.c
29b115
@@ -2105,8 +2105,13 @@ static void arm_cpu_instance_init(Object *obj)
29b115
 static void cpu_register_class_init(ObjectClass *oc, void *data)
29b115
 {
29b115
     ARMCPUClass *acc = ARM_CPU_CLASS(oc);
29b115
+    CPUClass *cc = CPU_CLASS(oc);
29b115
 
29b115
     acc->info = data;
29b115
+
29b115
+    if (acc->info->deprecation_note) {
29b115
+        cc->deprecation_note = acc->info->deprecation_note;
29b115
+    }
29b115
 }
29b115
 
29b115
 void arm_cpu_register(const ARMCPUInfo *info)
29b115
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
29b115
index 23879de5fa..c0c9f680e5 100644
29b115
--- a/target/arm/cpu.h
29b115
+++ b/target/arm/cpu.h
29b115
@@ -33,6 +33,8 @@
29b115
 #define KVM_HAVE_MCE_INJECTION 1
29b115
 #endif
29b115
 
29b115
+#define RHEL_CPU_DEPRECATION "use 'host' / 'max'"
29b115
+
29b115
 #define EXCP_UDEF            1   /* undefined instruction */
29b115
 #define EXCP_SWI             2   /* software interrupt */
29b115
 #define EXCP_PREFETCH_ABORT  3
29b115
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
29b115
index e80b831073..c8f152891c 100644
29b115
--- a/target/arm/cpu64.c
29b115
+++ b/target/arm/cpu64.c
29b115
@@ -975,7 +975,8 @@ static void aarch64_a64fx_initfn(Object *obj)
29b115
 #endif /* disabled for RHEL */
29b115
 
29b115
 static const ARMCPUInfo aarch64_cpus[] = {
29b115
-    { .name = "cortex-a57",         .initfn = aarch64_a57_initfn },
29b115
+    { .name = "cortex-a57",         .initfn = aarch64_a57_initfn,
29b115
+      .deprecation_note = RHEL_CPU_DEPRECATION },
29b115
 #if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
     { .name = "cortex-a53",         .initfn = aarch64_a53_initfn },
29b115
     { .name = "cortex-a72",         .initfn = aarch64_a72_initfn },
29b115
@@ -1052,8 +1053,13 @@ static void aarch64_cpu_instance_init(Object *obj)
29b115
 static void cpu_register_class_init(ObjectClass *oc, void *data)
29b115
 {
29b115
     ARMCPUClass *acc = ARM_CPU_CLASS(oc);
29b115
+    CPUClass *cc = CPU_CLASS(oc);
29b115
 
29b115
     acc->info = data;
29b115
+
29b115
+    if (acc->info->deprecation_note) {
29b115
+        cc->deprecation_note = acc->info->deprecation_note;
29b115
+    }
29b115
 }
29b115
 
29b115
 void aarch64_cpu_register(const ARMCPUInfo *info)
29b115
diff --git a/target/arm/helper.c b/target/arm/helper.c
29b115
index 7d14650615..3d34f63e49 100644
29b115
--- a/target/arm/helper.c
29b115
+++ b/target/arm/helper.c
29b115
@@ -8560,6 +8560,7 @@ void arm_cpu_list(void)
29b115
 static void arm_cpu_add_definition(gpointer data, gpointer user_data)
29b115
 {
29b115
     ObjectClass *oc = data;
29b115
+    CPUClass *cc = CPU_CLASS(oc);
29b115
     CpuDefinitionInfoList **cpu_list = user_data;
29b115
     CpuDefinitionInfo *info;
29b115
     const char *typename;
29b115
@@ -8569,6 +8570,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data)
29b115
     info->name = g_strndup(typename,
29b115
                            strlen(typename) - strlen("-" TYPE_ARM_CPU));
29b115
     info->q_typename = g_strdup(typename);
29b115
+    info->deprecated = !!cc->deprecation_note;
29b115
 
29b115
     QAPI_LIST_PREPEND(*cpu_list, info);
29b115
 }
29b115
-- 
29b115
2.35.3
29b115