summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2019-02-07 12:59:14 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-23 20:11:26 +0100
commit4e9f8e86d6c781a5098e46b175355f6109a46d72 (patch)
tree9e1b9e5617d1bc78c4c6467cea5e44c28028fee1 /kernel
parenta4eeaa9cc9dadd79369e91b9f8220c4aa0d77098 (diff)
downloadblackbird-obmc-linux-4e9f8e86d6c781a5098e46b175355f6109a46d72.tar.gz
blackbird-obmc-linux-4e9f8e86d6c781a5098e46b175355f6109a46d72.zip
swiotlb: Add is_swiotlb_active() function
commit 492366f7b4237257ef50ca9c431a6a0d50225aca upstream. This function will be used from dma_direct code to determine the maximum segment size of a dma mapping. Cc: stable@vger.kernel.org Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/dma/swiotlb.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 9cb21259cb0b..c873f9cc2146 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -667,3 +667,12 @@ size_t swiotlb_max_mapping_size(struct device *dev)
{
return ((size_t)1 << IO_TLB_SHIFT) * IO_TLB_SEGSIZE;
}
+
+bool is_swiotlb_active(void)
+{
+ /*
+ * When SWIOTLB is initialized, even if io_tlb_start points to physical
+ * address zero, io_tlb_end surely doesn't.
+ */
+ return io_tlb_end != 0;
+}
OpenPOWER on IntegriCloud