diff options
author | Ley Foon Tan <leyfoon.tan@starfivetech.com> | 2023-06-19 10:44:39 +0300 |
---|---|---|
committer | Genevieve Chan <genevieve.chan@starfivetech.com> | 2023-06-22 06:28:12 +0300 |
commit | d633a704f1f49be99c4bc43fb06f2fab508413e9 (patch) | |
tree | 86315f5efb007e786f1bbcf465084630ee8577d1 | |
parent | da348a2762ec72a2882ee911f281c6b3b083a9b8 (diff) | |
download | linux-d633a704f1f49be99c4bc43fb06f2fab508413e9.tar.xz |
riscv: Update arch_sync_dma_for_device() function
Handle different DMA directions.
Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
-rw-r--r-- | arch/riscv/mm/dma-noncoherent.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/riscv/mm/dma-noncoherent.c b/arch/riscv/mm/dma-noncoherent.c index be462267244a..c180632cc172 100644 --- a/arch/riscv/mm/dma-noncoherent.c +++ b/arch/riscv/mm/dma-noncoherent.c @@ -21,7 +21,17 @@ static bool noncoherent_supported = true; void arch_sync_dma_for_device(phys_addr_t paddr, size_t size, enum dma_data_direction dir) { - sbi_cache_flush(paddr, size); + switch (dir) { + case DMA_BIDIRECTIONAL: + case DMA_TO_DEVICE: + sbi_cache_flush(paddr, size); + break; + case DMA_FROM_DEVICE: + sbi_cache_invalidate(paddr, size); + break; + default: + BUG(); + } } void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size, enum dma_data_direction dir) |