mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Introduce option --platform iommufd=on|off
This option allows user to configure VFIO device pass-through with iommufd (e.g. vfio cdev mode) or not (e.g. vfio legacy mode). Signed-off-by: Bo Chen <bchen@crusoe.ai>
This commit is contained in:
@@ -794,6 +794,9 @@ components:
|
|||||||
sev_snp:
|
sev_snp:
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
|
iommufd:
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
MemoryZoneConfig:
|
MemoryZoneConfig:
|
||||||
required:
|
required:
|
||||||
|
|||||||
@@ -804,7 +804,7 @@ impl PlatformConfig {
|
|||||||
let mut syntax = "Platform configuration parameters \
|
let mut syntax = "Platform configuration parameters \
|
||||||
\"num_pci_segments=<num_pci_segments>,iommu_segments=<list_of_segments>,\
|
\"num_pci_segments=<num_pci_segments>,iommu_segments=<list_of_segments>,\
|
||||||
iommu_address_width=<bits>,serial_number=<dmi_device_serial_number>,\
|
iommu_address_width=<bits>,serial_number=<dmi_device_serial_number>,\
|
||||||
uuid=<dmi_device_uuid>,oem_strings=<list_of_strings>"
|
uuid=<dmi_device_uuid>,oem_strings=<list_of_strings>,iommufd=on|off"
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
if cfg!(feature = "tdx") {
|
if cfg!(feature = "tdx") {
|
||||||
@@ -831,7 +831,8 @@ impl PlatformConfig {
|
|||||||
.add("iommu_address_width")
|
.add("iommu_address_width")
|
||||||
.add("serial_number")
|
.add("serial_number")
|
||||||
.add("uuid")
|
.add("uuid")
|
||||||
.add("oem_strings");
|
.add("oem_strings")
|
||||||
|
.add("iommufd");
|
||||||
#[cfg(feature = "tdx")]
|
#[cfg(feature = "tdx")]
|
||||||
parser.add("tdx");
|
parser.add("tdx");
|
||||||
#[cfg(feature = "sev_snp")]
|
#[cfg(feature = "sev_snp")]
|
||||||
@@ -858,6 +859,11 @@ impl PlatformConfig {
|
|||||||
.convert::<StringList>("oem_strings")
|
.convert::<StringList>("oem_strings")
|
||||||
.map_err(Error::ParsePlatform)?
|
.map_err(Error::ParsePlatform)?
|
||||||
.map(|v| v.0);
|
.map(|v| v.0);
|
||||||
|
let iommufd = parser
|
||||||
|
.convert::<Toggle>("iommufd")
|
||||||
|
.map_err(Error::ParsePlatform)?
|
||||||
|
.unwrap_or(Toggle(false))
|
||||||
|
.0;
|
||||||
#[cfg(feature = "tdx")]
|
#[cfg(feature = "tdx")]
|
||||||
let tdx = parser
|
let tdx = parser
|
||||||
.convert::<Toggle>("tdx")
|
.convert::<Toggle>("tdx")
|
||||||
@@ -877,6 +883,7 @@ impl PlatformConfig {
|
|||||||
serial_number,
|
serial_number,
|
||||||
uuid,
|
uuid,
|
||||||
oem_strings,
|
oem_strings,
|
||||||
|
iommufd,
|
||||||
#[cfg(feature = "tdx")]
|
#[cfg(feature = "tdx")]
|
||||||
tdx,
|
tdx,
|
||||||
#[cfg(feature = "sev_snp")]
|
#[cfg(feature = "sev_snp")]
|
||||||
@@ -4824,6 +4831,7 @@ id=\"{id}\",pci_segment={pci_segment},queue_sizes={queue_sizes}"
|
|||||||
serial_number: None,
|
serial_number: None,
|
||||||
uuid: None,
|
uuid: None,
|
||||||
oem_strings: None,
|
oem_strings: None,
|
||||||
|
iommufd: false,
|
||||||
#[cfg(feature = "tdx")]
|
#[cfg(feature = "tdx")]
|
||||||
tdx: false,
|
tdx: false,
|
||||||
#[cfg(feature = "sev_snp")]
|
#[cfg(feature = "sev_snp")]
|
||||||
|
|||||||
@@ -133,6 +133,8 @@ pub struct PlatformConfig {
|
|||||||
#[cfg(feature = "sev_snp")]
|
#[cfg(feature = "sev_snp")]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub sev_snp: bool,
|
pub sev_snp: bool,
|
||||||
|
#[serde(default)]
|
||||||
|
pub iommufd: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const DEFAULT_PCI_SEGMENT_APERTURE_WEIGHT: u32 = 1;
|
pub const DEFAULT_PCI_SEGMENT_APERTURE_WEIGHT: u32 = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user