diff options
| author | Mitchel Humpherys <mitchelh@codeaurora.org> | 2015-10-08 15:03:09 -0700 |
|---|---|---|
| committer | Jeevan Shriram <jshriram@codeaurora.org> | 2016-05-20 19:24:00 -0700 |
| commit | 66bd3185331d065428e9279085322ceb8adced85 (patch) | |
| tree | dd99f8f585470a4a725a43f04116d325da17051a /include/linux | |
| parent | d740dc5f65964350fbe1c084b1e752240930110c (diff) | |
iommu: Add DMA mapper for io-pgtable-fast
io-pgtable-fast does some underhanded tricks to achieve performance.
One of those tricks is that it expects clients to call its map function
directly, rather than going through the IOMMU framework. Add a DMA API
implementation that goes through io-pgtable-fast.
CRs-Fixed: 997751
Change-Id: Iebcafeb630d9023f666078604898069e9f26dfdd
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/dma-mapping-fast.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/include/linux/dma-mapping-fast.h b/include/linux/dma-mapping-fast.h new file mode 100644 index 000000000000..ad82efca2153 --- /dev/null +++ b/include/linux/dma-mapping-fast.h @@ -0,0 +1,56 @@ +/* Copyright (c) 2016, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __LINUX_DMA_MAPPING_FAST_H +#define __LINUX_DMA_MAPPING_FAST_H + +#include <linux/iommu.h> +#include <linux/io-pgtable-fast.h> + +struct dma_fast_smmu_mapping { + struct device *dev; + struct iommu_domain *domain; + dma_addr_t base; + size_t size; + size_t num_4k_pages; + + unsigned int bitmap_size; + unsigned long *bitmap; + unsigned long next_start; + unsigned long upcoming_stale_bit; + bool have_stale_tlbs; + + dma_addr_t pgtbl_dma_handle; + av8l_fast_iopte *pgtbl_pmds; + + spinlock_t lock; +}; + +#ifdef CONFIG_IOMMU_IO_PGTABLE_FAST +int fast_smmu_attach_device(struct device *dev, + struct dma_iommu_mapping *mapping); +void fast_smmu_detach_device(struct device *dev, + struct dma_iommu_mapping *mapping); +#else +static inline int fast_smmu_attach_device(struct device *dev, + struct dma_iommu_mapping *mapping) +{ + return -ENODEV; +} + +static inline void fast_smmu_detach_device(struct device *dev, + struct dma_iommu_mapping *mapping) +{ +} +#endif + +#endif /* __LINUX_DMA_MAPPING_FAST_H */ |
