thebeanogamer / rpms / qemu-kvm

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