29b115
From 055edf068196622a3e1868c9e4c991d410272a6d Mon Sep 17 00:00:00 2001
29b115
From: Andrew Jones <drjones@redhat.com>
29b115
Date: Wed, 15 Jun 2022 15:28:27 +0200
29b115
Subject: [PATCH 03/18] RHEL-only: AArch64: Drop unsupported CPU types
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: [3/6] 21f54c86dc87e5e75a64459b5a385686bc09640c (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
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066824
29b115
Upstream Status: RHEL only
29b115
29b115
We only need to support AArch64 cpu types and we only need three
29b115
types:
29b115
   1) A base type to use with TCG, i.e. a cpu type with only base
29b115
      features. 'cortex-a57' serves this role and is currently used
29b115
      by libguestfs.
29b115
   2) The 'max' type, which is for both KVM and TCG and is good for
29b115
      tests that just specify 'max' but run under both. 'max' with
29b115
      TCG also provides the VM with all the CPU features TCG
29b115
      supports, which is good for VMs that need features not
29b115
      provided by the basic cortex-a57.
29b115
   3) The host type which is used with KVM.
29b115
29b115
Signed-off-by: Andrew Jones <drjones@redhat.com>
29b115
---
29b115
 hw/arm/virt.c                  |  4 ++++
29b115
 target/arm/cpu64.c             |  6 ++++++
29b115
 target/arm/cpu_tcg.c           | 12 ++----------
29b115
 tests/qtest/arm-cpu-features.c |  6 ++++++
29b115
 4 files changed, 18 insertions(+), 10 deletions(-)
29b115
29b115
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
29b115
index 95d012d6eb..74119976d3 100644
29b115
--- a/hw/arm/virt.c
29b115
+++ b/hw/arm/virt.c
29b115
@@ -239,12 +239,16 @@ static const int a15irqmap[] = {
29b115
 };
29b115
 
29b115
 static const char *valid_cpus[] = {
29b115
+#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
     ARM_CPU_TYPE_NAME("cortex-a7"),
29b115
     ARM_CPU_TYPE_NAME("cortex-a15"),
29b115
     ARM_CPU_TYPE_NAME("cortex-a53"),
29b115
+#endif /* disabled for RHEL */
29b115
     ARM_CPU_TYPE_NAME("cortex-a57"),
29b115
+#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
     ARM_CPU_TYPE_NAME("cortex-a72"),
29b115
     ARM_CPU_TYPE_NAME("a64fx"),
29b115
+#endif /* disabled for RHEL */
29b115
     ARM_CPU_TYPE_NAME("host"),
29b115
     ARM_CPU_TYPE_NAME("max"),
29b115
 };
29b115
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
29b115
index eb44c05822..e80b831073 100644
29b115
--- a/target/arm/cpu64.c
29b115
+++ b/target/arm/cpu64.c
29b115
@@ -146,6 +146,7 @@ static void aarch64_a57_initfn(Object *obj)
29b115
     define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
29b115
 }
29b115
 
29b115
+#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
 static void aarch64_a53_initfn(Object *obj)
29b115
 {
29b115
     ARMCPU *cpu = ARM_CPU(obj);
29b115
@@ -249,6 +250,7 @@ static void aarch64_a72_initfn(Object *obj)
29b115
     cpu->gic_vprebits = 5;
29b115
     define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
29b115
 }
29b115
+#endif /* disabled for RHEL */
29b115
 
29b115
 void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
29b115
 {
29b115
@@ -923,6 +925,7 @@ static void aarch64_max_initfn(Object *obj)
29b115
     qdev_property_add_static(DEVICE(obj), &arm_cpu_lpa2_property);
29b115
 }
29b115
 
29b115
+#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
 static void aarch64_a64fx_initfn(Object *obj)
29b115
 {
29b115
     ARMCPU *cpu = ARM_CPU(obj);
29b115
@@ -969,12 +972,15 @@ static void aarch64_a64fx_initfn(Object *obj)
29b115
 
29b115
     /* TODO:  Add A64FX specific HPC extension registers */
29b115
 }
