Blob Blame History Raw
From bfa3dc6e290c7b4f7f8825e4d4320ba062ed445a Mon Sep 17 00:00:00 2001
From: Andrew Jones <drjones@redhat.com>
Date: Sat, 9 Jan 2021 22:19:27 -0500
Subject: AArch64 machine types cleanup

RH-Author: Andrew Jones <drjones@redhat.com>
Message-id: <20210109221928.31407-2-drjones@redhat.com>
Patchwork-id: 100547
O-Subject: [RHEL-AV-8.4.0 qemu-kvm PATCH v2 1/2] AArch64 machine types cleanup
Bugzilla: 1895276
RH-Acked-by: Gavin Shan <gshan@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
RH-Acked-by: Thomas Huth <thuth@redhat.com>

No functional change here, just a reduction of downstream-only
changes and whitespace differences. Also the removal of a nested
'#if 0 /* disabled for RHEL */' block.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
 hw/arm/virt.c | 69 +++++++++++++++++++++++----------------------------
 1 file changed, 31 insertions(+), 38 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 21e0485ac5..530072fce0 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -123,7 +123,6 @@
     static const TypeInfo rhel##m##n##s##_machvirt_info = {             \
         .name = MACHINE_TYPE_NAME("virt-rhel" # m "." # n "." # s),     \
         .parent = TYPE_RHEL_MACHINE,                                    \
-        .instance_init = rhel##m##n##s##_virt_instance_init,            \
         .class_init = rhel##m##n##s##_virt_class_init,                  \
     };                                                                  \
     static void rhel##m##n##s##_machvirt_init(void)                     \
@@ -2098,8 +2097,8 @@ static void virt_set_virt(Object *obj, bool value, Error **errp)
 
     vms->virt = value;
 }
-
 #endif /* disabled for RHEL */
+
 static bool virt_get_highmem(Object *obj, Error **errp)
 {
     VirtMachineState *vms = VIRT_MACHINE(obj);
@@ -2167,14 +2166,13 @@ static void virt_set_ras(Object *obj, bool value, Error **errp)
 
     vms->ras = value;
 }
-#if 0 /* Disabled for Red Hat Enterprise Linux */
+
 static bool virt_get_mte(Object *obj, Error **errp)
 {
     VirtMachineState *vms = VIRT_MACHINE(obj);
 
     return vms->mte;
 }
-#endif /* disabled for RHEL */
 
 static void virt_set_mte(Object *obj, bool value, Error **errp)
 {
@@ -2182,7 +2180,8 @@ static void virt_set_mte(Object *obj, bool value, Error **errp)
 
     vms->mte = value;
 }
-#endif
+#endif /* disabled for RHEL */
+
 static char *virt_get_gic_version(Object *obj, Error **errp)
 {
     VirtMachineState *vms = VIRT_MACHINE(obj);
@@ -2818,25 +2817,6 @@ static void rhel_machine_class_init(ObjectClass *oc, void *data)
         "Enable ACPI");
 }
 
-static const TypeInfo rhel_machine_info = {
-    .name          = TYPE_RHEL_MACHINE,
-    .parent        = TYPE_MACHINE,
-    .abstract      = true,
-    .instance_size = sizeof(VirtMachineState),
-    .class_size    = sizeof(VirtMachineClass),
-    .class_init    = rhel_machine_class_init,
-    .interfaces = (InterfaceInfo[]) {
-         { TYPE_HOTPLUG_HANDLER },
-         { }
-    },
-};
-
-static void rhel_machine_init(void)
-{
-    type_register_static(&rhel_machine_info);
-}
-type_init(rhel_machine_init);
-
 static void rhel_virt_instance_init(Object *obj)
 {
     VirtMachineState *vms = VIRT_MACHINE(obj);
@@ -2844,22 +2824,23 @@ static void rhel_virt_instance_init(Object *obj)
 
     /* EL3 is disabled by default and non-configurable for RHEL */
     vms->secure = false;
+
     /* EL2 is disabled by default and non-configurable for RHEL */
     vms->virt = false;
-    /* High memory is enabled by default for RHEL */
+
+    /* High memory is enabled by default */
     vms->highmem = true;
     object_property_add_bool(obj, "highmem", virt_get_highmem,
                              virt_set_highmem);
     object_property_set_description(obj, "highmem",
                                     "Set on/off to enable/disable using "
                                     "physical address space above 32 bits");
-
     vms->gic_version = VIRT_GIC_VERSION_NOSEL;
     object_property_add_str(obj, "gic-version", virt_get_gic_version,
                         virt_set_gic_version);
     object_property_set_description(obj, "gic-version",
                                     "Set GIC version. "
-                                    "Valid values are 2, 3 and host");
+                                    "Valid values are 2, 3, host and max");
 
     vms->highmem_ecam = !vmc->no_highmem_ecam;
 
@@ -2882,18 +2863,36 @@ static void rhel_virt_instance_init(Object *obj)
                                     "Set the IOMMU type. "
                                     "Valid values are none and smmuv3");
 
+    /* Default disallows RAS instantiation and is non-configurable for RHEL */
     vms->ras = false;
-    /* MTE is disabled by default.  */
+
+    /* MTE is disabled by default and non-configurable for RHEL */
     vms->mte = false;
 
-    vms->irqmap=a15irqmap;
+    vms->irqmap = a15irqmap;
+
     virt_flash_create(vms);
 }
 
-static void rhel830_virt_instance_init(Object *obj)
+static const TypeInfo rhel_machine_info = {
+    .name          = TYPE_RHEL_MACHINE,
+    .parent        = TYPE_MACHINE,
+    .abstract      = true,
+    .instance_size = sizeof(VirtMachineState),
+    .class_size    = sizeof(VirtMachineClass),
+    .class_init    = rhel_machine_class_init,
+    .instance_init = rhel_virt_instance_init,
+    .interfaces = (InterfaceInfo[]) {
+         { TYPE_HOTPLUG_HANDLER },
+         { }
+    },
+};
+
+static void rhel_machine_init(void)
 {
-    rhel_virt_instance_init(obj);
+    type_register_static(&rhel_machine_info);
 }
+type_init(rhel_machine_init);
 
 static void rhel830_virt_options(MachineClass *mc)
 {
@@ -2901,16 +2900,10 @@ static void rhel830_virt_options(MachineClass *mc)
 }
 DEFINE_RHEL_MACHINE_AS_LATEST(8, 3, 0)
 
-static void rhel820_virt_instance_init(Object *obj)
-{
-    rhel_virt_instance_init(obj);
-}
-
 static void rhel820_virt_options(MachineClass *mc)
 {
     rhel830_virt_options(mc);
-    compat_props_add(mc->compat_props, hw_compat_rhel_8_2,
-                     hw_compat_rhel_8_2_len);
+    compat_props_add(mc->compat_props, hw_compat_rhel_8_2, hw_compat_rhel_8_2_len);
     mc->numa_mem_supported = true;
     mc->auto_enable_numa_with_memdev = false;
 }
-- 
2.18.4