Skip to content

arch/tricore: drop iLLD dependency in cache and perf paths - #19783

Open
zyfeier wants to merge 3 commits into
apache:masterfrom
zyfeier:tricore/perf-de-illd
Open

arch/tricore: drop iLLD dependency in cache and perf paths#19783
zyfeier wants to merge 3 commits into
apache:masterfrom
zyfeier:tricore/perf-de-illd

Conversation

@zyfeier

@zyfeier zyfeier commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Remove the Infineon iLLD dependency from the arch/tricore cache and
performance-counter paths, replacing the iLLD intrinsics and register
structures with direct CSR (Core Special Function Register) accesses.

The series contains three commits, kept separate to match the internal
development history:

  1. add tricore_mtcr and tricore_mfcr macros — introduce
    tricore_mtcr() / tricore_mfcr() inline-assembly wrappers for the
    MTCR/MFCR instructions in arch/arch.h, so arch/tricore code can access
    CSRs without the iLLD intrinsics.
  2. cachecode donot depend on illd — replace the iLLD register structures
    (Ifx_CPU_PCON0/1/2, Ifx_CPU_DCON0/1/2) and IfxCpu_cfg.h cache macros
    in tricore_cache.c with tricore_mtcr()/tricore_mfcr() plus locally
    defined PCON/DCON CSR numbers and bit masks. barriers.h UP_ISB() /
    UP_DSB() now emit the isync / dsync instructions directly instead of
    the iLLD __isync() / __dsync() intrinsics.
  3. perf.c donot depend on illd — replace IfxCpu_resetAndStartCounters()
    and IfxCpu_getClockCounter() with direct CCTRL/CCNT CSR accesses.

The CSR register numbers previously pulled in from the iLLD IfxCpu_reg.h
are now defined locally in each file that needs them.

Impact

  • Area: arch/tricore cache and performance-counter paths.
  • Behavior: unchanged.
  • User / build / documentation / security / compatibility: no impact.

Testing

  • Build Host: Linux x86_64, GCC 11.3.1 (tricore-elf-gcc)
  • Target: tricore, triboard_tc4x9_com:nsh

Build (0 errors, ELF produced):

LD: nuttx

Runtime (flashed to TC4x board, boots to NSH):

NuttShell (NSH) NuttX-13.0.0
nsh>

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>
Replace the iLLD register structures (Ifx_CPU_PCON0/1/2, Ifx_CPU_DCON0/1/2)
and the IfxCpu_cfg.h cache-size/line-size macros in the cache path with
direct CSR accesses via tricore_mtcr()/tricore_mfcr() and locally defined
PCON/DCON bit masks.  Also switch __isync()/__dsync() to the UP_ISB()/
UP_DSB() barrier wrappers.

This removes the arch/tricore cache path's dependency on the Infineon
iLLD layer.  No behavior change.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
Replace the iLLD helpers IfxCpu_resetAndStartCounters() and
IfxCpu_getClockCounter() in the performance-counter path with direct
CSR accesses via tricore_mtcr()/tricore_mfcr().

tricore_reset_ccnt() disables the CPU cycle counter (CPU_CCTRL), clears
CPU_CCNT, then re-enables it; up_perf_gettime() reads CPU_CCNT directly.
This removes the arch/tricore perf path's dependency on the Infineon
iLLD layer. No behavior change.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
@github-actions github-actions Bot added Arch: tricore Issues related to the TriCore architecture from Infineon Size: M The size of the change in this PR is medium labels Aug 11, 2026
@github-actions

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: tricore Issues related to the TriCore architecture from Infineon Size: M The size of the change in this PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants