mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-14 15:44:58 +00:00
runtime-rs: Handle PortDevice devices when invoke start_vm with Qemu
Extract PortDevice relevant information, and then invoke different processing methods based on the device type. Fixes #10361 Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
parent
c109328097
commit
07533522b8
@ -5,6 +5,7 @@
|
||||
|
||||
use super::cmdline_generator::{get_network_device, QemuCmdLine, QMP_SOCKET_FILE};
|
||||
use super::qmp::Qmp;
|
||||
use crate::device::topology::PCIePort;
|
||||
use crate::{
|
||||
device::driver::ProtectionDeviceConfig, hypervisor_persist::HypervisorState,
|
||||
utils::enter_netns, HypervisorConfig, MemoryConfig, VcpuThreadIds, VsockDevice,
|
||||
@ -145,6 +146,26 @@ impl QemuInner {
|
||||
}
|
||||
ProtectionDeviceConfig::Se => cmdline.add_se_protection_device(),
|
||||
},
|
||||
DeviceType::PortDevice(port_device) => {
|
||||
let port_type = port_device.config.port_type;
|
||||
let mem_reserve = port_device.config.memsz_reserve;
|
||||
let pref64_reserve = port_device.config.pref64_reserve;
|
||||
let devices_per_port = port_device.port_devices.clone();
|
||||
|
||||
match port_type {
|
||||
PCIePort::RootPort => cmdline.add_pcie_root_ports(
|
||||
devices_per_port,
|
||||
mem_reserve,
|
||||
pref64_reserve,
|
||||
)?,
|
||||
PCIePort::SwitchPort => cmdline.add_pcie_switch_ports(
|
||||
devices_per_port,
|
||||
mem_reserve,
|
||||
pref64_reserve,
|
||||
)?,
|
||||
_ => info!(sl!(), "no need to add {} ports", port_type),
|
||||
}
|
||||
}
|
||||
_ => info!(sl!(), "qemu cmdline: unsupported device: {:?}", device),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user