Skip to content

media: iris: Platform data refactoring, new platform support and Gen2 firmware autodetect#1226

Open
gouravk-qualcomm wants to merge 63 commits into
qualcomm-linux:tech/mm/videofrom
gouravk-qualcomm:cleanup
Open

media: iris: Platform data refactoring, new platform support and Gen2 firmware autodetect#1226
gouravk-qualcomm wants to merge 63 commits into
qualcomm-linux:tech/mm/videofrom
gouravk-qualcomm:cleanup

Conversation

@gouravk-qualcomm
Copy link
Copy Markdown

Integrates following changes to Iris video driver:

  • Cleans up UBWC configuration,
  • refactors platform data, and splits firmware descriptors from raw platform data.
  • Adds support for new SoCs - Kaanapali, X1P42100, and Glymur
  • Secure PAS/IOMMU support
  • Gen2 firmware autodetection with Gen1 fallback.
  • context bank infrastructure needed to enable these features on SM8550-family platforms.

CRs-Fixed: 4496236 , 4521169

This reverts commit 03baa6b.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…re platforms"

This reverts commit 97f393d.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
This reverts commit 428f036.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…vs index"

This reverts commit 36925cc.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…o use vcodec prefix"

This reverts commit 43f8008.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
This reverts commit a39682c.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
This reverts commit 2119eda.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…2100"

This reverts commit eb72f02.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
This reverts commit 4224b95.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
This reverts commit 10f101b.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…e data"

This reverts commit 2cb6e86.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…tform data"

This reverts commit 123d5ea.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…m platform data"

This reverts commit a40da67.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…s_ops"

This reverts commit f4ae977.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…ommand_ops"

This reverts commit a6625a0.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…ops"

This reverts commit c118090.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…n gen2-specific code"

This reverts commit 3ba6edc.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…function"

This reverts commit f7c099d.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…rm_data struct"

This reverts commit 61333e4.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
This reverts commit f4c1c6e.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
This reverts commit bf97a5b.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…_devs"

This reverts commit 9bfd102.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…d in frequency formula"

This reverts commit 573b0f8.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
This reverts commit 46f670f.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
This reverts commit fe0cd11.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…anaged by Linux"

This reverts commit fb6622c.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
This reverts commit 1a7aeec.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
lumag added 2 commits May 25, 2026 10:42
Specifying UBWC data in each driver doesn't scale and is prone to
errors. Request UBWC data from the central database in preparation to
using it through the rest of the driver.

Link: https://lore.kernel.org/linux-media/20260507-iris-ubwc-v5-1-e9a3aee53c49@oss.qualcomm.com/
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Tested-by: Wangao Wang <wangao.wang@oss.qualcomm.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
The min_acc length can be calculated from the platform UBWC
configuration. Use the freshly introduced helper and calculate min_acc
length based on the platform UBWC configuration instead of specifying it
directly in the source.

Link: https://lore.kernel.org/linux-media/20260507-iris-ubwc-v5-2-e9a3aee53c49@oss.qualcomm.com/
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Tested-by: Wangao Wang <wangao.wang@oss.qualcomm.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
lumag and others added 24 commits May 25, 2026 10:42
There is little point in having two different structures for HFI-related
core ops. Merge both of them into the new iris_hfi_ops structure.

Link: https://lore.kernel.org/linux-media/20260329-iris-platform-data-v11-5-eea672b03a95@oss.qualcomm.com/
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
The get_instance() is a callback tightly connected to the HFI
implementation. Move it into the new iris_hfi_sys_ops structure, merging
all core callbacks into a single vtable.

Link: https://lore.kernel.org/linux-media/20260329-iris-platform-data-v11-6-eea672b03a95@oss.qualcomm.com/
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
…m data

The HW response time is a constant between platforms. Remove it from the
iris_platform_data structure and use it directly.

Link: https://lore.kernel.org/linux-media/20260329-iris-platform-data-v11-7-eea672b03a95@oss.qualcomm.com/
Suggested-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Having firmware-related fields in platform data results in the tying
platform data to the HFI firmware data rather than the actual hardware.
For example, SM8450 uses Gen2 firmware, so currently its platform data
should be placed next to the other gen2 platforms, although it has the
VPU2.0 core, similar to the one found on SM8250 and SC7280 and so the
hardware-specific platform data is also close to those devices.

Split firmware data to a separate struct, separating hardware-related
data from the firmware interfaces.

Link: https://lore.kernel.org/linux-media/20260329-iris-platform-data-v11-8-eea672b03a95@oss.qualcomm.com/
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Finalize the logical separation of the software and hardware interface
descriptions by moving hardware properties to the files specific to the
particular VPU version.

Link: https://lore.kernel.org/linux-media/20260329-iris-platform-data-v11-9-eea672b03a95@oss.qualcomm.com/
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
The linux-firmware is providing the vpuNN_pM.mbn firmware for SM8250
since August of 2024. Stop using the legacy firmware name
(vpu-1.0/venus.mbn) and switch to the standard firmware name schema
(vpu/vpu20_p4.mbn).

