size_t fdt_size = 0;
int pfdt_size = 0;
libxl_domain_build_info *const info = &d_config->b_info;
- bool iommu_created;
+ bool iommu_needed = false;
unsigned int i;
const libxl_version_info *vers;
if (d_config->num_pcidevs)
FDT( make_vpci_node(gc, fdt, ainfo, dom) );
- iommu_created = false;
for (i = 0; i < d_config->num_disks; i++) {
libxl_device_disk *disk = &d_config->disks[i];
if (disk->specification == LIBXL_DISK_SPECIFICATION_VIRTIO) {
- if (disk->backend_domid != LIBXL_TOOLSTACK_DOMID &&
- !iommu_created) {
- FDT( make_xen_iommu_node(gc, fdt) );
- iommu_created = true;
- }
+ if (disk->backend_domid != LIBXL_TOOLSTACK_DOMID)
+ iommu_needed = true;
FDT( make_virtio_mmio_node(gc, fdt, disk->base, disk->irq,
disk->backend_domid) );
}
}
+ /*
+ * The iommu node should be created only once for all virtio-mmio
+ * devices.
+ */
+ if (iommu_needed)
+ FDT( make_xen_iommu_node(gc, fdt) );
+
if (pfdt)
FDT( copy_partial_fdt(gc, fdt, pfdt) );