Skip to content

video: driver: Add generic PAS TZ API and OP-TEE support - #134

Open
gouravk-qualcomm wants to merge 3 commits into
qualcomm-linux:video.qclinux.mainfrom
gouravk-qualcomm:gouravk-optee
Open

video: driver: Add generic PAS TZ API and OP-TEE support#134
gouravk-qualcomm wants to merge 3 commits into
qualcomm-linux:video.qclinux.mainfrom
gouravk-qualcomm:gouravk-optee

Conversation

@gouravk-qualcomm

@gouravk-qualcomm gouravk-qualcomm commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This PR extends the overlay's existing multi-kernel PAS compatibility
with a 4th variant to stay compatible with both the legacy and the
new generic API and adds the OP-TEE-specific handling needed
once that backend is in use.

Signed-off-by: Gourav Kumar gouravk@qti.qualcomm.com

Comment thread video/Kbuild Outdated

HAS_MDT_PAS_LOAD := $(shell grep -qs 'qcom_mdt_pas_load' $(MDT_LOADER_H) && echo yes || echo no)
HAS_MDT_PAS_LOAD_MEM := $(shell grep -qs 'mem_region.*reloc_base' $(MDT_LOADER_H) && echo yes || echo no)
HAS_QCOM_PAS := $(shell test -f $(QCOM_PAS_H) && echo yes || echo no)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename it to HAS_QCOM_TEE_PAS?
to indicate that TEE_PAS generic driver existence that handles SCM & PTA both.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it makes more comprehensive, updated.

Comment thread driver/vidc/src/firmware.c Outdated

static inline int fw_pas_set_remote_state(bool resume, int pas_id)
{
return qcom_scm_set_remote_state(resume, 0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can fix this bug to pass pas_id. Functionally its working cause the SCM call doesn't consume pas_id.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pgujjula-qcom yes, updated.

Generic PAS TZ API declared in a new linux/firmware/qcom/qcom_pas.h
header (replacing the qcom_scm_pas_* API), so alternate TZ backends
besides QTEE/SCM (e.g. OP-TEE) can be plugged in.

Detect that header the same way the existing HAS_MDT_PAS_LOAD*
probes detect mdt_loader.h capabilities, and set -DHAVE_QCOM_TEE_PAS
ahead of the rest of the ladder so kernels that have it take
priority over the legacy qcom_scm_pas_* variants.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
Generic PAS TZ service allows video firmware loading to work with
multiple TZ implementation backends -- the existing QTEE-based SCM
PAS service, as well as OP-TEE-based PAS service and any further
future TZ backend -- instead of being hardwired to the SCM-only
qcom_scm_pas_* API.

On kernels where the generic API is available (HAVE_QCOM_TEE_PAS),
route firmware load/unload/suspend/resume through qcom_pas_context
and qcom_pas_*. The remote-state call also now passes the video PAS
ID instead of a hardcoded 0, since OP-TEE backends use it for proper
bookkeeping (the SCM backend ignores it either way).

On kernels without the generic API, behavior is unchanged -- the
existing qcom_scm_pas_* code paths are preserved as-is.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
qcom_scm_mem_protect_video_var() is not serviced when PAS is backed
by OP-TEE, since the TEE itself owns secure memory protection in that
configuration -- so its failure there is expected rather than fatal.

On kernels with the generic PAS TZ API (HAVE_QCOM_TEE_PAS), use
qcom_pas_is_tee_backed() to detect that case in fw_load() and only
treat the scm_mem_protect failure as fatal when OP-TEE is not the
active PAS backend.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants