ed5979
From 8501581c99760ed8a800d0c98eeb17a4bf450366 Mon Sep 17 00:00:00 2001
495e37
From: Miroslav Rezanina <mrezanin@redhat.com>
495e37
Date: Fri, 19 Oct 2018 12:53:31 +0200
495e37
Subject: Add aarch64 machine types
495e37
495e37
Adding changes to add RHEL machine types for aarch64 architecture.
495e37
495e37
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
495e37
---
495e37
Rebase notes (6.1.0):
495e37
- Use CONFIG_TPM check when using TPM structures
495e37
- Add support for default_bus_bypass_iommu
495e37
- ea4c0b32d9 arm/virt: Register highmem and gic-version as class properties
495e37
- 895e1fa86a hw/arm/virt: Add 8.5 and 9.0 machine types and remove older ones
495e37
586cba
Rebase notes (7.0.0):
586cba
- Added dtb-kaslr-seed option
586cba
- Set no_tcg_lpa2 to true
586cba
ed5979
Rebase notes (7.1.0 rc0):
ed5979
- replace dtb_kaslr_seed by dtb_randomness
ed5979
ed5979
Rebase notes (7.1.0 rc3):
ed5979
- Updated dtb_randomness comment
ed5979
ed5979
Rebase notes (7.2.0 rc0):
ed5979
- Disabled cortex-a35
ed5979
586cba
Merged patches (6.2.0):
495e37
- 9a3d4fde0e hw/arm/virt: Remove 9.0 machine type
495e37
- f7d04d6695 hw: arm: virt: Add hw_compat_rhel_8_5 to 8.5 machine type
586cba
586cba
Merged patches (7.0.0):
586cba
- 3b82be3dd3 redhat: virt-rhel8.5.0: Update machine type compatibility for QEMU 6.2.0 update
586cba
- c354a86c9b hw/arm/virt: Register "iommu" as a class property
586cba
- c1a2630dc9 hw/arm/virt: Register "its" as a class property
586cba
- 9d8c61dc93 hw/arm/virt: Rename default_bus_bypass_iommu
586cba
- a1d1b6eeb6 hw/arm/virt: Expose the 'RAS' option
586cba
- 47f8fe1b82 hw/arm/virt: Add 9.0 machine type and remove 8.5 one
586cba
- ed2346788f hw/arm/virt: Check no_tcg_its and minor style changes
ed5979
ed5979
Merged patches (7.0.0):
ed5979
- f79b31bdef hw/arm/virt: Remove the dtb-kaslr-seed machine option
ed5979
- b6fca85f4a hw/arm/virt: Fix missing initialization in instance/class_init()
ed5979
ed5979
Merged patches (7.1.0 rc0):
ed5979
- ac97dd4f9f RHEL-only: AArch64: Drop unsupported CPU types
ed5979
- e9c0a70664 target/arm: deprecate named CPU models
ed5979
ed5979
Merged patches (7.2.0 rc0):
ed5979
- 0be2889fa2 Introduce upstream 7.0 compat changes (only applicable parts)
495e37
---
ed5979
 hw/arm/virt.c                  | 237 ++++++++++++++++++++++++++++++++-
ed5979
 include/hw/arm/virt.h          |   8 ++
ed5979
 target/arm/cpu-qom.h           |   1 +
ed5979
 target/arm/cpu.c               |   5 +
ed5979
 target/arm/cpu.h               |   2 +
ed5979
 target/arm/cpu64.c             |  16 ++-
ed5979
 target/arm/cpu_tcg.c           |  12 +-
ed5979
 target/arm/helper.c            |   2 +
ed5979
 tests/qtest/arm-cpu-features.c |   6 +
ed5979
 9 files changed, 277 insertions(+), 12 deletions(-)
495e37
495e37
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
ed5979
index d633300fdc..dfcab40a73 100644
495e37
--- a/hw/arm/virt.c
495e37
+++ b/hw/arm/virt.c
586cba
@@ -80,6 +80,7 @@
495e37
 #include "hw/char/pl011.h"
495e37
 #include "qemu/guest-random.h"
495e37
 
495e37
+#if 0 /* Disabled for Red Hat Enterprise Linux */
495e37
 #define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
495e37
     static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
495e37
                                                     void *data) \
586cba
@@ -106,7 +107,48 @@
495e37
     DEFINE_VIRT_MACHINE_LATEST(major, minor, true)
495e37
 #define DEFINE_VIRT_MACHINE(major, minor) \
495e37
     DEFINE_VIRT_MACHINE_LATEST(major, minor, false)
495e37
-
495e37
+#endif /* disabled for RHEL */
495e37
+
495e37
+#define DEFINE_RHEL_MACHINE_LATEST(m, n, s, latest)                     \
495e37
+    static void rhel##m##n##s##_virt_class_init(ObjectClass *oc,        \
495e37
+                                                void *data)             \
495e37
+    {                                                                   \
495e37
+        MachineClass *mc = MACHINE_CLASS(oc);                           \
495e37
+        rhel##m##n##s##_virt_options(mc);                               \
495e37
+        mc->desc = "RHEL " # m "." # n "." # s " ARM Virtual Machine";  \
495e37
+        if (latest) {                                                   \
495e37
+            mc->alias = "virt";                                         \
495e37
+            mc->is_default = 1;                                         \
495e37
+        }                                                               \
495e37
+    }                                                                   \
495e37
+    static const TypeInfo rhel##m##n##s##_machvirt_info = {             \
495e37
+        .name = MACHINE_TYPE_NAME("virt-rhel" # m "." # n "." # s),     \
495e37
+        .parent = TYPE_RHEL_MACHINE,                                    \
495e37
+        .class_init = rhel##m##n##s##_virt_class_init,                  \
495e37
+    };                                                                  \
495e37
+    static void rhel##m##n##s##_machvirt_init(void)                     \
495e37
+    {                                                                   \
495e37
+        type_register_static(&rhel##m##n##s##_machvirt_info);           \
495e37
+    }                                                                   \
495e37
+    type_init(rhel##m##n##s##_machvirt_init);
495e37
+
495e37
+#define DEFINE_RHEL_MACHINE_AS_LATEST(major, minor, subminor)   \
495e37
+    DEFINE_RHEL_MACHINE_LATEST(major, minor, subminor, true)
495e37
+#define DEFINE_RHEL_MACHINE(major, minor, subminor)             \
495e37
+    DEFINE_RHEL_MACHINE_LATEST(major, minor, subminor, false)
495e37
+
495e37
+/* This variable is for changes to properties that are RHEL specific,
495e37
+ * different to the current upstream and to be applied to the latest
495e37
+ * machine type.
495e37
+ */
495e37
+GlobalProperty arm_rhel_compat[] = {
495e37
+    {
495e37
+        .driver   = "virtio-net-pci",
495e37
+        .property = "romfile",
495e37
+        .value    = "",
495e37
+    },
495e37
+};
495e37
+const size_t arm_rhel_compat_len = G_N_ELEMENTS(arm_rhel_compat);
495e37
 
495e37
 /* Number of external interrupt lines to configure the GIC with */
495e37
 #define NUM_IRQS 256
ed5979
@@ -197,15 +239,19 @@ static const int a15irqmap[] = {
ed5979
 };
ed5979
 
ed5979
 static const char *valid_cpus[] = {
ed5979
+#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
     ARM_CPU_TYPE_NAME("cortex-a7"),
ed5979
     ARM_CPU_TYPE_NAME("cortex-a15"),
ed5979
     ARM_CPU_TYPE_NAME("cortex-a35"),
ed5979
     ARM_CPU_TYPE_NAME("cortex-a53"),
ed5979
+#endif /* disabled for RHEL */
ed5979
     ARM_CPU_TYPE_NAME("cortex-a57"),
ed5979
+#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
     ARM_CPU_TYPE_NAME("cortex-a72"),
ed5979
     ARM_CPU_TYPE_NAME("cortex-a76"),
ed5979
     ARM_CPU_TYPE_NAME("a64fx"),
ed5979
     ARM_CPU_TYPE_NAME("neoverse-n1"),
ed5979
+#endif /* disabled for RHEL */
ed5979
     ARM_CPU_TYPE_NAME("host"),
ed5979
     ARM_CPU_TYPE_NAME("max"),
ed5979
 };
ed5979
@@ -2290,6 +2336,7 @@ static void machvirt_init(MachineState *machine)
495e37
     qemu_add_machine_init_done_notifier(&vms->machine_done);
495e37
 }
495e37
 
495e37
+#if 0 /* Disabled for Red Hat Enterprise Linux */
495e37
 static bool virt_get_secure(Object *obj, Error **errp)
495e37
 {
495e37
     VirtMachineState *vms = VIRT_MACHINE(obj);
ed5979
@@ -2317,6 +2364,7 @@ static void virt_set_virt(Object *obj, bool value, Error **errp)
495e37
 
495e37
     vms->virt = value;
495e37
 }
495e37
+#endif /* disabled for RHEL */
495e37
 
495e37
 static bool virt_get_highmem(Object *obj, Error **errp)
495e37
 {
ed5979
@@ -2346,6 +2394,7 @@ static void virt_set_its(Object *obj, bool value, Error **errp)
ed5979
     vms->its = value;
ed5979
 }
ed5979
 
ed5979
+#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
 static bool virt_get_dtb_randomness(Object *obj, Error **errp)
ed5979
 {
ed5979
     VirtMachineState *vms = VIRT_MACHINE(obj);
ed5979
@@ -2359,6 +2408,7 @@ static void virt_set_dtb_randomness(Object *obj, bool value, Error **errp)
ed5979
 
ed5979
     vms->dtb_randomness = value;
ed5979
 }
ed5979
+#endif /* disabled for RHEL */
ed5979
 
ed5979
 static char *virt_get_oem_id(Object *obj, Error **errp)
ed5979
 {
ed5979
@@ -2442,6 +2492,7 @@ static void virt_set_ras(Object *obj, bool value, Error **errp)
586cba
     vms->ras = value;
495e37
 }
495e37
 
495e37
+#if 0 /* Disabled for Red Hat Enterprise Linux */
586cba
 static bool virt_get_mte(Object *obj, Error **errp)
495e37
 {
495e37
     VirtMachineState *vms = VIRT_MACHINE(obj);
ed5979
@@ -2455,6 +2506,7 @@ static void virt_set_mte(Object *obj, bool value, Error **errp)
495e37
 
495e37
     vms->mte = value;
495e37
 }
495e37
+#endif /* disabled for RHEL */
495e37
 
495e37
 static char *virt_get_gic_version(Object *obj, Error **errp)
495e37
 {
ed5979
@@ -2886,6 +2938,7 @@ static int virt_kvm_type(MachineState *ms, const char *type_str)
495e37
     return fixed_ipa ? 0 : requested_pa_size;
495e37
 }
495e37
 
495e37
+#if 0 /* Disabled for Red Hat Enterprise Linux */
495e37
 static void virt_machine_class_init(ObjectClass *oc, void *data)
495e37
 {
495e37
     MachineClass *mc = MACHINE_CLASS(oc);
ed5979
@@ -3294,3 +3347,185 @@ static void virt_machine_2_6_options(MachineClass *mc)
495e37
     vmc->no_pmu = true;
495e37
 }
495e37
 DEFINE_VIRT_MACHINE(2, 6)
495e37
+#endif /* disabled for RHEL */
495e37
+
495e37
+static void rhel_machine_class_init(ObjectClass *oc, void *data)
495e37
+{
495e37
+    MachineClass *mc = MACHINE_CLASS(oc);
495e37
+    HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
495e37
+
495e37
+    mc->family = "virt-rhel-Z";
495e37
+    mc->init = machvirt_init;
495e37
+    /* Maximum supported VCPU count for all virt-rhel* machines */
495e37
+    mc->max_cpus = 384;
495e37
+#ifdef CONFIG_TPM
495e37
+    machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
495e37
+#endif
495e37
+    mc->block_default_type = IF_VIRTIO;
495e37
+    mc->no_cdrom = 1;
495e37
+    mc->pci_allow_0_address = true;
495e37
+    /* We know we will never create a pre-ARMv7 CPU which needs 1K pages */
495e37
+    mc->minimum_page_bits = 12;
495e37
+    mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids;
495e37
+    mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
495e37
+    mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a57");
495e37
+    mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
495e37
+    mc->kvm_type = virt_kvm_type;
495e37
+    assert(!mc->get_hotplug_handler);
495e37
+    mc->get_hotplug_handler = virt_machine_get_hotplug_handler;
495e37
+    hc->pre_plug = virt_machine_device_pre_plug_cb;
495e37
+    hc->plug = virt_machine_device_plug_cb;
495e37
+    hc->unplug_request = virt_machine_device_unplug_request_cb;
495e37
+    hc->unplug = virt_machine_device_unplug_cb;
495e37
+    mc->nvdimm_supported = true;
ed5979
+    mc->smp_props.clusters_supported = true;
495e37
+    mc->auto_enable_numa_with_memhp = true;
495e37
+    mc->auto_enable_numa_with_memdev = true;
495e37
+    mc->default_ram_id = "mach-virt.ram";
495e37
+
495e37
+    object_class_property_add(oc, "acpi", "OnOffAuto",
495e37
+        virt_get_acpi, virt_set_acpi,
495e37
+        NULL, NULL);
495e37
+    object_class_property_set_description(oc, "acpi",
495e37
+        "Enable ACPI");
495e37
+
495e37
+    object_class_property_add_bool(oc, "highmem", virt_get_highmem,
495e37
+                                   virt_set_highmem);
495e37
+    object_class_property_set_description(oc, "highmem",
495e37
+                                          "Set on/off to enable/disable using "
495e37
+                                          "physical address space above 32 bits");
495e37
+
495e37
+    object_class_property_add_str(oc, "gic-version", virt_get_gic_version,
495e37
+                                  virt_set_gic_version);
495e37
+    object_class_property_set_description(oc, "gic-version",
495e37
+                                          "Set GIC version. "
495e37
+                                          "Valid values are 2, 3, host and max");
495e37
+
586cba
+    object_class_property_add_str(oc, "iommu", virt_get_iommu, virt_set_iommu);
586cba
+    object_class_property_set_description(oc, "iommu",
586cba
+                                          "Set the IOMMU type. "
586cba
+                                          "Valid values are none and smmuv3");
586cba
+
586cba
+    object_class_property_add_bool(oc, "default-bus-bypass-iommu",
586cba
+                                   virt_get_default_bus_bypass_iommu,
586cba
+                                   virt_set_default_bus_bypass_iommu);
586cba
+    object_class_property_set_description(oc, "default-bus-bypass-iommu",
586cba
+                                          "Set on/off to enable/disable "
586cba
+                                          "bypass_iommu for default root bus");
586cba
+
586cba
+    object_class_property_add_bool(oc, "ras", virt_get_ras,
586cba
+                                   virt_set_ras);
586cba
+    object_class_property_set_description(oc, "ras",
586cba
+                                          "Set on/off to enable/disable reporting host memory errors "
586cba
+                                          "to a KVM guest using ACPI and guest external abort exceptions");
586cba
+
586cba
+    object_class_property_add_bool(oc, "its", virt_get_its,
586cba
+                                   virt_set_its);
586cba
+    object_class_property_set_description(oc, "its",
586cba
+                                          "Set on/off to enable/disable "
586cba
+                                          "ITS instantiation");
586cba
+
495e37
+    object_class_property_add_str(oc, "x-oem-id",
495e37
+                                  virt_get_oem_id,
495e37
+                                  virt_set_oem_id);
495e37
+    object_class_property_set_description(oc, "x-oem-id",
495e37
+                                          "Override the default value of field OEMID "
495e37
+                                          "in ACPI table header."
495e37
+                                          "The string may be up to 6 bytes in size");
495e37
+
586cba
+
495e37
+    object_class_property_add_str(oc, "x-oem-table-id",
495e37
+                                  virt_get_oem_table_id,
495e37
+                                  virt_set_oem_table_id);
495e37
+    object_class_property_set_description(oc, "x-oem-table-id",
495e37
+                                          "Override the default value of field OEM Table ID "
495e37
+                                          "in ACPI table header."
495e37
+                                          "The string may be up to 8 bytes in size");
495e37
+}
495e37
+
495e37
+static void rhel_virt_instance_init(Object *obj)
495e37
+{
495e37
+    VirtMachineState *vms = VIRT_MACHINE(obj);
495e37
+    VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
495e37
+
495e37
+    /* EL3 is disabled by default and non-configurable for RHEL */
495e37
+    vms->secure = false;
495e37
+
495e37
+    /* EL2 is disabled by default and non-configurable for RHEL */
495e37
+    vms->virt = false;
495e37
+
495e37
+    /* High memory is enabled by default */
495e37
+    vms->highmem = true;
495e37
+    vms->gic_version = VIRT_GIC_VERSION_NOSEL;
495e37
+
495e37
+    vms->highmem_ecam = !vmc->no_highmem_ecam;
ed5979
+    vms->highmem_mmio = true;
ed5979
+    vms->highmem_redists = true;
495e37
+
495e37
+    if (vmc->no_its) {
495e37
+        vms->its = false;
495e37
+    } else {
495e37
+        /* Default allows ITS instantiation */
495e37
+        vms->its = true;
586cba
+
586cba
+        if (vmc->no_tcg_its) {
586cba
+            vms->tcg_its = false;
586cba
+        } else {
586cba
+            vms->tcg_its = true;
586cba
+        }
495e37
+    }
495e37
+
495e37
+    /* Default disallows iommu instantiation */
495e37
+    vms->iommu = VIRT_IOMMU_NONE;
586cba
+
586cba
+    /* The default root bus is attached to iommu by default */
586cba
+    vms->default_bus_bypass_iommu = false;
495e37
+
495e37
+    /* Default disallows RAS instantiation and is non-configurable for RHEL */
495e37
+    vms->ras = false;
495e37
+
495e37
+    /* MTE is disabled by default and non-configurable for RHEL */
495e37
+    vms->mte = false;
495e37
+
ed5979
+    /* Supply kaslr-seed and rng-seed by default, non-configurable for RHEL */
ed5979
+    vms->dtb_randomness = true;
495e37
+
495e37
+    vms->irqmap = a15irqmap;
495e37
+
495e37
+    virt_flash_create(vms);
586cba
+
495e37
+    vms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
495e37
+    vms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
495e37
+}
495e37
+
495e37
+static const TypeInfo rhel_machine_info = {
495e37
+    .name          = TYPE_RHEL_MACHINE,
495e37
+    .parent        = TYPE_MACHINE,
495e37
+    .abstract      = true,
495e37
+    .instance_size = sizeof(VirtMachineState),
495e37
+    .class_size    = sizeof(VirtMachineClass),
495e37
+    .class_init    = rhel_machine_class_init,
495e37
+    .instance_init = rhel_virt_instance_init,
495e37
+    .interfaces = (InterfaceInfo[]) {
495e37
+         { TYPE_HOTPLUG_HANDLER },
495e37
+         { }
495e37
+    },
495e37
+};
495e37
+
495e37
+static void rhel_machine_init(void)
495e37
+{
495e37
+    type_register_static(&rhel_machine_info);
495e37
+}
495e37
+type_init(rhel_machine_init);
495e37
+
586cba
+static void rhel900_virt_options(MachineClass *mc)
495e37
+{
586cba
+    VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
586cba
+
495e37
+    compat_props_add(mc->compat_props, arm_rhel_compat, arm_rhel_compat_len);
ed5979
+    compat_props_add(mc->compat_props, hw_compat_rhel_9_1, hw_compat_rhel_9_1_len);
586cba
+
586cba
+    /* Disable FEAT_LPA2 since old kernels (<= v5.12) don't boot with that feature */
586cba
+    vmc->no_tcg_lpa2 = true;
495e37
+}
586cba
+DEFINE_RHEL_MACHINE_AS_LATEST(9, 0, 0)
495e37
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
ed5979
index 6ec479ca2b..22b54ec510 100644
495e37
--- a/include/hw/arm/virt.h
495e37
+++ b/include/hw/arm/virt.h
ed5979
@@ -180,9 +180,17 @@ struct VirtMachineState {
495e37
 
495e37
 #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)
495e37
 
495e37
+#if 0 /* disabled for Red Hat Enterprise Linux */
495e37
 #define TYPE_VIRT_MACHINE   MACHINE_TYPE_NAME("virt")
495e37
 OBJECT_DECLARE_TYPE(VirtMachineState, VirtMachineClass, VIRT_MACHINE)
495e37
 
495e37
+#else
495e37
+#define TYPE_RHEL_MACHINE MACHINE_TYPE_NAME("virt-rhel")
495e37
+typedef struct VirtMachineClass VirtMachineClass;
495e37
+typedef struct VirtMachineState VirtMachineState;
495e37
+DECLARE_OBJ_CHECKERS(VirtMachineState, VirtMachineClass, VIRT_MACHINE, TYPE_RHEL_MACHINE)
495e37
+#endif
495e37
+
495e37
 void virt_acpi_setup(VirtMachineState *vms);
495e37
 bool virt_is_acpi_enabled(VirtMachineState *vms);
495e37
 
ed5979
diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
ed5979
index 64c44cef2d..82e97249bc 100644
ed5979
--- a/target/arm/cpu-qom.h
ed5979
+++ b/target/arm/cpu-qom.h
ed5979
@@ -35,6 +35,7 @@ typedef struct ARMCPUInfo {
ed5979
     const char *name;
ed5979
     void (*initfn)(Object *obj);
ed5979
     void (*class_init)(ObjectClass *oc, void *data);
ed5979
+    const char *deprecation_note;
ed5979
 } ARMCPUInfo;
ed5979
 
ed5979
 void arm_cpu_register(const ARMCPUInfo *info);
ed5979
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
ed5979
index 38d066c294..a845814bfb 100644
ed5979
--- a/target/arm/cpu.c
ed5979
+++ b/target/arm/cpu.c
ed5979
@@ -2250,8 +2250,13 @@ static void arm_cpu_instance_init(Object *obj)
ed5979
 static void cpu_register_class_init(ObjectClass *oc, void *data)
ed5979
 {
ed5979
     ARMCPUClass *acc = ARM_CPU_CLASS(oc);
ed5979
+    CPUClass *cc = CPU_CLASS(oc);
ed5979
 
ed5979
     acc->info = data;
ed5979
+
ed5979
+    if (acc->info->deprecation_note) {
ed5979
+        cc->deprecation_note = acc->info->deprecation_note;
ed5979
+    }
ed5979
 }
ed5979
 
ed5979
 void arm_cpu_register(const ARMCPUInfo *info)
ed5979
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
ed5979
index 9aeed3c848..f9f504d89e 100644
ed5979
--- a/target/arm/cpu.h
ed5979
+++ b/target/arm/cpu.h
ed5979
@@ -34,6 +34,8 @@
ed5979
 #define KVM_HAVE_MCE_INJECTION 1
ed5979
 #endif
ed5979
 
ed5979
+#define RHEL_CPU_DEPRECATION "use 'host' / 'max'"
ed5979
+
ed5979
 #define EXCP_UDEF            1   /* undefined instruction */
ed5979
 #define EXCP_SWI             2   /* software interrupt */
ed5979
 #define EXCP_PREFETCH_ABORT  3
ed5979
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
ed5979
index 3d74f134f5..4b330a52b5 100644
ed5979
--- a/target/arm/cpu64.c
ed5979
+++ b/target/arm/cpu64.c
ed5979
@@ -36,6 +36,7 @@
ed5979
 #include "hw/qdev-properties.h"
ed5979
 #include "internals.h"
ed5979
 
ed5979
+#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
 static void aarch64_a35_initfn(Object *obj)
ed5979
 {
ed5979
     ARMCPU *cpu = ARM_CPU(obj);
ed5979
@@ -115,6 +116,7 @@ static void aarch64_a35_initfn(Object *obj)
ed5979
     /* These values are the same with A53/A57/A72. */
ed5979
     define_cortex_a72_a57_a53_cp_reginfo(cpu);
ed5979
 }
ed5979
+#endif /* disabled for RHEL */
ed5979
 
ed5979
 void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
ed5979
 {
ed5979
@@ -735,6 +737,7 @@ static void aarch64_a57_initfn(Object *obj)
ed5979
     define_cortex_a72_a57_a53_cp_reginfo(cpu);
ed5979
 }
ed5979
 
ed5979
+#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
 static void aarch64_a53_initfn(Object *obj)
ed5979
 {
ed5979
     ARMCPU *cpu = ARM_CPU(obj);
ed5979
@@ -1033,6 +1036,7 @@ static void aarch64_neoverse_n1_initfn(Object *obj)
ed5979
     /* From D5.1 AArch64 PMU register summary */
ed5979
     cpu->isar.reset_pmcr_el0 = 0x410c3000;
ed5979
 }
ed5979
+#endif /* disabled for RHEL */
ed5979
 
ed5979
 static void aarch64_host_initfn(Object *obj)
ed5979
 {
ed5979
@@ -1240,13 +1244,18 @@ static void aarch64_max_initfn(Object *obj)
ed5979
 }
ed5979
 
ed5979
 static const ARMCPUInfo aarch64_cpus[] = {
ed5979
+#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
     { .name = "cortex-a35",         .initfn = aarch64_a35_initfn },
ed5979
-    { .name = "cortex-a57",         .initfn = aarch64_a57_initfn },
ed5979
+#endif /* disabled for RHEL */
ed5979
+    { .name = "cortex-a57",         .initfn = aarch64_a57_initfn,
ed5979
+      .deprecation_note = RHEL_CPU_DEPRECATION },
ed5979
+#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
     { .name = "cortex-a53",         .initfn = aarch64_a53_initfn },
ed5979
     { .name = "cortex-a72",         .initfn = aarch64_a72_initfn },
ed5979
     { .name = "cortex-a76",         .initfn = aarch64_a76_initfn },
ed5979
     { .name = "a64fx",              .initfn = aarch64_a64fx_initfn },
ed5979
     { .name = "neoverse-n1",        .initfn = aarch64_neoverse_n1_initfn },
ed5979
+#endif /* disabled for RHEL */
ed5979
     { .name = "max",                .initfn = aarch64_max_initfn },
ed5979
 #if defined(CONFIG_KVM) || defined(CONFIG_HVF)
ed5979
     { .name = "host",               .initfn = aarch64_host_initfn },
ed5979
@@ -1318,8 +1327,13 @@ static void aarch64_cpu_instance_init(Object *obj)
ed5979
 static void cpu_register_class_init(ObjectClass *oc, void *data)
ed5979
 {
ed5979
     ARMCPUClass *acc = ARM_CPU_CLASS(oc);
ed5979
+    CPUClass *cc = CPU_CLASS(oc);
ed5979
 
ed5979
     acc->info = data;
ed5979
+
ed5979
+    if (acc->info->deprecation_note) {
ed5979
+        cc->deprecation_note = acc->info->deprecation_note;
ed5979
+    }
ed5979
 }
ed5979
 
ed5979
 void aarch64_cpu_register(const ARMCPUInfo *info)
ed5979
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
ed5979
index a528ff9a3d..053f70e399 100644
ed5979
--- a/target/arm/cpu_tcg.c
ed5979
+++ b/target/arm/cpu_tcg.c
ed5979
@@ -148,10 +148,10 @@ void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu)
ed5979
 }
ed5979
 #endif /* !CONFIG_USER_ONLY */
ed5979
 
ed5979
+#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
 /* CPU models. These are not needed for the AArch64 linux-user build. */
ed5979
 #if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
ed5979
 
ed5979
-#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
 #if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
ed5979
 static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
ed5979
 {
ed5979
@@ -505,7 +505,6 @@ static void cortex_a9_initfn(Object *obj)
ed5979
     cpu->isar.reset_pmcr_el0 = 0x41093000;
ed5979
     define_arm_cp_regs(cpu, cortexa9_cp_reginfo);
ed5979
 }
ed5979
-#endif /* disabled for RHEL */
ed5979
 
ed5979
 #ifndef CONFIG_USER_ONLY
ed5979
 static uint64_t a15_l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri)
ed5979
@@ -530,7 +529,6 @@ static const ARMCPRegInfo cortexa15_cp_reginfo[] = {
ed5979
       .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
ed5979
 };
ed5979
 
ed5979
-#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
 static void cortex_a7_initfn(Object *obj)
ed5979
 {
ed5979
     ARMCPU *cpu = ARM_CPU(obj);
ed5979
@@ -579,7 +577,6 @@ static void cortex_a7_initfn(Object *obj)
ed5979
     cpu->isar.reset_pmcr_el0 = 0x41072000;
ed5979
     define_arm_cp_regs(cpu, cortexa15_cp_reginfo); /* Same as A15 */
ed5979
 }
ed5979
-#endif /* disabled for RHEL */
ed5979
 
ed5979
 static void cortex_a15_initfn(Object *obj)
ed5979
 {
ed5979
@@ -628,7 +625,6 @@ static void cortex_a15_initfn(Object *obj)
ed5979
     define_arm_cp_regs(cpu, cortexa15_cp_reginfo);
ed5979
 }
ed5979
 
ed5979
-#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
 static void cortex_m0_initfn(Object *obj)
ed5979
 {
ed5979
     ARMCPU *cpu = ARM_CPU(obj);
ed5979
@@ -1070,7 +1066,6 @@ static void arm_v7m_class_init(ObjectClass *oc, void *data)
ed5979
 
ed5979
     cc->gdb_core_xml_file = "arm-m-profile.xml";
ed5979
 }
