Skip to content

Commit

Permalink
iommu: add iommu_device_max_index IOMMU helper function
Browse files Browse the repository at this point in the history
This function helps IOMMUs to know the highest address that a device
can access to.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
FUJITA Tomonori authored and Ingo Molnar committed Sep 14, 2008
1 parent 6e03f99 commit eecfffc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions include/linux/iommu-helper.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
static inline unsigned long iommu_device_max_index(unsigned long size,
unsigned long offset,
u64 dma_mask)
{
if (size + offset > dma_mask)
return dma_mask - offset + 1;
else
return size;
}

extern int iommu_is_span_boundary(unsigned int index, unsigned int nr,
unsigned long shift,
unsigned long boundary_size);
Expand Down

0 comments on commit eecfffc

Please sign in to comment.