I agree with you. If it is added to the XML file, where should it be placed? I think the following may be OK:
<domain>
  ...
  <maxMemory slots='16' unit='KiB'>1524288</maxMemory>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <below4gMemory unit='GiB'>2</below4gMemory>
  ...
</domain>

Peter Krempa <pkrempa@redhat.com> 于2021年4月21日周三 下午4:46写道:
On Wed, Apr 21, 2021 at 16:25:28 +0800, yezhiyong wrote:
> Limit the amount of ram below 4G. This helps in scenarios like
> GPU passthrough when the GPA used by DMA device is conflict with
> the decode window of a host bridge and the address translation
> request to iommu isn't launched, which causes address overlapping.
> Note that currently this can be triggered by some abnormal behavior
> of hardware.
>
> In the general case, this option needs to be configured when virtual
> machines share the same host, which is why using qemu.conf to support
> per-host configuration.

Is this really something you want to set for EVERY VM all the time,
because it doesn't seem to me to be the case.

If there is any reason not to have this for all VMs it must not be done
via qemu.conf option but rather a XML knob.

> Signed-off-by: yezhiyong <yezhiyong@bytedance.com>
> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> Signed-off-by: zhangruien <zhangruien@bytedance.com>
> ---
>  src/qemu/qemu.conf      | 8 ++++++++
>  src/qemu/qemu_command.c | 4 ++++
>  src/qemu/qemu_conf.c    | 5 +++++
>  src/qemu/qemu_conf.h    | 1 +
>  4 files changed, 18 insertions(+)
>
> diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
> index 8722dc169c..f09c89486e 100644
> --- a/src/qemu/qemu.conf
> +++ b/src/qemu/qemu.conf
> @@ -898,6 +898,14 @@
>  # NOTE: big files will be stored here
>  #memory_backing_dir = "/var/lib/libvirt/qemu/ram"

> +# Limit the amount of ram below 4G. This helps in scenarios like
> +# GPU passthrough when the GPA used by DMA device is comflict with
> +# the decode window of a host bridge and the address translation
> +# request to iommu isn't launched, which causes address overlapping.
> +# Note that currently this can be triggered by some abnormal behavior
> +# of hardware.
> +#max_ram_below_4g = "2G"