Unverified Commit 8d496b5a authored by Alexandre Ghiti's avatar Alexandre Ghiti Committed by Palmer Dabbelt
Browse files

riscv: Add support for Zicbop



Zicbop introduces cache blocks prefetching instructions, add the
necessary support for the kernel to use it in the coming commits.

Co-developed-by: default avatarGuo Ren <guoren@kernel.org>
Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
Tested-by: default avatarAndrea Parri <parri.andrea@gmail.com>
Link: https://lore.kernel.org/r/20250421142441.395849-3-alexghiti@rivosinc.com


Signed-off-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: default avatarPalmer Dabbelt <palmer@dabbelt.com>
parent f0f4e64b
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -842,6 +842,21 @@ config RISCV_ISA_ZICBOZ

	   If you don't know what to do here, say Y.

config RISCV_ISA_ZICBOP
	bool "Zicbop extension support for cache block prefetch"
	depends on MMU
	depends on RISCV_ALTERNATIVE
	default y
	help
	  Adds support to dynamically detect the presence of the ZICBOP
	  extension (Cache Block Prefetch Operations) and enable its
	  usage.

	  The Zicbop extension can be used to prefetch cache blocks for
	  read/write fetch.

	  If you don't know what to do here, say Y.

config TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI
	def_bool y
	# https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=aed44286efa8ae8717a77d94b51ac3614e2ca6dc
+0 −5
Original line number Diff line number Diff line
@@ -14,11 +14,6 @@
#include <asm/cmpxchg.h>
#include <asm/fence.h>

#define nop()		__asm__ __volatile__ ("nop")
#define __nops(n)	".rept	" #n "\nnop\n.endr\n"
#define nops(n)		__asm__ __volatile__ (__nops(n))


/* These barriers need to enforce ordering on both devices or memory. */
#define __mb()		RISCV_FENCE(iorw, iorw)
#define __rmb()		RISCV_FENCE(ir, ir)
+1 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ void flush_icache_mm(struct mm_struct *mm, bool local);

extern unsigned int riscv_cbom_block_size;
extern unsigned int riscv_cboz_block_size;
extern unsigned int riscv_cbop_block_size;
void riscv_init_cbo_blocksizes(void);

#ifdef CONFIG_RISCV_DMA_NONCOHERENT
+1 −0
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@
#define RISCV_ISA_EXT_ZVFBFWMA		96
#define RISCV_ISA_EXT_ZAAMO		97
#define RISCV_ISA_EXT_ZALRSC		98
#define RISCV_ISA_EXT_ZICBOP		99

#define RISCV_ISA_EXT_XLINUXENVCFG	127

+6 −0
Original line number Diff line number Diff line
@@ -263,4 +263,10 @@

#define RISCV_INSN_NOP4	_AC(0x00000013, U)

#ifndef __ASSEMBLY__
#define nop()           __asm__ __volatile__ ("nop")
#define __nops(n)       ".rept  " #n "\nnop\n.endr\n"
#define nops(n)         __asm__ __volatile__ (__nops(n))
#endif

#endif /* __ASM_INSN_DEF_H */
Loading