On a Wednesday in 2025, Nathan Chen via Devel wrote:
Introduce support for "pciBus" driver attribute for "smmuv3" IOMMU model. The "pciBus" attribute indicates the index of the controller that a smmuv3 IOMMU device is attached to, and differentiates the device-pluggable arm-smmuv3 model from the virt-machine-associated smmuv3 model.Signed-off-by: Nathan Chen <[email protected]> --- docs/formatdomain.rst | 4 +++ src/conf/domain_conf.c | 16 +++++++++ src/conf/domain_conf.h | 1 + src/conf/domain_validate.c | 28 +++++++++++++-- src/conf/schemas/domaincommon.rng | 5 +++ src/qemu/qemu_command.c | 58 +++++++++++++++++++++++++++++-- 6 files changed, 106 insertions(+), 6 deletions(-)
Reviewed-by: Ján Tomko <[email protected]> I will squash in the following: diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index cb8bdebf62..5a834ef842 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6241,42 +6241,24 @@ qemuBuildBootCommandLine(virCommand *cmd, static virJSONValue * qemuBuildPCINestedSmmuv3DevProps(const virDomainDef *def, - const virDomainIOMMUDef *iommu, - size_t id) + const virDomainIOMMUDef *iommu) { g_autoptr(virJSONValue) props = NULL; g_autofree char *bus = NULL; - g_autofree char *smmuv3_id = NULL; - size_t i; + virPCIDeviceAddress addr = { .bus = iommu->pci_bus }; - for (i = 0; i < def->ncontrollers; i++) { - virDomainControllerDef *cont = def->controllers[i]; - if (cont->idx == iommu->pci_bus) { - if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) { - const char *alias = cont->info.alias; - - if (!alias) { - return NULL; - } else { - bus = g_strdup(alias); - } - break; - } - } - } + bus = qemuBuildDeviceAddressPCIGetBus(def, &addr); if (!bus) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not find a suitable controller for smmuv3.")); + _("Could not find a suitable controller for smmuv3")); return NULL; } - smmuv3_id = g_strdup_printf("smmuv3.%zu", id); - if (virJSONValueObjectAdd(&props, "s:driver", "arm-smmuv3", "s:primary-bus", bus, - "s:id", smmuv3_id, + "s:id", iommu->info.alias, NULL) < 0) return NULL; @@ -6361,7 +6343,7 @@ qemuBuildIOMMUCommandLine(virCommand *cmd, case VIR_DOMAIN_IOMMU_MODEL_SMMUV3: if (iommu->pci_bus >= 0) { - if (!(props = qemuBuildPCINestedSmmuv3DevProps(def, iommu, i))) + if (!(props = qemuBuildPCINestedSmmuv3DevProps(def, iommu))) return -1; if (qemuBuildDeviceCommandlineFromJSON(cmd, props, def, qemuCaps) < 0) return -1;
signature.asc
Description: PGP signature
