vmm: Don't put a VFIO device behind the vIOMMU by default

With some of the factorization that happened to be able to support VFIO
hotplug, one mistake was made. In case a vIOMMU is created through a
virtio-iommu device, and no matter the "iommu" option value from the
VFIO device parameter, the VFIO device was always placed behind the
virtual IOMMU.

This commit fixes this wrong behavior by making sure the device
configuration is taken into account to decide if it should be attached
or not to the virtual IOMMU.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2020-03-11 18:23:11 +01:00
parent 34412c9b41
commit efba48dddb

View File

@ -1591,7 +1591,7 @@ impl DeviceManager {
for device_cfg in device_list_cfg.iter_mut() {
let device_id =
self.add_vfio_device(pci, interrupt_manager, &device_fd, device_cfg)?;
if self.iommu_device.is_some() {
if device_cfg.iommu && self.iommu_device.is_some() {
iommu_attached_device_ids.push(device_id);
}
}