Skip to content

Commit 8f76193

Browse files
cuiyunhuiRevySR
authored andcommitted
FROMLIST: riscv: introduce ioremap_wc()
Compared with IO attributes, NC attributes can improve performance, specifically in these aspects: Relaxed Order, Gathering, Supports Read Speculation, Supports Unaligned Access. Signed-off-by: Yunhui Cui <[email protected]> Signed-off-by: Qingfang Deng <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Han Gao <[email protected]>
1 parent 0d6d380 commit 8f76193

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

arch/riscv/include/asm/io.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
#ifdef CONFIG_MMU
2929
#define IO_SPACE_LIMIT (PCI_IO_SIZE - 1)
3030
#define PCI_IOBASE ((void __iomem *)PCI_IO_START)
31+
32+
#define ioremap_wc(addr, size) \
33+
ioremap_prot((addr), (size), __pgprot(_PAGE_KERNEL_NC))
34+
3135
#endif /* CONFIG_MMU */
3236

3337
/*

arch/riscv/include/asm/pgtable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ extern struct pt_alloc_ops pt_ops __meminitdata;
203203

204204
#define PAGE_TABLE __pgprot(_PAGE_TABLE)
205205

206+
#define _PAGE_KERNEL_NC ((_PAGE_KERNEL & ~_PAGE_MTMASK) | _PAGE_NOCACHE)
206207
#define _PAGE_IOREMAP ((_PAGE_KERNEL & ~_PAGE_MTMASK) | _PAGE_IO)
207208
#define PAGE_KERNEL_IO __pgprot(_PAGE_IOREMAP)
208209

0 commit comments

Comments
 (0)