You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
353 lines
14 KiB
353 lines
14 KiB
From 697aaa43e3c0f20fc312f06be6c1093f1ba907e1 Mon Sep 17 00:00:00 2001
|
|
From: Miroslav Rezanina <mrezanin@redhat.com>
|
|
Date: Fri, 19 Oct 2018 12:53:31 +0200
|
|
Subject: Add aarch64 machine types
|
|
|
|
Adding changes to add RHEL machine types for aarch64 architecture.
|
|
|
|
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
---
|
|
Rebase notes (6.1.0):
|
|
- Use CONFIG_TPM check when using TPM structures
|
|
- Add support for default_bus_bypass_iommu
|
|
- ea4c0b32d9 arm/virt: Register highmem and gic-version as class properties
|
|
- 895e1fa86a hw/arm/virt: Add 8.5 and 9.0 machine types and remove older ones
|
|
|
|
Rebase notes (7.0.0):
|
|
- Added dtb-kaslr-seed option
|
|
- Set no_tcg_lpa2 to true
|
|
|
|
Merged patches (6.2.0):
|
|
- 9a3d4fde0e hw/arm/virt: Remove 9.0 machine type
|
|
- f7d04d6695 hw: arm: virt: Add hw_compat_rhel_8_5 to 8.5 machine type
|
|
|
|
Merged patches (7.0.0):
|
|
- 3b82be3dd3 redhat: virt-rhel8.5.0: Update machine type compatibility for QEMU 6.2.0 update
|
|
- c354a86c9b hw/arm/virt: Register "iommu" as a class property
|
|
- c1a2630dc9 hw/arm/virt: Register "its" as a class property
|
|
- 9d8c61dc93 hw/arm/virt: Rename default_bus_bypass_iommu
|
|
- a1d1b6eeb6 hw/arm/virt: Expose the 'RAS' option
|
|
- 47f8fe1b82 hw/arm/virt: Add 9.0 machine type and remove 8.5 one
|
|
- ed2346788f hw/arm/virt: Check no_tcg_its and minor style changes
|
|
---
|
|
hw/arm/virt.c | 234 +++++++++++++++++++++++++++++++++++++++++-
|
|
include/hw/arm/virt.h | 8 ++
|
|
2 files changed, 241 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
|
index 6a84031fd7..e06862d22a 100644
|
|
--- a/hw/arm/virt.c
|
|
+++ b/hw/arm/virt.c
|
|
@@ -80,6 +80,7 @@
|
|
#include "hw/char/pl011.h"
|
|
#include "qemu/guest-random.h"
|
|
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
|
#define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
|
|
static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
|
|
void *data) \
|
|
@@ -106,7 +107,48 @@
|
|
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)
|
|
+
|
|
+/* 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);
|
|
|
|
/* Number of external interrupt lines to configure the GIC with */
|
|
#define NUM_IRQS 256
|
|
@@ -2250,6 +2292,7 @@ static void machvirt_init(MachineState *machine)
|
|
qemu_add_machine_init_done_notifier(&vms->machine_done);
|
|
}
|
|
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
|
static bool virt_get_secure(Object *obj, Error **errp)
|
|
{
|
|
VirtMachineState *vms = VIRT_MACHINE(obj);
|
|
@@ -2277,6 +2320,7 @@ 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)
|
|
{
|
|
@@ -2402,6 +2446,7 @@ 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);
|
|
@@ -2415,6 +2460,7 @@ static void virt_set_mte(Object *obj, bool value, Error **errp)
|
|
|
|
vms->mte = value;
|
|
}
|
|
+#endif /* disabled for RHEL */
|
|
|
|
static char *virt_get_gic_version(Object *obj, Error **errp)
|
|
{
|
|
@@ -2818,6 +2864,7 @@ static int virt_kvm_type(MachineState *ms, const char *type_str)
|
|
return fixed_ipa ? 0 : requested_pa_size;
|
|
}
|
|
|
|
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
|
static void virt_machine_class_init(ObjectClass *oc, void *data)
|
|
{
|
|
MachineClass *mc = MACHINE_CLASS(oc);
|
|
@@ -3206,3 +3253,188 @@ static void virt_machine_2_6_options(MachineClass *mc)
|
|
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);
|
|
+ HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
|
|
+
|
|
+ mc->family = "virt-rhel-Z";
|
|
+ mc->init = machvirt_init;
|
|
+ /* Maximum supported VCPU count for all virt-rhel* machines */
|
|
+ mc->max_cpus = 384;
|
|
+#ifdef CONFIG_TPM
|
|
+ machine_class_allow_dynamic_sysbus_dev(mc, TYPE_TPM_TIS_SYSBUS);
|
|
+#endif
|
|
+ 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;
|
|
+ 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;
|
|
+ hc->unplug = virt_machine_device_unplug_cb;
|
|
+ mc->nvdimm_supported = true;
|
|
+ mc->auto_enable_numa_with_memhp = true;
|
|
+ mc->auto_enable_numa_with_memdev = true;
|
|
+ mc->default_ram_id = "mach-virt.ram";
|
|
+
|
|
+ object_class_property_add(oc, "acpi", "OnOffAuto",
|
|
+ virt_get_acpi, virt_set_acpi,
|
|
+ NULL, NULL);
|
|
+ object_class_property_set_description(oc, "acpi",
|
|
+ "Enable ACPI");
|
|
+
|
|
+ object_class_property_add_bool(oc, "highmem", virt_get_highmem,
|
|
+ virt_set_highmem);
|
|
+ object_class_property_set_description(oc, "highmem",
|
|
+ "Set on/off to enable/disable using "
|
|
+ "physical address space above 32 bits");
|
|
+
|
|
+ object_class_property_add_str(oc, "gic-version", virt_get_gic_version,
|
|
+ virt_set_gic_version);
|
|
+ object_class_property_set_description(oc, "gic-version",
|
|
+ "Set GIC version. "
|
|
+ "Valid values are 2, 3, host and max");
|
|
+
|
|
+ object_class_property_add_str(oc, "iommu", virt_get_iommu, virt_set_iommu);
|
|
+ object_class_property_set_description(oc, "iommu",
|
|
+ "Set the IOMMU type. "
|
|
+ "Valid values are none and smmuv3");
|
|
+
|
|
+ object_class_property_add_bool(oc, "default-bus-bypass-iommu",
|
|
+ virt_get_default_bus_bypass_iommu,
|
|
+ virt_set_default_bus_bypass_iommu);
|
|
+ object_class_property_set_description(oc, "default-bus-bypass-iommu",
|
|
+ "Set on/off to enable/disable "
|
|
+ "bypass_iommu for default root bus");
|
|
+
|
|
+ object_class_property_add_bool(oc, "ras", virt_get_ras,
|
|
+ virt_set_ras);
|
|
+ object_class_property_set_description(oc, "ras",
|
|
+ "Set on/off to enable/disable reporting host memory errors "
|
|
+ "to a KVM guest using ACPI and guest external abort exceptions");
|
|
+
|
|
+ object_class_property_add_bool(oc, "its", virt_get_its,
|
|
+ virt_set_its);
|
|
+ object_class_property_set_description(oc, "its",
|
|
+ "Set on/off to enable/disable "
|
|
+ "ITS instantiation");
|
|
+
|
|
+ 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");
|
|
+
|
|
+
|
|
+ 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");
|
|
+
|
|
+ object_class_property_add_bool(oc, "dtb-kaslr-seed",
|
|
+ virt_get_dtb_kaslr_seed,
|
|
+ virt_set_dtb_kaslr_seed);
|
|
+ object_class_property_set_description(oc, "dtb-kaslr-seed",
|
|
+ "Set off to disable passing of kaslr-seed "
|
|
+ "dtb node to guest");
|
|
+}
|
|
+
|
|
+static void rhel_virt_instance_init(Object *obj)
|
|
+{
|
|
+ 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;
|
|
+
|
|
+ /* EL2 is disabled by default and non-configurable for RHEL */
|
|
+ vms->virt = false;
|
|
+
|
|
+ /* High memory is enabled by default */
|
|
+ vms->highmem = true;
|
|
+ vms->gic_version = VIRT_GIC_VERSION_NOSEL;
|
|
+
|
|
+ vms->highmem_ecam = !vmc->no_highmem_ecam;
|
|
+
|
|
+ if (vmc->no_its) {
|
|
+ vms->its = false;
|
|
+ } else {
|
|
+ /* Default allows ITS instantiation */
|
|
+ vms->its = true;
|
|
+
|
|
+ if (vmc->no_tcg_its) {
|
|
+ vms->tcg_its = false;
|
|
+ } else {
|
|
+ vms->tcg_its = true;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ /* Default disallows iommu instantiation */
|
|
+ vms->iommu = VIRT_IOMMU_NONE;
|
|
+
|
|
+ /* The default root bus is attached to iommu by default */
|
|
+ vms->default_bus_bypass_iommu = false;
|
|
+
|
|
+ /* Default disallows RAS instantiation and is non-configurable for RHEL */
|
|
+ vms->ras = false;
|
|
+
|
|
+ /* MTE is disabled by default and non-configurable for RHEL */
|
|
+ vms->mte = false;
|
|
+
|
|
+ /* Supply a kaslr-seed by default */
|
|
+ vms->dtb_kaslr_seed = true;
|
|
+
|
|
+ vms->irqmap = a15irqmap;
|
|
+
|
|
+ virt_flash_create(vms);
|
|
+
|
|
+ vms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
|
|
+ vms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
|
|
+}
|
|
+
|
|
+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)
|
|
+{
|
|
+ type_register_static(&rhel_machine_info);
|
|
+}
|
|
+type_init(rhel_machine_init);
|
|
+
|
|
+static void rhel900_virt_options(MachineClass *mc)
|
|
+{
|
|
+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
|
|
+
|
|
+ compat_props_add(mc->compat_props, arm_rhel_compat, arm_rhel_compat_len);
|
|
+
|
|
+ /* Disable FEAT_LPA2 since old kernels (<= v5.12) don't boot with that feature */
|
|
+ vmc->no_tcg_lpa2 = true;
|
|
+}
|
|
+DEFINE_RHEL_MACHINE_AS_LATEST(9, 0, 0)
|
|
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
|
|
index 7e76ee2619..9b1efe8f0e 100644
|
|
--- a/include/hw/arm/virt.h
|
|
+++ b/include/hw/arm/virt.h
|
|
@@ -179,9 +179,17 @@ struct VirtMachineState {
|
|
|
|
#define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)
|
|
|
|
+#if 0 /* disabled for Red Hat Enterprise Linux */
|
|
#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
|
|
OBJECT_DECLARE_TYPE(VirtMachineState, VirtMachineClass, VIRT_MACHINE)
|
|
|
|
+#else
|
|
+#define TYPE_RHEL_MACHINE MACHINE_TYPE_NAME("virt-rhel")
|
|
+typedef struct VirtMachineClass VirtMachineClass;
|
|
+typedef struct VirtMachineState VirtMachineState;
|
|
+DECLARE_OBJ_CHECKERS(VirtMachineState, VirtMachineClass, VIRT_MACHINE, TYPE_RHEL_MACHINE)
|
|
+#endif
|
|
+
|
|
void virt_acpi_setup(VirtMachineState *vms);
|
|
bool virt_is_acpi_enabled(VirtMachineState *vms);
|
|
|
|
--
|
|
2.31.1
|
|
|