mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-16 06:18:58 +00:00
runtime-rs: support iommu_platform for qemu vhost-vsock device
iommu_platform addition is controlled solely by the configuration file. Signed-off-by: Pavel Mores <pmores@redhat.com>
This commit is contained in:
@@ -823,6 +823,7 @@ struct VhostVsock {
|
||||
vhostfd: tokio::fs::File,
|
||||
guest_cid: u32,
|
||||
disable_modern: bool,
|
||||
iommu_platform: bool,
|
||||
}
|
||||
|
||||
impl VhostVsock {
|
||||
@@ -832,6 +833,7 @@ impl VhostVsock {
|
||||
vhostfd,
|
||||
guest_cid,
|
||||
disable_modern: false,
|
||||
iommu_platform: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -839,6 +841,11 @@ impl VhostVsock {
|
||||
self.disable_modern = disable_modern;
|
||||
self
|
||||
}
|
||||
|
||||
fn set_iommu_platform(&mut self, iommu_platform: bool) -> &mut Self {
|
||||
self.iommu_platform = iommu_platform;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
@@ -849,6 +856,9 @@ impl ToQemuParams for VhostVsock {
|
||||
if self.disable_modern {
|
||||
params.push("disable-modern=true".to_owned());
|
||||
}
|
||||
if self.iommu_platform {
|
||||
params.push("iommu_platform=on".to_owned());
|
||||
}
|
||||
params.push(format!("vhostfd={}", self.vhostfd.as_raw_fd()));
|
||||
params.push(format!("guest-cid={}", self.guest_cid));
|
||||
|
||||
@@ -1282,6 +1292,10 @@ impl<'a> QemuCmdLine<'a> {
|
||||
vhost_vsock_pci.set_disable_modern(true);
|
||||
}
|
||||
|
||||
if self.config.device_info.enable_iommu_platform {
|
||||
vhost_vsock_pci.set_iommu_platform(true);
|
||||
}
|
||||
|
||||
self.devices.push(Box::new(vhost_vsock_pci));
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user