Re: [PATCH 03/11] media: amlogic: vdec: fix the microcode loading and prepare the HEVC core

From: Krzysztof Kozlowski

Date: Fri Oct 30 2026 - 07:34:34 EST


On Sun, Oct 25, 2026 at 08:24:59PM +0100, christian.koever-draxl@xxxxxxxxxxxxxxxxxx wrote:
> From: Christian Stefan Kövér-Draxl <ckoever@xxxxxxxxxx>
>
> The secure world rejected every microcode this driver handed over: the
> images carry a 256-byte signature header that has to stay attached, and
> the TEE only accepts loads once it has been told that boot is complete.
> Pass the whole image with the signature size, issue SYS_BOOT_COMPLETE
> before the first load, and keep probing when the preload fails because
> the secure world may already hold the microcode.
>
> Add what the HEVC core needs before codecs can use it: its power domain
> and clock handling, the reset and memory-power sequence used when the
> core switches between microcodes, and the per-codec hooks in the
> request path.
>
> Load a microcode into the HEVC core only when it is not already there.
> A browser opens a new decoder context for every seek, quality switch or
> advert; loading the image again for each of them makes the secure loader
> answer TEEC_ERROR_BAD_STATE after a few hundred loads, and it stays that
> way until the board is power cycled. The image survives in the core
> until the core memories are cycled on a codec switch or after a timeout.
>
> Signed-off-by: Christian Stefan Kövér-Draxl <ckoever@xxxxxxxxxx>
> ---
> drivers/media/platform/amlogic/vdec/Makefile | 2 +-
> .../media/platform/amlogic/vdec/aml_vdec.c | 72 ++++++-
> .../platform/amlogic/vdec/aml_vdec_drv.h | 21 +++
> .../media/platform/amlogic/vdec/aml_vdec_hw.c | 176 +++++++++++++++++-
> .../media/platform/amlogic/vdec/aml_vdec_hw.h | 64 +++++++
> .../platform/amlogic/vdec/aml_vdec_platform.c | 27 ++-
> .../platform/amlogic/vdec/aml_vdec_tee_fw.c | 87 ++++++++-
> .../media/platform/amlogic/vdec/reg_defines.h | 24 +++
> 8 files changed, 443 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/media/platform/amlogic/vdec/Makefile b/drivers/media/platform/amlogic/vdec/Makefile
> index f752716cbf9e..f9c35e9ac902 100644
> --- a/drivers/media/platform/amlogic/vdec/Makefile
> +++ b/drivers/media/platform/amlogic/vdec/Makefile
> @@ -1,4 +1,4 @@
> # SPDX-License-Identifier: GPL-2.0-only
> -aml-vdec-drv-objs := aml_vdec.o aml_vdec_drv.o aml_vdec_hw.o aml_vdec_platform.o h264.o aml_vdec_tee_fw.o\
> +aml-vdec-drv-objs := aml_vdec.o aml_vdec_drv.o aml_vdec_hw.o aml_vdec_platform.o h264.o aml_vdec_tee_fw.o

Why can't you just comment that original patch has issues?

Best regards,
Krzysztof