From: FUJITA Tomonori Date: Fri, 12 Sep 2008 10:42:33 +0000 (+0900) Subject: iommu: add iommu_device_max_index IOMMU helper function X-Git-Tag: v2.6.28-rc1~712^2^4~43 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=eecfffc154ffbfe70686a9905c090b488778c28e;p=linux-2.6-omap-h63xx.git iommu: add iommu_device_max_index IOMMU helper function This function helps IOMMUs to know the highest address that a device can access to. Signed-off-by: FUJITA Tomonori Signed-off-by: Ingo Molnar --- diff --git a/include/linux/iommu-helper.h b/include/linux/iommu-helper.h index c975caf7538..58f41107e4a 100644 --- a/include/linux/iommu-helper.h +++ b/include/linux/iommu-helper.h @@ -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);