Skip to content

Commit ca525d5

Browse files
avpatelPaul Walmsley
authored andcommitted
RISC-V: Define pgprot_dmacoherent() for non-coherent devices
The pgprot_dmacoherent() is used when allocating memory for non-coherent devices and by default pgprot_dmacoherent() is same as pgprot_noncached() unless architecture overrides it. Currently, there is no pgprot_dmacoherent() definition for RISC-V hence non-coherent device memory is being mapped as IO thereby making CPU access to such memory slow. Define pgprot_dmacoherent() to be same as pgprot_writecombine() for RISC-V so that CPU access non-coherent device memory as NOCACHE which is better than accessing it as IO. Fixes: ff689fd ("riscv: add RISC-V Svpbmt extension support") Signed-off-by: Anup Patel <[email protected]> Tested-by: Han Gao <[email protected]> Tested-by: Guo Ren (Alibaba DAMO Academy) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paul Walmsley <[email protected]>
1 parent fe69107 commit ca525d5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/riscv/include/asm/pgtable.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,8 @@ static inline pgprot_t pgprot_writecombine(pgprot_t _prot)
654654
return __pgprot(prot);
655655
}
656656

657+
#define pgprot_dmacoherent pgprot_writecombine
658+
657659
/*
658660
* Both Svade and Svadu control the hardware behavior when the PTE A/D bits need to be set. By
659661
* default the M-mode firmware enables the hardware updating scheme when only Svadu is present in

0 commit comments

Comments
 (0)