Add the iommu section of LoongArch in OSTD

This commit is contained in:
王英泰 2025-07-08 17:01:23 +08:00 committed by Tate, Hongliang Tian
parent c81ed0162c
commit d3538ec6df
1 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,37 @@
// SPDX-License-Identifier: MPL-2.0
//! The IOMMU support.
use crate::mm::{dma::Daddr, Paddr};
/// An enumeration representing possible errors related to IOMMU.
#[derive(Debug)]
pub(crate) enum IommuError {
/// No IOMMU is available.
NoIommu,
}
///
/// # Safety
///
/// Mapping an incorrect address may lead to a kernel data leak.
pub(crate) unsafe fn map(_daddr: Daddr, _paddr: Paddr) -> Result<(), IommuError> {
Err(IommuError::NoIommu)
}
pub(crate) fn unmap(_daddr: Daddr) -> Result<(), IommuError> {
Err(IommuError::NoIommu)
}
pub(crate) fn init() -> Result<(), IommuError> {
// TODO: We will support IOMMU on LoongArch
Err(IommuError::NoIommu)
}
pub(crate) fn has_dma_remapping() -> bool {
false
}
pub(crate) fn has_interrupt_remapping() -> bool {
false
}