Commit 3a8ee3a9 authored by Yunhui Cui's avatar Yunhui Cui Committed by Paul Walmsley
Browse files

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: default avatarYunhui Cui <cuiyunhui@bytedance.com>
Signed-off-by: default avatarQingfang Deng <qingfang.deng@siflower.com.cn>
Reviewed-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20250722091504.45974-2-cuiyunhui@bytedance.com


Signed-off-by: default avatarPaul Walmsley <pjw@kernel.org>
parent a03ee11b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -28,6 +28,10 @@
#ifdef CONFIG_MMU
#define IO_SPACE_LIMIT		(PCI_IO_SIZE - 1)
#define PCI_IOBASE		((void __iomem *)PCI_IO_START)

#define ioremap_wc(addr, size)	\
	ioremap_prot((addr), (size), __pgprot(_PAGE_KERNEL_NC))

#endif /* CONFIG_MMU */

/*
+1 −0
Original line number Diff line number Diff line
@@ -203,6 +203,7 @@ extern struct pt_alloc_ops pt_ops __meminitdata;

#define PAGE_TABLE		__pgprot(_PAGE_TABLE)

#define _PAGE_KERNEL_NC ((_PAGE_KERNEL & ~_PAGE_MTMASK) | _PAGE_NOCACHE)
#define _PAGE_IOREMAP	((_PAGE_KERNEL & ~_PAGE_MTMASK) | _PAGE_IO)
#define PAGE_KERNEL_IO		__pgprot(_PAGE_IOREMAP)