arch/tricore: add tricore_mtcr and tricore_mfcr macros

Add tricore_mtcr()/tricore_mfcr() inline-assembly wrappers for the
MTCR/MFCR (move to/from Core Special Function Register) instructions.
These let arch/tricore code access CSRs directly without relying on the
Infineon iLLD intrinsics, and are used by the following iLLD-removal
change in the performance-counter path.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
This commit is contained in:
zhangyu117
2026-08-13 20:10:55 +08:00
committed by Xiang Xiao
parent 2688f948c7
commit 46618bb25b
+14
View File
@@ -42,6 +42,20 @@
* Pre-processor Definitions
****************************************************************************/
/* MTCR and MFCR - move to / from Core Special Function Register */
#define tricore_mtcr(reg, val) \
({ \
__asm__ volatile ("mtcr %0,%1\n\t"::"i"(reg),"d"(val):"memory"); \
})
#define tricore_mfcr(reg) \
({ \
uint32_t __val; \
__asm__ volatile ("mfcr %0,%1": "=d" (__val) :"i"(reg): "memory"); \
__val; \
})
/****************************************************************************
* Public Types
****************************************************************************/