Link: https://lore.kernel.org/linux-media/20260329-iris-platform-data-v11-10-eea672b03a95@oss.qualcomm.com/
Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
In preparation to adding support for several firmware revisions to be
used for a platform, extract the firmware description data. It
incorporates firmware name, HFI ops and buffer requirements of the
particular firmware build.

Link: https://lore.kernel.org/linux-media/20260329-iris-platform-data-v11-11-eea672b03a95@oss.qualcomm.com/
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
[bod: Made struct iris_firmware_desc into static consts to pass media CI]
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Add support for the kaanapali platform by re-using the SM8550
definitions and using the vpu4 ops.
Move the configurations that differs in a per-SoC platform
header, that will contain SoC specific data.

Link: https://lore.kernel.org/all/20251017-knp_video-v2-8-f568ce1a4be3@oss.qualcomm.com/
Co-developed-by: Vishnu Reddy <quic_bvisredd@quicinc.com>
Signed-off-by: Vishnu Reddy <quic_bvisredd@quicinc.com>
Signed-off-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
…y Linux

Most Qualcomm platforms feature a inhouse hypervisor (such as Gunyah
or QHEE), which typically handles IOMMU configuration. This includes
mapping memory regions and device memory resources for remote processors
by intercepting qcom_scm_pas_auth_and_reset() calls. These mappings are
later removed during teardown. Additionally, SHM bridge setup is required
to enable memory protection for both remoteproc metadata and its memory
regions.

When the hypervisor is absent, the operating system must perform these
configurations instead.

Support for handling IOMMU and SHM setup in the absence of a hypervisor
is now in place. Extend the Iris driver to enable this functionality on
platforms where IOMMU is managed by Linux (i.e., non-Gunyah, non-QHEE).

Additionally, the Iris driver must map the firmware and its required
resources to the firmware SID, which is now specified via the device tree.

Link: https://lore.kernel.org/lkml/20250819165447.4149674-12-mukesh.ojha@oss.qualcomm.com/

Signed-off-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
The Qualcomm MDT loader changed qcom_mdt_pas_load() to take only four
arguments and use the PAS context for relocation and memory handling.

Update the iris firmware loading path to match that interface by dropping
the temporary memremap/memunmap flow, removing the extra mem_virt
argument from qcom_mdt_pas_load(), and simplifying the error path
accordingly.

This keeps the iris driver aligned with the SCM/PAS loader changes and
fixes the build failure caused by the old five-argument call.

Signed-off-by: Gourav Kumar <gouravk@qti.qualcomm.com>
…quency formula

The driver was using a fixed default FPS value when calculating the VPU
frequency. This caused wrong frequency requests for high-frame-rate
streams, for example 4K at 240 FPS. Because of this, the hardware was
running at a lower frequency than needed.

Add the FPS measurement based on the decoder input buffer arrival rate.
The measured FPS is stored per instance and used in frequency calculation
instead of the fixed default FPS. The value is clamped so that it does
not exceed platform limits. Add a VPP firmware overhead when running in
STAGE_2.

Link: https://lore.kernel.org/all/20260401-update_fps_calculation-v6-1-f44f8154ca39@oss.qualcomm.com/
Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
Wire up sm8550_init_cb_devs() in iris_platform_gen2.c to register the
two child context-bank devices (iris_non_pixel and iris_pixel)
using iris_create_cb_dev(), and hook it into the sm8550_data platform
data via the .init_cb_devs callback.

Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
Signed-off-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Different stream IDs from VPU would be associated to one of these CB.
Multiple CBs are needed to increase the IOVA for the video usecases
like higher concurrent sessions.

Co-developed-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
Signed-off-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Depending on the buffer type (input, output and internal), associated
context bank is selected, if available. Fallback to parent device for
backward compatibility.

Co-developed-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
Signed-off-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
On X1P42100 the Iris block has an extra BSE clock. Wire this clock into
the power on/off sequence.

The BSE clock is used to drive the Bin Stream Engine, which is a sub-block
of the video codec hardware responsible for bitstream-level processing. It
is required to be enabled separately from the core clock to ensure proper
codec operation.

Link: https://lore.kernel.org/linux-arm-msm/20260401-enable_iris_on_purwa-v4-2-ca784552a3e9@oss.qualcomm.com/
Signed-off-by: Wangao Wang <wangao.wang@oss.qualcomm.com>
Introduce platform data for X1P42100, derived from SM8550 but using a
different clock configuration and a dedicated OPP setup.

Link: https://lore.kernel.org/linux-arm-msm/20260401-enable_iris_on_purwa-v4-3-ca784552a3e9@oss.qualcomm.com/
Signed-off-by: Wangao Wang <wangao.wang@oss.qualcomm.com>
On Glymur, firmware interprets the value written to CPU_CS_SCIACMDARG3 as
the number of virtual machines (VMs) and internally adds 1 to it. Writing
1 causes firmware to treat it as 2 VMs. Since only one VM is required,
remove this write to leave the register at its reset value of 0. This does
not affect other platforms as only Glymur firmware uses this register,
earlier platform firmwares ignore it.

