diff options
author | Christoph Hellwig <hch@lst.de> | 2017-12-23 13:01:41 +0300 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-01-15 11:34:59 +0300 |
commit | cea9d03c822cf1b8e90cc4fc51be6d248fb5d776 (patch) | |
tree | bb10e17d163c6acca0b72d24abb7e79686a58f64 /include | |
parent | 57bf5a8963f80fb3828c46c3e3a5b2dd790e09a7 (diff) | |
download | linux-cea9d03c822cf1b8e90cc4fc51be6d248fb5d776.tar.xz |
dma-mapping: add an arch_dma_supported hook
To implement the x86 forbid_dac and iommu_sac_force we want an arch hook
so that it can apply the global options across all dma_map_ops
implementations.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/dma-mapping.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index d036e78b9ae9..46542ad9d709 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -576,6 +576,14 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) return 0; } +/* + * This is a hack for the legacy x86 forbid_dac and iommu_sac_force. Please + * don't use this is new code. + */ +#ifndef arch_dma_supported +#define arch_dma_supported(dev, mask) (1) +#endif + static inline void dma_check_mask(struct device *dev, u64 mask) { if (sme_active() && (mask < (((u64)sme_get_me_mask() << 1) - 1))) @@ -588,6 +596,9 @@ static inline int dma_supported(struct device *dev, u64 mask) if (!ops) return 0; + if (!arch_dma_supported(dev, mask)) + return 0; + if (!ops->dma_supported) return 1; return ops->dma_supported(dev, mask); |