Handle TDX MMIO and DMA direct

This commit is contained in:
Hsy-Intel
2024-03-11 14:02:42 +08:00
committed by Tate, Hongliang Tian
parent 461c872c43
commit 37c3a7a48c
18 changed files with 720 additions and 55 deletions

View File

@ -18,16 +18,10 @@ use crate::{arch::iommu::has_iommu, config::PAGE_SIZE, sync::SpinLock};
/// the address space used by device side.
pub type Daddr = usize;
fn has_tdx() -> bool {
// FIXME: Support TDX
false
}
#[derive(PartialEq)]
pub enum DmaType {
Direct,
Iommu,
Tdx,
}
#[derive(Debug)]
@ -48,10 +42,8 @@ static DMA_MAPPING_SET: Once<SpinLock<BTreeSet<Paddr>>> = Once::new();
pub fn dma_type() -> DmaType {
if has_iommu() {
DmaType::Iommu
} else if has_tdx() {
return DmaType::Tdx;
} else {
return DmaType::Direct;
DmaType::Direct
}
}