Link: https://lore.kernel.org/all/20260428-glymur-v3-1-8f28930f47d3@oss.qualcomm.com/
Fixes: abf5bac ("media: iris: implement the boot sequence of the firmware")
Cc: stable@vger.kernel.org
Reviewed-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
…odec prefix

The current clock and power domain enum names are too generic. Rename
them with a vcodec prefix to make the names more meaningful and to easily
accommodate vcodec1 enums for the secondary core for glymur platform.

No functional changes intended.

Link: https://lore.kernel.org/all/20260428-glymur-v3-7-8f28930f47d3@oss.qualcomm.com/
Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
The pmdomain_tbl was a array of strings holding only the power domain
names. Callers had to pass a pd_devs[] pointer indexed directly by the
platform_pm_domain_type enum value to iris_enable_power_domains() and
iris_disable_power_domains().

A future platform may need to introduce a new enum value that aliases
an existing one (e.g. IRIS_VCODEC1_POWER_DOMAIN aliasing the
IRIS_VPP0_HW_POWER_DOMAIN on Glymur), which would break the assumption
that enum values map 1:1 to pd_devs[] indices.

To fix this, replace the string array with a new struct platform_pd_data
that pairs each power domain name with its platform_pm_domain_type. Add
a helper iris_get_pd_index_by_type() that walks this table and returns
the correct pd_devs[] index for a given type.

Update iris_enable_power_domains() and iris_disable_power_domains()
to accept a platform_pm_domain_type instead of a struct device pointer.
They now call the helper internally to resolve the index, removing the
need for callers to do the index lookup themselves.

This prepares the driver for adding new platforms where power domain enum
values cannot be used directly as pd_devs[] indices.

Link: https://lore.kernel.org/all/20260428-glymur-v3-8-8f28930f47d3@oss.qualcomm.com/
Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
Glymur has a secondary video codec core (vcodec1), equivalent to the
primary core (vcodec0), but with independent power domains, clocks,
and reset lines. Reuse the existing code wherever possible and add
power sequence for vcodec1.

Link: https://lore.kernel.org/all/20260428-glymur-v3-9-8f28930f47d3@oss.qualcomm.com/
Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
…orms

On platforms with dual vcodec cores, select the hardware core for a
session based on current load. Assign the session to vcodec0 if its
MBPF/MBPS capacity allows it, otherwise assign to vcodec1. Communicate
the selected core to firmware using the new HFI_PROP_CORE_ID property.

Link: https://lore.kernel.org/all/20260428-glymur-v3-10-8f28930f47d3@oss.qualcomm.com/
Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
On glymur platform, the iris core shares most properties with the
iris core on the SM8550 platform. The major difference is that glymur
integrates two codec cores (vcodec0 and vcodec1), while SM8550 has only
one. Add glymur specific platform data, reusing SM8550 definitions
wherever applicable.

Link: https://lore.kernel.org/all/20260428-glymur-v3-11-8f28930f47d3@oss.qualcomm.com/
Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
… init

The HFI sys ops were previously initialized in probe() but, we don't
have firmware loaded at probe time. Since HFI is tightly coupled to
firmware, initialize the HFI sys ops after firmware has been successfully
loaded and booted.

Link: https://lore.kernel.org/all/20260512-kodiak-gen2-support-v4-v5-1-a98968423d24@oss.qualcomm.com/
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Some Iris platforms support both Gen1 and Gen2 HFI firmware images.
Update the firmware loading logic to handle this generically by
preferring Gen2 when available, while safely falling back to Gen1
when required.

The firmware loading logic is updated with the following priority:
1. Device Tree (`firmware-name`): If specified, load unconditionally.
2. Gen2 default : If no DT override exists, select the Gen2 firmware
   descriptor when present and attempt to load the corresponding
   firmware image.
3. Gen1 Fallback: If loading the Gen2 firmware fails and a Gen1
   descriptor is available, retry with the Gen1 firmware image.

When a platform provides both Gen1 and Gen2 firmware descriptors and the
firmware is loaded via a DT override, the driver detects the
firmware generation at runtime before authentication by inspecting
the firmware data. The firmware is classified as Gen2 if the
QC_IMAGE_VERSION_STRING starts with "vfw" or matches the
"video-firmware.N.M" format with N >= 2.

If a Gen1 firmware image is detected in this case, the driver switches
to the Gen1 firmware descriptor and associated platform data so that
the correct HFI implementation is used.

This change makes firmware generation detection platform-agnostic,
preserves DT overrides, prefers newer Gen2 firmware when available,
and maintains compatibility with platforms that only support Gen1.

Link: https://lore.kernel.org/all/20260512-kodiak-gen2-support-v4-v5-2-a98968423d24@oss.qualcomm.com/
Signed-off-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Co-developed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
@qcomlnxci qcomlnxci requested review from a team, dikshita-agarwal and vgarodia and removed request for a team May 25, 2026 11:32
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.

4 participants