vfio: Rearrange the bus assignemnt

Refactor the bus assignment so that the call to GetAllVFIODevicesFromIOMMUGroup
can be used by any module without affecting the topology.

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
Zvonko Kaiser
2023-05-09 08:46:30 +00:00
parent b1aa8c8a24
commit b5c4677e0e
7 changed files with 13 additions and 23 deletions

View File

@@ -704,14 +704,12 @@ func (q *qemu) CreateVM(ctx context.Context, id string, network Network, hypervi
return err
}
}
if machine.Type == QemuQ35 {
if err := q.createPCIeTopology(&qemuConfig, hypervisorConfig); err != nil {
q.Logger().WithError(err).Errorf("Cannot create PCIe topology")
return err
}
}
q.qemuConfig = qemuConfig
q.virtiofsDaemon, err = q.createVirtiofsDaemon(hypervisorConfig.SharedPath)
@@ -787,12 +785,6 @@ func (q *qemu) createPCIeTopology(qemuConfig *govmmQemu.Config, hypervisorConfig
if drivers.IsPCIeDevice(vfioDevice.BDF) {
numOfPluggablePorts = numOfPluggablePorts + 1
}
// Reset the Rank and AllPCIeDevsthe vfio module is going
// to assign the correct one in the case of hot-plug
if hypervisorConfig.HotPlugVFIO != config.NoPort {
vfioDevice.Rank = -1
drivers.AllPCIeDevs = map[string]bool{}
}
}
}