|
|
ed5979 |
From 4ab2aff624908e49b099f00609875f4d03e9e1ec Mon Sep 17 00:00:00 2001
|
|
|
ed5979 |
From: Gavin Shan <gshan@redhat.com>
|
|
|
ed5979 |
Date: Wed, 21 Dec 2022 08:48:45 +0800
|
|
|
ed5979 |
Subject: [PATCH 6/8] hw/arm/virt: Add 'compact-highmem' property
|
|
|
ed5979 |
|
|
|
ed5979 |
RH-Author: Gavin Shan <gshan@redhat.com>
|
|
|
ed5979 |
RH-MergeRequest: 126: hw/arm/virt: Optimize high memory region address assignment
|
|
|
ed5979 |
RH-Bugzilla: 2113840
|
|
|
ed5979 |
RH-Acked-by: Eric Auger <eric.auger@redhat.com>
|
|
|
ed5979 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
ed5979 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ed5979 |
RH-Commit: [6/8] 781506f3445493f05b511547370b6d88ef092457
|
|
|
ed5979 |
|
|
|
ed5979 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2113840
|
|
|
ed5979 |
|
|
|
ed5979 |
After the improvement to high memory region address assignment is
|
|
|
ed5979 |
applied, the memory layout can be changed, introducing possible
|
|
|
ed5979 |
migration breakage. For example, VIRT_HIGH_PCIE_MMIO memory region
|
|
|
ed5979 |
is disabled or enabled when the optimization is applied or not, with
|
|
|
ed5979 |
the following configuration. The configuration is only achievable by
|
|
|
ed5979 |
modifying the source code until more properties are added to allow
|
|
|
ed5979 |
users selectively disable those high memory regions.
|
|
|
ed5979 |
|
|
|
ed5979 |
pa_bits = 40;
|
|
|
ed5979 |
vms->highmem_redists = false;
|
|
|
ed5979 |
vms->highmem_ecam = false;
|
|
|
ed5979 |
vms->highmem_mmio = true;
|
|
|
ed5979 |
|
|
|
ed5979 |
# qemu-system-aarch64 -accel kvm -cpu host \
|
|
|
ed5979 |
-machine virt-7.2,compact-highmem={on, off} \
|
|
|
ed5979 |
-m 4G,maxmem=511G -monitor stdio
|
|
|
ed5979 |
|
|
|
ed5979 |
Region compact-highmem=off compact-highmem=on
|
|
|
ed5979 |
----------------------------------------------------------------
|
|
|
ed5979 |
MEM [1GB 512GB] [1GB 512GB]
|
|
|
ed5979 |
HIGH_GIC_REDISTS2 [512GB 512GB+64MB] [disabled]
|
|
|
ed5979 |
HIGH_PCIE_ECAM [512GB+256MB 512GB+512MB] [disabled]
|
|
|
ed5979 |
HIGH_PCIE_MMIO [disabled] [512GB 1TB]
|
|
|
ed5979 |
|
|
|
ed5979 |
In order to keep backwords compatibility, we need to disable the
|
|
|
ed5979 |
optimization on machine, which is virt-7.1 or ealier than it. It
|
|
|
ed5979 |
means the optimization is enabled by default from virt-7.2. Besides,
|
|
|
ed5979 |
'compact-highmem' property is added so that the optimization can be
|
|
|
ed5979 |
explicitly enabled or disabled on all machine types by users.
|
|
|
ed5979 |
|
|
|
ed5979 |
Signed-off-by: Gavin Shan <gshan@redhat.com>
|
|
|
ed5979 |
Reviewed-by: Eric Auger <eric.auger@redhat.com>
|
|
|
ed5979 |
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
ed5979 |
Reviewed-by: Marc Zyngier <maz@kernel.org>
|
|
|
ed5979 |
Tested-by: Zhenyu Zhang <zhenyzha@redhat.com>
|
|
|
ed5979 |
Message-id: 20221029224307.138822-7-gshan@redhat.com
|
|
|
ed5979 |
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
ed5979 |
(cherry picked from commit f40408a9fe5d1db70a75a33d2b26c8af8a5d57b0)
|
|
|
ed5979 |
Signed-off-by: Gavin Shan <gshan@redhat.com>
|
|
|
ed5979 |
Conflicts:
|
|
|
ed5979 |
hw/arm/virt.c
|
|
|
ed5979 |
Comment out the handlers of property 'compact-highmem' since
|
|
|
ed5979 |
the property isn't exposed.
|
|
|
ed5979 |
---
|
|
|
ed5979 |
docs/system/arm/virt.rst | 4 ++++
|
|
|
ed5979 |
hw/arm/virt.c | 34 ++++++++++++++++++++++++++++++++++
|
|
|
ed5979 |
include/hw/arm/virt.h | 1 +
|
|
|
ed5979 |
3 files changed, 39 insertions(+)
|
|
|
ed5979 |
|
|
|
ed5979 |
diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst
|
|
|
ed5979 |
index 20442ea2c1..4454706392 100644
|
|
|
ed5979 |
--- a/docs/system/arm/virt.rst
|
|
|
ed5979 |
+++ b/docs/system/arm/virt.rst
|
|
|
ed5979 |
@@ -94,6 +94,10 @@ highmem
|
|
|
ed5979 |
address space above 32 bits. The default is ``on`` for machine types
|
|
|
ed5979 |
later than ``virt-2.12``.
|
|
|
ed5979 |
|
|
|
ed5979 |
+compact-highmem
|
|
|
ed5979 |
+ Set ``on``/``off`` to enable/disable the compact layout for high memory regions.
|
|
|
ed5979 |
+ The default is ``on`` for machine types later than ``virt-7.2``.
|
|
|
ed5979 |
+
|
|
|
ed5979 |
gic-version
|
|
|
ed5979 |
Specify the version of the Generic Interrupt Controller (GIC) to provide.
|
|
|
ed5979 |
Valid values are:
|
|
|
ed5979 |
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
|
|
|
ed5979 |
index 6896e0ca0f..6087511ae9 100644
|
|
|
ed5979 |
--- a/hw/arm/virt.c
|
|
|
ed5979 |
+++ b/hw/arm/virt.c
|
|
|
ed5979 |
@@ -216,6 +216,12 @@ static const MemMapEntry base_memmap[] = {
|
|
|
ed5979 |
* Note the extended_memmap is sized so that it eventually also includes the
|
|
|
ed5979 |
* base_memmap entries (VIRT_HIGH_GIC_REDIST2 index is greater than the last
|
|
|
ed5979 |
* index of base_memmap).
|
|
|
ed5979 |
+ *
|
|
|
ed5979 |
+ * The memory map for these Highmem IO Regions can be in legacy or compact
|
|
|
ed5979 |
+ * layout, depending on 'compact-highmem' property. With legacy layout, the
|
|
|
ed5979 |
+ * PA space for one specific region is always reserved, even if the region
|
|
|
ed5979 |
+ * has been disabled or doesn't fit into the PA space. However, the PA space
|
|
|
ed5979 |
+ * for the region won't be reserved in these circumstances with compact layout.
|
|
|
ed5979 |
*/
|
|
|
ed5979 |
static MemMapEntry extended_memmap[] = {
|
|
|
ed5979 |
/* Additional 64 MB redist region (can contain up to 512 redistributors) */
|
|
|
ed5979 |
@@ -2400,6 +2406,22 @@ static void virt_set_highmem(Object *obj, bool value, Error **errp)
|
|
|
ed5979 |
vms->highmem = value;
|
|
|
ed5979 |
}
|
|
|
ed5979 |
|
|
|
ed5979 |
+#if 0 /* Disabled for Red Hat Enterprise Linux */
|
|
|
ed5979 |
+static bool virt_get_compact_highmem(Object *obj, Error **errp)
|
|
|
ed5979 |
+{
|
|
|
ed5979 |
+ VirtMachineState *vms = VIRT_MACHINE(obj);
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+ return vms->highmem_compact;
|
|
|
ed5979 |
+}
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+static void virt_set_compact_highmem(Object *obj, bool value, Error **errp)
|
|
|
ed5979 |
+{
|
|
|
ed5979 |
+ VirtMachineState *vms = VIRT_MACHINE(obj);
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+ vms->highmem_compact = value;
|
|
|
ed5979 |
+}
|
|
|
ed5979 |
+#endif /* disabled for RHEL */
|
|
|
ed5979 |
+
|
|
|
ed5979 |
static bool virt_get_its(Object *obj, Error **errp)
|
|
|
ed5979 |
{
|
|
|
ed5979 |
VirtMachineState *vms = VIRT_MACHINE(obj);
|
|
|
ed5979 |
@@ -3023,6 +3045,13 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
|
|
|
ed5979 |
"Set on/off to enable/disable using "
|
|
|
ed5979 |
"physical address space above 32 bits");
|
|
|
ed5979 |
|
|
|
ed5979 |
+ object_class_property_add_bool(oc, "compact-highmem",
|
|
|
ed5979 |
+ virt_get_compact_highmem,
|
|
|
ed5979 |
+ virt_set_compact_highmem);
|
|
|
ed5979 |
+ object_class_property_set_description(oc, "compact-highmem",
|
|
|
ed5979 |
+ "Set on/off to enable/disable compact "
|
|
|
ed5979 |
+ "layout for high memory regions");
|
|
|
ed5979 |
+
|
|
|
ed5979 |
object_class_property_add_str(oc, "gic-version", virt_get_gic_version,
|
|
|
ed5979 |
virt_set_gic_version);
|
|
|
ed5979 |
object_class_property_set_description(oc, "gic-version",
|
|
|
ed5979 |
@@ -3107,6 +3136,7 @@ static void virt_instance_init(Object *obj)
|
|
|
ed5979 |
|
|
|
ed5979 |
/* High memory is enabled by default */
|
|
|
ed5979 |
vms->highmem = true;
|
|
|
ed5979 |
+ vms->highmem_compact = !vmc->no_highmem_compact;
|
|
|
ed5979 |
vms->gic_version = VIRT_GIC_VERSION_NOSEL;
|
|
|
ed5979 |
|
|
|
ed5979 |
vms->highmem_ecam = !vmc->no_highmem_ecam;
|
|
|
ed5979 |
@@ -3176,8 +3206,12 @@ DEFINE_VIRT_MACHINE_AS_LATEST(7, 2)
|
|
|
ed5979 |
|
|
|
ed5979 |
static void virt_machine_7_1_options(MachineClass *mc)
|
|
|
ed5979 |
{
|
|
|
ed5979 |
+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
|
|
|
ed5979 |
+
|
|
|
ed5979 |
virt_machine_7_2_options(mc);
|
|
|
ed5979 |
compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len);
|
|
|
ed5979 |
+ /* Compact layout for high memory regions was introduced with 7.2 */
|
|
|
ed5979 |
+ vmc->no_highmem_compact = true;
|
|
|
ed5979 |
}
|
|
|
ed5979 |
DEFINE_VIRT_MACHINE(7, 1)
|
|
|
ed5979 |
|
|
|
ed5979 |
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
|
|
|
ed5979 |
index 15bd291311..85e7d61868 100644
|
|
|
ed5979 |
--- a/include/hw/arm/virt.h
|
|
|
ed5979 |
+++ b/include/hw/arm/virt.h
|
|
|
ed5979 |
@@ -125,6 +125,7 @@ struct VirtMachineClass {
|
|
|
ed5979 |
bool no_pmu;
|
|
|
ed5979 |
bool claim_edge_triggered_timers;
|
|
|
ed5979 |
bool smbios_old_sys_ver;
|
|
|
ed5979 |
+ bool no_highmem_compact;
|
|
|
ed5979 |
bool no_highmem_ecam;
|
|
|
ed5979 |
bool no_ged; /* Machines < 4.2 have no support for ACPI GED device */
|
|
|
ed5979 |
bool kvm_no_adjvtime;
|
|
|
ed5979 |
--
|
|
|
ed5979 |
2.31.1
|
|
|
ed5979 |
|