vmm: Add iommu field to the VmConfig

Adding a simple iommu boolean field to the VmConfig structure so that we
can later use it to create a virtio-iommu device for the current VM.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2019-09-18 07:13:56 -07:00 committed by Samuel Ortiz
parent 03352f45f9
commit 6e0aa56f06
2 changed files with 8 additions and 0 deletions

View File

@ -176,6 +176,9 @@ components:
$ref: '#/components/schemas/VhostUserBlkConfig'
vsock:
$ref: '#/components/schemas/VsockConfig'
iommu:
type: boolean
default: false
description: Virtual machine configuration
CpuConfig:

View File

@ -669,6 +669,8 @@ pub struct VmConfig {
pub vhost_user_net: Option<Vec<VhostUserNetConfig>>,
pub vhost_user_blk: Option<Vec<VhostUserBlkConfig>>,
pub vsock: Option<Vec<VsockConfig>>,
#[serde(default)]
pub iommu: bool,
}
impl VmConfig {
@ -677,6 +679,8 @@ impl VmConfig {
}
pub fn parse(vm_params: VmParams) -> Result<Self> {
let iommu = false;
let mut disks: Option<Vec<DiskConfig>> = None;
if let Some(disk_list) = &vm_params.disks {
let mut disk_config_list = Vec::new();
@ -778,6 +782,7 @@ impl VmConfig {
vhost_user_net,
vhost_user_blk,
vsock,
iommu,
})
}
}