linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH V3 0/2] riscv: add RISC-V Svpbmt Standard Extension supports
@ 2021-10-25  4:06 wefu
  2021-10-25  4:06 ` [RESEND PATCH V3 1/2] dt-bindings: riscv: add mmu-supports-svpbmt for Svpbmt wefu
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: wefu @ 2021-10-25  4:06 UTC (permalink / raw)
  To: anup.patel, atish.patra, palmerdabbelt, guoren,
	christoph.muellner, philipp.tomsich, hch, liush, wefu,
	lazyparser, drew
  Cc: linux-riscv, linux-kernel, taiten.peng, aniket.ponkshe,
	heinrich.schuchardt, gordan.markus, guoren, arnd, wens, maxime,
	dlustig, gfavor, andrea.mondelli, behrensj, xinhaoqu, huffman,
	mick, allen.baum, jscheid, rtrauben

From: Fu Wei <wefu@redhat.com>

This patch follows the  RISC-V standard Svpbmt extension in 
privilege spec to solve the non-coherent SOC DMA synchronization
issues.

The svpbmt PTE format:
| 63 | 62-61 | 60-8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
  N     MT     RSW    D   A   G   U   X   W   R   V
        ^

Of the Reserved bits [63:54] in a leaf PTE, the bits [62:61] are used as
the MT (aka MemType) field. This field specifies one of three memory types
as shown in the following table:
MemType     RISC-V Description
----------  ------------------------------------------------
00 - PMA    Normal Cacheable, No change to implied PMA memory type
01 - NC     Non-cacheable, idempotent, weakly-ordered Main Memory
10 - IO     Non-cacheable, non-idempotent, strongly-ordered I/O memory
11 - Rsvd   Reserved for future standard use

The standard protection_map[] needn't be modified because the "PMA"
type keeps the highest bits zero.
And the whole modification is limited in the arch/riscv/* and using
a global variable(__riscv_svpbmt) as _PAGE_DMA_MASK/IO/NC for
pgprot_noncached (&writecombine) in pgtable.h.
We also add _PAGE_CHG_MASK to filter PFN than before.

Enable it in devicetree - (Add "mmu-supports-svpbmt" in cpu node)
 - mmu-supports-svpbmt

Wei Fu (2):
  dt-bindings: riscv: add mmu-supports-svpbmt for Svpbmt
  riscv: add RISC-V Svpbmt extension supports

 .../devicetree/bindings/riscv/cpus.yaml       |  5 +++
 arch/riscv/include/asm/fixmap.h               |  2 +-
 arch/riscv/include/asm/pgtable-64.h           |  8 ++--
 arch/riscv/include/asm/pgtable-bits.h         | 41 ++++++++++++++++++-
 arch/riscv/include/asm/pgtable.h              | 39 ++++++++++++++----
 arch/riscv/kernel/cpufeature.c                | 32 +++++++++++++++
 arch/riscv/mm/init.c                          |  5 +++
 7 files changed, 117 insertions(+), 15 deletions(-)

-- 
2.25.4


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2021-11-26 16:25 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-25  4:06 [RESEND PATCH V3 0/2] riscv: add RISC-V Svpbmt Standard Extension supports wefu
2021-10-25  4:06 ` [RESEND PATCH V3 1/2] dt-bindings: riscv: add mmu-supports-svpbmt for Svpbmt wefu
2021-10-25  4:17   ` Anup Patel
2021-10-25  6:00     ` Guo Ren
2021-10-25  6:08       ` Anup Patel
2021-10-25 13:21         ` Philipp Tomsich
2021-10-25  6:09   ` Guo Ren
2021-10-25  4:06 ` [RESEND PATCH V3 2/2] riscv: add RISC-V Svpbmt extension supports wefu
2021-10-25  6:55   ` Christoph Hellwig
2021-10-25 10:55     ` Wei Fu
2021-11-02  6:07       ` Christoph Hellwig
2021-11-07  7:23         ` Wei Fu
2021-10-25 14:49     ` Wei Fu
2021-11-02  6:04       ` Christoph Hellwig
2021-11-07  6:54         ` Wei Fu
2021-10-27  0:12 ` [RESEND PATCH V3 0/2] riscv: add RISC-V Svpbmt Standard Extension supports Palmer Dabbelt
2021-10-27  7:54   ` Heinrich Schuchardt
2021-11-02  2:07   ` Guo Ren
2021-11-02  5:58     ` Christoph Hellwig
2021-11-02  8:51       ` Guo Ren
2021-11-07  7:12         ` Wei Fu
2021-11-08  7:52           ` Christoph Hellwig
2021-11-26 16:23             ` Wei Fu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).