From: Pavel Hrdina Date: Sun, 15 Feb 2026 19:10:50 +0000 (+0100) Subject: qemu_command: Extract building IOMMUFD props to function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f7ad3a8a5f0e453c85f186e811e051ead0f769a;p=thirdparty%2Flibvirt.git qemu_command: Extract building IOMMUFD props to function This will be reused by hotplug code. Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index cdf2f91ece..a742998e4c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5344,6 +5344,21 @@ qemuBuildHostdevCommandLine(virCommand *cmd, } +virJSONValue * +qemuBuildIOMMUFDProps(qemuFDPassDirect *iommufd) +{ + g_autoptr(virJSONValue) props = NULL; + + if (qemuMonitorCreateObjectProps(&props, "iommufd", + "iommufd0", + "S:fd", qemuFDPassDirectGetPath(iommufd), + NULL) < 0) + return NULL; + + return g_steal_pointer(&props); +} + + static int qemuBuildIOMMUFDCommandLine(virCommand *cmd, const virDomainDef *def, @@ -5357,10 +5372,7 @@ qemuBuildIOMMUFDCommandLine(virCommand *cmd, qemuFDPassDirectTransferCommand(priv->iommufd, cmd); - if (qemuMonitorCreateObjectProps(&props, "iommufd", - "iommufd0", - "S:fd", qemuFDPassDirectGetPath(priv->iommufd), - NULL) < 0) + if (!(props = qemuBuildIOMMUFDProps(priv->iommufd))) return -1; if (qemuBuildObjectCommandlineFromJSON(cmd, props) < 0) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index ad068f1f16..028d002ef9 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -190,6 +190,9 @@ int qemuBuildRNGBackendProps(virDomainRNGDef *rng, virJSONValue **props); +virJSONValue * +qemuBuildIOMMUFDProps(qemuFDPassDirect *iommufd); + /* Current, best practice */ virJSONValue * qemuBuildUSBHostdevDevProps(const virDomainDef *def,