mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-15 16:13:20 +00:00
runtime-rs: Add more fields in VfioDevice to express vfio devices
To support port devices for vfio devices, more fields need to be introduced to help pass port type, bus and other information. Fixes #10361 Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
This commit is contained in:
parent
9356ed59d5
commit
f1796fe9ba
@ -20,7 +20,7 @@ use kata_sys_util::fs::get_base_name;
|
||||
use crate::{
|
||||
device::{
|
||||
pci_path::PciPath,
|
||||
topology::{do_add_pcie_endpoint, PCIeTopology},
|
||||
topology::{do_add_pcie_endpoint, PCIePort, PCIeTopology},
|
||||
util::{do_decrease_count, do_increase_count},
|
||||
Device, DeviceType, PCIeDevice,
|
||||
},
|
||||
@ -223,6 +223,15 @@ pub struct VfioDevice {
|
||||
pub devices: Vec<HostDevice>,
|
||||
// options for vfio pci handler in kata-agent
|
||||
pub device_options: Vec<String>,
|
||||
|
||||
// specifies the PCIe port type to which the device is attached
|
||||
pub port: PCIePort,
|
||||
|
||||
// bus of VFIO PCIe device
|
||||
pub bus: String,
|
||||
|
||||
// Indicated host device allocated or not.
|
||||
pub allocated: bool,
|
||||
}
|
||||
|
||||
impl VfioDevice {
|
||||
@ -245,6 +254,8 @@ impl VfioDevice {
|
||||
config: dev_info.clone(),
|
||||
devices,
|
||||
device_options,
|
||||
allocated: false,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
vfio_device
|
||||
@ -480,6 +491,7 @@ impl Device for VfioDevice {
|
||||
if let DeviceType::Vfio(vfio) = dev {
|
||||
self.config = vfio.config;
|
||||
self.devices = vfio.devices;
|
||||
self.allocated = true;
|
||||
}
|
||||
|
||||
update_pcie_device!(self, pcie_topo)?;
|
||||
|
Loading…
Reference in New Issue
Block a user