vm-virtio: Add IOMMU support to virtio-blk

Adding virtio feature VIRTIO_F_IOMMU_PLATFORM when explicitly asked by
the user. The need for this feature is to be able to attach the virtio
device to a virtual IOMMU.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2019-10-02 11:18:39 -07:00
committed by Samuel Ortiz
parent 85e1865cb5
commit 9ebb1a55bc
2 changed files with 11 additions and 4 deletions

View File

@@ -580,15 +580,17 @@ impl DeviceManager {
let block = match image_type {
ImageType::Raw => {
let raw_img = vm_virtio::RawFile::new(raw_img);
let dev = vm_virtio::Block::new(raw_img, disk_cfg.path.clone(), false)
.map_err(DeviceManagerError::CreateVirtioBlock)?;
let dev =
vm_virtio::Block::new(raw_img, disk_cfg.path.clone(), false, false)
.map_err(DeviceManagerError::CreateVirtioBlock)?;
Box::new(dev) as Box<dyn vm_virtio::VirtioDevice>
}
ImageType::Qcow2 => {
let qcow_img = QcowFile::from(raw_img)
.map_err(DeviceManagerError::QcowDeviceCreate)?;
let dev = vm_virtio::Block::new(qcow_img, disk_cfg.path.clone(), false)
.map_err(DeviceManagerError::CreateVirtioBlock)?;
let dev =
vm_virtio::Block::new(qcow_img, disk_cfg.path.clone(), false, false)
.map_err(DeviceManagerError::CreateVirtioBlock)?;
Box::new(dev) as Box<dyn vm_virtio::VirtioDevice>
}
};