|
|
ed5979 |
From 30e86a7c4fbcdc95b74bcb2a15745cb221783091 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 7/8] hw/arm/virt: Add properties to disable high memory
|
|
|
ed5979 |
regions
|
|
|
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: [7/8] 16f8762393b447a590b31c9e4d8d3c58c6bc9fa8
|
|
|
ed5979 |
|
|
|
ed5979 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2113840
|
|
|
ed5979 |
|
|
|
ed5979 |
The 3 high memory regions are usually enabled by default, but they may
|
|
|
ed5979 |
be not used. For example, VIRT_HIGH_GIC_REDIST2 isn't needed by GICv2.
|
|
|
ed5979 |
This leads to waste in the PA space.
|
|
|
ed5979 |
|
|
|
ed5979 |
Add properties ("highmem-redists", "highmem-ecam", "highmem-mmio") to
|
|
|
ed5979 |
allow users selectively disable them if needed. After that, the high
|
|
|
ed5979 |
memory region for GICv3 or GICv4 redistributor can be disabled by user,
|
|
|
ed5979 |
the number of maximal supported CPUs needs to be calculated based on
|
|
|
ed5979 |
'vms->highmem_redists'. The follow-up error message is also improved
|
|
|
ed5979 |
to indicate if the high memory region for GICv3 and GICv4 has been
|
|
|
ed5979 |
enabled or not.
|
|
|
ed5979 |
|
|
|
ed5979 |
Suggested-by: Marc Zyngier <maz@kernel.org>
|
|
|
ed5979 |
Signed-off-by: Gavin Shan <gshan@redhat.com>
|
|
|
ed5979 |
Reviewed-by: Marc Zyngier <maz@kernel.org>
|
|
|
ed5979 |
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
ed5979 |
Reviewed-by: Eric Auger <eric.auger@redhat.com>
|
|
|
ed5979 |
Message-id: 20221029224307.138822-8-gshan@redhat.com
|
|
|
ed5979 |
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
ed5979 |
(cherry picked from commit 6a48c64eec355ab1aff694eb4522d07a8e461368)
|
|
|
ed5979 |
Signed-off-by: Gavin Shan <gshan@redhat.com>
|
|
|
ed5979 |
Conflicts:
|
|
|
ed5979 |
hw/arm/virt.c
|
|
|
ed5979 |
Comment out the handlers of the property 'highmem-redists',
|
|
|
ed5979 |
'highmem-ecam' and 'highmem-mmio' since they aren't exposed.
|
|
|
ed5979 |
---
|
|
|
ed5979 |
docs/system/arm/virt.rst | 13 +++++++
|
|
|
ed5979 |
hw/arm/virt.c | 75 ++++++++++++++++++++++++++++++++++++++--
|
|
|
ed5979 |
2 files changed, 86 insertions(+), 2 deletions(-)
|
|
|
ed5979 |
|
|
|
ed5979 |
diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst
|
|
|
ed5979 |
index 4454706392..188a4f211f 100644
|
|
|
ed5979 |
--- a/docs/system/arm/virt.rst
|
|
|
ed5979 |
+++ b/docs/system/arm/virt.rst
|
|
|
ed5979 |
@@ -98,6 +98,19 @@ 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 |
+highmem-redists
|
|
|
ed5979 |
+ Set ``on``/``off`` to enable/disable the high memory region for GICv3 or
|
|
|
ed5979 |
+ GICv4 redistributor. The default is ``on``. Setting this to ``off`` will
|
|
|
ed5979 |
+ limit the maximum number of CPUs when GICv3 or GICv4 is used.
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+highmem-ecam
|
|
|
ed5979 |
+ Set ``on``/``off`` to enable/disable the high memory region for PCI ECAM.
|
|
|
ed5979 |
+ The default is ``on`` for machine types later than ``virt-3.0``.
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+highmem-mmio
|
|
|
ed5979 |
+ Set ``on``/``off`` to enable/disable the high memory region for PCI MMIO.
|
|
|
ed5979 |
+ The default is ``on``.
|
|
|
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 6087511ae9..304fa0d6e7 100644
|
|
|
ed5979 |
--- a/hw/arm/virt.c
|
|
|
ed5979 |
+++ b/hw/arm/virt.c
|
|
|
ed5979 |
@@ -2142,14 +2142,20 @@ static void machvirt_init(MachineState *machine)
|
|
|
ed5979 |
if (vms->gic_version == VIRT_GIC_VERSION_2) {
|
|
|
ed5979 |
virt_max_cpus = GIC_NCPU;
|
|
|
ed5979 |
} else {
|
|
|
ed5979 |
- virt_max_cpus = virt_redist_capacity(vms, VIRT_GIC_REDIST) +
|
|
|
ed5979 |
- virt_redist_capacity(vms, VIRT_HIGH_GIC_REDIST2);
|
|
|
ed5979 |
+ virt_max_cpus = virt_redist_capacity(vms, VIRT_GIC_REDIST);
|
|
|
ed5979 |
+ if (vms->highmem_redists) {
|
|
|
ed5979 |
+ virt_max_cpus += virt_redist_capacity(vms, VIRT_HIGH_GIC_REDIST2);
|
|
|
ed5979 |
+ }
|
|
|
ed5979 |
}
|
|
|
ed5979 |
|
|
|
ed5979 |
if (max_cpus > virt_max_cpus) {
|
|
|
ed5979 |
error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
|
|
|
ed5979 |
"supported by machine 'mach-virt' (%d)",
|
|
|
ed5979 |
max_cpus, virt_max_cpus);
|
|
|
ed5979 |
+ if (vms->gic_version != VIRT_GIC_VERSION_2 && !vms->highmem_redists) {
|
|
|
ed5979 |
+ error_printf("Try 'highmem-redists=on' for more CPUs\n");
|
|
|
ed5979 |
+ }
|
|
|
ed5979 |
+
|
|
|
ed5979 |
exit(1);
|
|
|
ed5979 |
}
|
|
|
ed5979 |
|
|
|
ed5979 |
@@ -2420,6 +2426,49 @@ static void virt_set_compact_highmem(Object *obj, bool value, Error **errp)
|
|
|
ed5979 |
|
|
|
ed5979 |
vms->highmem_compact = value;
|
|
|
ed5979 |
}
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+static bool virt_get_highmem_redists(Object *obj, Error **errp)
|
|
|
ed5979 |
+{
|
|
|
ed5979 |
+ VirtMachineState *vms = VIRT_MACHINE(obj);
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+ return vms->highmem_redists;
|
|
|
ed5979 |
+}
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+static void virt_set_highmem_redists(Object *obj, bool value, Error **errp)
|
|
|
ed5979 |
+{
|
|
|
ed5979 |
+ VirtMachineState *vms = VIRT_MACHINE(obj);
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+ vms->highmem_redists = value;
|
|
|
ed5979 |
+}
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+static bool virt_get_highmem_ecam(Object *obj, Error **errp)
|
|
|
ed5979 |
+{
|
|
|
ed5979 |
+ VirtMachineState *vms = VIRT_MACHINE(obj);
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+ return vms->highmem_ecam;
|
|
|
ed5979 |
+}
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+static void virt_set_highmem_ecam(Object *obj, bool value, Error **errp)
|
|
|
ed5979 |
+{
|
|
|
ed5979 |
+ VirtMachineState *vms = VIRT_MACHINE(obj);
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+ vms->highmem_ecam = value;
|
|
|
ed5979 |
+}
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+static bool virt_get_highmem_mmio(Object *obj, Error **errp)
|
|
|
ed5979 |
+{
|
|
|
ed5979 |
+ VirtMachineState *vms = VIRT_MACHINE(obj);
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+ return vms->highmem_mmio;
|
|
|
ed5979 |
+}
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+static void virt_set_highmem_mmio(Object *obj, bool value, Error **errp)
|
|
|
ed5979 |
+{
|
|
|
ed5979 |
+ VirtMachineState *vms = VIRT_MACHINE(obj);
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+ vms->highmem_mmio = value;
|
|
|
ed5979 |
+}
|
|
|
ed5979 |
+
|
|
|
ed5979 |
#endif /* disabled for RHEL */
|
|
|
ed5979 |
|
|
|
ed5979 |
static bool virt_get_its(Object *obj, Error **errp)
|
|
|
ed5979 |
@@ -3052,6 +3101,28 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
|
|
|
ed5979 |
"Set on/off to enable/disable compact "
|
|
|
ed5979 |
"layout for high memory regions");
|
|
|
ed5979 |
|
|
|
ed5979 |
+ object_class_property_add_bool(oc, "highmem-redists",
|
|
|
ed5979 |
+ virt_get_highmem_redists,
|
|
|
ed5979 |
+ virt_set_highmem_redists);
|
|
|
ed5979 |
+ object_class_property_set_description(oc, "highmem-redists",
|
|
|
ed5979 |
+ "Set on/off to enable/disable high "
|
|
|
ed5979 |
+ "memory region for GICv3 or GICv4 "
|
|
|
ed5979 |
+ "redistributor");
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+ object_class_property_add_bool(oc, "highmem-ecam",
|
|
|
ed5979 |
+ virt_get_highmem_ecam,
|
|
|
ed5979 |
+ virt_set_highmem_ecam);
|
|
|
ed5979 |
+ object_class_property_set_description(oc, "highmem-ecam",
|
|
|
ed5979 |
+ "Set on/off to enable/disable high "
|
|
|
ed5979 |
+ "memory region for PCI ECAM");
|
|
|
ed5979 |
+
|
|
|
ed5979 |
+ object_class_property_add_bool(oc, "highmem-mmio",
|
|
|
ed5979 |
+ virt_get_highmem_mmio,
|
|
|
ed5979 |
+ virt_set_highmem_mmio);
|
|
|
ed5979 |
+ object_class_property_set_description(oc, "highmem-mmio",
|
|
|
ed5979 |
+ "Set on/off to enable/disable high "
|
|
|
ed5979 |
+ "memory region for PCI MMIO");
|
|
|
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 |
--
|
|
|
ed5979 |
2.31.1
|
|
|
ed5979 |
|