OSDN Git Service

riscv: add swiotlb support
authorChristoph Hellwig <hch@lst.de>
Fri, 27 Apr 2018 06:43:14 +0000 (08:43 +0200)
committerChristoph Hellwig <hch@lst.de>
Sat, 19 May 2018 06:46:26 +0000 (08:46 +0200)
commit10314e09d044296bc50dec831aa85b3ae1acedf0
tree2d6dd79cb00f3797e5f92afd90589803b64b1842
parentf1306f0423ec02a1da31bab34006323fcadf2e06
riscv: add swiotlb support

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>
arch/riscv/Kconfig
arch/riscv/include/asm/dma-mapping.h [new file with mode: 0644]
arch/riscv/kernel/setup.c