From: Eric Auger <eric.auger@redhat.com>
To: "Matthew R. Ochs" <mochs@nvidia.com>,
qemu-devel@nongnu.org, shameerali.kolothum.thodi@huawei.com,
nathanc@nvidia.com
Cc: qemu-arm@nongnu.org, peter.maydell@linaro.org,
ddutile@redhat.com, nicolinc@nvidia.com, ankita@nvidia.com,
philmd@linaro.org, gshan@redhat.com
Subject: Re: [PATCH v4] hw/arm/virt: Support larger highmem MMIO regions
Date: Thu, 13 Feb 2025 18:12:49 +0100 [thread overview]
Message-ID: <191589e7-69ff-41db-94cd-988c83f623e4@redhat.com> (raw)
In-Reply-To: <20250212145457.1899954-1-mochs@nvidia.com>
On 2/12/25 3:54 PM, Matthew R. Ochs wrote:
> The MMIO region size required to support virtualized environments with
> large PCI BAR regions can exceed the hardcoded limit configured in QEMU.
> For example, a VM with multiple NVIDIA Grace-Hopper GPUs passed through
> requires more MMIO memory than the amount provided by VIRT_HIGH_PCIE_MMIO
> (currently 512GB). Instead of updating VIRT_HIGH_PCIE_MMIO, introduce a
> new parameter, highmem-mmio-size, that specifies the MMIO size required
> to support the VM configuration.
>
> Example usage with 1TB MMIO region size:
> -machine virt,gic-version=3,highmem-mmio-size=1T
>
> Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
> Reviewed-by: Gavin Shan <gshan@redhat.com>
> Reviewed-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com>
> ---
> v4: - Added default size to highmem-mmio-size description
> v3: - Updated highmem-mmio-size description
> v2: - Add unit suffix to example in commit message
> - Use existing "high memory region" terminology
> - Resolve minor braces nit
>
> docs/system/arm/virt.rst | 4 ++++
> hw/arm/virt.c | 38 ++++++++++++++++++++++++++++++++++++++
> 2 files changed, 42 insertions(+)
>
> diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst
> index e67e7f0f7c50..6ff1de1ecbba 100644
> --- a/docs/system/arm/virt.rst
> +++ b/docs/system/arm/virt.rst
> @@ -138,6 +138,10 @@ highmem-mmio
> Set ``on``/``off`` to enable/disable the high memory region for PCI MMIO.
> The default is ``on``.
>
> +highmem-mmio-size
> + Set the high memory region size for PCI MMIO. Must be a power-of-2 and
> + greater than or equal to the default size (512G).
> +
> gic-version
> Specify the version of the Generic Interrupt Controller (GIC) to provide.
> Valid values are:
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 49eb0355ef0c..d8d62df43f04 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -2773,6 +2773,36 @@ static void virt_set_highmem_mmio(Object *obj, bool value, Error **errp)
> vms->highmem_mmio = value;
> }
>
> +static void virt_get_highmem_mmio_size(Object *obj, Visitor *v, const char *name,
> + void *opaque, Error **errp)
> +{
> + uint64_t size = extended_memmap[VIRT_HIGH_PCIE_MMIO].size;
> +
> + visit_type_size(v, name, &size, errp);
> +}
> +
> +static void virt_set_highmem_mmio_size(Object *obj, Visitor *v, const char *name,
> + void *opaque, Error **errp)
> +{
> + uint64_t size;
> +
> + if (!visit_type_size(v, name, &size, errp)) {
> + return;
> + }
> +
> + if (!is_power_of_2(size)) {
> + error_setg(errp, "highmem_mmio_size is not a power-of-2");
> + return;
> + }
> +
> + if (size < extended_memmap[VIRT_HIGH_PCIE_MMIO].size) {
> + error_setg(errp, "highmem_mmio_size is less than the default (%lu)",
> + extended_memmap[VIRT_HIGH_PCIE_MMIO].size);
> + return;
> + }
> +
> + extended_memmap[VIRT_HIGH_PCIE_MMIO].size = size;
> +}
>
> static bool virt_get_its(Object *obj, Error **errp)
> {
> @@ -3446,6 +3476,14 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
> "Set on/off to enable/disable high "
> "memory region for PCI MMIO");
>
> + object_class_property_add(oc, "highmem-mmio-size", "size",
> + virt_get_highmem_mmio_size,
> + virt_set_highmem_mmio_size,
> + NULL, NULL);
> + object_class_property_set_description(oc, "highmem-mmio-size",
> + "Set the high memory region size "
> + "for PCI MMIO");
> +
> object_class_property_add_str(oc, "gic-version", virt_get_gic_version,
> virt_set_gic_version);
> object_class_property_set_description(oc, "gic-version",
Reviewed-by: Eric Auger <eric.auger@redhat.com>
The only nitpick I have is that if you read
static MemMapEntry extended_memmap[] = {
/* Additional 64 MB redist region (can contain up to 512
redistributors) */
[VIRT_HIGH_GIC_REDIST2] = { 0x0, 64 * MiB },
[VIRT_HIGH_PCIE_ECAM] = { 0x0, 256 * MiB },
/* Second PCIe window */
[VIRT_HIGH_PCIE_MMIO] = { 0x0, 512 * GiB },
};
and the above comment, it is not obvious that the HIGH_PCI_MMIO can be
extended by an option. A distracted reader may not get it.
But I don't know if it is worth respinning.
Eric
next prev parent reply other threads:[~2025-02-13 17:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 14:54 [PATCH v4] hw/arm/virt: Support larger highmem MMIO regions Matthew R. Ochs
2025-02-13 17:12 ` Eric Auger [this message]
2025-02-17 15:35 ` Peter Maydell
2025-02-17 15:37 ` Peter Maydell
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=191589e7-69ff-41db-94cd-988c83f623e4@redhat.com \
--to=eric.auger@redhat.com \
--cc=ankita@nvidia.com \
--cc=ddutile@redhat.com \
--cc=gshan@redhat.com \
--cc=mochs@nvidia.com \
--cc=nathanc@nvidia.com \
--cc=nicolinc@nvidia.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=shameerali.kolothum.thodi@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).