mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: add NVIDIA GPUDirect P2P support
On platforms where PCIe P2P is supported, inject a PCI capability into NVIDIA GPU to indicate support. Signed-off-by: Thomas Barrett <tbarrett@crusoeenergy.com>
This commit is contained in:
committed by
Rob Bradford
parent
05ec6190da
commit
b750c332aa
@@ -1046,7 +1046,9 @@ components:
|
||||
format: int16
|
||||
id:
|
||||
type: string
|
||||
|
||||
x_nv_gpudirect_clique:
|
||||
type: integer
|
||||
format: int8
|
||||
TpmConfig:
|
||||
required:
|
||||
- socket
|
||||
|
||||
@@ -1746,7 +1746,12 @@ impl DeviceConfig {
|
||||
|
||||
pub fn parse(device: &str) -> Result<Self> {
|
||||
let mut parser = OptionParser::new();
|
||||
parser.add("path").add("id").add("iommu").add("pci_segment");
|
||||
parser
|
||||
.add("path")
|
||||
.add("id")
|
||||
.add("iommu")
|
||||
.add("pci_segment")
|
||||
.add("x_nv_gpudirect_clique");
|
||||
parser.parse(device).map_err(Error::ParseDevice)?;
|
||||
|
||||
let path = parser
|
||||
@@ -1763,12 +1768,15 @@ impl DeviceConfig {
|
||||
.convert::<u16>("pci_segment")
|
||||
.map_err(Error::ParseDevice)?
|
||||
.unwrap_or_default();
|
||||
|
||||
let x_nv_gpudirect_clique = parser
|
||||
.convert::<u8>("x_nv_gpudirect_clique")
|
||||
.map_err(Error::ParseDevice)?;
|
||||
Ok(DeviceConfig {
|
||||
path,
|
||||
iommu,
|
||||
id,
|
||||
pci_segment,
|
||||
x_nv_gpudirect_clique,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3324,6 +3332,7 @@ mod tests {
|
||||
id: None,
|
||||
iommu: false,
|
||||
pci_segment: 0,
|
||||
x_nv_gpudirect_clique: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3510,6 +3510,7 @@ impl DeviceManager {
|
||||
pci_device_bdf,
|
||||
Arc::new(move || memory_manager.lock().unwrap().allocate_memory_slot()),
|
||||
vm_migration::snapshot_from_id(self.snapshot.as_ref(), vfio_name.as_str()),
|
||||
device_cfg.x_nv_gpudirect_clique,
|
||||
)
|
||||
.map_err(DeviceManagerError::VfioPciCreate)?;
|
||||
|
||||
|
||||
@@ -434,6 +434,8 @@ pub struct DeviceConfig {
|
||||
pub id: Option<String>,
|
||||
#[serde(default)]
|
||||
pub pci_segment: u16,
|
||||
#[serde(default)]
|
||||
pub x_nv_gpudirect_clique: Option<u8>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
|
||||
|
||||
Reference in New Issue
Block a user