29b115
+#endif /* disabled for RHEL */
29b115
 
29b115
 static const ARMCPUInfo aarch64_cpus[] = {
29b115
     { .name = "cortex-a57",         .initfn = aarch64_a57_initfn },
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
     { .name = "a64fx",              .initfn = aarch64_a64fx_initfn },
29b115
+#endif /* disabled for RHEL */
29b115
     { .name = "max",                .initfn = aarch64_max_initfn },
29b115
 #if defined(CONFIG_KVM) || defined(CONFIG_HVF)
29b115
     { .name = "host",               .initfn = aarch64_host_initfn },
29b115
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
29b115
index 3826fa5122..74727fc92c 100644
29b115
--- a/target/arm/cpu_tcg.c
29b115
+++ b/target/arm/cpu_tcg.c
29b115
@@ -19,10 +19,10 @@
29b115
 #include "hw/boards.h"
29b115
 #endif
29b115
 
29b115
+#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
 /* CPU models. These are not needed for the AArch64 linux-user build. */
29b115
 #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
29b115
 
29b115
-#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
 #if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
29b115
 static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
29b115
 {
29b115
@@ -376,7 +376,6 @@ static void cortex_a9_initfn(Object *obj)
29b115
     cpu->ccsidr[1] = 0x200fe019; /* 16k L1 icache. */
29b115
     define_arm_cp_regs(cpu, cortexa9_cp_reginfo);
29b115
 }
29b115
-#endif /* disabled for RHEL */
29b115
 
29b115
 #ifndef CONFIG_USER_ONLY
29b115
 static uint64_t a15_l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri)
29b115
@@ -402,7 +401,6 @@ static const ARMCPRegInfo cortexa15_cp_reginfo[] = {
29b115
     REGINFO_SENTINEL
29b115
 };
29b115
 
29b115
-#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
 static void cortex_a7_initfn(Object *obj)
29b115
 {
29b115
     ARMCPU *cpu = ARM_CPU(obj);
29b115
@@ -448,7 +446,6 @@ static void cortex_a7_initfn(Object *obj)
29b115
     cpu->ccsidr[2] = 0x711fe07a; /* 4096K L2 unified cache */
29b115
     define_arm_cp_regs(cpu, cortexa15_cp_reginfo); /* Same as A15 */
29b115
 }
29b115
-#endif /* disabled for RHEL */
29b115
 
29b115
 static void cortex_a15_initfn(Object *obj)
29b115
 {
29b115
@@ -492,7 +489,6 @@ static void cortex_a15_initfn(Object *obj)
29b115
     define_arm_cp_regs(cpu, cortexa15_cp_reginfo);
29b115
 }
29b115
 
29b115
-#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
 static void cortex_m0_initfn(Object *obj)
29b115
 {
29b115
     ARMCPU *cpu = ARM_CPU(obj);
29b115
@@ -933,7 +929,6 @@ static void arm_v7m_class_init(ObjectClass *oc, void *data)
29b115
 
29b115
     cc->gdb_core_xml_file = "arm-m-profile.xml";
29b115
 }
29b115
-#endif /* disabled for RHEL */
29b115
 
29b115
 #ifndef TARGET_AARCH64
29b115
 /*
29b115
@@ -1013,7 +1008,6 @@ static void arm_max_initfn(Object *obj)
29b115
 #endif /* !TARGET_AARCH64 */
29b115
 
