🛠 Le C906 sous le capot : errata T-Head, OPP 408/1008 MHz, thermique et vector
Objectives
The D1 is a T-Head XuanTie C906 core: RV64IMAFDC + vendor vector extension xtheadvector (pre-RVV 1.0, vlenb=16), sv39 MMU, 32 KB I/D caches, PLIC thead,c900. This core has specificities that the mainline kernel fixes via arch/riscv/errata/thead/errata.c: CPU IDs returned as 0, absence of standard CMO instructions (the kernel uses vendor ops th.dcache.*), PMU erratum, MAE addressing mode, and the speculative GHOSTWRITE vulnerability related to xtheadvector. This advanced tutorial: observe all this from the system, tune the OPPs (408 MHz / 1008 MHz @ 0.9 V), monitor the thermal threshold (85 °C passive, 100 °C critical) and measure the impact of compilation choices on this atypical core.
Hardware
- Lichee RV Dock running a recent mainline image (T-Head errata are in recent kernels; CONFIG_ERRATA_THEAD_*)
- Serial console or SSH;
stress-ng(orstress) for load; heatsink or small fan for thermal tests (512 MB DDR3 in-package, no GPU) - Native riscv64 gcc on the board for micro-benchmarks
Complete code
# 1) Identité CPU — le C906 ment sur ses registres d'identification :
dmesg | grep -iE 'errata|thead|c9'
cat /proc/cpuinfo # uarch « thead,c906 » ; mvendorid/marchid à 0 (errata)
# 2) Fréquence : deux OPP seulement (408 MHz et 1008 MHz @ 0,9 V)
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
echo performance | sudo tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq # ~1008000 kHz en pleine charge
# 3) Thermique : seuils mainline 85 °C (passif/throttle) et 100 °C (critique)
watch -n2 'cat /sys/class/thermal/thermal_zone*/temp' # milli-°C
stress-ng --cpu 1 --timeout 300 & # la fréquence doit baisser près de 85 °C
# 4) Vectoriel : le C906 expose xtheadvector (0.7.1), PAS rvv-1.0 :
# un binaire compilé avec -march=rv64gcv (RVV standard) refusera la
# partie vectorielle ; les toolchains T-Head (XTheadVector) ciblent le 0.7.1.
cat /proc/sys/abi/* 2>/dev/null | head -3
gcc -Q --help=target | grep -i march # ce que le gcc natif accepte
# 5) Benchmark mono-cœur honnête (1 cœur, 512 MB : comparer vos flags)
gcc -O2 -march=rv64imafdc -o bench bench.c && ./bench
gcc -O3 -march=rv64gc -o bench2 bench.c && ./bench2 # éviter -march=rv64gcv ici
Expected verification
dmesg displays lines for applied T-Head errata (CMO/PMU/MAE/GHOSTWRITE depending on the kernel) — proof that the kernel recognizes the C906 despite its IDs being 0. scaling_available_frequencies lists exactly 408 MHz and 1008 MHz; under full load the CPU holds 1008 MHz then drops when the 85 °C passive threshold is reached (visible in the thermal log). A standard -march=...v binary raises an illegal instruction or ignores vector operations: the C906 does not speak RVV 1.0. RAM caps at ~460-500 MB usable (512 MB DDR3 in-package).
Common errors
- Believing the CPU is dead because
mvendorid/marchidare 0: this is the documented erratum for the C9xx, not a defect; the kernel relies on the device tree (thead,c906). - Compiling with
-march=rv64gcv"to take advantage of vector operations": xtheadvector 0.7.1 ≠ RVV 1.0; use a T-Head toolchain or stay scalar. - Expecting a GPU/video: no usable 3D GPU or hardware codec in mainline (CedarX without clear licensing) — HDMI 4Kp30 is display only.
- Monitoring without load: throttling at 85 °C is only visible with prolonged stress-ng; without load testing, the threshold is never validated.
- Comparing performance with ARM boards while forgetting: 1 core, 512 MB, 1 GHz — size services accordingly (no browser, no heavy containers).
Other tutorials for this board
- Premier boot du Lichee RV Dock avec Ubuntu 24.04 RISC-V
- LEDs du Lichee RV Dock : LED verte et RGB WS2812 pilotée par le LEDC du D1
- Audio sur le Dock : enregistrer au micro numérique et jouer sur le haut-parleur 3 W
- Wi-Fi et Bluetooth du module RTL8723DS sur le Lichee RV Dock
- GPIO, touche utilisateur ADC et PWM sur le connecteur 2×20 du Lichee RV
- Tina Linux : l'OpenWrt vendor d'Allwinner pour le Lichee RV, installation et sysconfig
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash