[RFC PATCH v2 06/11] riscv: pgtable: Add DMA_COHERENT with custom PTE attributes

Nick Kossifidis mick at ics.forth.gr
Sun Jun 6 10:22:14 PDT 2021

Στις 2021-06-06 12:04, guoren at kernel.org έγραψε:
> From: Guo Ren <guoren at linux.alibaba.com>
> The dma-noncoherent SOCs need different virtual memory mappings
> with different attributes:
>  - noncached + Strong Order (for IO/DMA descriptor)
>  - noncached + Weak Order (for writecombine usage, eg: frame
>    buffer)
> All above base on PTE attributes by MMU hardware. That means
> address attributes are determined by PTE entry, not PMA. RISC-V
> soc vendors have defined their own custom PTE attributes for
> dma-noncoherency.

This patch violates the Privilege Spec section 4.4.1 that clearly 

"Bits63–54 are reserved for future standard use and must be zeroed by 
software for forward compatibility"

Standard use means that valid values can only be defined by the Priv. 
Spec, not by the vendor (otherwise they'd be marked as "custom use" or 
"platform use"), and since they "must" be zeroed by software we 'll be 
violating the Privilege Spec if we do otherwise.

More information about the linux-riscv mailing list