29b115
 static const ARMCPUInfo arm_tcg_cpus[] = {
29b115
-#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
     { .name = "arm926",      .initfn = arm926_initfn },
29b115
     { .name = "arm946",      .initfn = arm946_initfn },
29b115
     { .name = "arm1026",     .initfn = arm1026_initfn },
29b115
@@ -1029,9 +1023,7 @@ static const ARMCPUInfo arm_tcg_cpus[] = {
29b115
     { .name = "cortex-a7",   .initfn = cortex_a7_initfn },
29b115
     { .name = "cortex-a8",   .initfn = cortex_a8_initfn },
29b115
     { .name = "cortex-a9",   .initfn = cortex_a9_initfn },
29b115
-#endif /* disabled for RHEL */
29b115
     { .name = "cortex-a15",  .initfn = cortex_a15_initfn },
29b115
-#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
     { .name = "cortex-m0",   .initfn = cortex_m0_initfn,
29b115
                              .class_init = arm_v7m_class_init },
29b115
     { .name = "cortex-m3",   .initfn = cortex_m3_initfn,
29b115
@@ -1062,7 +1054,6 @@ static const ARMCPUInfo arm_tcg_cpus[] = {
29b115
     { .name = "pxa270-b1",   .initfn = pxa270b1_initfn },
29b115
     { .name = "pxa270-c0",   .initfn = pxa270c0_initfn },
29b115
     { .name = "pxa270-c5",   .initfn = pxa270c5_initfn },
29b115
-#endif /* disabled for RHEL */
29b115
 #ifndef TARGET_AARCH64
29b115
     { .name = "max",         .initfn = arm_max_initfn },
29b115
 #endif
29b115
@@ -1090,3 +1081,4 @@ static void arm_tcg_cpu_register_types(void)
29b115
 type_init(arm_tcg_cpu_register_types)
29b115
 
29b115
 #endif /* !CONFIG_USER_ONLY || !TARGET_AARCH64 */
29b115
+#endif /* disabled for RHEL */
29b115
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
29b115
index f76652143a..fe2a0a070d 100644
29b115
--- a/tests/qtest/arm-cpu-features.c
29b115
+++ b/tests/qtest/arm-cpu-features.c
29b115
@@ -440,8 +440,10 @@ static void test_query_cpu_model_expansion(const void *data)
29b115
     assert_error(qts, "host", "The CPU type 'host' requires KVM", NULL);
29b115
 
29b115
     /* Test expected feature presence/absence for some cpu types */
29b115
+#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
     assert_has_feature_enabled(qts, "cortex-a15", "pmu");
29b115
     assert_has_not_feature(qts, "cortex-a15", "aarch64");
29b115
+#endif /* disabled for RHEL */
29b115
 
29b115
     /* Enabling and disabling pmu should always work. */
29b115
     assert_has_feature_enabled(qts, "max", "pmu");
29b115
@@ -458,6 +460,7 @@ static void test_query_cpu_model_expansion(const void *data)
29b115
         assert_has_feature_enabled(qts, "cortex-a57", "pmu");
29b115
         assert_has_feature_enabled(qts, "cortex-a57", "aarch64");
29b115
 
29b115
+#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
         assert_has_feature_enabled(qts, "a64fx", "pmu");
29b115
         assert_has_feature_enabled(qts, "a64fx", "aarch64");
29b115
         /*
29b115
@@ -470,6 +473,7 @@ static void test_query_cpu_model_expansion(const void *data)
29b115
                      "{ 'sve384': true }");
29b115
         assert_error(qts, "a64fx", "cannot enable sve640",
29b115
                      "{ 'sve640': true }");
29b115
+#endif /* disabled for RHEL */
29b115
 
29b115
         sve_tests_default(qts, "max");
29b115
         pauth_tests_default(qts, "max");
29b115
@@ -505,9 +509,11 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
29b115
         QDict *resp;
29b115
         char *error;
29b115
 
29b115
+#if 0 /* Disabled for Red Hat Enterprise Linux */
29b115
         assert_error(qts, "cortex-a15",
29b115
             "We cannot guarantee the CPU type 'cortex-a15' works "
29b115
             "with KVM on this host", NULL);
29b115
+#endif /* disabled for RHEL */
29b115
 
29b115
         assert_has_feature_enabled(qts, "host", "aarch64");
29b115
 
29b115
-- 
29b115
2.35.3
29b115