diff options
author | Christoph Hellwig <hch@lst.de> | 2018-04-27 08:43:14 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-05-19 08:46:26 +0200 |
commit | 10314e09d044296bc50dec831aa85b3ae1acedf0 (patch) | |
tree | 2d6dd79cb00f3797e5f92afd90589803b64b1842 /arch/riscv/kernel/setup.c | |
parent | f1306f0423ec02a1da31bab34006323fcadf2e06 (diff) | |
download | linux-next-10314e09d044296bc50dec831aa85b3ae1acedf0.tar.gz |
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>
Diffstat (limited to 'arch/riscv/kernel/setup.c')
-rw-r--r-- | arch/riscv/kernel/setup.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index c11f40c1b2a8..ee44a48faf79 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c @@ -29,6 +29,7 @@ #include <linux/of_fdt.h> #include <linux/of_platform.h> #include <linux/sched/task.h> +#include <linux/swiotlb.h> #include <asm/setup.h> #include <asm/sections.h> @@ -206,6 +207,7 @@ void __init setup_arch(char **cmdline_p) setup_bootmem(); paging_init(); unflatten_device_tree(); + swiotlb_init(1); #ifdef CONFIG_SMP setup_smp(); |