MT8189 SCP firmware: single-core HEVC INIT clears 256 KiB past h265_dec_srv_param and crashes the SCP
Selim Awn
selimawn at ik.me
Sat Nov 14 05:59:51 PST 2026
Hi,
On MT8189 (ASUS Chromebook "Tarkin"), opening a stateless HEVC decoder
crashes the SCP every time. I believe this is a bug in the SCP
firmware.
Setup:
- Kernel: chromeos-6.6 based, 6.6.147, mtk-vcodec-dec stateless,
mtk_vdec_single_core_pdata (MTK_VDEC_PURE_SINGLE_CORE)
- Firmware: linux-firmware mediatek/mt8189/scp.img, "9a0dfa3 Aug 4
2025", sha256
7b1d56bfe34db620be411e72a56b5bdc981e88fce5664b73a5d270ae9d821f23
- The ChromeOS SCP image "e3c0782 Jan 30 2026" has the same code and
constants, so it should be affected too (checked by disassembly only)
Symptom: the AP_IPIMSG_DEC_INIT (0xA000) for 'S265' on IPI 14 is never
acked. "SCP watchdog timeout! 0x0" fires within milliseconds, then
"scp ipi 14 ack time out" appears and remoteproc reloads scp.img.
Cause, from the firmware's symbols/DWARF (vdec_h265_sig_srv.c,
vdec_com_h265.c, vdec_h265_psr.c):
- h265_dec_srv_param is at 0x73d6b8, size 0x221398, ending at
0x95ea50.
- INIT places the instance at offset 0xfc30 (0x74d2e8).
h265_init_instance_ctx() puts three areas after it, back to back: the
instance (0x2558), buf1 at 0x74f840 (0x20f210, ending exactly at
0x95ea50) and buf2 at 0x95ea80.
- vdec_h265_init_rom() then does memset(buf2, 0, 0x3fff0), up to
0x99ea70. This clears hw_param, hal_param, default_frame_context_bin,
dcq/acq_lookup, h264_dec_param, h264_comhal_bsops, venc_vsi,
venc_drv_inst, venc_h264_func, the venc RC/reference tables, and then
runs past __dram_end (0x98b000).
- In short, the object is 0x40000 bytes too small for its own layout.
How I verified it (read-only on the firmware side):
1. Set remoteproc recovery to disabled.
2. Sent one HEVC INIT.
3. After the crash, read the SCP DRAM (phys 0x50000000 = SCP 0x700000)
through /dev/mem.
4. Set recovery back to enabled.
Result: the buf2 pointer was 0x95ea80, and default_frame_context_bin,
dcq_lookup, h264_comhal_bsops and venc_h264_func were all zero (they
were non-zero before).
To reproduce: on an unpatched kernel, open an HEVC_SLICE context on
the decoder node, e.g. ffmpeg -hwaccel vaapi with libva-v4l2_request
on any HEVC clip.
Kernel side: vdec_hevc_req_multi_if only implements LAT + core, and
its decode() rejects MTK_VDEC_PURE_SINGLE_CORE, in chromeos-6.6 and in
mainline. The format is still offered because the firmware sets
MTK_VDEC_FORMAT_HEVC_FRAME (dec_capability 0xc1520). Locally I now
skip HEVC_SLICE on pure single core and return -EOPNOTSUPP in
vdec_hevc_slice_init() before any IPI is sent. I can post that if it
is useful.
Questions:
1. Can you confirm the overrun and fix the firmware (grow
h265_dec_srv_param or move buf2)?
2. Is single-core HEVC (vdec_h265_sig_srv) meant to be supported on
MT8189? If so, is a kernel single-core backend planned, or what
VSI/IPI flow should it follow? If not, should the firmware stop
setting the HEVC capability bit?
3. Can you confirm that the MT8189 SCP firmware has no AV1 decoder?
vdec_msg_handler only dispatches VP9F/S265/S264, and the AV1
capability bit (0x800) is not set.
Thanks,
Selim
More information about the Linux-mediatek
mailing list