2021-04-30 07:28:51 +00:00
|
|
|
From ee8aeb6b79bde21b581090c479faf10e716a7e6d Mon Sep 17 00:00:00 2001
|
2018-11-08 17:02:33 +00:00
|
|
|
From: Miroslav Rezanina <mrezanin@redhat.com>
|
2018-11-29 12:09:34 +00:00
|
|
|
Date: Fri, 19 Oct 2018 12:53:31 +0200
|
2018-11-08 17:02:33 +00:00
|
|
|
Subject: Add aarch64 machine types
|
|
|
|
|
|
|
|
Adding changes to add RHEL machine types for aarch64 architecture.
|
|
|
|
|
|
|
|
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
|
---
|
2021-04-30 07:28:51 +00:00
|
|
|
hw/arm/virt.c | 211 +++++++++++++++++++++++++++++++++++++++++-
|
2021-01-05 05:59:21 +00:00
|
|
|
include/hw/arm/virt.h | 8 ++
|
2021-04-30 07:28:51 +00:00
|
|
|
2 files changed, 218 insertions(+), 1 deletion(-)
|
2018-11-08 17:02:33 +00:00
|
|
|
|
|
|
|
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
2021-04-30 07:28:51 +00:00
|
|
|
index f904d3e98e..080cf54ef1 100644
|
2018-11-08 17:02:33 +00:00
|
|
|
--- a/hw/arm/virt.c
|
|
|
|
+++ b/hw/arm/virt.c
|
2021-04-30 07:28:51 +00:00
|
|
|
@@ -80,6 +80,7 @@
|
2020-05-13 01:03:43 +00:00
|
|
|
#include "hw/char/pl011.h"
|
2020-07-08 13:37:45 +00:00
|
|
|
#include "qemu/guest-random.h"
|
2018-11-08 17:02:33 +00:00
|
|
|
|
2019-05-07 21:00:36 +00:00
|
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
2018-11-08 17:02:33 +00:00
|
|
|
#define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
|
|
|
|
static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
|
|
|
|
void *data) \
|
2021-04-30 07:28:51 +00:00
|
|
|
@@ -106,7 +107,48 @@
|
2018-11-08 17:02:33 +00:00
|
|
|
DEFINE_VIRT_MACHINE_LATEST(major, minor, true)
|
|
|
|
#define DEFINE_VIRT_MACHINE(major, minor) \
|
|
|
|
DEFINE_VIRT_MACHINE_LATEST(major, minor, false)
|
|
|
|
-
|
|
|
|
+#endif /* disabled for RHEL */
|
|
|
|
+
|
|
|
|
+#define DEFINE_RHEL_MACHINE_LATEST(m, n, s, latest) \
|
|
|
|
+ static void rhel##m##n##s##_virt_class_init(ObjectClass *oc, \
|
|
|
|
+ void *data) \
|
|
|
|
+ { \
|
|
|
|
+ MachineClass *mc = MACHINE_CLASS(oc); \
|
|
|
|
+ rhel##m##n##s##_virt_options(mc); \
|
|
|
|
+ mc->desc = "RHEL " # m "." # n "." # s " ARM Virtual Machine"; \
|
|
|
|
+ if (latest) { \
|
|
|
|
+ mc->alias = "virt"; \
|
|
|
|
+ mc->is_default = 1; \
|
|
|
|
+ } \
|
|
|
|
+ } \
|
|
|
|
+ static const TypeInfo rhel##m##n##s##_machvirt_info = { \
|
|
|
|
+ .name = MACHINE_TYPE_NAME("virt-rhel" # m "." # n "." # s), \
|
|
|
|
+ .parent = TYPE_RHEL_MACHINE, \
|
|
|
|
+ .class_init = rhel##m##n##s##_virt_class_init, \
|
|
|
|
+ }; \
|
|
|
|
+ static void rhel##m##n##s##_machvirt_init(void) \
|
|
|
|
+ { \
|
|
|
|
+ type_register_static(&rhel##m##n##s##_machvirt_info); \
|
|
|
|
+ } \
|
|
|
|
+ type_init(rhel##m##n##s##_machvirt_init);
|
|
|
|
+
|
|
|
|
+#define DEFINE_RHEL_MACHINE_AS_LATEST(major, minor, subminor) \
|
|
|
|
+ DEFINE_RHEL_MACHINE_LATEST(major, minor, subminor, true)
|
|
|
|
+#define DEFINE_RHEL_MACHINE(major, minor, subminor) \
|
|
|
|
+ DEFINE_RHEL_MACHINE_LATEST(major, minor, subminor, false)
|
2019-05-07 21:00:36 +00:00
|
|
|
+
|
|
|
|
+/* This variable is for changes to properties that are RHEL specific,
|
|
|
|
+ * different to the current upstream and to be applied to the latest
|
|
|
|
+ * machine type.
|
|
|
|
+ */
|
|
|
|
+GlobalProperty arm_rhel_compat[] = {
|
|
|
|
+ {
|
|
|
|
+ .driver = "virtio-net-pci",
|
|
|
|
+ .property = "romfile",
|
|
|
|
+ .value = "",
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+const size_t arm_rhel_compat_len = G_N_ELEMENTS(arm_rhel_compat);
|
2018-11-08 17:02:33 +00:00
|
|
|
|
|
|
|
/* Number of external interrupt lines to configure the GIC with */
|
|
|
|
#define NUM_IRQS 256
|
2021-04-30 07:28:51 +00:00
|
|
|
@@ -2113,6 +2155,7 @@ static void machvirt_init(MachineState *machine)
|
2018-11-08 17:02:33 +00:00
|
|
|
qemu_add_machine_init_done_notifier(&vms->machine_done);
|
|
|
|
}
|
|
|
|
|
2019-05-07 21:00:36 +00:00
|
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
2018-11-08 17:02:33 +00:00
|
|
|
static bool virt_get_secure(Object *obj, Error **errp)
|
|
|
|
{
|
|
|
|
VirtMachineState *vms = VIRT_MACHINE(obj);
|
2021-04-30 07:28:51 +00:00
|
|
|
@@ -2140,6 +2183,7 @@ static void virt_set_virt(Object *obj, bool value, Error **errp)
|
|
|
|
|
2018-11-08 17:02:33 +00:00
|
|
|
vms->virt = value;
|
|
|
|
}
|
|
|
|
+#endif /* disabled for RHEL */
|
2021-04-30 07:28:51 +00:00
|
|
|
|
2018-11-08 17:02:33 +00:00
|
|
|
static bool virt_get_highmem(Object *obj, Error **errp)
|
|
|
|
{
|
2021-04-30 07:28:51 +00:00
|
|
|
@@ -2237,6 +2281,7 @@ static void virt_set_acpi(Object *obj, Visitor *v, const char *name,
|
2020-11-13 13:09:35 +00:00
|
|
|
visit_type_OnOffAuto(v, name, &vms->acpi, errp);
|
|
|
|
}
|
|
|
|
|
|
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
|
|
|
static bool virt_get_ras(Object *obj, Error **errp)
|
|
|
|
{
|
|
|
|
VirtMachineState *vms = VIRT_MACHINE(obj);
|
2021-04-30 07:28:51 +00:00
|
|
|
@@ -2264,6 +2309,7 @@ static void virt_set_mte(Object *obj, bool value, Error **errp)
|
2020-08-12 15:53:34 +00:00
|
|
|
|
2021-04-30 07:28:51 +00:00
|
|
|
vms->mte = value;
|
2020-11-13 13:09:35 +00:00
|
|
|
}
|
|
|
|
+#endif /* disabled for RHEL */
|
|
|
|
|
2020-08-12 15:53:34 +00:00
|
|
|
static char *virt_get_gic_version(Object *obj, Error **errp)
|
|
|
|
{
|
2021-04-30 07:28:51 +00:00
|
|
|
@@ -2584,6 +2630,7 @@ static int virt_kvm_type(MachineState *ms, const char *type_str)
|
|
|
|
return fixed_ipa ? 0 : requested_pa_size;
|
2018-11-08 17:02:33 +00:00
|
|
|
}
|
|
|
|
|
2019-05-07 21:00:36 +00:00
|
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
2019-12-09 20:39:05 +00:00
|
|
|
static void virt_machine_class_init(ObjectClass *oc, void *data)
|
2018-11-08 17:02:33 +00:00
|
|
|
{
|
2019-12-09 20:39:05 +00:00
|
|
|
MachineClass *mc = MACHINE_CLASS(oc);
|
2021-04-30 07:28:51 +00:00
|
|
|
@@ -2910,3 +2957,165 @@ static void virt_machine_2_6_options(MachineClass *mc)
|
2018-11-08 17:02:33 +00:00
|
|
|
vmc->no_pmu = true;
|
|
|
|
}
|
|
|
|
DEFINE_VIRT_MACHINE(2, 6)
|
|
|
|
+#endif /* disabled for RHEL */
|
|
|
|
+
|
|
|
|
+static void rhel_machine_class_init(ObjectClass *oc, void *data)
|
|
|
|
+{
|
|
|
|
+ MachineClass *mc = MACHINE_CLASS(oc);
|
2019-12-09 20:39:05 +00:00
|
|
|
+ HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
|
|
|
+ mc->family = "virt-rhel-Z";
|
|
|
|
+ mc->init = machvirt_init;
|
2020-11-13 13:09:35 +00:00
|
|
|
+ /* Maximum supported VCPU count for all virt-rhel* machines */
|
|
|
|
+ mc->max_cpus = 384;
|
|
|
|
+ machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
|
2018-11-08 17:02:33 +00:00
|
|
|
+ mc->block_default_type = IF_VIRTIO;
|
|
|
|
+ mc->no_cdrom = 1;
|
|
|
|
+ mc->pci_allow_0_address = true;
|
|
|
|
+ /* We know we will never create a pre-ARMv7 CPU which needs 1K pages */
|
|
|
|
+ mc->minimum_page_bits = 12;
|
|
|
|
+ mc->possible_cpu_arch_ids = virt_possible_cpu_arch_ids;
|
|
|
|
+ mc->cpu_index_to_instance_props = virt_cpu_index_to_props;
|
|
|
|
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a57");
|
|
|
|
+ mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
|
2019-12-09 20:39:05 +00:00
|
|
|
+ mc->kvm_type = virt_kvm_type;
|
|
|
|
+ assert(!mc->get_hotplug_handler);
|
|
|
|
+ mc->get_hotplug_handler = virt_machine_get_hotplug_handler;
|
|
|
|
+ hc->pre_plug = virt_machine_device_pre_plug_cb;
|
|
|
|
+ hc->plug = virt_machine_device_plug_cb;
|
|
|
|
+ hc->unplug_request = virt_machine_device_unplug_request_cb;
|
2020-07-08 13:37:45 +00:00
|
|
|
+ hc->unplug = virt_machine_device_unplug_cb;
|
|
|
|
+ mc->nvdimm_supported = true;
|
2019-12-09 20:39:05 +00:00
|
|
|
+ mc->auto_enable_numa_with_memhp = true;
|
2020-11-13 13:09:35 +00:00
|
|
|
+ mc->auto_enable_numa_with_memdev = true;
|
2020-05-13 01:03:43 +00:00
|
|
|
+ mc->default_ram_id = "mach-virt.ram";
|
|
|
|
+
|
|
|
|
+ object_class_property_add(oc, "acpi", "OnOffAuto",
|
|
|
|
+ virt_get_acpi, virt_set_acpi,
|
2020-07-08 13:37:45 +00:00
|
|
|
+ NULL, NULL);
|
2020-05-13 01:03:43 +00:00
|
|
|
+ object_class_property_set_description(oc, "acpi",
|
2020-07-08 13:37:45 +00:00
|
|
|
+ "Enable ACPI");
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
2021-04-30 07:28:51 +00:00
|
|
|
+ object_class_property_add_str(oc, "x-oem-id",
|
|
|
|
+ virt_get_oem_id,
|
|
|
|
+ virt_set_oem_id);
|
|
|
|
+ object_class_property_set_description(oc, "x-oem-id",
|
|
|
|
+ "Override the default value of field OEMID "
|
|
|
|
+ "in ACPI table header."
|
|
|
|
+ "The string may be up to 6 bytes in size");
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
2021-04-30 07:28:51 +00:00
|
|
|
+
|
|
|
|
+ object_class_property_add_str(oc, "x-oem-table-id",
|
|
|
|
+ virt_get_oem_table_id,
|
|
|
|
+ virt_set_oem_table_id);
|
|
|
|
+ object_class_property_set_description(oc, "x-oem-table-id",
|
|
|
|
+ "Override the default value of field OEM Table ID "
|
|
|
|
+ "in ACPI table header."
|
|
|
|
+ "The string may be up to 8 bytes in size");
|
2018-11-08 17:02:33 +00:00
|
|
|
+}
|
|
|
|
+
|
2020-11-13 13:09:35 +00:00
|
|
|
+static void rhel_virt_instance_init(Object *obj)
|
2018-11-08 17:02:33 +00:00
|
|
|
+{
|
|
|
|
+ VirtMachineState *vms = VIRT_MACHINE(obj);
|
|
|
|
+ VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
|
|
|
|
+
|
|
|
|
+ /* EL3 is disabled by default and non-configurable for RHEL */
|
|
|
|
+ vms->secure = false;
|
2021-04-30 07:28:51 +00:00
|
|
|
+
|
2018-11-08 17:02:33 +00:00
|
|
|
+ /* EL2 is disabled by default and non-configurable for RHEL */
|
|
|
|
+ vms->virt = false;
|
2021-04-30 07:28:51 +00:00
|
|
|
+
|
|
|
|
+ /* High memory is enabled by default */
|
2018-11-08 17:02:33 +00:00
|
|
|
+ vms->highmem = true;
|
|
|
|
+ object_property_add_bool(obj, "highmem", virt_get_highmem,
|
2020-07-08 13:37:45 +00:00
|
|
|
+ virt_set_highmem);
|
2018-11-08 17:02:33 +00:00
|
|
|
+ object_property_set_description(obj, "highmem",
|
|
|
|
+ "Set on/off to enable/disable using "
|
2020-07-08 13:37:45 +00:00
|
|
|
+ "physical address space above 32 bits");
|
2020-11-13 13:09:35 +00:00
|
|
|
+ vms->gic_version = VIRT_GIC_VERSION_NOSEL;
|
2018-11-08 17:02:33 +00:00
|
|
|
+ object_property_add_str(obj, "gic-version", virt_get_gic_version,
|
2020-07-08 13:37:45 +00:00
|
|
|
+ virt_set_gic_version);
|
2018-11-08 17:02:33 +00:00
|
|
|
+ object_property_set_description(obj, "gic-version",
|
|
|
|
+ "Set GIC version. "
|
2021-04-30 07:28:51 +00:00
|
|
|
+ "Valid values are 2, 3, host and max");
|
2018-11-08 17:02:33 +00:00
|
|
|
+
|
2019-05-07 21:00:36 +00:00
|
|
|
+ vms->highmem_ecam = !vmc->no_highmem_ecam;
|
|
|
|
+
|
2018-11-08 17:02:33 +00:00
|
|
|
+ if (vmc->no_its) {
|
|
|
|
+ vms->its = false;
|
|
|
|
+ } else {
|
|
|
|
+ /* Default allows ITS instantiation */
|
|
|
|
+ vms->its = true;
|
|
|
|
+ object_property_add_bool(obj, "its", virt_get_its,
|
2020-07-08 13:37:45 +00:00
|
|
|
+ virt_set_its);
|
2018-11-08 17:02:33 +00:00
|
|
|
+ object_property_set_description(obj, "its",
|
|
|
|
+ "Set on/off to enable/disable "
|
2020-07-08 13:37:45 +00:00
|
|
|
+ "ITS instantiation");
|
2018-11-08 17:02:33 +00:00
|
|
|
+ }
|
|
|
|
+
|
2019-08-15 04:45:41 +00:00
|
|
|
+ /* Default disallows iommu instantiation */
|
2019-05-07 21:00:36 +00:00
|
|
|
+ vms->iommu = VIRT_IOMMU_NONE;
|
2020-07-08 13:37:45 +00:00
|
|
|
+ object_property_add_str(obj, "iommu", virt_get_iommu, virt_set_iommu);
|
2019-08-15 04:45:41 +00:00
|
|
|
+ object_property_set_description(obj, "iommu",
|
|
|
|
+ "Set the IOMMU type. "
|
2020-07-08 13:37:45 +00:00
|
|
|
+ "Valid values are none and smmuv3");
|
2020-08-12 15:53:34 +00:00
|
|
|
+
|
2021-04-30 07:28:51 +00:00
|
|
|
+ /* Default disallows RAS instantiation and is non-configurable for RHEL */
|
2020-11-13 13:09:35 +00:00
|
|
|
+ vms->ras = false;
|
2021-04-30 07:28:51 +00:00
|
|
|
+
|
|
|
|
+ /* MTE is disabled by default and non-configurable for RHEL */
|
2020-08-12 15:53:34 +00:00
|
|
|
+ vms->mte = false;
|
|
|
|
+
|
2021-04-30 07:28:51 +00:00
|
|
|
+ vms->irqmap = a15irqmap;
|
|
|
|
+
|
2019-08-15 04:45:41 +00:00
|
|
|
+ virt_flash_create(vms);
|
2021-04-30 07:28:51 +00:00
|
|
|
+ vms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
|
|
|
|
+ vms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
|
|
|
|
+
|
2018-11-08 17:02:33 +00:00
|
|
|
+}
|
|
|
|
+
|
2021-04-30 07:28:51 +00:00
|
|
|
+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)
|
2020-11-13 13:09:35 +00:00
|
|
|
+{
|
2021-04-30 07:28:51 +00:00
|
|
|
+ type_register_static(&rhel_machine_info);
|
2020-11-13 13:09:35 +00:00
|
|
|
+}
|
2021-04-30 07:28:51 +00:00
|
|
|
+type_init(rhel_machine_init);
|
2020-11-13 13:09:35 +00:00
|
|
|
+
|
2021-04-30 07:28:51 +00:00
|
|
|
+static void rhel840_virt_options(MachineClass *mc)
|
2018-11-08 17:02:33 +00:00
|
|
|
+{
|
2019-05-07 21:00:36 +00:00
|
|
|
+ compat_props_add(mc->compat_props, arm_rhel_compat, arm_rhel_compat_len);
|
2021-04-30 07:28:51 +00:00
|
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_8_4, hw_compat_rhel_8_4_len);
|
2018-11-08 17:02:33 +00:00
|
|
|
+}
|
2021-04-30 07:28:51 +00:00
|
|
|
+DEFINE_RHEL_MACHINE_AS_LATEST(8, 4, 0)
|
2020-11-13 13:09:35 +00:00
|
|
|
+
|
2021-04-30 07:28:51 +00:00
|
|
|
+static void rhel830_virt_options(MachineClass *mc)
|
2020-11-13 13:09:35 +00:00
|
|
|
+{
|
2021-04-30 07:28:51 +00:00
|
|
|
+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
|
|
|
|
+
|
|
|
|
+ rhel840_virt_options(mc);
|
|
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_8_3, hw_compat_rhel_8_3_len);
|
|
|
|
+ vmc->no_kvm_steal_time = true;
|
2020-11-13 13:09:35 +00:00
|
|
|
+}
|
2021-04-30 07:28:51 +00:00
|
|
|
+DEFINE_RHEL_MACHINE(8, 3, 0)
|
2020-11-13 13:09:35 +00:00
|
|
|
+
|
|
|
|
+static void rhel820_virt_options(MachineClass *mc)
|
|
|
|
+{
|
|
|
|
+ rhel830_virt_options(mc);
|
2021-04-30 07:28:51 +00:00
|
|
|
+ compat_props_add(mc->compat_props, hw_compat_rhel_8_2, hw_compat_rhel_8_2_len);
|
2020-11-13 13:09:35 +00:00
|
|
|
+ mc->numa_mem_supported = true;
|
|
|
|
+ mc->auto_enable_numa_with_memdev = false;
|
|
|
|
+}
|
|
|
|
+DEFINE_RHEL_MACHINE(8, 2, 0)
|
2018-11-08 17:02:33 +00:00
|
|
|
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
|
2021-04-30 07:28:51 +00:00
|
|
|
index 921416f918..6c34864a0a 100644
|
2018-11-08 17:02:33 +00:00
|
|
|
--- a/include/hw/arm/virt.h
|
|
|
|
+++ b/include/hw/arm/virt.h
|
2021-04-30 07:28:51 +00:00
|
|
|
@@ -170,9 +170,17 @@ struct VirtMachineState {
|
2018-11-08 17:02:33 +00:00
|
|
|
|
2019-05-07 21:00:36 +00:00
|
|
|
#define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)
|
2018-11-08 17:02:33 +00:00
|
|
|
|
|
|
|
+#if 0 /* disabled for Red Hat Enterprise Linux */
|
|
|
|
#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
|
2020-11-13 13:09:35 +00:00
|
|
|
OBJECT_DECLARE_TYPE(VirtMachineState, VirtMachineClass, VIRT_MACHINE)
|
2018-11-08 17:02:33 +00:00
|
|
|
|
|
|
|
+#else
|
|
|
|
+#define TYPE_RHEL_MACHINE MACHINE_TYPE_NAME("virt-rhel")
|
2020-11-13 13:09:35 +00:00
|
|
|
+typedef struct VirtMachineClass VirtMachineClass;
|
|
|
|
+typedef struct VirtMachineState VirtMachineState;
|
|
|
|
+DECLARE_OBJ_CHECKERS(VirtMachineState, VirtMachineClass, VIRT_MACHINE, TYPE_RHEL_MACHINE)
|
2018-11-08 17:02:33 +00:00
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
void virt_acpi_setup(VirtMachineState *vms);
|
2020-05-13 01:03:43 +00:00
|
|
|
bool virt_is_acpi_enabled(VirtMachineState *vms);
|
2018-11-08 17:02:33 +00:00
|
|
|
|
|
|
|
--
|
2021-04-30 07:28:51 +00:00
|
|
|
2.27.0
|
2018-11-08 17:02:33 +00:00
|
|
|
|