From: Tushar Dave <tdave@nvidia.com>
To: qemu-devel@nongnu.org
Cc: alwilliamson@nvidia.com, jgg@nvidia.com, skolothumtho@nvidia.com,
qemu-arm@nongnu.org, peter.maydell@linaro.org, mst@redhat.com,
marcel.apfelbaum@gmail.com, devel@edk2.groups.io
Subject: [RFC PATCH v2 5/5] hw/arm/virt: add highmem-mmio-base property
Date: Wed, 26 Aug 2026 19:40:24 -0500 [thread overview]
Message-ID: <20260827004024.598351-6-tdave@nvidia.com> (raw)
In-Reply-To: <20260827004024.598351-1-tdave@nvidia.com>
Add a highmem-mmio-base property to override the base of the virt
machine's high PCIe MMIO window, alongside the existing
highmem-mmio-size:
-machine virt,highmem-mmio-base=<addr>,highmem-mmio-size=<size>
Some PCI devices require MMIO resources to be placed within a
specific address range that cannot be satisfied by the default
placement. The configured base is validated to be non-zero, aligned
to highmem-mmio-size, non-overlapping with the existing high memory
layout, and within the configured physical address space.
Signed-off-by: Tushar Dave <tdave@nvidia.com>
---
hw/arm/virt.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 61 insertions(+), 1 deletion(-)
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index cb9cd2d25c..47653b8753 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -2515,9 +2515,34 @@ static void virt_set_high_memmap(VirtMachineState *vms,
for (i = VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) {
region_enabled = virt_get_high_memmap_enabled(vms, i);
- region_base = ROUND_UP(base, extended_memmap[i].size);
region_size = extended_memmap[i].size;
+ if (i == VIRT_HIGH_PCIE_MMIO && extended_memmap[i].base) {
+ region_base = extended_memmap[i].base;
+
+ if (region_base < base) {
+ error_report("highmem-mmio-base 0x%"PRIx64" overlaps prior "
+ "high memory layout (must be >= 0x%"PRIx64")",
+ region_base, base);
+ exit(1);
+ }
+ if (region_base % region_size != 0) {
+ error_report("highmem-mmio-base 0x%"PRIx64" must be "
+ "aligned to highmem-mmio-size 0x%"PRIx64,
+ region_base, region_size);
+ exit(1);
+ }
+ if (region_base + region_size > BIT_ULL(pa_bits)) {
+ error_report("highmem-mmio-base + highmem-mmio-size "
+ "[0x%"PRIx64", 0x%"PRIx64") exceeds %d-bit PA "
+ "space", region_base,
+ region_base + region_size, pa_bits);
+ exit(1);
+ }
+ } else {
+ region_base = ROUND_UP(base, region_size);
+ }
+
vms->memmap[i].base = region_base;
vms->memmap[i].size = region_size;
@@ -3418,6 +3443,33 @@ static void virt_set_highmem_mmio_size(Object *obj, Visitor *v,
extended_memmap[VIRT_HIGH_PCIE_MMIO].size = size;
}
+static void virt_get_highmem_mmio_base(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ uint64_t base = extended_memmap[VIRT_HIGH_PCIE_MMIO].base;
+
+ visit_type_size(v, name, &base, errp);
+}
+
+static void virt_set_highmem_mmio_base(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ uint64_t base;
+
+ if (!visit_type_size(v, name, &base, errp)) {
+ return;
+ }
+
+ if (base == 0) {
+ error_setg(errp, "highmem-mmio-base cannot be 0");
+ return;
+ }
+
+ extended_memmap[VIRT_HIGH_PCIE_MMIO].base = base;
+}
+
static char *virt_get_msi(Object *obj, Error **errp)
{
VirtMachineState *vms = VIRT_MACHINE(obj);
@@ -4285,6 +4337,14 @@ static void virt_machine_class_init(ObjectClass *oc, const void *data)
"Set the high memory region size "
"for PCI MMIO");
+ object_class_property_add(oc, "highmem-mmio-base", "size",
+ virt_get_highmem_mmio_base,
+ virt_set_highmem_mmio_base,
+ NULL, NULL);
+ object_class_property_set_description(oc, "highmem-mmio-base",
+ "Set the high memory region base "
+ "for PCI MMIO");
+
object_class_property_add(oc, "virtio-mmio-transports", "uint8",
virt_get_virtio_transports,
virt_set_virtio_transports,
--
2.34.1
next prev parent reply other threads:[~2026-08-27 0:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 0:40 [RFC PATCH v2 0/5] hw/pci, hw/arm/virt: fixed PCI BAR placement Tushar Dave
2026-08-27 0:40 ` [RFC PATCH v2 1/5] hw/pci: add fixed-bar and pci-bars properties Tushar Dave
2026-08-27 0:40 ` [RFC PATCH v2 2/5] pci: add validation for fixed BAR configuration Tushar Dave
2026-08-27 0:40 ` [RFC PATCH v2 3/5] pci: add fixed BAR fw_cfg blob export Tushar Dave
2026-08-27 0:40 ` [RFC PATCH v2 4/5] hw/arm/virt: export fixed BAR metadata via fw_cfg Tushar Dave
2026-08-27 0:40 ` Tushar Dave [this message]
2026-08-27 7:18 ` [RFC PATCH v2 0/5] hw/pci, hw/arm/virt: fixed PCI BAR placement Gerd Hoffmann
2026-08-27 13:47 ` Alex Williamson
2026-08-27 14:38 ` [edk2-devel] " Ard Biesheuvel
2026-08-28 15:49 ` Tushar Dave
2026-08-31 13:42 ` Gerd Hoffmann
2026-09-01 21:58 ` Tushar Dave
2026-08-31 13:24 ` Gerd Hoffmann
2026-09-01 22:27 ` Tushar Dave
2026-09-02 6:15 ` Gerd Hoffmann
2026-09-02 15:24 ` Alex Williamson
2026-09-03 9:34 ` Gerd Hoffmann
2026-09-02 16:30 ` Tushar Dave
2026-09-03 9:47 ` Gerd Hoffmann
2026-09-04 13:46 ` Tushar Dave
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260827004024.598351-6-tdave@nvidia.com \
--to=tdave@nvidia.com \
--cc=alwilliamson@nvidia.com \
--cc=devel@edk2.groups.io \
--cc=jgg@nvidia.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=skolothumtho@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.