On Wed, Oct 01, 2025 at 05:23:47PM -0700, Nathan Chen via Devel wrote:
> Add support for parsing multiple IOMMU devices from
> the VM definition when "smmuv3Dev" is the IOMMU model.
>
> Signed-off-by: Nathan Chen <[email protected]>
> ---
> src/conf/domain_conf.c | 84 +++++++++++++----
> src/conf/domain_conf.h | 9 +-
> src/conf/domain_validate.c | 32 ++++---
> src/conf/schemas/domaincommon.rng | 4 +-
> src/libvirt_private.syms | 2 +
> src/qemu/qemu_alias.c | 15 ++-
> src/qemu/qemu_command.c | 146 ++++++++++++++++--------------
> src/qemu/qemu_domain_address.c | 35 +++----
> src/qemu/qemu_driver.c | 8 +-
> src/qemu/qemu_postparse.c | 11 ++-
> src/qemu/qemu_validate.c | 2 +-
> 11 files changed, 215 insertions(+), 133 deletions(-)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 6d1adb831d..1c2cf9a2d9 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -4134,7 +4134,8 @@ void virDomainDefFree(virDomainDef *def)
> virDomainCryptoDefFree(def->cryptos[i]);
> g_free(def->cryptos);
>
> - virDomainIOMMUDefFree(def->iommu);
> + for (i = 0; i < def->niommus; i++)
> + virDomainIOMMUDefFree(def->iommu[i]);
Also need 'g_free(def->iommu)
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 1d0c94a00a..f830fe5226 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -3297,6 +3297,9 @@ struct _virDomainDef {
> size_t nwatchdogs;
> virDomainWatchdogDef **watchdogs;
>
> + size_t niommus;
> + virDomainIOMMUDef **iommu;
Call that 'iommus' since we tend to use plurals for these
fields.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|