From 6e0aa56f06908566689af7c41bfea6ede7d57347 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Wed, 18 Sep 2019 07:13:56 -0700 Subject: [PATCH] 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 --- vmm/src/api/openapi/cloud-hypervisor.yaml | 3 +++ vmm/src/config.rs | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/vmm/src/api/openapi/cloud-hypervisor.yaml b/vmm/src/api/openapi/cloud-hypervisor.yaml index 3cbfd1689..b4af1018d 100644 --- a/vmm/src/api/openapi/cloud-hypervisor.yaml +++ b/vmm/src/api/openapi/cloud-hypervisor.yaml @@ -176,6 +176,9 @@ components: $ref: '#/components/schemas/VhostUserBlkConfig' vsock: $ref: '#/components/schemas/VsockConfig' + iommu: + type: boolean + default: false description: Virtual machine configuration CpuConfig: diff --git a/vmm/src/config.rs b/vmm/src/config.rs index c5c889fa0..119b7cd72 100644 --- a/vmm/src/config.rs +++ b/vmm/src/config.rs @@ -669,6 +669,8 @@ pub struct VmConfig { pub vhost_user_net: Option>, pub vhost_user_blk: Option>, pub vsock: Option>, + #[serde(default)] + pub iommu: bool, } impl VmConfig { @@ -677,6 +679,8 @@ impl VmConfig { } pub fn parse(vm_params: VmParams) -> Result { + let iommu = false; + let mut disks: Option> = 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, }) } }