mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Introduce a PciDeviceCommonConfig struct
Introduce a common struct that can encompass all the config fields used by devices that are PCI based. The use of `skip_serializing_if` means that the iommu field will only be included if set (otherwise falling back to default false). This neatly handles the devices that don't support an iommu. Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -273,6 +273,16 @@ pub struct VirtQueueAffinity {
|
||||
pub host_cpus: Vec<usize>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize, Default)]
|
||||
pub struct PciDeviceCommonConfig {
|
||||
#[serde(default)]
|
||||
pub id: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "<&bool as std::ops::Not>::not")]
|
||||
pub iommu: bool,
|
||||
#[serde(default)]
|
||||
pub pci_segment: u16,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
|
||||
pub struct DiskConfig {
|
||||
pub path: Option<PathBuf>,
|
||||
|
||||
Reference in New Issue
Block a user