ed5979
-#endif /* disabled for RHEL */
ed5979
 
ed5979
 #ifndef TARGET_AARCH64
ed5979
 /*
ed5979
@@ -1138,7 +1133,6 @@ static void arm_max_initfn(Object *obj)
ed5979
 #endif /* !TARGET_AARCH64 */
ed5979
 
ed5979
 static const ARMCPUInfo arm_tcg_cpus[] = {
ed5979
-#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
     { .name = "arm926",      .initfn = arm926_initfn },
ed5979
     { .name = "arm946",      .initfn = arm946_initfn },
ed5979
     { .name = "arm1026",     .initfn = arm1026_initfn },
ed5979
@@ -1154,9 +1148,7 @@ static const ARMCPUInfo arm_tcg_cpus[] = {
ed5979
     { .name = "cortex-a7",   .initfn = cortex_a7_initfn },
ed5979
     { .name = "cortex-a8",   .initfn = cortex_a8_initfn },
ed5979
     { .name = "cortex-a9",   .initfn = cortex_a9_initfn },
ed5979
-#endif /* disabled for RHEL */
ed5979
     { .name = "cortex-a15",  .initfn = cortex_a15_initfn },
ed5979
-#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
     { .name = "cortex-m0",   .initfn = cortex_m0_initfn,
ed5979
                              .class_init = arm_v7m_class_init },
ed5979
     { .name = "cortex-m3",   .initfn = cortex_m3_initfn,
ed5979
@@ -1187,7 +1179,6 @@ static const ARMCPUInfo arm_tcg_cpus[] = {
ed5979
     { .name = "pxa270-b1",   .initfn = pxa270b1_initfn },
ed5979
     { .name = "pxa270-c0",   .initfn = pxa270c0_initfn },
ed5979
     { .name = "pxa270-c5",   .initfn = pxa270c5_initfn },
ed5979
-#endif /* disabled for RHEL */
ed5979
 #ifndef TARGET_AARCH64
ed5979
     { .name = "max",         .initfn = arm_max_initfn },
ed5979
 #endif
ed5979
@@ -1215,3 +1206,4 @@ static void arm_tcg_cpu_register_types(void)
ed5979
 type_init(arm_tcg_cpu_register_types)
ed5979
 
ed5979
 #endif /* !CONFIG_USER_ONLY || !TARGET_AARCH64 */
ed5979
+#endif /* disabled for RHEL */
ed5979
diff --git a/target/arm/helper.c b/target/arm/helper.c
ed5979
index d8c8223ec3..ad9d235773 100644
ed5979
--- a/target/arm/helper.c
ed5979
+++ b/target/arm/helper.c
ed5979
@@ -8476,6 +8476,7 @@ void arm_cpu_list(void)
ed5979
 static void arm_cpu_add_definition(gpointer data, gpointer user_data)
ed5979
 {
ed5979
     ObjectClass *oc = data;
ed5979
+    CPUClass *cc = CPU_CLASS(oc);
ed5979
     CpuDefinitionInfoList **cpu_list = user_data;
ed5979
     CpuDefinitionInfo *info;
ed5979
     const char *typename;
ed5979
@@ -8485,6 +8486,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data)
ed5979
     info->name = g_strndup(typename,
ed5979
                            strlen(typename) - strlen("-" TYPE_ARM_CPU));
ed5979
     info->q_typename = g_strdup(typename);
ed5979
+    info->deprecated = !!cc->deprecation_note;
ed5979
 
ed5979
     QAPI_LIST_PREPEND(*cpu_list, info);
ed5979
 }
ed5979
diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c
ed5979
index 5a14527386..a3579fc303 100644
ed5979
--- a/tests/qtest/arm-cpu-features.c
ed5979
+++ b/tests/qtest/arm-cpu-features.c
ed5979
@@ -440,8 +440,10 @@ static void test_query_cpu_model_expansion(const void *data)
ed5979
     assert_error(qts, "host", "The CPU type 'host' requires KVM", NULL);
ed5979
 
ed5979
     /* Test expected feature presence/absence for some cpu types */
ed5979
+#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
     assert_has_feature_enabled(qts, "cortex-a15", "pmu");
ed5979
     assert_has_not_feature(qts, "cortex-a15", "aarch64");
ed5979
+#endif /* disabled for RHEL */
ed5979
 
ed5979
     /* Enabling and disabling pmu should always work. */
ed5979
     assert_has_feature_enabled(qts, "max", "pmu");
ed5979
@@ -458,6 +460,7 @@ static void test_query_cpu_model_expansion(const void *data)
ed5979
         assert_has_feature_enabled(qts, "cortex-a57", "pmu");
ed5979
         assert_has_feature_enabled(qts, "cortex-a57", "aarch64");
ed5979
 
ed5979
+#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
         assert_has_feature_enabled(qts, "a64fx", "pmu");
ed5979
         assert_has_feature_enabled(qts, "a64fx", "aarch64");
ed5979
         /*
ed5979
@@ -470,6 +473,7 @@ static void test_query_cpu_model_expansion(const void *data)
ed5979
                      "{ 'sve384': true }");
ed5979
         assert_error(qts, "a64fx", "cannot enable sve640",
ed5979
                      "{ 'sve640': true }");
ed5979
+#endif /* disabled for RHEL */
ed5979
 
ed5979
         sve_tests_default(qts, "max");
ed5979
         pauth_tests_default(qts, "max");
ed5979
@@ -505,9 +509,11 @@ static void test_query_cpu_model_expansion_kvm(const void *data)
ed5979
         QDict *resp;
ed5979
         char *error;
ed5979
 
ed5979
+#if 0 /* Disabled for Red Hat Enterprise Linux */
ed5979
         assert_error(qts, "cortex-a15",
ed5979
             "We cannot guarantee the CPU type 'cortex-a15' works "
ed5979
             "with KVM on this host", NULL);
ed5979
+#endif /* disabled for RHEL */
ed5979
 
ed5979
         assert_has_feature_enabled(qts, "host", "aarch64");
ed5979
 
495e37
-- 
586cba
2.31.1
495e37