Commit eeeeaafa authored by Huacai Chen's avatar Huacai Chen
Browse files

LoongArch: Use correct accessor to read FWPC/MWPC



CSR.FWPC and CSR.MWPC are 32bit registers, so use csr_read32() rather
than csr_read64() to read the values of FWPC/MWPC.

Cc: stable@vger.kernel.org
Fixes: edffa33c ("LoongArch: Add hardware breakpoints/watchpoints support")
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 4c8a7c98
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -134,13 +134,13 @@ static inline void hw_breakpoint_thread_switch(struct task_struct *next)
/* Determine number of BRP registers available. */
static inline int get_num_brps(void)
{
	return csr_read64(LOONGARCH_CSR_FWPC) & CSR_FWPC_NUM;
	return csr_read32(LOONGARCH_CSR_FWPC) & CSR_FWPC_NUM;
}

/* Determine number of WRP registers available. */
static inline int get_num_wrps(void)
{
	return csr_read64(LOONGARCH_CSR_MWPC) & CSR_MWPC_NUM;
	return csr_read32(LOONGARCH_CSR_MWPC) & CSR_MWPC_NUM;
}

#endif	/* __KERNEL__ */