pub struct IoPageTable<F: IoPageTableFmt> { /* private fields */ }Expand description
Implementations§
Source§impl<F: IoPageTableFmt> IoPageTable<F>
impl<F: IoPageTableFmt> IoPageTable<F>
Sourcepub fn new(
dev: &Device<Bound>,
config: Config,
) -> impl PinInit<Devres<IoPageTable<F>>, Error> + '_
pub fn new( dev: &Device<Bound>, config: Config, ) -> impl PinInit<Devres<IoPageTable<F>>, Error> + '_
Create a new IoPageTable as a device resource.
Sourcepub unsafe fn new_raw(
dev: &Device<Bound>,
config: Config,
) -> Result<IoPageTable<F>>
pub unsafe fn new_raw( dev: &Device<Bound>, config: Config, ) -> Result<IoPageTable<F>>
Create a new IoPageTable.
§Safety
If successful, then the returned IoPageTable must be dropped before the device is
unbound.
Sourcepub fn raw_ops(&self) -> *mut io_pgtable_ops
pub fn raw_ops(&self) -> *mut io_pgtable_ops
Obtain a raw pointer to the underlying struct io_pgtable_ops.
Sourcepub fn raw_pgtable(&self) -> *mut io_pgtable
pub fn raw_pgtable(&self) -> *mut io_pgtable
Obtain a raw pointer to the underlying struct io_pgtable.
Sourcepub fn raw_cfg(&self) -> *mut io_pgtable_cfg
pub fn raw_cfg(&self) -> *mut io_pgtable_cfg
Obtain a raw pointer to the underlying struct io_pgtable_cfg.
Sourcepub unsafe fn map_pages(
&self,
iova: usize,
paddr: PhysAddr,
pgsize: usize,
pgcount: usize,
prot: u32,
flags: Flags,
) -> (usize, Result)
pub unsafe fn map_pages( &self, iova: usize, paddr: PhysAddr, pgsize: usize, pgcount: usize, prot: u32, flags: Flags, ) -> (usize, Result)
Map a physically contiguous range of pages of the same size.
Even if successful, this operation may not map the entire range. In that case, only a
prefix of the range is mapped, and the returned integer indicates its length in bytes. In
this case, the caller will usually call map_pages again for the remaining range.
The returned Result indicates whether an error was encountered while mapping pages.
Note that this may return a non-zero length even if an error was encountered. The caller
will usually unmap the relevant pages on error.
The caller must flush the TLB before using the pgtable to access the newly created mapping.
§Safety
- No other io-pgtable operation may access the range
iova .. iova+pgsize*pgcountwhile thismap_pagesoperation executes. - This page table must not contain any mapping that overlaps with the mapping created by this call.
- If this page table is live, then the caller must ensure that it’s okay to access the physical address being mapped for the duration in which it is mapped.
Sourcepub unsafe fn unmap_pages(
&self,
iova: usize,
pgsize: usize,
pgcount: usize,
) -> usize
pub unsafe fn unmap_pages( &self, iova: usize, pgsize: usize, pgcount: usize, ) -> usize
Unmap a range of virtually contiguous pages of the same size.
This may not unmap the entire range, and returns the length of the unmapped prefix in bytes.
§Safety
- No other io-pgtable operation may access the range
iova .. iova+pgsize*pgcountwhile thisunmap_pagesoperation executes. - This page table must contain one or more consecutive mappings starting at
iovawhose total size ispgcount * pgsize.
Source§impl IoPageTable<ARM64LPAES1>
impl IoPageTable<ARM64LPAES1>
Trait Implementations§
Source§impl<F: IoPageTableFmt> Drop for IoPageTable<F>
impl<F: IoPageTableFmt> Drop for IoPageTable<F>
impl<F: IoPageTableFmt> Send for IoPageTable<F>
impl<F: IoPageTableFmt> Sync for IoPageTable<F>
Auto Trait Implementations§
impl<F> Freeze for IoPageTable<F>
impl<F> RefUnwindSafe for IoPageTable<F>where
F: RefUnwindSafe,
impl<F> Unpin for IoPageTable<F>where
F: Unpin,
impl<F> UnwindSafe for IoPageTable<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
slot. Read more