mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 16:09:57 +07:00
10314e09d0
All RISC-V platforms today lack an IOMMU. However, legacy PCI devices sometimes require DMA-memory to be in the low 32 bits. To make this work, we enable the software-based bounce buffers from swiotlb. They only impose overhead when the device in question cannot address the full 64-bit address space, so a perfect fit. This patch assumes that DMA is coherent with the processor and the PCI bus. It also assumes that the processor and devices share a common address space. This is true for all RISC-V platforms so far. [changelog stolen from an earlier patch by Palmer Dabbelt that did the more complicated swiotlb wireup before the recent consolidation] Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
16 lines
373 B
C
16 lines
373 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef _RISCV_ASM_DMA_MAPPING_H
|
|
#define _RISCV_ASM_DMA_MAPPING_H 1
|
|
|
|
#ifdef CONFIG_SWIOTLB
|
|
#include <linux/swiotlb.h>
|
|
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
|
|
{
|
|
return &swiotlb_dma_ops;
|
|
}
|
|
#else
|
|
#include <asm-generic/dma-mapping.h>
|
|
#endif /* CONFIG_SWIOTLB */
|
|
|
|
#endif /* _RISCV_ASM_DMA_MAPPING_H */
|