media: iris: Add support for glymur platform
Subsystems (9)
v5 cover media: iris: Add support for glymur platform
Glymur is a new generation video codec that supports dual hardware cores along with additional power domains and clocks.
This series adds platform specific support in the iris driver to handle the extra cores, power domains, and clock requirements introduced by glymur. Add support for firmware loading through context bank firmware device.
Dependencies and merge strategy:
Patch[1-2]: IOMMU maintainer need to apply and provide an immutable tag which can merged into media tree.
Patch[3-11]: Media maintainer can pick them independently.
Patch[12]: Media maintainer can apply this once tag for patch[1-2] is available.
Patch[13-14]: Glymur iris DT node, depends on videocc.
https://lore.kernel.org/all/20260410-glymur_mmcc_dt_config_v2-v3-1-acce9d106e72@oss.qualcomm.com/
v4l2-compliance report for decoder including streaming tests:
v4l2-compliance 1.33.0-5441, 64 bits, 64-bit time_t v4l2-compliance SHA: 4310f15610f4 2026-01-18 22:09:17
Compliance test for iris_driver device /dev/video0:
Driver Info:
Driver name : iris_driver
Card type : Iris Decoder
Bus info : platform:aa00000.video-codec
Driver version : 7.1.0
Capabilities : 0x84204000 Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateful Decoder
Required ioctls:
test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/video0 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 12 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK
test Composing: OK
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported) test blocking wait: OK
Test input 0:
Streaming ioctls:
test read/write: OK (Not Supported)
the input file is smaller than 7077888 bytes
Video Capture Multiplanar: Captured 465 buffers test MMAP (select, REQBUFS): OK
the input file is smaller than 7077888 bytes
Video Capture Multiplanar: Captured 465 buffers test MMAP (epoll, REQBUFS): OK
the input file is smaller than 7077888 bytes
Video Capture Multiplanar: Captured 465 buffers test MMAP (select, CREATE_BUFS): OK
the input file is smaller than 7077888 bytes
Video Capture Multiplanar: Captured 465 buffers test MMAP (epoll, CREATE_BUFS): OK
test USERPTR (select): OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device
Total for iris_driver device /dev/video0: 54, Succeeded: 54, Failed: 0, Warnings: 0
v4l2-compliance report for encoder including streaming tests:
v4l2-compliance 1.33.0-5441, 64 bits, 64-bit time_t v4l2-compliance SHA: 4310f15610f4 2026-01-18 22:09:17
Compliance test for iris_driver device /dev/video1:
Driver Info:
Driver name : iris_driver
Card type : Iris Encoder
Bus info : platform:aa00000.video-codec
Driver version : 7.1.0
Capabilities : 0x84204000 Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04204000
Video Memory-to-Memory Multiplanar Streaming
Extended Pix Format
Detected Stateful Encoder
Required ioctls:
test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/video1 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 43 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK
test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK
test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported) test blocking wait: OK
Test input 0:
Streaming ioctls:
test read/write: OK (Not Supported) Video Capture Multiplanar: Captured 61 buffers test MMAP (select, REQBUFS): OK
Video Capture Multiplanar: Captured 61 buffers test MMAP (epoll, REQBUFS): OK
Video Capture Multiplanar: Captured 61 buffers test MMAP (select, CREATE_BUFS): OK Video Capture Multiplanar: Captured 61 buffers test MMAP (epoll, CREATE_BUFS): OK
test USERPTR (select): OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device
Total for iris_driver device /dev/video1: 54, Succeeded: 54, Failed: 0, Warnings: 0
Fluster test report:
77/135 while testing JVT-AVC_V1 with
GStreamer-H.264-V4L2-Gst1.0.JVT-AVC_V1
The failing tests are:
- 52 test vectors failed due to interlaced clips: Interlaced decoding is not supported.
- cabac_mot_fld0_full
- cabac_mot_mbaff0_full
- cabac_mot_picaff0_full
- CABREF3_Sand_D
- CAFI1_SVA_C
- CAMA1_Sony_C
- CAMA1_TOSHIBA_B
- cama1_vtc_c
- cama2_vtc_b
- CAMA3_Sand_E
- cama3_vtc_b
- CAMACI3_Sony_C
- CAMANL1_TOSHIBA_B
- CAMANL2_TOSHIBA_B
- CAMANL3_Sand_E
- CAMASL3_Sony_B
- CAMP_MOT_MBAFF_L30
- CAMP_MOT_MBAFF_L31
- CANLMA2_Sony_C
- CANLMA3_Sony_C
- CAPA1_TOSHIBA_B
- CAPAMA3_Sand_F
- cavlc_mot_fld0_full_B
- cavlc_mot_mbaff0_full_B
- cavlc_mot_picaff0_full_B
- CVCANLMA2_Sony_C
- CVFI1_Sony_D
- CVFI1_SVA_C
- CVFI2_Sony_H
- CVFI2_SVA_C
- CVMA1_Sony_D
- CVMA1_TOSHIBA_B
- CVMANL1_TOSHIBA_B
- CVMANL2_TOSHIBA_B
- CVMAPAQP3_Sony_E
- CVMAQP2_Sony_G
- CVMAQP3_Sony_D
- CVMP_MOT_FLD_L30_B
- CVNLFI1_Sony_C
- CVNLFI2_Sony_H
- CVPA1_TOSHIBA_B
- FI1_Sony_E
- MR6_BT_B
- MR7_BT_B
- MR8_BT_B
- MR9_BT_B
- Sharp_MP_Field_1_B
- Sharp_MP_Field_2_B
- Sharp_MP_Field_3_B
- Sharp_MP_PAFF_1r2
- Sharp_MP_PAFF_2r
- CVMP_MOT_FRM_L31_B
3 test case failed due to unsupported bitstream. num_slice_groups_minus1 greater than zero is not supported.
- FM1_BT_B
- FM1_FT_E
- FM2_SVA_C
2 test case failed because SP_SLICE type is not supported.
- SP1_BT_A
- sp2_bt_b
1 test case failed due to unsupported profile.
- BA3_SVA_C
131/147 testcases passed while testing JCT-VC-HEVC_V1 with GStreamer-H.265-V4L2-Gst1.0
10 testcases failed due to unsupported 10 bit format.
- DBLK_A_MAIN10_VIXS_4
- INITQP_B_Main10_Sony_1
- TSUNEQBD_A_MAIN10_Technicolor_2
- WP_A_MAIN10_Toshiba_3
- WP_MAIN10_B_Toshiba_3
- WPP_A_ericsson_MAIN10_2
- WPP_B_ericsson_MAIN10_2
- WPP_C_ericsson_MAIN10_2
- WPP_E_ericsson_MAIN10_2
- WPP_F_ericsson_MAIN10_2
4 testcase failed due to unsupported resolution.
- PICSIZE_A_Bossen_1
- PICSIZE_B_Bossen_1
- WPP_D_ericsson_MAIN10_2
- WPP_D_ericsson_MAIN_2
2 testcase failed due to CRC mismatch.
- VPSSPSPPS_A_MainConcept_1
This fails with software decoder as well. Refer the below link for the discussion happened for earlier platform.
https://lore.kernel.org/all/[email protected]/
- RAP_A_docomo_6
This was discussed on bug report
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/4392
Based on above discussion, the initial error frames need to be dropped in the firmware or driver. Discussion ongoing with video firmware team on a way to handle such case. This issue is not specific to this platform, and its there on other platforms also.
235/305 testcases passed while testing VP9-TEST-VECTORS with GStreamer-VP9-V4L2-Gst1.0 64 testcases failed due to unsupported resolution
- vp90-2-02-size-08x08.webm
- vp90-2-02-size-08x10.webm
- vp90-2-02-size-08x16.webm
- vp90-2-02-size-08x18.webm
- vp90-2-02-size-08x32.webm
- vp90-2-02-size-08x34.webm
- vp90-2-02-size-08x64.webm
- vp90-2-02-size-08x66.webm
- vp90-2-02-size-10x08.webm
- vp90-2-02-size-10x10.webm
- vp90-2-02-size-10x16.webm
- vp90-2-02-size-10x18.webm
- vp90-2-02-size-10x32.webm
- vp90-2-02-size-10x34.webm
- vp90-2-02-size-10x64.webm
- vp90-2-02-size-10x66.webm
- vp90-2-02-size-16x08.webm
- vp90-2-02-size-16x10.webm
- vp90-2-02-size-16x16.webm
- vp90-2-02-size-16x18.webm
- vp90-2-02-size-16x32.webm
- vp90-2-02-size-16x34.webm
- vp90-2-02-size-16x64.webm
- vp90-2-02-size-16x66.webm
- vp90-2-02-size-18x08.webm
- vp90-2-02-size-18x10.webm
- vp90-2-02-size-18x16.webm
- vp90-2-02-size-18x18.webm
- vp90-2-02-size-18x32.webm
- vp90-2-02-size-18x34.webm
- vp90-2-02-size-18x64.webm
- vp90-2-02-size-18x66.webm
- vp90-2-02-size-32x08.webm
- vp90-2-02-size-32x10.webm
- vp90-2-02-size-32x16.webm
- vp90-2-02-size-32x18.webm
- vp90-2-02-size-32x32.webm
- vp90-2-02-size-32x34.webm
- vp90-2-02-size-32x64.webm
- vp90-2-02-size-32x66.webm
- vp90-2-02-size-34x08.webm
- vp90-2-02-size-34x10.webm
- vp90-2-02-size-34x16.webm
- vp90-2-02-size-34x18.webm
- vp90-2-02-size-34x32.webm
- vp90-2-02-size-34x34.webm
- vp90-2-02-size-34x64.webm
- vp90-2-02-size-34x66.webm
- vp90-2-02-size-64x08.webm
- vp90-2-02-size-64x10.webm
- vp90-2-02-size-64x16.webm
- vp90-2-02-size-64x18.webm
- vp90-2-02-size-64x32.webm
- vp90-2-02-size-64x34.webm
- vp90-2-02-size-64x64.webm
- vp90-2-02-size-64x66.webm
- vp90-2-02-size-66x08.webm
- vp90-2-02-size-66x10.webm
- vp90-2-02-size-66x16.webm
- vp90-2-02-size-66x18.webm
- vp90-2-02-size-66x32.webm
- vp90-2-02-size-66x34.webm
- vp90-2-02-size-66x64.webm
- vp90-2-02-size-66x66.webm
2 testcases failed due to unsupported format.
- vp91-2-04-yuv422.webm
- vp91-2-04-yuv444.webm
2 testcase failed due to unsupported resolution after DRC.
- vp90-2-21-resize_inter_320x180_5_1-2.webm
- vp90-2-21-resize_inter_320x180_7_1-2.webm
1 testcase failed with CRC mismatch.
- vp90-2-22-svc_1280x720_3.ivf
This VP9 bitstream contains 20 superframes, and each superframe consists of three subframes in the following order:
• 180p subframe
• 360p subframe
• 720p subframe
Each superframe is submitted to the driver and firmware as a single input buffer, with one common timestamp attached to it. For every such input buffer, the hardware decoder produces three corresponding output buffers, one for each resolution (180p, 360p, and 720p), and all three output buffers carry the same timestamp. When these output buffers are returned to the client (GStreamer, in this case), the first buffer returned is displayed, while the remaining two buffers are dropped due to having identical timestamps. As a result, only one frame per superframe is rendered. Here the expectation of the test result is with 720p, last decoded frame in each super frame.
Discussion ongoing with firmware team and gst maintainer on how to handle this case. This is not specific to glymur, and its there for the other platforms also.
1 testcase failed due to unsupported stream.
- vp90-2-16-intra-only.webm
---
Changes in v5:
- Remove clocks, clock-names, power-domains from the required list in venus-common schema (Krzysztof)
- Update core selection logic (Vikash)
- Add macros for power status bits instead of magical values (Vikash)
- Add new config for iris vpu bus instead of using the iris driver
config.
- Re-arrage the patches (Krzysztof)
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- Update existing venus common binding.
- Update glymur DT binding required properties.
- Patches are rebased and resolved merge conflicts.
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Drop generic dma context bus and moved to iris vpu bus (Greg)
- Update commit message for platform data patch (Dmitry)
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Update the clock and reset names in DT binding (Krzysztof)
- Update firmware device names (Mukesh, Konrad)
- Update the selection of core for dual core platforms
- Add new generic dma context bus instead of own iris vpu bus (Dmitry)
- Add patch to get power domain type to look up pd_devs index
- Update glymur platform data (Dmitry)
- lInk to v1: https://lore.kernel.org/r/[email protected]
---
Mukesh Ojha (1):
media: iris: Enable Secure PAS support with IOMMU managed by Linux
Vikash Garodia (2):
media: iris: Add iris vpu bus support
iommu: Add iris-vpu-bus to iommu_buses
Vishnu Reddy (11):
media: iris: Fix VM count passed to firmware
dt-bindings: media: qcom,venus: Remove clock, power-domain, and iommus from common schema
dt-bindings: media: qcom,glymur-iris: Add glymur video codec
media: iris: Add context bank hooks for platform specific initialization
media: iris: Rename clock and power domain macros to use vcodec prefix
media: iris: Use power domain type to look up pd_devs index
media: iris: Add power sequence for Glymur
media: iris: Add support to select core for dual core platforms
media: iris: Add platform data for glymur
arm64: dts: qcom: glymur: Add iris video node
arm64: dts: qcom: glymur-crd: Enable iris video codec node
.../bindings/media/qcom,glymur-iris.yaml | 208 +++++++++++++++++++++ .../bindings/media/qcom,msm8916-venus.yaml | 3 + .../bindings/media/qcom,msm8996-venus.yaml | 3 + .../bindings/media/qcom,qcm2290-venus.yaml | 3 + .../bindings/media/qcom,sc7180-venus.yaml | 3 + .../bindings/media/qcom,sc7280-venus.yaml | 3 + .../bindings/media/qcom,sdm660-venus.yaml | 3 + .../bindings/media/qcom,sdm845-venus-v2.yaml | 3 + .../bindings/media/qcom,sdm845-venus.yaml | 3 + .../bindings/media/qcom,sm8250-venus.yaml | 3 + .../bindings/media/qcom,sm8750-iris.yaml | 3 + .../bindings/media/qcom,venus-common.yaml | 23 --- arch/arm64/boot/dts/qcom/glymur-crd.dts | 4 + arch/arm64/boot/dts/qcom/glymur.dtsi | 118 ++++++++++++ drivers/iommu/iommu.c | 4 + drivers/media/platform/qcom/iris/Kconfig | 4 + drivers/media/platform/qcom/iris/Makefile | 2 + drivers/media/platform/qcom/iris/iris_common.c | 10 + drivers/media/platform/qcom/iris/iris_common.h | 1 + drivers/media/platform/qcom/iris/iris_core.h | 9 + drivers/media/platform/qcom/iris/iris_firmware.c | 72 ++++++- drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + .../platform/qcom/iris/iris_hfi_gen2_command.c | 19 ++ .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + drivers/media/platform/qcom/iris/iris_instance.h | 2 + .../platform/qcom/iris/iris_platform_common.h | 33 +++- .../media/platform/qcom/iris/iris_platform_gen1.c | 24 ++- .../media/platform/qcom/iris/iris_platform_gen2.c | 129 +++++++++++-- .../platform/qcom/iris/iris_platform_glymur.c | 97 ++++++++++ .../platform/qcom/iris/iris_platform_glymur.h | 17 ++ .../platform/qcom/iris/iris_platform_sc7280.h | 10 +- .../platform/qcom/iris/iris_platform_sm8750.h | 12 +- drivers/media/platform/qcom/iris/iris_power.c | 11 +- drivers/media/platform/qcom/iris/iris_probe.c | 31 ++- drivers/media/platform/qcom/iris/iris_resources.c | 43 ++++- drivers/media/platform/qcom/iris/iris_resources.h | 6 +- drivers/media/platform/qcom/iris/iris_utils.c | 75 ++++++-- drivers/media/platform/qcom/iris/iris_vb2.c | 4 + drivers/media/platform/qcom/iris/iris_vidc.c | 6 +- drivers/media/platform/qcom/iris/iris_vpu3x.c | 163 ++++++++++++++-- drivers/media/platform/qcom/iris/iris_vpu4x.c | 68 +++---- drivers/media/platform/qcom/iris/iris_vpu_bus.c | 69 +++++++ drivers/media/platform/qcom/iris/iris_vpu_common.c | 45 +++-- drivers/media/platform/qcom/iris/iris_vpu_common.h | 1 + .../platform/qcom/iris/iris_vpu_register_defines.h | 10 + include/dt-bindings/media/qcom,glymur-iris.h | 11 ++ include/linux/iris_vpu_bus.h | 25 +++ 47 files changed, 1220 insertions(+), 178 deletions(-)
---
base-commit: 17c7841d09ee7d33557fd075562d9289b6018c90
change-id: 20260409-glymur-140ab7ca0910
Best regards,
Signature · 1 line
Vishnu Reddy <[email protected]>
PATCH v5 1/14 media: iris: Add iris vpu bus support
From: Vikash Garodia <[email protected]>
On glymur platform, firmware loading needs a separate IOMMU mapping with its own stream ID. This stream ID is defined in the device tree with the assosiated firmware function ID in the iommu-map property. To create this mapping, a separate child device is needed so the firmware memory can be isolated in its own IOMMU context.
Introduced a new bus called iris-vpu-bus. This creates a dynamic device, and its dma_configure() callback calls of_dma_configure_id() with the function ID provided by the client to map the corresponding stream ID. This sets up a dedicated IOMMU context for the child device.
--- drivers/media/platform/qcom/iris/Kconfig | 4 ++ drivers/media/platform/qcom/iris/Makefile | 1 + drivers/media/platform/qcom/iris/iris_vpu_bus.c | 69 +++++++++++++++++++++++++ include/linux/iris_vpu_bus.h | 25 +++++++++ 4 files changed, 99 insertions(+)
drivers/media/platform/qcom/iris/Kconfig +4 -0
@@ -1,3 +1,6 @@ +config QCOM_IRIS_VPU_BUS + bool + config VIDEO_QCOM_IRIS tristate "Qualcomm iris V4L2 decoder driver" depends on VIDEO_DEV
@@ -6,6 +9,7 @@ config VIDEO_QCOM_IRIS select QCOM_MDT_LOADER select QCOM_SCM select VIDEOBUF2_DMA_CONTIG + select QCOM_IRIS_VPU_BUS help This is a V4L2 driver for Qualcomm iris video accelerator hardware. It accelerates decoding operations on various
drivers/media/platform/qcom/iris/Makefile +1 -0
@@ -31,3 +31,4 @@ qcom-iris-objs += iris_platform_gen1.o endif obj-$(CONFIG_VIDEO_QCOM_IRIS) += qcom-iris.o +obj-$(CONFIG_QCOM_IRIS_VPU_BUS) += iris_vpu_bus.o
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +69 -0
69 lines not on this page · raw message
include/linux/iris_vpu_bus.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#ifndef _LINUX_IRIS_VPU_BUS_H +#define _LINUX_IRIS_VPU_BUS_H + +#include <linux/device.h> + +#ifdef CONFIG_QCOM_IRIS_VPU_BUS +extern const struct bus_type iris_vpu_bus_type; + +struct device *create_iris_vpu_bus_device (struct device *parent_device,const char *name, +u64 dma_mask,const u32 *iommu_fid); +#else +static inline struct device *create_iris_vpu_bus_device (struct device *parent_device, +const char *name,u64 dma_mask, +const u32 *iommu_fid) +{ +return ERR_PTR (-ENODEV ); +} +#endif + +#endif /* _LINUX_IRIS_VPU_BUS_H */
Signature · 1 line
2.34.1
Re: [PATCH v5 01/14] media: iris: Add iris vpu bus support
Quoted 59 lines · Vishnu Reddy
From: Vikash Garodia <[email protected]>
On glymur platform, firmware loading needs a separate IOMMU mapping with its own stream ID. This stream ID is defined in the device tree with the assosiated firmware function ID in the iommu-map property. To create this mapping, a separate child device is needed so the firmware memory can be isolated in its own IOMMU context.
Introduced a new bus called iris-vpu-bus. This creates a dynamic device, and its
dma_configure()callback callsof_dma_configure_id()with the function ID provided by the client to map the corresponding stream ID. This sets up a dedicated IOMMU context for the child device.Reviewed-by Vishnu Reddy <[email protected]>Signed-off-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/Kconfig | 4 ++ drivers/media/platform/qcom/iris/Makefile | 1 + drivers/media/platform/qcom/iris/iris_vpu_bus.c | 69 +++++++++++++++++++++++++ include/linux/iris_vpu_bus.h | 25 +++++++++ 4 files changed, 99 insertions(+)drivers/media/platform/qcom/iris/Kconfig +4
-0@@ -1,3 +1,6 @@ +config QCOM_IRIS_VPU_BUS + bool + config VIDEO_QCOM_IRIS tristate "Qualcomm iris V4L2 decoder driver" depends on VIDEO_DEV@@ -6,6 +9,7 @@ config VIDEO_QCOM_IRIS select QCOM_MDT_LOADER select QCOM_SCM select VIDEOBUF2_DMA_CONTIG + select QCOM_IRIS_VPU_BUS help This is a V4L2 driver for Qualcomm iris video accelerator hardware. It accelerates decoding operations on variousdrivers/media/platform/qcom/iris/Makefile +1
-0@@ -31,3 +31,4 @@ qcom-iris-objs += iris_platform_gen1.o endif obj-$(CONFIG_VIDEO_QCOM_IRIS) += qcom-iris.o +obj-$(CONFIG_QCOM_IRIS_VPU_BUS) += iris_vpu_bus.odrivers/media/platform/qcom/iris/iris_vpu_bus.c new file +2
-0@@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0-only +/*
drivers/media/platform/qcom/iris/iris_vpu_bus.c line 12
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +10
-0+* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#include <linux/device.h> +#include <linux/iris_vpu_bus.h> +#include <linux/of_device.h> + +static int iris_vpu_bus_dma_configure (struct device *dev) +{ +const u32 *iommu_fid =dev_get_drvdata (dev);
This should be drm_get_platdata() rather than _drvdata().
Quoted 41 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +41
-0+ +return of_dma_configure_id (dev, dev->parent->of_node, true, iommu_fid); +} + +const struct bus_type iris_vpu_bus_type = { + .name ="iris-vpu-bus" , + .dma_configure = iris_vpu_bus_dma_configure, +}; +EXPORT_SYMBOL_GPL (iris_vpu_bus_type); + +static void release_iris_vpu_bus_device (struct device *dev) +{ +kfree (dev); +} + +struct device *create_iris_vpu_bus_device (struct device *parent_device,const char *name, +u64 dma_mask,const u32 *iommu_fid) +{ +struct device *dev; +int ret; + + dev =kzalloc_obj (*dev); +if (!dev) +return ERR_PTR (-ENOMEM ); + + dev->release = release_iris_vpu_bus_device; + dev->bus = &iris_vpu_bus_type; + dev->parent = parent_device; + dev->coherent_dma_mask = dma_mask; + dev->dma_mask = &dev->coherent_dma_mask; + +dev_set_name (dev,"%s" , name); +dev_set_drvdata (dev, (void *)iommu_fid); + + ret =device_register (dev); +if (ret) { +put_device (dev); +return ERR_PTR (ret); + } + +return dev;
drivers/media/platform/qcom/iris/iris_vpu_bus.c line 63
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +10
-0+} +EXPORT_SYMBOL_GPL (create_iris_vpu_bus_device); + +static int __init iris_vpu_bus_init (void ) +{ +int ret; + + ret =bus_register (&iris_vpu_bus_type); +if (ret) { +pr_err ("iris-vpu-bus registration failed: %d\n" , ret);
Just 'return bus_register();'
Quoted 19 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +6
-0+return ret; + } + +return 0 ; +} +postcore_initcall (iris_vpu_bus_init);include/linux/iris_vpu_bus.h new file +7
-0@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#ifndef _LINUX_IRIS_VPU_BUS_H +#define _LINUX_IRIS_VPU_BUS_H
include/linux/iris_vpu_bus.h line 17
Quoted 10 lines
include/linux/iris_vpu_bus.h new file +10
-0+ +#include <linux/device.h> + +#ifdef CONFIG_QCOM_IRIS_VPU_BUS +extern const struct bus_type iris_vpu_bus_type; + +struct device *create_iris_vpu_bus_device (struct device *parent_device,const char *name, +u64 dma_mask,const u32 *iommu_fid); +#else +static inline struct device *create_iris_vpu_bus_device(struct device *parent_device,
You are adding globally visible API without _any_ sensible prefix. It should be named other way: iris_vpu_bus_create_device().
Quoted 12 lines
include/linux/iris_vpu_bus.h new file +8
-0+ const char *name, u64 dma_mask, + const u32 *iommu_fid) +{ + return ERR_PTR(-ENODEV); +} +#endif + +#endif /* _LINUX_IRIS_VPU_BUS_H */ Signature · 2 lines
-- 2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 01/14] media: iris: Add iris vpu bus support
Quoted 63 lines · Dmitry Baryshkov
Quoted 62 lines · Vishnu Reddy
From: Vikash Garodia <[email protected]>
On glymur platform, firmware loading needs a separate IOMMU mapping with its own stream ID. This stream ID is defined in the device tree with the assosiated firmware function ID in the iommu-map property. To create this mapping, a separate child device is needed so the firmware memory can be isolated in its own IOMMU context.
Introduced a new bus called iris-vpu-bus. This creates a dynamic device, and its
dma_configure()callback callsof_dma_configure_id()with the function ID provided by the client to map the corresponding stream ID. This sets up a dedicated IOMMU context for the child device.Reviewed-by Vishnu Reddy <[email protected]>Signed-off-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/Kconfig | 4 ++ drivers/media/platform/qcom/iris/Makefile | 1 + drivers/media/platform/qcom/iris/iris_vpu_bus.c | 69 +++++++++++++++++++++++++ include/linux/iris_vpu_bus.h | 25 +++++++++ 4 files changed, 99 insertions(+)drivers/media/platform/qcom/iris/Kconfig +4
-0@@ -1,3 +1,6 @@ +config QCOM_IRIS_VPU_BUS + bool + config VIDEO_QCOM_IRIS tristate "Qualcomm iris V4L2 decoder driver" depends on VIDEO_DEV@@ -6,6 +9,7 @@ config VIDEO_QCOM_IRIS select QCOM_MDT_LOADER select QCOM_SCM select VIDEOBUF2_DMA_CONTIG + select QCOM_IRIS_VPU_BUS help This is a V4L2 driver for Qualcomm iris video accelerator hardware. It accelerates decoding operations on variousdrivers/media/platform/qcom/iris/Makefile +1
-0@@ -31,3 +31,4 @@ qcom-iris-objs += iris_platform_gen1.o endif obj-$(CONFIG_VIDEO_QCOM_IRIS) += qcom-iris.o +obj-$(CONFIG_QCOM_IRIS_VPU_BUS) += iris_vpu_bus.odrivers/media/platform/qcom/iris/iris_vpu_bus.c new file +5
-0@@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ +
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c line 12
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +7
-0+#include <linux/device.h> +#include <linux/iris_vpu_bus.h> +#include <linux/of_device.h> + +static int iris_vpu_bus_dma_configure (struct device *dev) +{ +const u32 *iommu_fid =dev_get_drvdata (dev);This should be
drm_get_platdata()rather than_drvdata().
Ack, will use dev_get_platdata().
Quoted 44 lines
Quoted 44 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +44
-0+ +return of_dma_configure_id (dev, dev->parent->of_node, true, iommu_fid); +} + +const struct bus_type iris_vpu_bus_type = { + .name ="iris-vpu-bus" , + .dma_configure = iris_vpu_bus_dma_configure, +}; +EXPORT_SYMBOL_GPL (iris_vpu_bus_type); + +static void release_iris_vpu_bus_device (struct device *dev) +{ +kfree (dev); +} + +struct device *create_iris_vpu_bus_device (struct device *parent_device,const char *name, +u64 dma_mask,const u32 *iommu_fid) +{ +struct device *dev; +int ret; + + dev =kzalloc_obj (*dev); +if (!dev) +return ERR_PTR (-ENOMEM ); + + dev->release = release_iris_vpu_bus_device; + dev->bus = &iris_vpu_bus_type; + dev->parent = parent_device; + dev->coherent_dma_mask = dma_mask; + dev->dma_mask = &dev->coherent_dma_mask; + +dev_set_name (dev,"%s" , name); +dev_set_drvdata (dev, (void *)iommu_fid); + + ret =device_register (dev); +if (ret) { +put_device (dev); +return ERR_PTR (ret); + } + +return dev; +} +EXPORT_SYMBOL_GPL (create_iris_vpu_bus_device); +
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c line 63
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +7
-0+static int __init iris_vpu_bus_init (void ) +{ +int ret; + + ret =bus_register (&iris_vpu_bus_type); +if (ret) { +pr_err ("iris-vpu-bus registration failed: %d\n" , ret);Just 'return
bus_register();'
Ack.
Quoted 23 lines
Quoted 23 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +6
-0+return ret; + } + +return 0 ; +} +postcore_initcall (iris_vpu_bus_init);include/linux/iris_vpu_bus.h new file +11
-0@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#ifndef _LINUX_IRIS_VPU_BUS_H +#define _LINUX_IRIS_VPU_BUS_H + +#include <linux/device.h> + +#ifdef CONFIG_QCOM_IRIS_VPU_BUS
Quoted 8 lines
include/linux/iris_vpu_bus.h line 17
Quoted 6 lines
include/linux/iris_vpu_bus.h new file +6
-0+extern const struct bus_type iris_vpu_bus_type; + +struct device *create_iris_vpu_bus_device (struct device *parent_device,const char *name, +u64 dma_mask,const u32 *iommu_fid); +#else +static inline struct device *create_iris_vpu_bus_device(struct device *parent_device,You are adding globally visible API without _any_ sensible prefix. It should be named other way:
iris_vpu_bus_create_device().
Ack.
Quoted 12 lines
Quoted 12 lines
include/linux/iris_vpu_bus.h new file +8
-0+ const char *name, u64 dma_mask, + const u32 *iommu_fid) +{ + return ERR_PTR(-ENODEV); +} +#endif + +#endif /* _LINUX_IRIS_VPU_BUS_H */ Signature · 2 lines
-- 2.34.1
[email protected]
AI reviewRe: [PATCH v5 01/14] media: iris: Add iris vpu bus support
In reply to Vishnu ReddyThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Low] Missing explicit inclusion of `<linux/slab.h>`. - [Low] Unchecked return value of `dev_set_name()`…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] Missing explicit inclusion of <linux/slab.h>.
- [Low] Unchecked return value of dev_set_name() obscures memory allocation failures. --
commit 98f1237fb4e4382526cb267a03ee922744bc30d4
Author: Vikash Garodia <[email protected]>
media: iris: Add iris vpu bus support
This commit introduces the iris-vpu-bus to create a dynamic child device for firmware loading, setting up a dedicated IOMMU context with a separate stream ID.
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +0
-0
drivers/media/platform/qcom/iris/iris_vpu_bus.c line 8
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +8
-0@@ -0,0 +1,69 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#include <linux/device.h> +#include <linux/iris_vpu_bus.h> +#include <linux/of_device.h>
This isn't a bug, but should linux/slab.h be explicitly included here?
The implementation uses slab allocator functions like kzalloc_obj() and kfree(), and relying on implicit inclusion could lead to build breakages on different architectures or in future kernel versions.
[ ... ]
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +7
-0+struct device *create_iris_vpu_bus_device (struct device *parent_device,const char *name, +u64 dma_mask,const u32 *iommu_fid) +{ +struct device *dev; +int ret; + + dev =kzalloc_obj (*dev);
drivers/media/platform/qcom/iris/iris_vpu_bus.c line 44
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +10
-0+if (!dev) +return ERR_PTR (-ENOMEM ); + + dev->release = release_iris_vpu_bus_device; + dev->bus = &iris_vpu_bus_type; + dev->parent = parent_device; + dev->coherent_dma_mask = dma_mask; + dev->dma_mask = &dev->coherent_dma_mask; + +dev_set_name (dev,"%s" , name);
Is it safe to ignore the return value of dev_set_name() here?
If memory allocation fails, dev_set_name() returns -ENOMEM and leaves the device name as NULL. The subsequent call to device_register() handles this gracefully by returning -EINVAL rather than propagating the original -ENOMEM.
While this does not cause a crash, could dropping the accurate error code obscure the root out-of-memory cause during debugging?
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu_bus.c new file +10
-0+dev_set_drvdata (dev, (void *)iommu_fid); + + ret =device_register (dev); +if (ret) { +put_device (dev); +return ERR_PTR (ret); + } + +return dev; +}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v5 2/14 iommu: Add iris-vpu-bus to iommu_buses
In reply to Vishnu ReddyFrom: Vikash Garodia <[email protected]>
Add iris-vpu-bus to iommu_buses[] to register the bus notifier callbacks for device add and removal events. This ensures that when a device is registered on iris-vpu-bus, the notifier triggers dma_configure(), which sets up the IOMMU context for that device.
--- drivers/iommu/iommu.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/iommu/iommu.c +4 -0
@@ -13,6 +13,7 @@#include <linux/bug.h> #include <linux/types.h> #include <linux/init.h> +#include <linux/iris_vpu_bus.h> #include <linux/export.h> #include <linux/slab.h> #include <linux/errno.h>
@@ -179,6 +180,9 @@ static const struct bus_type * const iommu_buses[] = {#ifdef CONFIG_CDX_BUS &cdx_bus_type,#endif +#ifdef CONFIG_QCOM_IRIS_VPU_BUS + &iris_vpu_bus_type, +#endif };/*
Signature · 1 line
2.34.1
Re: [PATCH v5 02/14] iommu: Add iris-vpu-bus to iommu_buses
Quoted 7 lines · Vishnu Reddy
From: Vikash Garodia <[email protected]>
Add iris-vpu-bus to iommu_buses[] to register the bus notifier callbacks for device add and removal events. This ensures that when a device is registered on iris-vpu-bus, the notifier triggers
dma_configure(), which sets up the IOMMU context for that device.
Quoted 8 lines
Reviewed-by Vishnu Reddy <[email protected]>Signed-off-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/iommu/iommu.c | 4 ++++ 1 file changed, 4 insertions(+)
Signature · 2 lines
With best wishes Dmitry
[email protected]
AI reviewRe: [PATCH v5 02/14] iommu: Add iris-vpu-bus to iommu_buses
In reply to Vishnu ReddyThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] Improper Abstraction and Architectural Violation - [Medium] Technical Inaccuracy in Commit…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Improper Abstraction and Architectural Violation
- [Medium] Technical Inaccuracy in Commit Message
--
commit 61e281d574bca776edc5305b6c70e207b44fa3e0
Author: Vikash Garodia <[email protected]>
iommu: Add iris-vpu-bus to iommu_buses
This commit adds the iris_vpu_bus_type to the iommu_buses array in the core IOMMU subsystem. This allows the bus to register notifier callbacks for device addition and removal to set up the IOMMU context.
Quoted 4 lines
Add iris-vpu-bus to iommu_buses[] to register the bus notifier callbacks for device add and removal events. This ensures that when a device is registered on iris-vpu-bus, the notifier triggers
dma_configure(), which sets up the IOMMU context for that device.
Is this description of the notifier sequence accurate?
Looking at iommu_bus_notifier() in drivers/iommu/iommu.c, the BUS_NOTIFY_ADD_DEVICE event actually triggers iommu_probe_device(), which establishes the IOMMU group.
The dma_configure() routine is invoked separately by the driver core, specifically via really_probe() in drivers/base/dd.c, during driver binding.
Could the commit message be updated to reflect the actual device model flow?
Quoted 4 lines
drivers/iommu/iommu.c +0
-0
[ ... ]
drivers/iommu/iommu.c static const struct bus_type * const iommu_buses[] = { · line 188
Quoted 10 lines
drivers/iommu/iommu.c +3
-0@@ -179,6 +180,9 @@ static const struct bus_type * const iommu_buses[] = {#ifdef CONFIG_CDX_BUS &cdx_bus_type,#endif +#ifdef CONFIG_QCOM_IRIS_VPU_BUS + &iris_vpu_bus_type, +#endif };/*
Does modifying the generic IOMMU framework's iommu_buses[] array to include a vendor-specific bus violate abstraction boundaries?
It appears the driver creates a custom bus type (iris_vpu_bus_type) purely to provide a custom .dma_configure callback for passing an iommu_fid.
Could standard Linux device model methodologies be used instead, such as instantiating child platform_device nodes or utilizing the auxiliary_bus framework, to avoid tight coupling between the core IOMMU subsystem and vendor-specific driver details?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Vikash Garodia
maintainerRe: [PATCH v5 02/14] iommu: Add iris-vpu-bus to iommu_buses
In reply to Vishnu ReddyHi Rob, Robin,
Quoted 7 lines · Vishnu Reddy
From: Vikash Garodia<[email protected]>
Add iris-vpu-bus to iommu_buses[] to register the bus notifier callbacks for device add and removal events. This ensures that when a device is registered on iris-vpu-bus, the notifier triggers
dma_configure(), which sets up the IOMMU context for that device.
Quoted 6 lines
Reviewed-by Vishnu Reddy<[email protected]>Signed-off-by Vikash Garodia<[email protected]>Signed-off-by Vishnu Reddy<[email protected]>--- drivers/iommu/iommu.c | 4 ++++ 1 file changed, 4 insertions(+)
We have added vpu platform bus as suggested by you earlier. Patches #1 and #2 in this series adds the same. Please review and suggest if you have any comments.
Please provide an immutable tag by applying patch #1 and #2, we can then have that in media tree and apply remaining patches in this series.
If you have any other suggestion to land these patches, please suggest.
Regards,
Vikash
PATCH v5 3/14 media: iris: Fix VM count passed to firmware
In reply to Vishnu ReddyOn 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.
--- drivers/media/platform/qcom/iris/iris_vpu_common.c | 1 - 1 file changed, 1 deletion(-)
drivers/media/platform/qcom/iris/iris_vpu_common.c +0 -1
@@ -78,7 +78,6 @@ int iris_vpu_boot_firmware(struct iris_core *core)iris_vpu_setup_ucregion_memory_map (core);writel (ctrl_init, core->reg_base +CTRL_INIT ); -writel (0x1 , core->reg_base +CPU_CS_SCIACMDARG3 );while (!ctrl_status && count < max_tries) { ctrl_status =readl (core->reg_base +CTRL_STATUS );
Signature · 1 line
2.34.1
Re: [PATCH v5 03/14] media: iris: Fix VM count passed to firmware
Quoted 6 lines · Vishnu Reddy
On Glymur, firmware interprets the value written to
CPU_CS_SCIACMDARG3as 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.
The explanation is pretty suspicious. I can see this write in venus sources too and it was added in the initial submission, dating 2017. The driver targeted two platforms, MSM8916 and MSM8996, so this write predates Glymur pretty much.
Quoted 9 lines
Fixes abf5bac63f68 ("media: iris: implement the boot sequence of the firmware")Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_vpu_common.c | 1 - 1 file changed, 1 deletion(-)
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 03/14] media: iris: Fix VM count passed to firmware
Quoted 11 lines · Dmitry Baryshkov
Quoted 6 lines · Vishnu Reddy
On Glymur, firmware interprets the value written to
CPU_CS_SCIACMDARG3as 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.The explanation is pretty suspicious. I can see this write in venus sources too and it was added in the initial submission, dating 2017. The driver targeted two platforms, MSM8916 and MSM8996, so this write predates Glymur pretty much.
Thank you for the historical context! I checked with the firmware team and confirmed that this register is not read by any of the platform firmwares currently supported in the Iris driver. Regarding MSM8916 and MSM8996, those are not supported in the Iris driver.
Quoted 8 lines
Quoted 8 lines
Fixes abf5bac63f68 ("media: iris: implement the boot sequence of the firmware")Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_vpu_common.c | 1 - 1 file changed, 1 deletion(-)
Re: [PATCH v5 03/14] media: iris: Fix VM count passed to firmware
Quoted 14 lines · Vishnu Reddy
Quoted 11 lines · Dmitry Baryshkov
Quoted 6 lines · Vishnu Reddy
On Glymur, firmware interprets the value written to
CPU_CS_SCIACMDARG3as 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.The explanation is pretty suspicious. I can see this write in venus sources too and it was added in the initial submission, dating 2017. The driver targeted two platforms, MSM8916 and MSM8996, so this write predates Glymur pretty much.
Quoted 4 lines
Thank you for the historical context! I checked with the firmware team and confirmed that this register is not read by any of the platform firmwares currently supported in the Iris driver. Regarding MSM8916 and MSM8996, those are not supported in the Iris driver.
So, which platforms actually needed that register? The "currently supported" is not strong enough. We are bringing in Agatti support and support for SM8150 and SDM845 is in discussion. I would not be surprised if we end up porting other older platforms too. So, you are changing the historical behaviour. You need to document the applicability of the change.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Fixes abf5bac63f68 ("media: iris: implement the boot sequence of the firmware")Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_vpu_common.c | 1 - 1 file changed, 1 deletion(-)
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 03/14] media: iris: Fix VM count passed to firmware
Quoted 17 lines · Dmitry Baryshkov
Quoted 8 lines · Vishnu Reddy
Quoted 7 lines · Dmitry Baryshkov
Quoted 6 lines · Vishnu Reddy
On Glymur, firmware interprets the value written to
CPU_CS_SCIACMDARG3as 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.Quoted 8 lines
Quoted 4 lines
The explanation is pretty suspicious. I can see this write in venus sources too and it was added in the initial submission, dating 2017. The driver targeted two platforms, MSM8916 and MSM8996, so this write predates Glymur pretty much.
Thank you for the historical context! I checked with the firmware team and confirmed that this register is not read by any of the platform firmwares currently supported in the Iris driver. Regarding MSM8916 and MSM8996, those are not supported in the Iris driver.
Quoted 6 lines
So, which platforms actually needed that register? The "currently supported" is not strong enough. We are bringing in Agatti support and support for SM8150 and SDM845 is in discussion. I would not be surprised if we end up porting other older platforms too. So, you are changing the historical behaviour. You need to document the applicability of the change.
Apologies for the late reply, I was on vacation last week.
I'll move this to a glymur-specific vpu_ops hook and keep the existing behavior for the remaining platforms.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Fixes abf5bac63f68 ("media: iris: implement the boot sequence of the firmware")Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_vpu_common.c | 1 - 1 file changed, 1 deletion(-)
PATCH v5 4/14 dt-bindings: media: qcom,venus: Remove clock, power-domain, and iommus from common schema
In reply to Vishnu ReddyThe common schema defines minItems and maxItems for clocks, power-domains, and iommus. This suggests that the number of these resources can vary, while in reality they are fixed constraints per platform.
Remove these constraints from the common schema. Each platform specific schema already defines its own exact fixed constraints for these properties. Additionally, remove these from the required list and update all schemas that reference this common schema.
--- .../bindings/media/qcom,msm8916-venus.yaml | 3 +++ .../bindings/media/qcom,msm8996-venus.yaml | 3 +++ .../bindings/media/qcom,qcm2290-venus.yaml | 3 +++ .../bindings/media/qcom,sc7180-venus.yaml | 3 +++ .../bindings/media/qcom,sc7280-venus.yaml | 3 +++ .../bindings/media/qcom,sdm660-venus.yaml | 3 +++ .../bindings/media/qcom,sdm845-venus-v2.yaml | 3 +++ .../bindings/media/qcom,sdm845-venus.yaml | 3 +++ .../bindings/media/qcom,sm8250-venus.yaml | 3 +++ .../bindings/media/qcom,sm8750-iris.yaml | 3 +++ .../bindings/media/qcom,venus-common.yaml | 23 ---------------------- 11 files changed, 30 insertions(+), 23 deletions(-)
Documentation/devicetree/bindings/media/qcom,msm8916-venus.yaml +3 -0
@@ -62,8 +62,11 @@ properties: additionalProperties: false required: + - clocks + - clock-names - compatible - iommus + - power-domains unevaluatedProperties: false
Documentation/devicetree/bindings/media/qcom,msm8996-venus.yaml +3 -0
@@ -97,8 +97,11 @@ properties: additionalProperties: false required: + - clocks + - clock-names - compatible - iommus + - power-domains - video-decoder - video-encoder
Documentation/devicetree/bindings/media/qcom,qcm2290-venus.yaml +3 -0
@@ -57,7 +57,10 @@ properties: type: object required: + - clocks + - clock-names - compatible + - power-domains - power-domain-names - iommus
Documentation/devicetree/bindings/media/qcom,sc7180-venus.yaml +3 -0
@@ -92,7 +92,10 @@ properties: additionalProperties: false required: + - clocks + - clock-names - compatible + - power-domains - power-domain-names - iommus
Documentation/devicetree/bindings/media/qcom,sc7280-venus.yaml +3 -0
@@ -85,7 +85,10 @@ properties: additionalProperties: false required: + - clocks + - clock-names - compatible + - power-domains - power-domain-names - iommus
Documentation/devicetree/bindings/media/qcom,sdm660-venus.yaml +3 -0
@@ -96,8 +96,11 @@ properties: additionalProperties: false required: + - clocks + - clock-names - compatible - iommus + - power-domains - video-decoder - video-encoder
Documentation/devicetree/bindings/media/qcom,sdm845-venus-v2.yaml +3 -0
@@ -87,7 +87,10 @@ properties: additionalProperties: false required: + - clocks + - clock-names - compatible + - power-domains - power-domain-names - iommus
Documentation/devicetree/bindings/media/qcom,sdm845-venus.yaml +3 -0
@@ -88,8 +88,11 @@ properties: additionalProperties: false required: + - clocks + - clock-names - compatible - iommus + - power-domains - video-core0 - video-core1
Documentation/devicetree/bindings/media/qcom,sm8250-venus.yaml +3 -0
@@ -90,11 +90,14 @@ properties: additionalProperties: false required: + - clocks + - clock-names - compatible - power-domain-names - interconnects - interconnect-names - iommus + - power-domains - resets - reset-names
Documentation/devicetree/bindings/media/qcom,sm8750-iris.yaml +3 -0
@@ -68,11 +68,14 @@ properties: - const: vcodec0_core required: + - clocks + - clock-names - compatible - dma-coherent - interconnects - interconnect-names - iommus + - power-domains - power-domain-names - resets - reset-names
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +0 -23
@@ -18,35 +18,15 @@ properties: reg: maxItems: 1 - clocks: - minItems: 3 - maxItems: 7 - - clock-names: - minItems: 3 - maxItems: 7 - firmware-name: maxItems: 1 interrupts: maxItems: 1 - iommus: - minItems: 1 - maxItems: 20 - memory-region: maxItems: 1 - power-domains: - minItems: 1 - maxItems: 4 - - power-domain-names: - minItems: 1 - maxItems: 4 - video-firmware: type: object additionalProperties: false
@@ -64,10 +44,7 @@ properties: required: - reg - - clocks - - clock-names - interrupts - memory-region - - power-domains additionalProperties: true
Signature · 1 line
2.34.1
Re: [PATCH v5 04/14] dt-bindings: media: qcom,venus: Remove clock, power-domain, and iommus from common schema
Quoted 3 lines · Vishnu Reddy
The common schema defines minItems and maxItems for clocks, power-domains, and iommus. This suggests that the number of these resources can vary, while in reality they are fixed constraints per platform.
It really doesn't. It provides common definitions, while individual platform schemas tighten those.
Quoted 37 lines
Remove these constraints from the common schema. Each platform specific schema already defines its own exact fixed constraints for these properties. Additionally, remove these from the required list and update all schemas that reference this common schema.
Signed-off-by Vishnu Reddy <[email protected]>--- .../bindings/media/qcom,msm8916-venus.yaml | 3 +++ .../bindings/media/qcom,msm8996-venus.yaml | 3 +++ .../bindings/media/qcom,qcm2290-venus.yaml | 3 +++ .../bindings/media/qcom,sc7180-venus.yaml | 3 +++ .../bindings/media/qcom,sc7280-venus.yaml | 3 +++ .../bindings/media/qcom,sdm660-venus.yaml | 3 +++ .../bindings/media/qcom,sdm845-venus-v2.yaml | 3 +++ .../bindings/media/qcom,sdm845-venus.yaml | 3 +++ .../bindings/media/qcom,sm8250-venus.yaml | 3 +++ .../bindings/media/qcom,sm8750-iris.yaml | 3 +++ .../bindings/media/qcom,venus-common.yaml | 23 ---------------------- 11 files changed, 30 insertions(+), 23 deletions(-)Documentation/devicetree/bindings/media/qcom,msm8916-venus.yaml +3
-0@@ -62,8 +62,11 @@ properties: additionalProperties: false required: + - clocks + - clock-names - compatible - iommus + - power-domains unevaluatedProperties: false
[...]
Quoted 41 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +0
-20@@ -18,35 +18,15 @@ properties: reg: maxItems: 1 - clocks: - minItems: 3 - maxItems: 7 - - clock-names: - minItems: 3 - maxItems: 7 - firmware-name: maxItems: 1 interrupts: maxItems: 1 - iommus: - minItems: 1 - maxItems: 20 - memory-region: maxItems: 1 - power-domains: - minItems: 1 - maxItems: 4 - - power-domain-names: - minItems: 1 - maxItems: 4 - video-firmware: type: object additionalProperties: false
Documentation/devicetree/bindings/media/qcom,venus-common.yaml properties: · line 71
Quoted 8 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +0
-3@@ -64,10 +44,7 @@ properties: required: - reg - - clocks - - clock-names - interrupts - memory-region - - power-domains
Do we expect the platforms with Venus / Iris not having either clocks or power domains.
Quoted 6 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +0
-0additionalProperties: trueSignature · 1 line
2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 04/14] dt-bindings: media: qcom,venus: Remove clock, power-domain, and iommus from common schema
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Vishnu Reddy
The common schema defines minItems and maxItems for clocks, power-domains, and iommus. This suggests that the number of these resources can vary, while in reality they are fixed constraints per platform.
It really doesn't. It provides common definitions, while individual platform schemas tighten those.
If a new platform requires more resources than the current maxItems listed in the common-schema (e.g.,Glymur due to its dual vcodec core design), we need to keep bumping maxItems in the common schema every time a new platform exceeds the previous limit. That makes the common schema a moving target driven by platform specific.
I am fine with increasing maxItems in the common schema instead of removing. I can set it to a reasonable value (for example, up to 20) so that it accommodates future platforms without frequent changes. Anyway, each platform schema must define fixed constraints, since clocks and power-domains are mandatory per platform.
Could you please let me know which one you would prefer going forward?
Quoted 80 lines
Quoted 36 lines
Remove these constraints from the common schema. Each platform specific schema already defines its own exact fixed constraints for these properties. Additionally, remove these from the required list and update all schemas that reference this common schema.
Signed-off-by Vishnu Reddy <[email protected]>--- .../bindings/media/qcom,msm8916-venus.yaml | 3 +++ .../bindings/media/qcom,msm8996-venus.yaml | 3 +++ .../bindings/media/qcom,qcm2290-venus.yaml | 3 +++ .../bindings/media/qcom,sc7180-venus.yaml | 3 +++ .../bindings/media/qcom,sc7280-venus.yaml | 3 +++ .../bindings/media/qcom,sdm660-venus.yaml | 3 +++ .../bindings/media/qcom,sdm845-venus-v2.yaml | 3 +++ .../bindings/media/qcom,sdm845-venus.yaml | 3 +++ .../bindings/media/qcom,sm8250-venus.yaml | 3 +++ .../bindings/media/qcom,sm8750-iris.yaml | 3 +++ .../bindings/media/qcom,venus-common.yaml | 23 ---------------------- 11 files changed, 30 insertions(+), 23 deletions(-)Documentation/devicetree/bindings/media/qcom,msm8916-venus.yaml +3
-0@@ -62,8 +62,11 @@ properties: additionalProperties: false required: + - clocks + - clock-names - compatible - iommus + - power-domains unevaluatedProperties: false[...]
Quoted 42 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +0
-20@@ -18,35 +18,15 @@ properties: reg: maxItems: 1 - clocks: - minItems: 3 - maxItems: 7 - - clock-names: - minItems: 3 - maxItems: 7 - firmware-name: maxItems: 1 interrupts: maxItems: 1 - iommus: - minItems: 1 - maxItems: 20 - memory-region: maxItems: 1 - power-domains: - minItems: 1 - maxItems: 4 - - power-domain-names: - minItems: 1 - maxItems: 4 - video-firmware: type: object additionalProperties: false@@ -64,10 +44,7 @@ properties:
Quoted 9 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml properties: · line 71
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +0
-3required: - reg - - clocks - - clock-names - interrupts - memory-region - - power-domainsDo we expect the platforms with Venus / Iris not having either clocks or power domains.
All Venus / Iris platforms have clocks and power-domains. These removed from here and added in each platform schema.
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +0
-0additionalProperties: trueSignature · 1 line
2.34.1
Re: [PATCH v5 04/14] dt-bindings: media: qcom,venus: Remove clock, power-domain, and iommus from common schema
Quoted 15 lines · Vishnu Reddy
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Vishnu Reddy
The common schema defines minItems and maxItems for clocks, power-domains, and iommus. This suggests that the number of these resources can vary, while in reality they are fixed constraints per platform.
It really doesn't. It provides common definitions, while individual platform schemas tighten those.
If a new platform requires more resources than the current maxItems listed in the common-schema (e.g.,Glymur due to its dual vcodec core design), we need to keep bumping maxItems in the common schema every time a new platform exceeds the previous limit. That makes the common schema a moving target driven by platform specific.
Quoted 7 lines
I am fine with increasing maxItems in the common schema instead of removing. I can set it to a reasonable value (for example, up to 20) so that it accommodates future platforms without frequent changes. Anyway, each platform schema must define fixed constraints, since clocks and power-domains are mandatory per platform.
Could you please let me know which one you would prefer going forward?
Just touch venus-common when new platform requires bigger lists.
Quoted 19 lines
Quoted 9 lines
Quoted 9 lines
Remove these constraints from the common schema. Each platform specific schema already defines its own exact fixed constraints for these properties. Additionally, remove these from the required list and update all schemas that reference this common schema.
Signed-off-by Vishnu Reddy <[email protected]>(quoted diff) +0
-0@@ -64,10 +44,7 @@ properties:Quoted 9 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml properties: · line 71
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +0
-3required: - reg - - clocks - - clock-names - interrupts - memory-region - - power-domainsDo we expect the platforms with Venus / Iris not having either clocks or power domains.
Quoted 2 lines
All Venus / Iris platforms have clocks and power-domains. These removed from here and added in each platform schema.
This is a sign that this is wrong.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
(quoted diff) +0
-0additionalProperties: trueSignature · 1 line
2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 04/14] dt-bindings: media: qcom,venus: Remove clock, power-domain, and iommus from common schema
Quoted 14 lines · Dmitry Baryshkov
Quoted 13 lines · Vishnu Reddy
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Vishnu Reddy
The common schema defines minItems and maxItems for clocks, power-domains, and iommus. This suggests that the number of these resources can vary, while in reality they are fixed constraints per platform.
It really doesn't. It provides common definitions, while individual platform schemas tighten those.
If a new platform requires more resources than the current maxItems listed in the common-schema (e.g.,Glymur due to its dual vcodec core design), we need to keep bumping maxItems in the common schema every time a new platform exceeds the previous limit. That makes the common schema a moving target driven by platform specific.
Quoted 8 lines
Quoted 7 lines
I am fine with increasing maxItems in the common schema instead of removing. I can set it to a reasonable value (for example, up to 20) so that it accommodates future platforms without frequent changes. Anyway, each platform schema must define fixed constraints, since clocks and power-domains are mandatory per platform.
Could you please let me know which one you would prefer going forward?
Just touch venus-common when new platform requires bigger lists.
In the v3 series, I followed same approach — bumping maxItems in venus-common schema to accommodate the Glymur platform while keeping fixed constraints in the Glymur-specific schema:
https://lore.kernel.org/all/[email protected]/
I'm fine with bumping it only when a new platform requires it. However, I'd like to understand your preference a bit more:
Would you prefer setting it to a slightly larger value (e.g., ~20) upfront, so that it accommodates a few future platforms without needing frequent changes to the common schema?
Or
would you rather we bump it conservatively each time a new platform exceeds the current limit?
I'm fine with either way — just wanted to align on the preferred approach before the next revision.
Quoted 27 lines
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
Remove these constraints from the common schema. Each platform specific schema already defines its own exact fixed constraints for these properties. Additionally, remove these from the required list and update all schemas that reference this common schema.
Signed-off-by Vishnu Reddy <[email protected]>(quoted diff) +0
-0@@ -64,10 +44,7 @@ properties:Quoted 9 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml properties: · line 71
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +0
-3required: - reg - - clocks - - clock-names - interrupts - memory-region - - power-domainsDo we expect the platforms with Venus / Iris not having either clocks or power domains.
Quoted 2 lines
All Venus / Iris platforms have clocks and power-domains. These removed from here and added in each platform schema.
This is a sign that this is wrong.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
(quoted diff) +0
-0additionalProperties: trueSignature · 1 line
2.34.1
Re: [PATCH v5 04/14] dt-bindings: media: qcom,venus: Remove clock, power-domain, and iommus from common schema
Quoted 40 lines · Vishnu Reddy
Quoted 14 lines · Dmitry Baryshkov
Quoted 13 lines · Vishnu Reddy
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Vishnu Reddy
The common schema defines minItems and maxItems for clocks, power-domains, and iommus. This suggests that the number of these resources can vary, while in reality they are fixed constraints per platform.
It really doesn't. It provides common definitions, while individual platform schemas tighten those.
If a new platform requires more resources than the current maxItems listed in the common-schema (e.g.,Glymur due to its dual vcodec core design), we need to keep bumping maxItems in the common schema every time a new platform exceeds the previous limit. That makes the common schema a moving target driven by platform specific.
Quoted 8 lines
Quoted 7 lines
I am fine with increasing maxItems in the common schema instead of removing. I can set it to a reasonable value (for example, up to 20) so that it accommodates future platforms without frequent changes. Anyway, each platform schema must define fixed constraints, since clocks and power-domains are mandatory per platform.
Could you please let me know which one you would prefer going forward?
Just touch venus-common when new platform requires bigger lists.
In the v3 series, I followed same approach — bumping maxItems in venus-common schema to accommodate the Glymur platform while keeping fixed constraints in the Glymur-specific schema:
https://lore.kernel.org/all/[email protected]/I'm fine with bumping it only when a new platform requires it. However, I'd like to understand your preference a bit more:
Would you prefer setting it to a slightly larger value (e.g., ~20) upfront, so that it accommodates a few future platforms without needing frequent changes to the common schema?
Or
would you rather we bump it conservatively each time a new platform exceeds the current limit?
Quoted 2 lines
I'm fine with either way — just wanted to align on the preferred approach before the next revision.
The latter one is the most typical approach.
Quoted 28 lines
Quoted 28 lines
Quoted 18 lines
Quoted 9 lines
Quoted 9 lines
Remove these constraints from the common schema. Each platform specific schema already defines its own exact fixed constraints for these properties. Additionally, remove these from the required list and update all schemas that reference this common schema.
Signed-off-by Vishnu Reddy <[email protected]>(quoted diff) +0
-0@@ -64,10 +44,7 @@ properties:Quoted 9 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml properties: · line 71
Quoted 7 lines
Documentation/devicetree/bindings/media/qcom,venus-common.yaml +0
-3required: - reg - - clocks - - clock-names - interrupts - memory-region - - power-domainsDo we expect the platforms with Venus / Iris not having either clocks or power domains.
Quoted 2 lines
All Venus / Iris platforms have clocks and power-domains. These removed from here and added in each platform schema.
This is a sign that this is wrong.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
(quoted diff) +0
-0additionalProperties: trueSignature · 1 line
2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 04/14] dt-bindings: media: qcom,venus: Remove clock, power-domain, and iommus from common schema
In reply to Vishnu ReddyQuoted 22 lines · Vishnu Reddy
Quoted 20 lines · Dmitry Baryshkov
Quoted 19 lines · Vishnu Reddy
Quoted 6 lines · Dmitry Baryshkov
Quoted 3 lines · Vishnu Reddy
The common schema defines minItems and maxItems for clocks, power-domains, and iommus. This suggests that the number of these resources can vary, while in reality they are fixed constraints per platform.
It really doesn't. It provides common definitions, while individual platform schemas tighten those.
If a new platform requires more resources than the current maxItems listed in the common-schema (e.g.,Glymur due to its dual vcodec core design), we need to keep bumping maxItems in the common schema every time a new platform exceeds the previous limit. That makes the common schema a moving target driven by platform specific.
I am fine with increasing maxItems in the common schema instead of removing. I can set it to a reasonable value (for example, up to 20) so that it accommodates future platforms without frequent changes. Anyway, each platform schema must define fixed constraints, since clocks and power-domains are mandatory per platform.
Quoted 8 lines
Quoted 2 lines
Quoted 1 line
Could you please let me know which one you would prefer going forward?
Just touch venus-common when new platform requires bigger lists.
In the v3 series, I followed same approach — bumping maxItems in venus-common schema to accommodate the Glymur platform while keeping fixed constraints in the Glymur-specific schema:
https://lore.kernel.org/all/[email protected]/
The approach taken at v3 was correct and I ONLY commented about very confusing commit msg which told that you relaxed constraints. You must not relax constraints, so commit msg claiming that you relax them is obviously incorrect. Each device must have a fixed, as in non-relaxed, constraints, thus making them relaxed (not fixed) is wrong.
Best regards,
Krzysztof
PATCH v5 5/14 dt-bindings: media: qcom,glymur-iris: Add glymur video codec
In reply to Vishnu ReddyAdd device tree binding for the Qualcomm Glymur Iris video codec. Glymur is a new generation of video IP that introduces a dual-core architecture. The second core brings its own power domain, clocks, and reset lines, requiring additional power domains and clocks in the power sequence.
--- .../bindings/media/qcom,glymur-iris.yaml | 208 +++++++++++++++++++++ include/dt-bindings/media/qcom,glymur-iris.h | 11 ++ 2 files changed, 219 insertions(+)
Documentation/devicetree/bindings/media/qcom,glymur-iris.yaml new file +208 -0
@@ -0,0 +1,208 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/qcom,glymur-iris.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Glymur SoC Iris video encoder and decoder + +maintainers: + - Vishnu Reddy <[email protected]> + +description: + The Iris video processing unit on Qualcomm Glymur SoC is a video encode and + decode accelerator. + +properties: + compatible: + const: qcom,glymur-iris + + clocks: + maxItems: 9 + + clock-names: + items: + - const: iface + - const: core + - const: vcodec0_core + - const: iface1 + - const: core_freerun + - const: vcodec0_core_freerun + - const: iface2 + - const: vcodec1_core + - const: vcodec1_core_freerun + + dma-coherent: true + + interconnects: + maxItems: 2 + + interconnect-names: + items: + - const: cpu-cfg + - const: video-mem + + iommus: + maxItems: 4 + + iommu-map: + maxItems: 1 + + operating-points-v2: true + opp-table: + type: object + + power-domains: + maxItems: 5 + + power-domain-names: + items: + - const: venus + - const: vcodec0 + - const: mxc + - const: mmcx + - const: vcodec1 + + resets: + maxItems: 6 + + reset-names: + items: + - const: bus0 + - const: bus1 + - const: core + - const: vcodec0_core + - const: bus2 + - const: vcodec1_core + +required: + - clocks + - clock-names + - compatible + - dma-coherent + - interconnects + - interconnect-names + - iommus + - power-domains + - power-domain-names + - resets + - reset-names + +allOf: + - $ref: qcom,venus-common.yaml# + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/media/qcom,glymur-iris.h> + #include <dt-bindings/power/qcom,rpmhpd.h> + + video-codec@aa00000 { + compatible = "qcom,glymur-iris"; + reg = <0x0aa00000 0xf0000>; + + clocks = <&gcc_video_axi0_clk>, + <&videocc_mvs0c_clk>, + <&videocc_mvs0_clk>, + <&gcc_video_axi0c_clk>, + <&videocc_mvs0c_freerun_clk>, + <&videocc_mvs0_freerun_clk>, + <&gcc_video_axi1_clk>, + <&videocc_mvs1_clk>, + <&videocc_mvs1_freerun_clk>; + clock-names = "iface", + "core", + "vcodec0_core", + "iface1", + "core_freerun", + "vcodec0_core_freerun", + "iface2", + "vcodec1_core", + "vcodec1_core_freerun"; + + dma-coherent; + + interconnects = <&hsc_noc_master_appss_proc &config_noc_slave_venus_cfg>, + <&mmss_noc_master_video &mc_virt_slave_ebi1>; + interconnect-names = "cpu-cfg", + "video-mem"; + + interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; + + iommus = <&apps_smmu 0x1940 0x0>, + <&apps_smmu 0x1943 0x0>, + <&apps_smmu 0x1944 0x0>, + <&apps_smmu 0x19e0 0x0>; + + iommu-map = <IOMMU_FID_IRIS_FIRMWARE &apps_smmu 0x19e2 0x1>; + + memory-region = <&video_mem>; + + operating-points-v2 = <&iris_opp_table>; + + power-domains = <&videocc_mvs0c_gdsc>, + <&videocc_mvs0_gdsc>, + <&rpmhpd RPMHPD_MXC>, + <&rpmhpd RPMHPD_MMCX>, + <&videocc_mvs1_gdsc>; + power-domain-names = "venus", + "vcodec0", + "mxc", + "mmcx", + "vcodec1"; + + resets = <&gcc_video_axi0_clk_ares>, + <&gcc_video_axi0c_clk_ares>, + <&videocc_mvs0c_freerun_clk_ares>, + <&videocc_mvs0_freerun_clk_ares>, + <&gcc_video_axi1_clk_ares>, + <&videocc_mvs1_freerun_clk_ares>; + reset-names = "bus0", + "bus1", + "core", + "vcodec0_core", + "bus2", + "vcodec1_core"; + + iris_opp_table: opp-table { + compatible = "operating-points-v2"; + + opp-240000000 { + opp-hz = /bits/ 64 <240000000 240000000 360000000>; + required-opps = <&rpmhpd_opp_svs>, + <&rpmhpd_opp_low_svs>; + }; + + opp-338000000 { + opp-hz = /bits/ 64 <338000000 338000000 507000000>; + required-opps = <&rpmhpd_opp_svs>, + <&rpmhpd_opp_svs>; + }; + + opp-366000000 { + opp-hz = /bits/ 64 <366000000 366000000 549000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_svs_l1>; + }; + + opp-444000000 { + opp-hz = /bits/ 64 <444000000 444000000 666000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_nom>; + }; + + opp-533333334 { + opp-hz = /bits/ 64 <533333334 533333334 800000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_turbo>; + }; + + opp-655000000 { + opp-hz = /bits/ 64 <655000000 655000000 982000000>; + required-opps = <&rpmhpd_opp_nom>, + <&rpmhpd_opp_turbo_l1>; + }; + }; + };
include/dt-bindings/media/qcom,glymur-iris.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. +*/ + +#ifndef _DT_BINDINGS_MEDIA_QCOM_GLYMUR_IRIS_H_ +#define _DT_BINDINGS_MEDIA_QCOM_GLYMUR_IRIS_H_ + +#define IOMMU_FID_IRIS_FIRMWARE 0 + +#endif
Signature · 1 line
2.34.1
PATCH v5 6/14 media: iris: Add context bank hooks for platform specific initialization
In reply to Vishnu ReddyThe Glymur platform requires a dedicated firmware context bank device which is mapped to the firmware stream ID to load the firmware.
Add init and deinit hooks in the platform data for context bank setup. These hooks allow platform specific code to initialize and tear down context banks.
--- .../platform/qcom/iris/iris_platform_common.h | 2 ++ drivers/media/platform/qcom/iris/iris_probe.c | 23 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_platform_common.h +2 -0
@@ -219,6 +219,8 @@ struct iris_platform_data {u32 (*get_vpu_buffer_size)(struct iris_inst *inst,enum iris_buffer_type buffer_type);const struct vpu_ops *vpu_ops;void (*set_preset_registers)(struct iris_core *core); +int (*init_cb_devs)(struct iris_core *core); +void (*deinit_cb_devs)(struct iris_core *core);const struct icc_info *icc_tbl;unsigned int icc_tbl_size;const struct bw_info *bw_tbl_dec;
drivers/media/platform/qcom/iris/iris_probe.c +22 -1
@@ -142,6 +142,20 @@ static int iris_init_resources(struct iris_core *core)return iris_init_resets (core); } +static int iris_init_cb_devs (struct iris_core *core) +{ +if (core->iris_platform_data->init_cb_devs) +return core->iris_platform_data->init_cb_devs (core); + +return 0 ; +} + +static void iris_deinit_cb_devs (struct iris_core *core) +{ +if (core->iris_platform_data->deinit_cb_devs) + core->iris_platform_data->deinit_cb_devs (core); +} +static int iris_register_video_device (struct iris_core *core,enum domain_type type) {struct video_device *vdev;
@@ -193,6 +207,7 @@ static void iris_remove(struct platform_device *pdev)return ;iris_core_deinit (core); +iris_deinit_cb_devs (core);video_unregister_device (core->vdev_dec);video_unregister_device (core->vdev_enc);
@@ -259,11 +274,15 @@ static int iris_probe(struct platform_device *pdev)if (ret)return ret; + ret =iris_init_cb_devs (core); +if (ret) +return ret; +iris_session_init_caps (core); ret =v4l2_device_register (dev, &core->v4l2_dev);if (ret) -return ret; + goto err_deinit_cb; ret =iris_register_video_device (core,DECODER );if (ret)
@@ -298,6 +317,8 @@ static int iris_probe(struct platform_device *pdev)video_unregister_device (core->vdev_dec); err_v4l2_unreg:v4l2_device_unregister (&core->v4l2_dev); +err_deinit_cb: +iris_deinit_cb_devs (core);return ret; }
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v5 06/14] media: iris: Add context bank hooks for platform specific initialization
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Teardown order violation in `iris_remove()` creates a race condition with userspace, potentially…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Teardown order violation in iris_remove() creates a race condition with userspace, potentially leading to Use-After-Free or IOMMU faults. --
commit 4def10f3c3b40c622d9f01893a1225d37915f0d3
Author: Vishnu Reddy <[email protected]>
media: iris: Add context bank hooks for platform specific initialization
This commit adds initialization and deinitialization hooks in the platform data for context bank setup. These hooks allow platform-specific code to configure dedicated firmware context bank devices mapped to the firmware stream ID.
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_probe.c +0
-0
[ ... ]
drivers/media/platform/qcom/iris/iris_probe.c static void iris_remove(struct platform_device *pdev) · line 213
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_probe.c +1
-0@@ -193,6 +207,7 @@ static void iris_remove(struct platform_device *pdev)return ;iris_core_deinit (core); +iris_deinit_cb_devs (core);video_unregister_device (core->vdev_dec);video_unregister_device (core->vdev_enc);
Could this teardown order create a race condition with userspace?
The patch calls iris_deinit_cb_devs() before video_unregister_device(), which leaves a window where the hardware context banks are destroyed while the v4l2 character devices remain registered and accessible to userspace.
If userspace calls open() on the device during this window, the standard v4l2_open() will succeed and could eventually call into iris_core_init(). Since iris_core_init() acquires the core lock, detects the deinit state, and calls iris_fw_load(), it could attempt to load the firmware while the context banks are being torn down.
Attempting to use destroyed context banks for DMA or firmware mapping could result in IOMMU faults or memory corruption.
While the pre-existing code already called iris_core_deinit() before unregistering the video devices, this patch introduces a new failure mode by explicitly tearing down the context banks during this exposed window.
Should iris_deinit_cb_devs() be called after the video devices are fully unregistered, similar to the LIFO teardown order followed in the iris_probe() error paths?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
PATCH v5 7/14 media: iris: Enable Secure PAS support with IOMMU managed by Linux
In reply to Vishnu ReddyFrom: Mukesh Ojha <[email protected]>
Most Qualcomm platforms feature a proprietary 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 iommu-map in the device tree.
--- drivers/media/platform/qcom/iris/iris_core.h | 4 ++ drivers/media/platform/qcom/iris/iris_firmware.c | 72 ++++++++++++++++++++---- 2 files changed, 66 insertions(+), 10 deletions(-)
drivers/media/platform/qcom/iris/iris_core.h +4 -0
@@ -34,6 +34,8 @@ enum domain_type {* struct iris_core - holds core parameters valid for all instances * * @dev: reference to device structure +* @fw_dev: reference to the context bank device used for firmware load +* @pas_ctx: SCM PAS context for authenticated firmware load and shutdown * @reg_base: IO memory base address * @irq: iris irq * @v4l2_dev: a holder for v4l2 device structure
@@ -77,6 +79,8 @@ enum domain_type {struct iris_core {struct device *dev; +struct device *fw_dev; +struct qcom_scm_pas_context *pas_ctx;void __iomem *reg_base;int irq;struct v4l2_device v4l2_dev;
drivers/media/platform/qcom/iris/iris_firmware.c +62 -10
136 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v5 07/14] media: iris: Enable Secure PAS support with IOMMU managed by Linux
Quoted 4 lines · Vishnu Reddy
From: Mukesh Ojha <[email protected]>
Most Qualcomm platforms feature a proprietary hypervisor (such as Gunyah or QHEE),
Gunyah has open-source version as well. Can we make it little less ambiguous?
---Trilok Soni
Re: [PATCH v5 07/14] media: iris: Enable Secure PAS support with IOMMU managed by Linux
Quoted 7 lines · Trilok Soni
Quoted 4 lines · Vishnu Reddy
From: Mukesh Ojha <[email protected]>
Most Qualcomm platforms feature a proprietary hypervisor (such as Gunyah or QHEE),
Gunyah has open-source version as well. Can we make it little less ambiguous?
I doubt, Gunyah open versions handles PIL bring up sequence which only done by QHEE module., Yes, we can just mention QHEE here to be precise..
Quoted 2 lines
---Trilok Soni
Signature · 1 line
-Mukesh Ojha
Re: [PATCH v5 07/14] media: iris: Enable Secure PAS support with IOMMU managed by Linux
In reply to Vishnu ReddyQuoted 6 lines · Vishnu Reddy
From: Mukesh Ojha <[email protected]>
Most Qualcomm platforms feature a proprietary 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
No the calls to those functions are not intercepted. Doesn't hypervisor simply implement the SCM calls?
Quoted 10 lines
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).
I fail to identify, which changes correspond to this description. If it's about the PAS context creation, could you please be more specific?
Quoted 4 lines
Additionally, the Iris driver must map the firmware and its required resources to the firmware SID, which is now specified via iommu-map in the device tree.
Why? You miss the most important part here.
Quoted 11 lines
Reviewed-by Vishnu Reddy <[email protected]>Co-developed-by Vikash Garodia <[email protected]>Signed-off-by Vikash Garodia <[email protected]>Signed-off-by Mukesh Ojha <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_core.h | 4 ++ drivers/media/platform/qcom/iris/iris_firmware.c | 72 ++++++++++++++++++++---- 2 files changed, 66 insertions(+), 10 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 07/14] media: iris: Enable Secure PAS support with IOMMU managed by Linux
Quoted 10 lines · Dmitry Baryshkov
Quoted 6 lines · Vishnu Reddy
From: Mukesh Ojha <[email protected]>
Most Qualcomm platforms feature a proprietary 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 areNo the calls to those functions are not intercepted. Doesn't hypervisor simply implement the SCM calls?
All the SMC calls are intercepted whenever Gunyah or QHEE hypervisor is present and in most of the case the preparational work for the TZ like in case of qcom_scm_pas_auth_and_reset() it does create/register SHMbridge over PIL memory so that the TZ can access the memory and then calls same SMC call to TZ for authentication and once done it comes back does mapping the PIL region and call bring up sequence of the co-processor.
SMC SHM setup SMC (auth) map memory/resource and trigger reset sequence
HLOS ==> Gunyah(QHEE) ==> TZ ==> Gunyah(QHEE) === ==> IRIS
Quoted 8 lines
Quoted 8 lines
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.
Quoted 6 lines
Quoted 3 lines
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).
I fail to identify, which changes correspond to this description. If it's about the PAS context creation, could you please be more specific?
I think, commit text is trying to tell the Infra to support any Secure PIL when IOMMU is managed by Linux at EL2 and the dependency related to SHM set up in Linux are done as part of [1] are in upstream.
[1]
https://lore.kernel.org/lkml/[email protected]/
Quoted 7 lines
Quoted 5 lines
Additionally, the Iris driver must map the firmware and its required resources to the firmware SID, which is now specified via iommu-map in the device tree.
Why? You miss the most important part here.
Sorry, I did not get.. are you looking for explaination here, why via iommu-map in commit text ?
Quoted 16 lines
Quoted 12 lines
Reviewed-by Vishnu Reddy <[email protected]>Co-developed-by Vikash Garodia <[email protected]>Signed-off-by Vikash Garodia <[email protected]>Signed-off-by Mukesh Ojha <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_core.h | 4 ++ drivers/media/platform/qcom/iris/iris_firmware.c | 72 ++++++++++++++++++++---- 2 files changed, 66 insertions(+), 10 deletions(-)Signature · 2 lines
With best wishes Dmitry
Signature · 1 line
-Mukesh Ojha
Re: [PATCH v5 07/14] media: iris: Enable Secure PAS support with IOMMU managed by Linux
Quoted 12 lines · Mukesh Ojha
Quoted 10 lines · Dmitry Baryshkov
Quoted 6 lines · Vishnu Reddy
From: Mukesh Ojha <[email protected]>
Most Qualcomm platforms feature a proprietary 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 areNo the calls to those functions are not intercepted. Doesn't hypervisor simply implement the SCM calls?
Quoted 6 lines
All the SMC calls are intercepted whenever Gunyah or QHEE hypervisor is present and in most of the case the preparational work for the TZ like in case of
qcom_scm_pas_auth_and_reset()it does create/register SHMbridge over PIL memory so that the TZ can access the memory and then calls same SMC call to TZ for authentication and once done it comes back does mapping the PIL region and call bring up sequence of the co-processor.
I see, thanks for the explanation.
Quoted 17 lines
SMC SHM setup SMC (auth) map memory/resource and trigger reset sequence
HLOS ==> Gunyah(QHEE) ==> TZ ==> Gunyah(QHEE) === ==> IRISQuoted 12 lines
Quoted 11 lines
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).
Quoted 6 lines
Quoted 2 lines
I fail to identify, which changes correspond to this description. If it's about the PAS context creation, could you please be more specific?
I think, commit text is trying to tell the Infra to support any Secure PIL when IOMMU is managed by Linux at EL2 and the dependency related to SHM set up in Linux are done as part of [1] are in upstream.
Ok... I'd say, this part of the commit message might need some polishing, but I can't give an exact advice here.
Quoted 6 lines
[1]
https://lore.kernel.org/lkml/[email protected]/Quoted 2 lines
Quoted 2 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Additionally, the Iris driver must map the firmware and its required resources to the firmware SID, which is now specified via iommu-map in the device tree.
Why? You miss the most important part here.
Sorry, I did not get.. are you looking for explaination here, why via iommu-map in commit text ?
Yes. Why are you using iommu-map instead of listing it in the main iommus entry?
Quoted 20 lines
Quoted 17 lines
Quoted 13 lines
Reviewed-by Vishnu Reddy <[email protected]>Co-developed-by Vikash Garodia <[email protected]>Signed-off-by Vikash Garodia <[email protected]>Signed-off-by Mukesh Ojha <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_core.h | 4 ++ drivers/media/platform/qcom/iris/iris_firmware.c | 72 ++++++++++++++++++++---- 2 files changed, 66 insertions(+), 10 deletions(-)Signature · 2 lines
With best wishes DmitrySignature · 1 line
-Mukesh Ojha
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 07/14] media: iris: Enable Secure PAS support with IOMMU managed by Linux
Quoted 44 lines · Dmitry Baryshkov
Quoted 8 lines · Mukesh Ojha
Quoted 7 lines · Dmitry Baryshkov
Quoted 6 lines · Vishnu Reddy
From: Mukesh Ojha <[email protected]>
Most Qualcomm platforms feature a proprietary 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 areQuoted 8 lines
Quoted 2 lines
No the calls to those functions are not intercepted. Doesn't hypervisor simply implement the SCM calls?
All the SMC calls are intercepted whenever Gunyah or QHEE hypervisor is present and in most of the case the preparational work for the TZ like in case of
qcom_scm_pas_auth_and_reset()it does create/register SHMbridge over PIL memory so that the TZ can access the memory and then calls same SMC call to TZ for authentication and once done it comes back does mapping the PIL region and call bring up sequence of the co-processor.I see, thanks for the explanation.
Quoted 11 lines
SMC SHM setup SMC (auth) map memory/resource and trigger reset sequence
HLOS ==> Gunyah(QHEE) ==> TZ ==> Gunyah(QHEE) === ==> IRISQuoted 7 lines
Quoted 7 lines
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.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
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).
I fail to identify, which changes correspond to this description. If it's about the PAS context creation, could you please be more specific?
I think, commit text is trying to tell the Infra to support any Secure PIL when IOMMU is managed by Linux at EL2 and the dependency related to SHM set up in Linux are done as part of [1] are in upstream.
Ok... I'd say, this part of the commit message might need some polishing, but I can't give an exact advice here.
Quoted 3 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Additionally, the Iris driver must map the firmware and its required resources to the firmware SID, which is now specified via iommu-map in the device tree.
Why? You miss the most important part here.
Sorry, I did not get.. are you looking for explaination here, why via iommu-map in commit text ?
Yes. Why are you using iommu-map instead of listing it in the main iommus entry?
Without hypervisor: iommu-map is populated, so the driver creates a firmware device and handles the IOMMU mapping.
With Gunyah/QHEE: iommu-map is omitted, firmware device is NULL, and the driver skips mapping since the hypervisor takes care of it.
The main iommus entry already holds other stream IDs (pixel, non-pixel, etc.) and cannot be used to distinguish the firmware SID or infer hypervisor presence, hence the use of a separate iommu-map property.
Quoted 15 lines
Quoted 15 lines
Quoted 13 lines
Quoted 10 lines
Reviewed-by Vishnu Reddy <[email protected]>Co-developed-by Vikash Garodia <[email protected]>Signed-off-by Vikash Garodia <[email protected]>Signed-off-by Mukesh Ojha <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_core.h | 4 ++ drivers/media/platform/qcom/iris/iris_firmware.c | 72 ++++++++++++++++++++---- 2 files changed, 66 insertions(+), 10 deletions(-)Signature · 2 lines
With best wishes DmitrySignature · 1 line
-Mukesh Ojha
Re: [PATCH v5 07/14] media: iris: Enable Secure PAS support with IOMMU managed by Linux
Quoted 58 lines · Vishnu Reddy
Quoted 44 lines · Dmitry Baryshkov
Quoted 8 lines · Mukesh Ojha
Quoted 7 lines · Dmitry Baryshkov
Quoted 6 lines · Vishnu Reddy
From: Mukesh Ojha <[email protected]>
Most Qualcomm platforms feature a proprietary 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 areQuoted 8 lines
Quoted 2 lines
No the calls to those functions are not intercepted. Doesn't hypervisor simply implement the SCM calls?
All the SMC calls are intercepted whenever Gunyah or QHEE hypervisor is present and in most of the case the preparational work for the TZ like in case of
qcom_scm_pas_auth_and_reset()it does create/register SHMbridge over PIL memory so that the TZ can access the memory and then calls same SMC call to TZ for authentication and once done it comes back does mapping the PIL region and call bring up sequence of the co-processor.I see, thanks for the explanation.
Quoted 11 lines
SMC SHM setup SMC (auth) map memory/resource and trigger reset sequence
HLOS ==> Gunyah(QHEE) ==> TZ ==> Gunyah(QHEE) === ==> IRISQuoted 7 lines
Quoted 7 lines
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.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
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).
I fail to identify, which changes correspond to this description. If it's about the PAS context creation, could you please be more specific?
I think, commit text is trying to tell the Infra to support any Secure PIL when IOMMU is managed by Linux at EL2 and the dependency related to SHM set up in Linux are done as part of [1] are in upstream.
Ok... I'd say, this part of the commit message might need some polishing, but I can't give an exact advice here.
Quoted 3 lines
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Additionally, the Iris driver must map the firmware and its required resources to the firmware SID, which is now specified via iommu-map in the device tree.
Why? You miss the most important part here.
Sorry, I did not get.. are you looking for explaination here, why via iommu-map in commit text ?
Yes. Why are you using iommu-map instead of listing it in the main iommus entry?
Without hypervisor: iommu-map is populated, so the driver creates a firmware device and handles the IOMMU mapping.
Quoted 6 lines
With Gunyah/QHEE: iommu-map is omitted, firmware device is NULL, and the driver skips mapping since the hypervisor takes care of it.
The main iommus entry already holds other stream IDs (pixel, non-pixel, etc.) and cannot be used to distinguish the firmware SID or infer hypervisor presence, hence the use of a separate iommu-map property.
This is not really an explanation. Would you be able to understand it if you were shown this text?
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 14 lines
Quoted 11 lines
Reviewed-by Vishnu Reddy <[email protected]>Co-developed-by Vikash Garodia <[email protected]>Signed-off-by Vikash Garodia <[email protected]>Signed-off-by Mukesh Ojha <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_core.h | 4 ++ drivers/media/platform/qcom/iris/iris_firmware.c | 72 ++++++++++++++++++++---- 2 files changed, 66 insertions(+), 10 deletions(-)Signature · 2 lines
With best wishes DmitrySignature · 1 line
-Mukesh Ojha
Signature · 2 lines
With best wishes Dmitry
[email protected]
AI reviewRe: [PATCH v5 07/14] media: iris: Enable Secure PAS support with IOMMU managed by Linux
In reply to Vishnu ReddyThank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider: - [High] Missing `qcom_scm_pas_metadata_release()` causes PAS metadata buffer memory leak. - [High]…
Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [High] Missing qcom_scm_pas_metadata_release() causes PAS metadata buffer memory leak.
- [High] Unbounded memory leak due to dynamic devm_qcom_scm_pas_context_alloc() inside iris_load_fw_to_memory().
- [High] Skipped iris_fw_iommu_unmap() if qcom_scm_pas_shutdown() fails causes permanent device failure.
- [High] Directly calling iommu_map() on a default DMA domain bypasses the DMA API.
- [Medium] Original error codes from iris_load_fw_to_memory() are unconditionally masked with -ENOMEM. --
commit f84ed6beb9478a59d8db52c92115b570f4c199ba
Author: Mukesh Ojha <[email protected]>
media: iris: Enable Secure PAS support with IOMMU managed by Linux
This commit extends the Iris driver to handle IOMMU and SHM bridge configurations for firmware load and resources mapping in the absence of a proprietary hypervisor.
[ ... ]
Quoted 2 lines
drivers/media/platform/qcom/iris/iris_firmware.c +0
-0
[ ... ]
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_firmware.c +1
-1@@ -29,14 +33,18 @@ static int iris_load_fw_to_memory(struct iris_core *core, const char *fw_name)if (strlen (fw_name) >=MAX_FIRMWARE_NAME_SIZE -4 )return -EINVAL ; - ret =of_reserved_mem_region_to_resource (dev->of_node,0 , &res); + ret =of_reserved_mem_region_to_resource (core->dev->of_node,0 , &res);
drivers/media/platform/qcom/iris/iris_firmware.c static int iris_load_fw_to_memory(struct iris_core *core, const char *fw_name) · line 45
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_firmware.c +3
-1if (ret)return ret; mem_phys = res.start; res_size =resource_size (&res); - ret =request_firmware (&firmware, fw_name, dev); + pas_ctx =devm_qcom_scm_pas_context_alloc (fw_dev, pas_id, mem_phys, res_size); +if (IS_ERR (pas_ctx)) +return PTR_ERR (pas_ctx);
devm_qcom_scm_pas_context_alloc() ties the memory to the fw_dev unbind event. If iris_load_fw_to_memory() is called dynamically (e.g., when userspace opens the device) and fails later in the function, this devres allocation isn't freed. Could repeated failures here lead to an unbounded memory leak?
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_firmware.c +2
-0+ + ret =request_firmware (&firmware, fw_name, fw_dev);if (ret)return ret;
[ ... ]
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_firmware.c +4
-2@@ -52,9 +60,27 @@ static int iris_load_fw_to_memory(struct iris_core *core, const char *fw_name) goto err_release_fw; } - ret =qcom_mdt_load (dev, firmware, fw_name, - pas_id, mem_virt, mem_phys, res_size,NULL ); + pas_ctx->use_tzmem = !!core->fw_dev; + ret =qcom_mdt_pas_load (pas_ctx, firmware, fw_name, mem_virt,NULL ); +if (ret) + goto err_mem_unmap;
drivers/media/platform/qcom/iris/iris_firmware.c static int iris_load_fw_to_memory(struct iris_core *core, const char *fw_name) · line 76
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_firmware.c +10
-0+ +if (pas_ctx->use_tzmem) { + domain =iommu_get_domain_for_dev (fw_dev); +if (!domain) { + ret = -ENODEV ; + goto err_mem_unmap; + } + + ret =iommu_map (domain,IRIS_FW_START_ADDR , mem_phys, res_size, +IOMMU_READ |IOMMU_WRITE |IOMMU_PRIV ,GFP_KERNEL );
iommu_get_domain_for_dev() will return the default DMA domain attached to fw_dev. Is it safe to call iommu_map() directly on a DMA domain?
This bypasses the DMA API's IOVA allocator and might trigger a kernel warning. Should the driver allocate and attach an unmanaged domain instead?
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_firmware.c +6
-0+if (ret) + goto err_mem_unmap; + } + core->pas_ctx = pas_ctx; + +err_mem_unmap:memunmap (mem_virt); err_release_fw:release_firmware (firmware);
[ ... ]
drivers/media/platform/qcom/iris/iris_firmware.c int iris_fw_load(struct iris_core *core) · line 118
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_firmware.c +0
-0@@ -79,10 +117,10 @@ int iris_fw_load(struct iris_core *core)return -ENOMEM ; }
Now that iris_load_fw_to_memory() has been updated to return specific error codes like -EINVAL, -ENODEV, or PTR_ERR(), is there a reason to continue masking all of them with -ENOMEM here?
drivers/media/platform/qcom/iris/iris_firmware.c int iris_fw_load(struct iris_core *core) · line 120
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_firmware.c +1
-1- ret =qcom_scm_pas_auth_and_reset (core->iris_platform_data->pas_id); + ret =qcom_scm_pas_prepare_and_auth_reset (core->pas_ctx);
qcom_mdt_pas_load() allocates a secure DMA buffer for firmware metadata via qcom_scm_pas_init_image(). Does this driver need to call qcom_scm_pas_metadata_release() after authentication here to avoid leaking the metadata buffer?
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_firmware.c +1
-1if (ret) {dev_err (core->dev,"auth and reset failed: %d\n" , ret); -return ret; + goto err_unmap; }
[ ... ]
Quoted 1 line
drivers/media/platform/qcom/iris/iris_firmware.c +0
-0@@ -93,17 +131,31 @@ int iris_fw_load(struct iris_core *core)
[ ... ]
drivers/media/platform/qcom/iris/iris_firmware.c int iris_fw_load(struct iris_core *core) · line 158
Quoted 12 lines
int
iris_fw_unload(struct iris_core *core)
{drivers/media/platform/qcom/iris/iris_firmware.c +9
-1-return qcom_scm_pas_shutdown (core->iris_platform_data->pas_id); +int ret; + + ret =qcom_scm_pas_shutdown (core->pas_ctx->pas_id); +if (ret) +return ret; + +iris_fw_iommu_unmap (core); + +return ret;
If qcom_scm_pas_shutdown() fails and returns early, iris_fw_iommu_unmap() is skipped. Will this leave the IOMMU mapping active at IRIS_FW_START_ADDR, causing the next iommu_map() attempt during initialization to fail with -EEXIST?
Quoted 3 lines
}
int
iris_set_hw_state(struct iris_core *core, bool resume)
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
PATCH v5 8/14 media: iris: Rename clock and power domain macros to use vcodec prefix
In reply to Vishnu ReddyThe 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.
--- .../platform/qcom/iris/iris_platform_common.h | 12 ++++---- .../media/platform/qcom/iris/iris_platform_gen1.c | 6 ++-- .../media/platform/qcom/iris/iris_platform_gen2.c | 6 ++-- .../platform/qcom/iris/iris_platform_sc7280.h | 10 +++---- .../platform/qcom/iris/iris_platform_sm8750.h | 12 ++++---- drivers/media/platform/qcom/iris/iris_vpu3x.c | 21 +++++++------- drivers/media/platform/qcom/iris/iris_vpu4x.c | 30 +++++++++++--------- drivers/media/platform/qcom/iris/iris_vpu_common.c | 33 +++++++++++----------- 8 files changed, 67 insertions(+), 63 deletions(-)
drivers/media/platform/qcom/iris/iris_platform_common.h +6 -6
@@ -49,14 +49,14 @@ extern const struct iris_platform_data sm8650_data;extern const struct iris_platform_data sm8750_data;enum platform_clk_type { -IRIS_AXI_CLK ,/* AXI0 in case of platforms with multiple AXI clocks */ +IRIS_AXI_VCODEC_CLK ,IRIS_CTRL_CLK ,IRIS_AHB_CLK , -IRIS_HW_CLK , -IRIS_HW_AHB_CLK , -IRIS_AXI1_CLK , +IRIS_VCODEC_CLK , +IRIS_VCODEC_AHB_CLK , +IRIS_AXI_CTRL_CLK ,IRIS_CTRL_FREERUN_CLK , -IRIS_HW_FREERUN_CLK , +IRIS_VCODEC_FREERUN_CLK ,IRIS_BSE_HW_CLK ,IRIS_VPP0_HW_CLK ,IRIS_VPP1_HW_CLK ,
@@ -206,7 +206,7 @@ struct icc_vote_data {enum platform_pm_domain_type {IRIS_CTRL_POWER_DOMAIN , -IRIS_HW_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN ,IRIS_VPP0_HW_POWER_DOMAIN ,IRIS_VPP1_HW_POWER_DOMAIN ,IRIS_APV_HW_POWER_DOMAIN ,
drivers/media/platform/qcom/iris/iris_platform_gen1.c +3 -3
@@ -284,9 +284,9 @@ static const char * const sm8250_pmdomain_table[] = { "venus", "vcodec0" };static const char *const sm8250_opp_pd_table[] = {"mx" };static const struct platform_clk_data sm8250_clk_table[] = { - {IRIS_AXI_CLK ,"iface" }, - {IRIS_CTRL_CLK ,"core" }, - {IRIS_HW_CLK ,"vcodec0_core" }, + {IRIS_AXI_VCODEC_CLK ,"iface" }, + {IRIS_CTRL_CLK ,"core" }, + {IRIS_VCODEC_CLK ,"vcodec0_core" }, };static const char *const sm8250_opp_clk_table[] = {
drivers/media/platform/qcom/iris/iris_platform_gen2.c +3 -3
@@ -780,9 +780,9 @@ static const char * const sm8550_pmdomain_table[] = { "venus", "vcodec0" };static const char *const sm8550_opp_pd_table[] = {"mxc" ,"mmcx" };static const struct platform_clk_data sm8550_clk_table[] = { - {IRIS_AXI_CLK ,"iface" }, - {IRIS_CTRL_CLK ,"core" }, - {IRIS_HW_CLK ,"vcodec0_core" }, + {IRIS_AXI_VCODEC_CLK ,"iface" }, + {IRIS_CTRL_CLK ,"core" }, + {IRIS_VCODEC_CLK ,"vcodec0_core" }, };static const char *const sm8550_opp_clk_table[] = {
drivers/media/platform/qcom/iris/iris_platform_sc7280.h +5 -5
@@ -16,11 +16,11 @@ static const struct bw_info sc7280_bw_table_dec[] = {static const char *const sc7280_opp_pd_table[] = {"cx" };static const struct platform_clk_data sc7280_clk_table[] = { - {IRIS_CTRL_CLK ,"core" }, - {IRIS_AXI_CLK ,"iface" }, - {IRIS_AHB_CLK ,"bus" }, - {IRIS_HW_CLK ,"vcodec_core" }, - {IRIS_HW_AHB_CLK ,"vcodec_bus" }, + {IRIS_CTRL_CLK ,"core" }, + {IRIS_AXI_VCODEC_CLK ,"iface" }, + {IRIS_AHB_CLK ,"bus" }, + {IRIS_VCODEC_CLK ,"vcodec_core" }, + {IRIS_VCODEC_AHB_CLK ,"vcodec_bus" }, };static const char *const sc7280_opp_clk_table[] = {
drivers/media/platform/qcom/iris/iris_platform_sm8750.h +6 -6
@@ -11,12 +11,12 @@ static const char * const sm8750_clk_reset_table[] = { };static const struct platform_clk_data sm8750_clk_table[] = { - {IRIS_AXI_CLK ,"iface" }, - {IRIS_CTRL_CLK ,"core" }, - {IRIS_HW_CLK ,"vcodec0_core" }, - {IRIS_AXI1_CLK ,"iface1" }, - {IRIS_CTRL_FREERUN_CLK ,"core_freerun" }, - {IRIS_HW_FREERUN_CLK ,"vcodec0_core_freerun" }, + {IRIS_AXI_VCODEC_CLK ,"iface" }, + {IRIS_CTRL_CLK ,"core" }, + {IRIS_VCODEC_CLK ,"vcodec0_core" }, + {IRIS_AXI_CTRL_CLK ,"iface1" }, + {IRIS_CTRL_FREERUN_CLK ,"core_freerun" }, + {IRIS_VCODEC_FREERUN_CLK ,"vcodec0_core_freerun" }, };#endif
drivers/media/platform/qcom/iris/iris_vpu3x.c +11 -10
@@ -209,7 +209,7 @@ static int iris_vpu33_power_off_controller(struct iris_core *core) disable_power:iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); -iris_disable_unprepare_clock (core,IRIS_AXI_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK );return 0 ; }
@@ -218,30 +218,31 @@ static int iris_vpu35_power_on_hw(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core, + core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]);if (ret)return ret; - ret =iris_prepare_enable_clock (core,IRIS_AXI_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_AXI_VCODEC_CLK );if (ret) goto err_disable_power; - ret =iris_prepare_enable_clock (core,IRIS_HW_FREERUN_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_VCODEC_FREERUN_CLK );if (ret) goto err_disable_axi_clk; - ret =iris_prepare_enable_clock (core,IRIS_HW_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_VCODEC_CLK );if (ret) goto err_disable_hw_free_clk;return 0 ; err_disable_hw_free_clk: -iris_disable_unprepare_clock (core,IRIS_HW_FREERUN_CLK ); +iris_disable_unprepare_clock (core,IRIS_VCODEC_FREERUN_CLK ); err_disable_axi_clk: -iris_disable_unprepare_clock (core,IRIS_AXI_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]);return ret; }
@@ -250,8 +251,8 @@ static void iris_vpu35_power_off_hw(struct iris_core *core) {iris_vpu33_power_off_hardware (core); -iris_disable_unprepare_clock (core,IRIS_HW_FREERUN_CLK ); -iris_disable_unprepare_clock (core,IRIS_AXI_CLK ); +iris_disable_unprepare_clock (core,IRIS_VCODEC_FREERUN_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); }const struct vpu_ops iris_vpu3_ops = {
drivers/media/platform/qcom/iris/iris_vpu4x.c +16 -14
@@ -27,7 +27,8 @@ static int iris_vpu4x_genpd_set_hwmode(struct iris_core *core, bool hw_mode, u32 {int ret; - ret =dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ], hw_mode); + ret =dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], + hw_mode);if (ret)return ret;
@@ -63,7 +64,7 @@ static int iris_vpu4x_genpd_set_hwmode(struct iris_core *core, bool hw_mode, u32dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VPP0_HW_POWER_DOMAIN ], !hw_mode); restore_hw_domain_mode: -dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ], !hw_mode); +dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], !hw_mode);return ret; }
@@ -162,15 +163,15 @@ static int iris_vpu4x_enable_hardware_clocks(struct iris_core *core, u32 efuse_v {int ret; - ret =iris_prepare_enable_clock (core,IRIS_AXI_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_AXI_VCODEC_CLK );if (ret)return ret; - ret =iris_prepare_enable_clock (core,IRIS_HW_FREERUN_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_VCODEC_FREERUN_CLK );if (ret) goto disable_axi_clock; - ret =iris_prepare_enable_clock (core,IRIS_HW_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_VCODEC_CLK );if (ret) goto disable_hw_free_run_clock;
@@ -198,11 +199,11 @@ static int iris_vpu4x_enable_hardware_clocks(struct iris_core *core, u32 efuse_v disable_bse_hw_clock:iris_disable_unprepare_clock (core,IRIS_BSE_HW_CLK ); disable_hw_clock: -iris_disable_unprepare_clock (core,IRIS_HW_CLK ); +iris_disable_unprepare_clock (core,IRIS_VCODEC_CLK ); disable_hw_free_run_clock: -iris_disable_unprepare_clock (core,IRIS_HW_FREERUN_CLK ); +iris_disable_unprepare_clock (core,IRIS_VCODEC_FREERUN_CLK ); disable_axi_clock: -iris_disable_unprepare_clock (core,IRIS_AXI_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK );return ret; }
@@ -216,9 +217,9 @@ static void iris_vpu4x_disable_hardware_clocks(struct iris_core *core, u32 efuseiris_disable_unprepare_clock (core,IRIS_VPP0_HW_CLK );iris_disable_unprepare_clock (core,IRIS_BSE_HW_CLK ); -iris_disable_unprepare_clock (core,IRIS_HW_CLK ); -iris_disable_unprepare_clock (core,IRIS_HW_FREERUN_CLK ); -iris_disable_unprepare_clock (core,IRIS_AXI_CLK ); +iris_disable_unprepare_clock (core,IRIS_VCODEC_CLK ); +iris_disable_unprepare_clock (core,IRIS_VCODEC_FREERUN_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); }static int iris_vpu4x_power_on_hardware (struct iris_core *core)
@@ -226,7 +227,8 @@ static int iris_vpu4x_power_on_hardware(struct iris_core *core)u32 efuse_value =readl (core->reg_base +WRAPPER_EFUSE_MONITOR );int ret; - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core, + core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]);if (ret)return ret;
@@ -267,7 +269,7 @@ static int iris_vpu4x_power_on_hardware(struct iris_core *core)iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs [IRIS_VPP0_HW_POWER_DOMAIN ]); disable_hw_power_domain: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]);return ret; }
@@ -345,7 +347,7 @@ static void iris_vpu4x_power_off_hardware(struct iris_core *core)iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs [IRIS_VPP0_HW_POWER_DOMAIN ]); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); }static int iris_vpu4x_set_hwmode (struct iris_core *core)
drivers/media/platform/qcom/iris/iris_vpu_common.c +17 -16
@@ -213,7 +213,7 @@ int iris_vpu_power_off_controller(struct iris_core *core) disable_power:iris_disable_unprepare_clock (core,IRIS_AHB_CLK );iris_disable_unprepare_clock (core,IRIS_CTRL_CLK ); -iris_disable_unprepare_clock (core,IRIS_AXI_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK );iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]);return 0 ;
@@ -221,10 +221,10 @@ int iris_vpu_power_off_controller(struct iris_core *core)void iris_vpu_power_off_hw (struct iris_core *core) { -dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ], false); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ]); -iris_disable_unprepare_clock (core,IRIS_HW_AHB_CLK ); -iris_disable_unprepare_clock (core,IRIS_HW_CLK ); +dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], false); +iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_disable_unprepare_clock (core,IRIS_VCODEC_AHB_CLK ); +iris_disable_unprepare_clock (core,IRIS_VCODEC_CLK ); }void iris_vpu_power_off (struct iris_core *core)
@@ -251,7 +251,7 @@ int iris_vpu_power_on_controller(struct iris_core *core)if (ret) goto err_disable_power; - ret =iris_prepare_enable_clock (core,IRIS_AXI_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_AXI_VCODEC_CLK );if (ret) goto err_disable_power;
@@ -268,7 +268,7 @@ int iris_vpu_power_on_controller(struct iris_core *core) err_disable_ctrl_clock:iris_disable_unprepare_clock (core,IRIS_CTRL_CLK ); err_disable_axi_clock: -iris_disable_unprepare_clock (core,IRIS_AXI_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); err_disable_power:iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]);
@@ -279,31 +279,32 @@ int iris_vpu_power_on_hw(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core, + core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]);if (ret)return ret; - ret =iris_prepare_enable_clock (core,IRIS_HW_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_VCODEC_CLK );if (ret) goto err_disable_power; - ret =iris_prepare_enable_clock (core,IRIS_HW_AHB_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_VCODEC_AHB_CLK );if (ret && ret != -ENOENT ) goto err_disable_hw_clock;return 0 ; err_disable_hw_clock: -iris_disable_unprepare_clock (core,IRIS_HW_CLK ); +iris_disable_unprepare_clock (core,IRIS_VCODEC_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]);return ret; }int iris_vpu_set_hwmode (struct iris_core *core) { -return dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN ], true); +return dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], true); }int iris_vpu_switch_to_hwmode (struct iris_core *core)
@@ -366,7 +367,7 @@ int iris_vpu35_vpu4x_power_off_controller(struct iris_core *core) disable_power:iris_disable_unprepare_clock (core,IRIS_CTRL_CLK );iris_disable_unprepare_clock (core,IRIS_CTRL_FREERUN_CLK ); -iris_disable_unprepare_clock (core,IRIS_AXI1_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_CTRL_CLK );iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]);
@@ -383,7 +384,7 @@ int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core)if (ret)return ret; - ret =iris_prepare_enable_clock (core,IRIS_AXI1_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_AXI_CTRL_CLK );if (ret) goto err_disable_power;
@@ -400,7 +401,7 @@ int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core) err_disable_ctrl_free_clk:iris_disable_unprepare_clock (core,IRIS_CTRL_FREERUN_CLK ); err_disable_axi1_clk: -iris_disable_unprepare_clock (core,IRIS_AXI1_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_CTRL_CLK ); err_disable_power:iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]);
Signature · 1 line
2.34.1
Re: [PATCH v5 08/14] media: iris: Rename clock and power domain macros to use vcodec prefix
Quoted 27 lines · Vishnu Reddy
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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- .../platform/qcom/iris/iris_platform_common.h | 12 ++++---- .../media/platform/qcom/iris/iris_platform_gen1.c | 6 ++-- .../media/platform/qcom/iris/iris_platform_gen2.c | 6 ++-- .../platform/qcom/iris/iris_platform_sc7280.h | 10 +++---- .../platform/qcom/iris/iris_platform_sm8750.h | 12 ++++---- drivers/media/platform/qcom/iris/iris_vpu3x.c | 21 +++++++------- drivers/media/platform/qcom/iris/iris_vpu4x.c | 30 +++++++++++--------- drivers/media/platform/qcom/iris/iris_vpu_common.c | 33 +++++++++++----------- 8 files changed, 67 insertions(+), 63 deletions(-)drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0@@ -49,14 +49,14 @@ extern const struct iris_platform_data sm8650_data;extern const struct iris_platform_data sm8750_data;enum platform_clk_type {
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 57
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +4
-4-IRIS_AXI_CLK ,/* AXI0 in case of platforms with multiple AXI clocks */ +IRIS_AXI_VCODEC_CLK ,IRIS_CTRL_CLK ,IRIS_AHB_CLK , -IRIS_HW_CLK , -IRIS_HW_AHB_CLK , - IRIS_AXI1_CLK, +IRIS_VCODEC_CLK , +IRIS_VCODEC_AHB_CLK , + IRIS_AXI_CTRL_CLK,
Why AXI_CTRL is better than AXI1?
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 59
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1IRIS_CTRL_FREERUN_CLK , - IRIS_HW_FREERUN_CLK, + IRIS_VCODEC_FREERUN_CLK,
Can we at least group them too?
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 60
Quoted 1 line
drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0IRIS_BSE_HW_CLK,
Is BSE a core or a codec clock?
Quoted 11 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1IRIS_VPP0_HW_CLK , IRIS_VPP1_HW_CLK,@@ -206,7 +206,7 @@ struct icc_vote_data {enum platform_pm_domain_type {IRIS_CTRL_POWER_DOMAIN , -IRIS_HW_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN ,IRIS_VPP0_HW_POWER_DOMAIN ,IRIS_VPP1_HW_POWER_DOMAIN ,IRIS_APV_HW_POWER_DOMAIN ,
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 08/14] media: iris: Rename clock and power domain macros to use vcodec prefix
Quoted 27 lines · Dmitry Baryshkov
Quoted 26 lines · Vishnu Reddy
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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- .../platform/qcom/iris/iris_platform_common.h | 12 ++++---- .../media/platform/qcom/iris/iris_platform_gen1.c | 6 ++-- .../media/platform/qcom/iris/iris_platform_gen2.c | 6 ++-- .../platform/qcom/iris/iris_platform_sc7280.h | 10 +++---- .../platform/qcom/iris/iris_platform_sm8750.h | 12 ++++---- drivers/media/platform/qcom/iris/iris_vpu3x.c | 21 +++++++------- drivers/media/platform/qcom/iris/iris_vpu4x.c | 30 +++++++++++--------- drivers/media/platform/qcom/iris/iris_vpu_common.c | 33 +++++++++++----------- 8 files changed, 67 insertions(+), 63 deletions(-)drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0@@ -49,14 +49,14 @@ extern const struct iris_platform_data sm8650_data;extern const struct iris_platform_data sm8750_data;
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 57
Quoted 11 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +4
-4enum platform_clk_type { -IRIS_AXI_CLK ,/* AXI0 in case of platforms with multiple AXI clocks */ +IRIS_AXI_VCODEC_CLK ,IRIS_CTRL_CLK ,IRIS_AHB_CLK , -IRIS_HW_CLK , -IRIS_HW_AHB_CLK , -IRIS_AXI1_CLK , +IRIS_VCODEC_CLK , +IRIS_VCODEC_AHB_CLK , +IRIS_AXI_CTRL_CLK ,Why
AXI_CTRLis better than AXI1?
Glymur has 3 AXI clocks: axi_vcodec0, axi_ctrl, and axi_vcodec1. Using positional names like AXI0/AXI1/AXI2 doesn't convey their purpose, whereas naming them as AXI_VCODEC_CLK, AXI_CTRL_CLK makes the intent clearer, especially when platforms differ in the number of AXI clocks they expose.
Quoted 20 lines
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 59
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1IRIS_CTRL_FREERUN_CLK , - IRIS_HW_FREERUN_CLK, + IRIS_VCODEC_FREERUN_CLK,Can we at least group them too?
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 60
Quoted 1 line
drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0IRIS_BSE_HW_CLK,Is BSE a core or a codec clock?
Quoted 11 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1IRIS_VPP0_HW_CLK , IRIS_VPP1_HW_CLK,@@ -206,7 +206,7 @@ struct icc_vote_data {enum platform_pm_domain_type {IRIS_CTRL_POWER_DOMAIN , -IRIS_HW_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN ,IRIS_VPP0_HW_POWER_DOMAIN ,IRIS_VPP1_HW_POWER_DOMAIN ,IRIS_APV_HW_POWER_DOMAIN ,
Re: [PATCH v5 08/14] media: iris: Rename clock and power domain macros to use vcodec prefix
Quoted 42 lines · Vishnu Reddy
Quoted 27 lines · Dmitry Baryshkov
Quoted 26 lines · Vishnu Reddy
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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- .../platform/qcom/iris/iris_platform_common.h | 12 ++++---- .../media/platform/qcom/iris/iris_platform_gen1.c | 6 ++-- .../media/platform/qcom/iris/iris_platform_gen2.c | 6 ++-- .../platform/qcom/iris/iris_platform_sc7280.h | 10 +++---- .../platform/qcom/iris/iris_platform_sm8750.h | 12 ++++---- drivers/media/platform/qcom/iris/iris_vpu3x.c | 21 +++++++------- drivers/media/platform/qcom/iris/iris_vpu4x.c | 30 +++++++++++--------- drivers/media/platform/qcom/iris/iris_vpu_common.c | 33 +++++++++++----------- 8 files changed, 67 insertions(+), 63 deletions(-)drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0@@ -49,14 +49,14 @@ extern const struct iris_platform_data sm8650_data;extern const struct iris_platform_data sm8750_data;Quoted 12 lines
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 57
Quoted 11 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +4
-4enum platform_clk_type { -IRIS_AXI_CLK ,/* AXI0 in case of platforms with multiple AXI clocks */ +IRIS_AXI_VCODEC_CLK ,IRIS_CTRL_CLK ,IRIS_AHB_CLK , -IRIS_HW_CLK , -IRIS_HW_AHB_CLK , -IRIS_AXI1_CLK , +IRIS_VCODEC_CLK , +IRIS_VCODEC_AHB_CLK , +IRIS_AXI_CTRL_CLK ,Why
AXI_CTRLis better than AXI1?
Quoted 4 lines
Glymur has 3 AXI clocks:
axi_vcodec0,axi_ctrl, andaxi_vcodec1. Using positional names like AXI0/AXI1/AXI2 doesn't convey their purpose, whereas naming them asAXI_VCODEC_CLK,AXI_CTRL_CLKmakes the intent clearer, especially when platforms differ in the number of AXI clocks they expose.
=> commit message
Quoted 9 lines
Quoted 9 lines
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 59
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1IRIS_CTRL_FREERUN_CLK , - IRIS_HW_FREERUN_CLK, + IRIS_VCODEC_FREERUN_CLK,Can we at least group them too?
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 60
Quoted 1 line
drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0IRIS_BSE_HW_CLK,Is BSE a core or a codec clock?
Unanswered
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1IRIS_VPP0_HW_CLK , IRIS_VPP1_HW_CLK,@@ -206,7 +206,7 @@ struct icc_vote_data {enum platform_pm_domain_type {IRIS_CTRL_POWER_DOMAIN , -IRIS_HW_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN ,IRIS_VPP0_HW_POWER_DOMAIN ,IRIS_VPP1_HW_POWER_DOMAIN ,IRIS_APV_HW_POWER_DOMAIN ,
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerRe: [PATCH v5 08/14] media: iris: Rename clock and power domain macros to use vcodec prefix
Quoted 43 lines · Dmitry Baryshkov
Quoted 42 lines · Vishnu Reddy
Quoted 39 lines · Dmitry Baryshkov
Quoted 27 lines · Vishnu Reddy
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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- .../platform/qcom/iris/iris_platform_common.h | 12 ++++---- .../media/platform/qcom/iris/iris_platform_gen1.c | 6 ++-- .../media/platform/qcom/iris/iris_platform_gen2.c | 6 ++-- .../platform/qcom/iris/iris_platform_sc7280.h | 10 +++---- .../platform/qcom/iris/iris_platform_sm8750.h | 12 ++++---- drivers/media/platform/qcom/iris/iris_vpu3x.c | 21 +++++++------- drivers/media/platform/qcom/iris/iris_vpu4x.c | 30 +++++++++++--------- drivers/media/platform/qcom/iris/iris_vpu_common.c | 33 +++++++++++----------- 8 files changed, 67 insertions(+), 63 deletions(-)drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0@@ -49,14 +49,14 @@ extern const struct iris_platform_data sm8650_data;extern const struct iris_platform_data sm8750_data;enum platform_clk_type {drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 57
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +4
-4-IRIS_AXI_CLK ,/* AXI0 in case of platforms with multiple AXI clocks */ +IRIS_AXI_VCODEC_CLK ,IRIS_CTRL_CLK ,IRIS_AHB_CLK , -IRIS_HW_CLK , -IRIS_HW_AHB_CLK , - IRIS_AXI1_CLK, +IRIS_VCODEC_CLK , +IRIS_VCODEC_AHB_CLK , + IRIS_AXI_CTRL_CLK,Why
AXI_CTRLis better than AXI1?
Quoted 16 lines
Quoted 4 lines
Glymur has 3 AXI clocks:
axi_vcodec0,axi_ctrl, andaxi_vcodec1. Using positional names like AXI0/AXI1/AXI2 doesn't convey their purpose, whereas naming them asAXI_VCODEC_CLK,AXI_CTRL_CLKmakes the intent clearer, especially when platforms differ in the number of AXI clocks they expose.=> commit message
Quoted 9 lines
Quoted 9 lines
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 59
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1IRIS_CTRL_FREERUN_CLK , - IRIS_HW_FREERUN_CLK, + IRIS_VCODEC_FREERUN_CLK,Can we at least group them too?
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 60
Quoted 1 line
drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0IRIS_BSE_HW_CLK,Is BSE a core or a codec clock?
IRIS_VCODEC_BSE_CLK would be more appropriate here.
Core and vcodec (video codec), it refers to the main processing block and are referred interchangeably. BSE and VPP are the sub blocks inside the core/vcodec block.
Quoted 16 lines
Unanswered
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1IRIS_VPP0_HW_CLK , IRIS_VPP1_HW_CLK,@@ -206,7 +206,7 @@ struct icc_vote_data {enum platform_pm_domain_type {IRIS_CTRL_POWER_DOMAIN , -IRIS_HW_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN ,IRIS_VPP0_HW_POWER_DOMAIN ,IRIS_VPP1_HW_POWER_DOMAIN ,IRIS_APV_HW_POWER_DOMAIN ,
Re: [PATCH v5 08/14] media: iris: Rename clock and power domain macros to use vcodec prefix
Quoted 58 lines · Vikash Garodia
Quoted 56 lines · Dmitry Baryshkov
Quoted 41 lines · Vishnu Reddy
Quoted 30 lines · Dmitry Baryshkov
Quoted 29 lines · Vishnu Reddy
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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- .../platform/qcom/iris/iris_platform_common.h | 12 ++++---- .../media/platform/qcom/iris/iris_platform_gen1.c | 6 ++-- .../media/platform/qcom/iris/iris_platform_gen2.c | 6 ++-- .../platform/qcom/iris/iris_platform_sc7280.h | 10 +++---- .../platform/qcom/iris/iris_platform_sm8750.h | 12 ++++---- drivers/media/platform/qcom/iris/iris_vpu3x.c | 21 +++++++------- drivers/media/platform/qcom/iris/iris_vpu4x.c | 30 +++++++++++--------- drivers/media/platform/qcom/iris/iris_vpu_common.c | 33 +++++++++++----------- 8 files changed, 67 insertions(+), 63 deletions(-)drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1@@ -49,14 +49,14 @@ extern const struct iris_platform_data sm8650_data;extern const struct iris_platform_data sm8750_data;enum platform_clk_type { -IRIS_AXI_CLK ,/* AXI0 in case of platforms with multiple AXI clocks */ +IRIS_AXI_VCODEC_CLK ,IRIS_CTRL_CLK ,Quoted 8 lines
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 57
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +3
-3IRIS_AHB_CLK , -IRIS_HW_CLK , -IRIS_HW_AHB_CLK , - IRIS_AXI1_CLK, +IRIS_VCODEC_CLK , +IRIS_VCODEC_AHB_CLK , + IRIS_AXI_CTRL_CLK,Why
AXI_CTRLis better than AXI1?Quoted 4 lines
Glymur has 3 AXI clocks:
axi_vcodec0,axi_ctrl, andaxi_vcodec1. Using positional names like AXI0/AXI1/AXI2 doesn't convey their purpose, whereas naming them asAXI_VCODEC_CLK,AXI_CTRL_CLKmakes the intent clearer, especially when platforms differ in the number of AXI clocks they expose.=> commit message
Quoted 7 lines
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 59
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1IRIS_CTRL_FREERUN_CLK , - IRIS_HW_FREERUN_CLK, + IRIS_VCODEC_FREERUN_CLK,Can we at least group them too?
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 60
Quoted 1 line
drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0IRIS_BSE_HW_CLK,Is BSE a core or a codec clock?
IRIS_VCODEC_BSE_CLKwould be more appropriate here.Core and vcodec (video codec), it refers to the main processing block and are referred interchangeably. BSE and VPP are the sub blocks inside the core/vcodec block.
Thanks!
Quoted 16 lines
Quoted 15 lines
Unanswered
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1IRIS_VPP0_HW_CLK , IRIS_VPP1_HW_CLK,@@ -206,7 +206,7 @@ struct icc_vote_data {enum platform_pm_domain_type {IRIS_CTRL_POWER_DOMAIN , -IRIS_HW_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN ,IRIS_VPP0_HW_POWER_DOMAIN ,IRIS_VPP1_HW_POWER_DOMAIN ,IRIS_APV_HW_POWER_DOMAIN ,
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 08/14] media: iris: Rename clock and power domain macros to use vcodec prefix
In reply to Dmitry BaryshkovQuoted 13 lines · Dmitry Baryshkov
Quoted 12 lines · Vishnu Reddy
Quoted 10 lines · Dmitry Baryshkov
Quoted 9 lines · Vishnu Reddy
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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>---
[...]
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 59
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1IRIS_CTRL_FREERUN_CLK , - IRIS_HW_FREERUN_CLK, + IRIS_VCODEC_FREERUN_CLK,Can we at least group them too?
Quoted 1 line
IRIS_BSE_HW_CLK,Is BSE a core or a codec clock?
Unanswered
Is it the same BSE that requires a new clock on Purwa?
https://lore.kernel.org/linux-arm-msm/[email protected]/
Konrad
Re: [PATCH v5 08/14] media: iris: Rename clock and power domain macros to use vcodec prefix
Quoted 22 lines · Konrad Dybcio
Quoted 13 lines · Dmitry Baryshkov
Quoted 12 lines · Vishnu Reddy
Quoted 10 lines · Dmitry Baryshkov
Quoted 9 lines · Vishnu Reddy
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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>---
[...]
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_platform_common.h extern const struct iris_platform_data sm8650_data; · line 59
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-1IRIS_CTRL_FREERUN_CLK , - IRIS_HW_FREERUN_CLK, + IRIS_VCODEC_FREERUN_CLK,Can we at least group them too?
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
IRIS_BSE_HW_CLK,Is BSE a core or a codec clock?
Unanswered
Is it the same BSE that requires a new clock on Purwa?
Yes. But not that BSE question is simply an attempt to find a better approach for naming the clocks.
Signature · 2 lines
With best wishes Dmitry
[email protected]
AI reviewRe: [PATCH v5 08/14] media: iris: Rename clock and power domain macros to use vcodec prefix
In reply to Vishnu ReddyThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Stale goto labels were not renamed to match the newly introduced `VCODEC` and `AXI_CTRL`…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Stale goto labels were not renamed to match the newly introduced VCODEC and AXI_CTRL terminology, leaving the refactoring incomplete. --
commit f3b910e5c28a152c2333978c6b950a8247d50b04
Author: Vishnu Reddy <[email protected]>
media: iris: Rename clock and power domain macros to use vcodec prefix
This commit renames the generic clock and power domain macros in the iris driver to use a 'vcodec' prefix. This accommodates secondary core enums and provides more meaningful names.
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_vpu4x.c +0
-0
[ ... ]
drivers/media/platform/qcom/iris/iris_vpu4x.c static int iris_vpu4x_enable_hardware_clocks(struct iris_core *core, u32 efuse_v · line 172
Quoted 13 lines
drivers/media/platform/qcom/iris/iris_vpu4x.c +2
-2@@ -162,15 +163,15 @@ static int iris_vpu4x_enable_hardware_clocks(struct iris_core *core, u32 efuse_v {int ret; - ret =iris_prepare_enable_clock (core,IRIS_AXI_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_AXI_VCODEC_CLK );if (ret)return ret; - ret =iris_prepare_enable_clock (core,IRIS_HW_FREERUN_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_VCODEC_FREERUN_CLK );if (ret) goto disable_axi_clock;
This isn't a bug, but should the disable_axi_clock label be renamed to match the new IRIS_AXI_VCODEC_CLK macro name?
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_vpu4x.c +1
-1- ret =iris_prepare_enable_clock (core,IRIS_HW_CLK ); + ret =iris_prepare_enable_clock (core,IRIS_VCODEC_CLK );if (ret) goto disable_hw_free_run_clock;
[ ... ]
drivers/media/platform/qcom/iris/iris_vpu4x.c static int iris_vpu4x_enable_hardware_clocks(struct iris_core *core, u32 efuse_v · line 202
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_vpu4x.c +1
-1@@ -198,11 +199,11 @@ static int iris_vpu4x_enable_hardware_clocks(struct iris_core *core, u32 efuse_v disable_bse_hw_clock:iris_disable_unprepare_clock (core,IRIS_BSE_HW_CLK ); disable_hw_clock: -iris_disable_unprepare_clock (core,IRIS_HW_CLK ); +iris_disable_unprepare_clock (core,IRIS_VCODEC_CLK );
Similarly, would it make sense to update labels like disable_hw_clock to reflect the VCODEC terminology?
Quoted 14 lines
drivers/media/platform/qcom/iris/iris_vpu4x.c +2
-2disable_hw_free_run_clock: -iris_disable_unprepare_clock (core,IRIS_HW_FREERUN_CLK ); +iris_disable_unprepare_clock (core,IRIS_VCODEC_FREERUN_CLK ); disable_axi_clock: -iris_disable_unprepare_clock (core,IRIS_AXI_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK );return ret; }drivers/media/platform/qcom/iris/iris_vpu_common.c +0
-0
[ ... ]
drivers/media/platform/qcom/iris/iris_vpu_common.c int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core) · line 404
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_vpu_common.c +1
-1@@ -400,7 +401,7 @@ int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core) err_disable_ctrl_free_clk:iris_disable_unprepare_clock (core,IRIS_CTRL_FREERUN_CLK ); err_disable_axi1_clk: -iris_disable_unprepare_clock (core,IRIS_AXI1_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_CTRL_CLK );
Could this err_disable_axi1_clk label also be renamed to match the new IRIS_AXI_CTRL_CLK macro?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=8
PATCH v5 9/14 media: iris: Use power domain type to look up pd_devs index
In reply to Vishnu ReddyThe 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.
--- .../platform/qcom/iris/iris_platform_common.h | 9 +++- .../media/platform/qcom/iris/iris_platform_gen1.c | 18 +++++--- .../media/platform/qcom/iris/iris_platform_gen2.c | 24 ++++++---- drivers/media/platform/qcom/iris/iris_probe.c | 4 +- drivers/media/platform/qcom/iris/iris_resources.c | 43 +++++++++++++++++- drivers/media/platform/qcom/iris/iris_resources.h | 6 ++- drivers/media/platform/qcom/iris/iris_vpu3x.c | 7 ++- drivers/media/platform/qcom/iris/iris_vpu4x.c | 52 ++++++++-------------- drivers/media/platform/qcom/iris/iris_vpu_common.c | 23 +++++----- 9 files changed, 115 insertions(+), 71 deletions(-)
drivers/media/platform/qcom/iris/iris_platform_common.h +7 -2
@@ -212,6 +212,12 @@ enum platform_pm_domain_type { IRIS_APV_HW_POWER_DOMAIN, }; +struct platform_pd_data { +enum platform_pm_domain_type *pd_types; +const char **pd_names; +u32 pd_count; +}; +struct iris_platform_data {void (*init_hfi_command_ops)(struct iris_core *core);void (*init_hfi_response_ops)(struct iris_core *core);
@@ -225,8 +231,7 @@ struct iris_platform_data {unsigned int icc_tbl_size;const struct bw_info *bw_tbl_dec;unsigned int bw_tbl_dec_size; -const char *const *pmdomain_tbl; -unsigned int pmdomain_tbl_size; +const struct platform_pd_data *pmdomain_tbl;const char *const *opp_pd_tbl;unsigned int opp_pd_tbl_size;const struct platform_clk_data *clk_tbl;
drivers/media/platform/qcom/iris/iris_platform_gen1.c +13 -5
@@ -279,7 +279,17 @@ static const struct bw_info sm8250_bw_table_dec[] = { { ((1920 * 1080) / 256) * 30, 416000 }, }; -static const char *const sm8250_pmdomain_table[] = {"venus" ,"vcodec0" }; +static const struct platform_pd_data sm8250_pmdomain_table = { + .pd_types = (enum platform_pm_domain_type []) { +IRIS_CTRL_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN , + }, + .pd_names = (const char *[]) { +"venus" , +"vcodec0" , + }, + .pd_count =2 , +};static const char *const sm8250_opp_pd_table[] = {"mx" };
@@ -350,8 +360,7 @@ const struct iris_platform_data sm8250_data = { .clk_rst_tbl_size = ARRAY_SIZE(sm8250_clk_reset_table), .bw_tbl_dec = sm8250_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8250_bw_table_dec), - .pmdomain_tbl = sm8250_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8250_pmdomain_table), + .pmdomain_tbl = &sm8250_pmdomain_table, .opp_pd_tbl = sm8250_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8250_opp_pd_table), .clk_tbl = sm8250_clk_table,
@@ -403,8 +412,7 @@ const struct iris_platform_data sc7280_data = { .icc_tbl_size = ARRAY_SIZE(sm8250_icc_table), .bw_tbl_dec = sc7280_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sc7280_bw_table_dec), - .pmdomain_tbl = sm8250_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8250_pmdomain_table), + .pmdomain_tbl = &sm8250_pmdomain_table, .opp_pd_tbl = sc7280_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sc7280_opp_pd_table), .clk_tbl = sc7280_clk_table,
drivers/media/platform/qcom/iris/iris_platform_gen2.c +15 -9
@@ -775,7 +775,17 @@ static const struct bw_info sm8550_bw_table_dec[] = { { ((1920 * 1080) / 256) * 30, 294000 }, }; -static const char *const sm8550_pmdomain_table[] = {"venus" ,"vcodec0" }; +static const struct platform_pd_data sm8550_pmdomain_table = { + .pd_types = (enum platform_pm_domain_type []) { +IRIS_CTRL_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN , + }, + .pd_names = (const char *[]) { +"venus" , +"vcodec0" , + }, + .pd_count =2 , +};static const char *const sm8550_opp_pd_table[] = {"mxc" ,"mmcx" };
@@ -934,8 +944,7 @@ const struct iris_platform_data sm8550_data = { .clk_rst_tbl_size = ARRAY_SIZE(sm8550_clk_reset_table), .bw_tbl_dec = sm8550_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8550_bw_table_dec), - .pmdomain_tbl = sm8550_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8550_pmdomain_table), + .pmdomain_tbl = &sm8550_pmdomain_table, .opp_pd_tbl = sm8550_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl = sm8550_clk_table,
@@ -1039,8 +1048,7 @@ const struct iris_platform_data sm8650_data = { .controller_rst_tbl_size = ARRAY_SIZE(sm8650_controller_reset_table), .bw_tbl_dec = sm8550_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8550_bw_table_dec), - .pmdomain_tbl = sm8550_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8550_pmdomain_table), + .pmdomain_tbl = &sm8550_pmdomain_table, .opp_pd_tbl = sm8550_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl = sm8550_clk_table,
@@ -1135,8 +1143,7 @@ const struct iris_platform_data sm8750_data = { .clk_rst_tbl_size = ARRAY_SIZE(sm8750_clk_reset_table), .bw_tbl_dec = sm8550_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8550_bw_table_dec), - .pmdomain_tbl = sm8550_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8550_pmdomain_table), + .pmdomain_tbl = &sm8550_pmdomain_table, .opp_pd_tbl = sm8550_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl = sm8750_clk_table,
@@ -1235,8 +1242,7 @@ const struct iris_platform_data qcs8300_data = { .clk_rst_tbl_size = ARRAY_SIZE(sm8550_clk_reset_table), .bw_tbl_dec = sm8550_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8550_bw_table_dec), - .pmdomain_tbl = sm8550_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8550_pmdomain_table), + .pmdomain_tbl = &sm8550_pmdomain_table, .opp_pd_tbl = sm8550_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl = sm8550_clk_table,
drivers/media/platform/qcom/iris/iris_probe.c +2 -2
@@ -43,8 +43,8 @@ static int iris_init_power_domains(struct iris_core *core)int ret;struct dev_pm_domain_attach_data iris_pd_data = { - .pd_names = core->iris_platform_data->pmdomain_tbl, - .num_pd_names = core->iris_platform_data->pmdomain_tbl_size, + .pd_names = core->iris_platform_data->pmdomain_tbl->pd_names, + .num_pd_names = core->iris_platform_data->pmdomain_tbl->pd_count, .pd_flags =PD_FLAG_NO_DEV_LINK , };
drivers/media/platform/qcom/iris/iris_resources.c +41 -2
61 lines not on this page · raw message
drivers/media/platform/qcom/iris/iris_resources.h +4 -2
@@ -9,11 +9,13 @@struct iris_core ;int iris_opp_set_rate (struct device *dev,unsigned long freq); -int iris_enable_power_domains (struct iris_core *core,struct device *pd_dev); -int iris_disable_power_domains (struct iris_core *core,struct device *pd_dev); +int iris_enable_power_domains (struct iris_core *core,enum platform_pm_domain_type pd_type); +int iris_disable_power_domains (struct iris_core *core,enum platform_pm_domain_type pd_type);int iris_unset_icc_bw (struct iris_core *core);int iris_set_icc_bw (struct iris_core *core,unsigned long icc_bw);int iris_disable_unprepare_clock (struct iris_core *core,enum platform_clk_type clk_type);int iris_prepare_enable_clock (struct iris_core *core,enum platform_clk_type clk_type); +int iris_genpd_set_hwmode (struct iris_core *core,enum platform_pm_domain_type pd_type, +bool hwmode);#endif
drivers/media/platform/qcom/iris/iris_vpu3x.c +3 -4
@@ -208,7 +208,7 @@ static int iris_vpu33_power_off_controller(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_CTRL_CLK ); disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK );return 0 ;
@@ -218,8 +218,7 @@ static int iris_vpu35_power_on_hw(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, - core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );if (ret)return ret;
@@ -242,7 +241,7 @@ static int iris_vpu35_power_on_hw(struct iris_core *core) err_disable_axi_clk:iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );return ret; }
drivers/media/platform/qcom/iris/iris_vpu4x.c +19 -33
132 lines not on this page · raw message
drivers/media/platform/qcom/iris/iris_vpu_common.c +11 -12
@@ -214,15 +214,15 @@ int iris_vpu_power_off_controller(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_AHB_CLK );iris_disable_unprepare_clock (core,IRIS_CTRL_CLK );iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );return 0 ; }void iris_vpu_power_off_hw (struct iris_core *core) { -dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], false); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , false); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );iris_disable_unprepare_clock (core,IRIS_VCODEC_AHB_CLK );iris_disable_unprepare_clock (core,IRIS_VCODEC_CLK ); }
@@ -243,7 +243,7 @@ int iris_vpu_power_on_controller(struct iris_core *core)u32 rst_tbl_size = core->iris_platform_data->clk_rst_tbl_size;int ret; - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );if (ret)return ret;
@@ -270,7 +270,7 @@ int iris_vpu_power_on_controller(struct iris_core *core) err_disable_axi_clock:iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );return ret; }
@@ -279,8 +279,7 @@ int iris_vpu_power_on_hw(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, - core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );if (ret)return ret;
@@ -297,14 +296,14 @@ int iris_vpu_power_on_hw(struct iris_core *core) err_disable_hw_clock:iris_disable_unprepare_clock (core,IRIS_VCODEC_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );return ret; }int iris_vpu_set_hwmode (struct iris_core *core) { -return dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], true); +return iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , true); }int iris_vpu_switch_to_hwmode (struct iris_core *core)
@@ -369,7 +368,7 @@ int iris_vpu35_vpu4x_power_off_controller(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_CTRL_FREERUN_CLK );iris_disable_unprepare_clock (core,IRIS_AXI_CTRL_CLK ); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );reset_control_bulk_reset (clk_rst_tbl_size, core->resets);
@@ -380,7 +379,7 @@ int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );if (ret)return ret;
@@ -403,7 +402,7 @@ int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core) err_disable_axi1_clk:iris_disable_unprepare_clock (core,IRIS_AXI_CTRL_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );return ret; }
Signature · 1 line
2.34.1
Re: [PATCH v5 09/14] media: iris: Use power domain type to look up pd_devs index
Quoted 8 lines · Vishnu Reddy
The
pmdomain_tblwas a array of strings holding only the power domain names. Callers had to pass a pd_devs[] pointer indexed directly by theplatform_pm_domain_typeenum value toiris_enable_power_domains()andiris_disable_power_domains().A future platform may need to introduce a new enum value that aliases an existing one (e.g.
IRIS_VCODEC1_POWER_DOMAINaliasing theIRIS_VPP0_HW_POWER_DOMAINon Glymur), which would break the assumption
Why do they alias so? Or what do you mean by aliasing? Why VCODEC1 is the same as VPP0? Do you mean that the index in DT would match?
Quoted 6 lines
that enum values map 1:1 to pd_devs[] indices.
To fix this, replace the string array with a new struct
platform_pd_datathat pairs each power domain name with itsplatform_pm_domain_type. Add a helperiris_get_pd_index_by_type()that walks this table and returns the correct pd_devs[] index for a given type.
This looks like leaking too many platform details into the not-so-generic code.
Quoted 206 lines
Update
iris_enable_power_domains()andiris_disable_power_domains()to accept aplatform_pm_domain_typeinstead 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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- .../platform/qcom/iris/iris_platform_common.h | 9 +++- .../media/platform/qcom/iris/iris_platform_gen1.c | 18 +++++--- .../media/platform/qcom/iris/iris_platform_gen2.c | 24 ++++++---- drivers/media/platform/qcom/iris/iris_probe.c | 4 +- drivers/media/platform/qcom/iris/iris_resources.c | 43 +++++++++++++++++- drivers/media/platform/qcom/iris/iris_resources.h | 6 ++- drivers/media/platform/qcom/iris/iris_vpu3x.c | 7 ++- drivers/media/platform/qcom/iris/iris_vpu4x.c | 52 ++++++++-------------- drivers/media/platform/qcom/iris/iris_vpu_common.c | 23 +++++----- 9 files changed, 115 insertions(+), 71 deletions(-)drivers/media/platform/qcom/iris/iris_platform_common.h +7
-2@@ -212,6 +212,12 @@ enum platform_pm_domain_type { IRIS_APV_HW_POWER_DOMAIN, }; +struct platform_pd_data { +enum platform_pm_domain_type *pd_types; +const char **pd_names; +u32 pd_count; +}; +struct iris_platform_data {void (*init_hfi_command_ops)(struct iris_core *core);void (*init_hfi_response_ops)(struct iris_core *core);@@ -225,8 +231,7 @@ struct iris_platform_data {unsigned int icc_tbl_size;const struct bw_info *bw_tbl_dec;unsigned int bw_tbl_dec_size; -const char *const *pmdomain_tbl; -unsigned int pmdomain_tbl_size; +const struct platform_pd_data *pmdomain_tbl;const char *const *opp_pd_tbl;unsigned int opp_pd_tbl_size;const struct platform_clk_data *clk_tbl;drivers/media/platform/qcom/iris/iris_platform_gen1.c +13
-5@@ -279,7 +279,17 @@ static const struct bw_info sm8250_bw_table_dec[] = { { ((1920 * 1080) / 256) * 30, 416000 }, }; -static const char *const sm8250_pmdomain_table[] = {"venus" ,"vcodec0" }; +static const struct platform_pd_data sm8250_pmdomain_table = { + .pd_types = (enum platform_pm_domain_type []) { +IRIS_CTRL_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN , + }, + .pd_names = (const char *[]) { +"venus" , +"vcodec0" , + }, + .pd_count =2 , +};static const char *const sm8250_opp_pd_table[] = {"mx" };@@ -350,8 +360,7 @@ const struct iris_platform_data sm8250_data = { .clk_rst_tbl_size = ARRAY_SIZE(sm8250_clk_reset_table), .bw_tbl_dec = sm8250_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8250_bw_table_dec), - .pmdomain_tbl = sm8250_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8250_pmdomain_table), + .pmdomain_tbl = &sm8250_pmdomain_table, .opp_pd_tbl = sm8250_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8250_opp_pd_table), .clk_tbl = sm8250_clk_table,@@ -403,8 +412,7 @@ const struct iris_platform_data sc7280_data = { .icc_tbl_size = ARRAY_SIZE(sm8250_icc_table), .bw_tbl_dec = sc7280_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sc7280_bw_table_dec), - .pmdomain_tbl = sm8250_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8250_pmdomain_table), + .pmdomain_tbl = &sm8250_pmdomain_table, .opp_pd_tbl = sc7280_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sc7280_opp_pd_table), .clk_tbl = sc7280_clk_table,drivers/media/platform/qcom/iris/iris_platform_gen2.c +15
-9@@ -775,7 +775,17 @@ static const struct bw_info sm8550_bw_table_dec[] = { { ((1920 * 1080) / 256) * 30, 294000 }, }; -static const char *const sm8550_pmdomain_table[] = {"venus" ,"vcodec0" }; +static const struct platform_pd_data sm8550_pmdomain_table = { + .pd_types = (enum platform_pm_domain_type []) { +IRIS_CTRL_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN , + }, + .pd_names = (const char *[]) { +"venus" , +"vcodec0" , + }, + .pd_count =2 , +};static const char *const sm8550_opp_pd_table[] = {"mxc" ,"mmcx" };@@ -934,8 +944,7 @@ const struct iris_platform_data sm8550_data = { .clk_rst_tbl_size = ARRAY_SIZE(sm8550_clk_reset_table), .bw_tbl_dec = sm8550_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8550_bw_table_dec), - .pmdomain_tbl = sm8550_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8550_pmdomain_table), + .pmdomain_tbl = &sm8550_pmdomain_table, .opp_pd_tbl = sm8550_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl = sm8550_clk_table,@@ -1039,8 +1048,7 @@ const struct iris_platform_data sm8650_data = { .controller_rst_tbl_size = ARRAY_SIZE(sm8650_controller_reset_table), .bw_tbl_dec = sm8550_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8550_bw_table_dec), - .pmdomain_tbl = sm8550_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8550_pmdomain_table), + .pmdomain_tbl = &sm8550_pmdomain_table, .opp_pd_tbl = sm8550_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl = sm8550_clk_table,@@ -1135,8 +1143,7 @@ const struct iris_platform_data sm8750_data = { .clk_rst_tbl_size = ARRAY_SIZE(sm8750_clk_reset_table), .bw_tbl_dec = sm8550_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8550_bw_table_dec), - .pmdomain_tbl = sm8550_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8550_pmdomain_table), + .pmdomain_tbl = &sm8550_pmdomain_table, .opp_pd_tbl = sm8550_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl = sm8750_clk_table,@@ -1235,8 +1242,7 @@ const struct iris_platform_data qcs8300_data = { .clk_rst_tbl_size = ARRAY_SIZE(sm8550_clk_reset_table), .bw_tbl_dec = sm8550_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8550_bw_table_dec), - .pmdomain_tbl = sm8550_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8550_pmdomain_table), + .pmdomain_tbl = &sm8550_pmdomain_table, .opp_pd_tbl = sm8550_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl = sm8550_clk_table,drivers/media/platform/qcom/iris/iris_probe.c +2
-2@@ -43,8 +43,8 @@ static int iris_init_power_domains(struct iris_core *core)int ret;struct dev_pm_domain_attach_data iris_pd_data = { - .pd_names = core->iris_platform_data->pmdomain_tbl, - .num_pd_names = core->iris_platform_data->pmdomain_tbl_size, + .pd_names = core->iris_platform_data->pmdomain_tbl->pd_names, + .num_pd_names = core->iris_platform_data->pmdomain_tbl->pd_count, .pd_flags =PD_FLAG_NO_DEV_LINK , };drivers/media/platform/qcom/iris/iris_resources.c +25
-1@@ -70,10 +70,42 @@ int iris_opp_set_rate(struct device *dev, unsigned long freq)return dev_pm_opp_set_opp (dev, opp); } -int iris_enable_power_domains (struct iris_core *core,struct device *pd_dev) +static int iris_get_pd_index_by_type (struct iris_core *core,enum platform_pm_domain_type pd_type) { +const struct platform_pd_data *pd_tbl; +u32 i; + + pd_tbl = core->iris_platform_data->pmdomain_tbl; + +for (i =0 ; i < pd_tbl->pd_count; i++) { +if (pd_tbl->pd_types[i] == pd_type) +return i; + } + +return -EINVAL ; +} + +int iris_genpd_set_hwmode (struct iris_core *core,enum platform_pm_domain_type pd_type,bool hwmode) +{ +int pd_index =iris_get_pd_index_by_type (core, pd_type); + +if (pd_index <0 ) +return pd_index; + +return dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[pd_index], hwmode); +} + +int iris_enable_power_domains (struct iris_core *core,enum platform_pm_domain_type pd_type)
drivers/media/platform/qcom/iris/iris_resources.c int iris_opp_set_rate(struct device *dev, unsigned long freq) · line 108
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_resources.c +8
-0+{ +int pd_index =iris_get_pd_index_by_type (core, pd_type); +struct device *pd_dev;int ret; +if (pd_index <0 ) +return pd_index; + + pd_dev = core->pmdomain_tbl->pd_devs[pd_index]; +
As you are touching this code... It looks like the original intent of this function was to enable all power domains in a single run (thus it has the iris_opp_set_rate() call. Now we are are calling this function multiple times and still setting the clock rate to the max all the times. Please break it down, so that we bump the OPP performance point only once, before the first bump of the power domains. Another option would be to restore the behaviour and enable all domains at once.
drivers/media/platform/qcom/iris/iris_resources.c int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev) · line 120
Quoted 9 lines
drivers/media/platform/qcom/iris/iris_resources.c +1
-1ret =iris_opp_set_rate (core->dev,ULONG_MAX );if (ret)return ret;@@ -85,10 +117,17 @@ int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev)return ret; } -int iris_disable_power_domains (struct iris_core *core,struct device *pd_dev) +int iris_disable_power_domains (struct iris_core *core,enum platform_pm_domain_type pd_type)
The same here.
Quoted 308 lines
drivers/media/platform/qcom/iris/iris_resources.c +7
-0{ +int pd_index =iris_get_pd_index_by_type (core, pd_type); +struct device *pd_dev;int ret; +if (pd_index <0 ) +return pd_index; + + pd_dev = core->pmdomain_tbl->pd_devs[pd_index]; + ret =iris_opp_set_rate (core->dev,0 );if (ret)return ret;drivers/media/platform/qcom/iris/iris_resources.h +4
-2@@ -9,11 +9,13 @@struct iris_core ;int iris_opp_set_rate (struct device *dev,unsigned long freq); -int iris_enable_power_domains (struct iris_core *core,struct device *pd_dev); -int iris_disable_power_domains (struct iris_core *core,struct device *pd_dev); +int iris_enable_power_domains (struct iris_core *core,enum platform_pm_domain_type pd_type); +int iris_disable_power_domains (struct iris_core *core,enum platform_pm_domain_type pd_type);int iris_unset_icc_bw (struct iris_core *core);int iris_set_icc_bw (struct iris_core *core,unsigned long icc_bw);int iris_disable_unprepare_clock (struct iris_core *core,enum platform_clk_type clk_type);int iris_prepare_enable_clock (struct iris_core *core,enum platform_clk_type clk_type); +int iris_genpd_set_hwmode (struct iris_core *core,enum platform_pm_domain_type pd_type, +bool hwmode);#endif drivers/media/platform/qcom/iris/iris_vpu3x.c +3
-4@@ -208,7 +208,7 @@ static int iris_vpu33_power_off_controller(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_CTRL_CLK ); disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK );return 0 ;@@ -218,8 +218,7 @@ static int iris_vpu35_power_on_hw(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, - core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );if (ret)return ret;@@ -242,7 +241,7 @@ static int iris_vpu35_power_on_hw(struct iris_core *core) err_disable_axi_clk:iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );return ret; }drivers/media/platform/qcom/iris/iris_vpu4x.c +19
-33@@ -27,28 +27,24 @@ static int iris_vpu4x_genpd_set_hwmode(struct iris_core *core, bool hw_mode, u32 {int ret; - ret =dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], - hw_mode); + ret =iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , hw_mode);if (ret)return ret;if (!(efuse_value &DISABLE_VIDEO_VPP0_BIT )) { - ret =dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs - [IRIS_VPP0_HW_POWER_DOMAIN ], hw_mode); + ret =iris_genpd_set_hwmode (core,IRIS_VPP0_HW_POWER_DOMAIN , hw_mode);if (ret) goto restore_hw_domain_mode; }if (!(efuse_value &DISABLE_VIDEO_VPP1_BIT )) { - ret =dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs - [IRIS_VPP1_HW_POWER_DOMAIN ], hw_mode); + ret =iris_genpd_set_hwmode (core,IRIS_VPP1_HW_POWER_DOMAIN , hw_mode);if (ret) goto restore_vpp0_domain_mode; }if (!(efuse_value &DISABLE_VIDEO_APV_BIT )) { - ret =dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs - [IRIS_APV_HW_POWER_DOMAIN ], hw_mode); + ret =iris_genpd_set_hwmode (core,IRIS_APV_HW_POWER_DOMAIN , hw_mode);if (ret) goto restore_vpp1_domain_mode; }@@ -57,14 +53,12 @@ static int iris_vpu4x_genpd_set_hwmode(struct iris_core *core, bool hw_mode, u32 restore_vpp1_domain_mode:if (!(efuse_value &DISABLE_VIDEO_VPP1_BIT )) -dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VPP1_HW_POWER_DOMAIN ], - !hw_mode); +iris_genpd_set_hwmode (core,IRIS_VPP1_HW_POWER_DOMAIN , !hw_mode); restore_vpp0_domain_mode:if (!(efuse_value &DISABLE_VIDEO_VPP0_BIT )) -dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VPP0_HW_POWER_DOMAIN ], - !hw_mode); +iris_genpd_set_hwmode (core,IRIS_VPP0_HW_POWER_DOMAIN , !hw_mode); restore_hw_domain_mode: -dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], !hw_mode); +iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , !hw_mode);return ret; }@@ -73,8 +67,7 @@ static int iris_vpu4x_power_on_apv(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, - core->pmdomain_tbl->pd_devs[IRIS_APV_HW_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_APV_HW_POWER_DOMAIN );if (ret)return ret;@@ -85,7 +78,7 @@ static int iris_vpu4x_power_on_apv(struct iris_core *core)return 0 ; disable_apv_hw_power_domain: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_APV_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_APV_HW_POWER_DOMAIN );return ret; }@@ -140,7 +133,7 @@ static void iris_vpu4x_power_off_apv(struct iris_core *core) disable_clocks_and_power:iris_disable_unprepare_clock (core,IRIS_APV_HW_CLK ); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_APV_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_APV_HW_POWER_DOMAIN ); }static void iris_vpu4x_ahb_sync_reset_apv (struct iris_core *core)@@ -227,21 +220,18 @@ static int iris_vpu4x_power_on_hardware(struct iris_core *core)u32 efuse_value =readl (core->reg_base +WRAPPER_EFUSE_MONITOR );int ret; - ret =iris_enable_power_domains (core, - core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );if (ret)return ret;if (!(efuse_value &DISABLE_VIDEO_VPP0_BIT )) { - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs - [IRIS_VPP0_HW_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_VPP0_HW_POWER_DOMAIN );if (ret) goto disable_hw_power_domain; }if (!(efuse_value &DISABLE_VIDEO_VPP1_BIT )) { - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs - [IRIS_VPP1_HW_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_VPP1_HW_POWER_DOMAIN );if (ret) goto disable_vpp0_power_domain; }@@ -262,14 +252,12 @@ static int iris_vpu4x_power_on_hardware(struct iris_core *core)iris_vpu4x_disable_hardware_clocks (core, efuse_value); disable_vpp1_power_domain:if (!(efuse_value &DISABLE_VIDEO_VPP1_BIT )) -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs - [IRIS_VPP1_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VPP1_HW_POWER_DOMAIN ); disable_vpp0_power_domain:if (!(efuse_value &DISABLE_VIDEO_VPP0_BIT )) -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs - [IRIS_VPP0_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VPP0_HW_POWER_DOMAIN ); disable_hw_power_domain: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );return ret; }@@ -340,14 +328,12 @@ static void iris_vpu4x_power_off_hardware(struct iris_core *core)iris_vpu4x_disable_hardware_clocks (core, efuse_value);if (!(efuse_value &DISABLE_VIDEO_VPP1_BIT )) -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs - [IRIS_VPP1_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VPP1_HW_POWER_DOMAIN );if (!(efuse_value &DISABLE_VIDEO_VPP0_BIT )) -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs - [IRIS_VPP0_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VPP0_HW_POWER_DOMAIN ); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN ); }static int iris_vpu4x_set_hwmode (struct iris_core *core)drivers/media/platform/qcom/iris/iris_vpu_common.c +11
-12@@ -214,15 +214,15 @@ int iris_vpu_power_off_controller(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_AHB_CLK );iris_disable_unprepare_clock (core,IRIS_CTRL_CLK );iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );return 0 ; }void iris_vpu_power_off_hw (struct iris_core *core) { -dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], false); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , false); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );iris_disable_unprepare_clock (core,IRIS_VCODEC_AHB_CLK );iris_disable_unprepare_clock (core,IRIS_VCODEC_CLK ); }@@ -243,7 +243,7 @@ int iris_vpu_power_on_controller(struct iris_core *core)u32 rst_tbl_size = core->iris_platform_data->clk_rst_tbl_size;int ret; - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );if (ret)return ret;@@ -270,7 +270,7 @@ int iris_vpu_power_on_controller(struct iris_core *core) err_disable_axi_clock:iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );return ret; }@@ -279,8 +279,7 @@ int iris_vpu_power_on_hw(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, - core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );if (ret)return ret;@@ -297,14 +296,14 @@ int iris_vpu_power_on_hw(struct iris_core *core) err_disable_hw_clock:iris_disable_unprepare_clock (core,IRIS_VCODEC_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );return ret; }int iris_vpu_set_hwmode (struct iris_core *core) { -return dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], true); +return iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , true); }int iris_vpu_switch_to_hwmode (struct iris_core *core)@@ -369,7 +368,7 @@ int iris_vpu35_vpu4x_power_off_controller(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_CTRL_FREERUN_CLK );iris_disable_unprepare_clock (core,IRIS_AXI_CTRL_CLK ); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );reset_control_bulk_reset (clk_rst_tbl_size, core->resets);@@ -380,7 +379,7 @@ int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );if (ret)return ret;@@ -403,7 +402,7 @@ int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core) err_disable_axi1_clk:iris_disable_unprepare_clock (core,IRIS_AXI_CTRL_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );return ret; }Signature · 2 lines
-- 2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 09/14] media: iris: Use power domain type to look up pd_devs index
Quoted 11 lines · Dmitry Baryshkov
Quoted 8 lines · Vishnu Reddy
The
pmdomain_tblwas a array of strings holding only the power domain names. Callers had to pass a pd_devs[] pointer indexed directly by theplatform_pm_domain_typeenum value toiris_enable_power_domains()andiris_disable_power_domains().A future platform may need to introduce a new enum value that aliases an existing one (e.g.
IRIS_VCODEC1_POWER_DOMAINaliasing theIRIS_VPP0_HW_POWER_DOMAINon Glymur), which would break the assumptionWhy do they alias so? Or what do you mean by aliasing? Why VCODEC1 is the same as VPP0? Do you mean that the index in DT would match?
VPP0 index in kaanapali and the VCODEC1 index in glymur are same.
Quoted 219 lines
Quoted 6 lines
that enum values map 1:1 to pd_devs[] indices.
To fix this, replace the string array with a new struct
platform_pd_datathat pairs each power domain name with itsplatform_pm_domain_type. Add a helperiris_get_pd_index_by_type()that walks this table and returns the correct pd_devs[] index for a given type.This looks like leaking too many platform details into the not-so-generic code.
Quoted 210 lines
Update
iris_enable_power_domains()andiris_disable_power_domains()to accept aplatform_pm_domain_typeinstead 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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- .../platform/qcom/iris/iris_platform_common.h | 9 +++- .../media/platform/qcom/iris/iris_platform_gen1.c | 18 +++++--- .../media/platform/qcom/iris/iris_platform_gen2.c | 24 ++++++---- drivers/media/platform/qcom/iris/iris_probe.c | 4 +- drivers/media/platform/qcom/iris/iris_resources.c | 43 +++++++++++++++++- drivers/media/platform/qcom/iris/iris_resources.h | 6 ++- drivers/media/platform/qcom/iris/iris_vpu3x.c | 7 ++- drivers/media/platform/qcom/iris/iris_vpu4x.c | 52 ++++++++-------------- drivers/media/platform/qcom/iris/iris_vpu_common.c | 23 +++++----- 9 files changed, 115 insertions(+), 71 deletions(-)drivers/media/platform/qcom/iris/iris_platform_common.h +7
-2@@ -212,6 +212,12 @@ enum platform_pm_domain_type { IRIS_APV_HW_POWER_DOMAIN, }; +struct platform_pd_data { +enum platform_pm_domain_type *pd_types; +const char **pd_names; +u32 pd_count; +}; +struct iris_platform_data {void (*init_hfi_command_ops)(struct iris_core *core);void (*init_hfi_response_ops)(struct iris_core *core);@@ -225,8 +231,7 @@ struct iris_platform_data {unsigned int icc_tbl_size;const struct bw_info *bw_tbl_dec;unsigned int bw_tbl_dec_size; -const char *const *pmdomain_tbl; -unsigned int pmdomain_tbl_size; +const struct platform_pd_data *pmdomain_tbl;const char *const *opp_pd_tbl;unsigned int opp_pd_tbl_size;const struct platform_clk_data *clk_tbl;drivers/media/platform/qcom/iris/iris_platform_gen1.c +13
-5@@ -279,7 +279,17 @@ static const struct bw_info sm8250_bw_table_dec[] = { { ((1920 * 1080) / 256) * 30, 416000 }, }; -static const char *const sm8250_pmdomain_table[] = {"venus" ,"vcodec0" }; +static const struct platform_pd_data sm8250_pmdomain_table = { + .pd_types = (enum platform_pm_domain_type []) { +IRIS_CTRL_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN , + }, + .pd_names = (const char *[]) { +"venus" , +"vcodec0" , + }, + .pd_count =2 , +};static const char *const sm8250_opp_pd_table[] = {"mx" };@@ -350,8 +360,7 @@ const struct iris_platform_data sm8250_data = { .clk_rst_tbl_size = ARRAY_SIZE(sm8250_clk_reset_table), .bw_tbl_dec = sm8250_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8250_bw_table_dec), - .pmdomain_tbl = sm8250_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8250_pmdomain_table), + .pmdomain_tbl = &sm8250_pmdomain_table, .opp_pd_tbl = sm8250_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8250_opp_pd_table), .clk_tbl = sm8250_clk_table,@@ -403,8 +412,7 @@ const struct iris_platform_data sc7280_data = { .icc_tbl_size = ARRAY_SIZE(sm8250_icc_table), .bw_tbl_dec = sc7280_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sc7280_bw_table_dec), - .pmdomain_tbl = sm8250_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8250_pmdomain_table), + .pmdomain_tbl = &sm8250_pmdomain_table, .opp_pd_tbl = sc7280_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sc7280_opp_pd_table), .clk_tbl = sc7280_clk_table,drivers/media/platform/qcom/iris/iris_platform_gen2.c +15
-9@@ -775,7 +775,17 @@ static const struct bw_info sm8550_bw_table_dec[] = { { ((1920 * 1080) / 256) * 30, 294000 }, }; -static const char *const sm8550_pmdomain_table[] = {"venus" ,"vcodec0" }; +static const struct platform_pd_data sm8550_pmdomain_table = { + .pd_types = (enum platform_pm_domain_type []) { +IRIS_CTRL_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN , + }, + .pd_names = (const char *[]) { +"venus" , +"vcodec0" , + }, + .pd_count =2 , +};static const char *const sm8550_opp_pd_table[] = {"mxc" ,"mmcx" };@@ -934,8 +944,7 @@ const struct iris_platform_data sm8550_data = { .clk_rst_tbl_size = ARRAY_SIZE(sm8550_clk_reset_table), .bw_tbl_dec = sm8550_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8550_bw_table_dec), - .pmdomain_tbl = sm8550_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8550_pmdomain_table), + .pmdomain_tbl = &sm8550_pmdomain_table, .opp_pd_tbl = sm8550_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl = sm8550_clk_table,@@ -1039,8 +1048,7 @@ const struct iris_platform_data sm8650_data = { .controller_rst_tbl_size = ARRAY_SIZE(sm8650_controller_reset_table), .bw_tbl_dec = sm8550_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8550_bw_table_dec), - .pmdomain_tbl = sm8550_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8550_pmdomain_table), + .pmdomain_tbl = &sm8550_pmdomain_table, .opp_pd_tbl = sm8550_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl = sm8550_clk_table,@@ -1135,8 +1143,7 @@ const struct iris_platform_data sm8750_data = { .clk_rst_tbl_size = ARRAY_SIZE(sm8750_clk_reset_table), .bw_tbl_dec = sm8550_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8550_bw_table_dec), - .pmdomain_tbl = sm8550_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8550_pmdomain_table), + .pmdomain_tbl = &sm8550_pmdomain_table, .opp_pd_tbl = sm8550_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl = sm8750_clk_table,@@ -1235,8 +1242,7 @@ const struct iris_platform_data qcs8300_data = { .clk_rst_tbl_size = ARRAY_SIZE(sm8550_clk_reset_table), .bw_tbl_dec = sm8550_bw_table_dec, .bw_tbl_dec_size = ARRAY_SIZE(sm8550_bw_table_dec), - .pmdomain_tbl = sm8550_pmdomain_table, - .pmdomain_tbl_size = ARRAY_SIZE(sm8550_pmdomain_table), + .pmdomain_tbl = &sm8550_pmdomain_table, .opp_pd_tbl = sm8550_opp_pd_table, .opp_pd_tbl_size = ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl = sm8550_clk_table,drivers/media/platform/qcom/iris/iris_probe.c +2
-2@@ -43,8 +43,8 @@ static int iris_init_power_domains(struct iris_core *core)int ret;struct dev_pm_domain_attach_data iris_pd_data = { - .pd_names = core->iris_platform_data->pmdomain_tbl, - .num_pd_names = core->iris_platform_data->pmdomain_tbl_size, + .pd_names = core->iris_platform_data->pmdomain_tbl->pd_names, + .num_pd_names = core->iris_platform_data->pmdomain_tbl->pd_count, .pd_flags =PD_FLAG_NO_DEV_LINK , };drivers/media/platform/qcom/iris/iris_resources.c +28
-1@@ -70,10 +70,42 @@ int iris_opp_set_rate(struct device *dev, unsigned long freq)return dev_pm_opp_set_opp (dev, opp); } -int iris_enable_power_domains (struct iris_core *core,struct device *pd_dev) +static int iris_get_pd_index_by_type (struct iris_core *core,enum platform_pm_domain_type pd_type) { +const struct platform_pd_data *pd_tbl; +u32 i; + + pd_tbl = core->iris_platform_data->pmdomain_tbl; + +for (i =0 ; i < pd_tbl->pd_count; i++) { +if (pd_tbl->pd_types[i] == pd_type) +return i; + } + +return -EINVAL ; +} + +int iris_genpd_set_hwmode (struct iris_core *core,enum platform_pm_domain_type pd_type,bool hwmode) +{ +int pd_index =iris_get_pd_index_by_type (core, pd_type); + +if (pd_index <0 ) +return pd_index; + +return dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[pd_index], hwmode); +} + +int iris_enable_power_domains (struct iris_core *core,enum platform_pm_domain_type pd_type) +{ +int pd_index =iris_get_pd_index_by_type (core, pd_type); +struct device *pd_dev;int ret;
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_resources.c int iris_opp_set_rate(struct device *dev, unsigned long freq) · line 108
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_resources.c +5
-0+if (pd_index <0 ) +return pd_index; + + pd_dev = core->pmdomain_tbl->pd_devs[pd_index]; +As you are touching this code... It looks like the original intent of this function was to enable all power domains in a single run (thus it has the
iris_opp_set_rate()call. Now we are are calling this function multiple times and still setting the clock rate to the max all the times. Please break it down, so that we bump the OPP performance point only once, before the first bump of the power domains. Another option would be to restore the behaviour and enable all domains at once.
The dev_pm_opp_set_opp() returns early if the requested rate matches the previous set rate, so it does not call rpmhpd level set or trigger a clock update. So, calling it multiple times with the same frequency is not expensive.
Quoted 319 lines
drivers/media/platform/qcom/iris/iris_resources.c int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev) · line 120
Quoted 9 lines
drivers/media/platform/qcom/iris/iris_resources.c +1
-1ret =iris_opp_set_rate (core->dev,ULONG_MAX );if (ret)return ret;@@ -85,10 +117,17 @@ int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev)return ret; } -int iris_disable_power_domains (struct iris_core *core,struct device *pd_dev) +int iris_disable_power_domains (struct iris_core *core,enum platform_pm_domain_type pd_type)The same here.
Quoted 308 lines
drivers/media/platform/qcom/iris/iris_resources.c +7
-0{ +int pd_index =iris_get_pd_index_by_type (core, pd_type); +struct device *pd_dev;int ret; +if (pd_index <0 ) +return pd_index; + + pd_dev = core->pmdomain_tbl->pd_devs[pd_index]; + ret =iris_opp_set_rate (core->dev,0 );if (ret)return ret;drivers/media/platform/qcom/iris/iris_resources.h +4
-2@@ -9,11 +9,13 @@struct iris_core ;int iris_opp_set_rate (struct device *dev,unsigned long freq); -int iris_enable_power_domains (struct iris_core *core,struct device *pd_dev); -int iris_disable_power_domains (struct iris_core *core,struct device *pd_dev); +int iris_enable_power_domains (struct iris_core *core,enum platform_pm_domain_type pd_type); +int iris_disable_power_domains (struct iris_core *core,enum platform_pm_domain_type pd_type);int iris_unset_icc_bw (struct iris_core *core);int iris_set_icc_bw (struct iris_core *core,unsigned long icc_bw);int iris_disable_unprepare_clock (struct iris_core *core,enum platform_clk_type clk_type);int iris_prepare_enable_clock (struct iris_core *core,enum platform_clk_type clk_type); +int iris_genpd_set_hwmode (struct iris_core *core,enum platform_pm_domain_type pd_type, +bool hwmode);#endif drivers/media/platform/qcom/iris/iris_vpu3x.c +3
-4@@ -208,7 +208,7 @@ static int iris_vpu33_power_off_controller(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_CTRL_CLK ); disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK );return 0 ;@@ -218,8 +218,7 @@ static int iris_vpu35_power_on_hw(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, - core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );if (ret)return ret;@@ -242,7 +241,7 @@ static int iris_vpu35_power_on_hw(struct iris_core *core) err_disable_axi_clk:iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );return ret; }drivers/media/platform/qcom/iris/iris_vpu4x.c +19
-33@@ -27,28 +27,24 @@ static int iris_vpu4x_genpd_set_hwmode(struct iris_core *core, bool hw_mode, u32 {int ret; - ret =dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], - hw_mode); + ret =iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , hw_mode);if (ret)return ret;if (!(efuse_value &DISABLE_VIDEO_VPP0_BIT )) { - ret =dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs - [IRIS_VPP0_HW_POWER_DOMAIN ], hw_mode); + ret =iris_genpd_set_hwmode (core,IRIS_VPP0_HW_POWER_DOMAIN , hw_mode);if (ret) goto restore_hw_domain_mode; }if (!(efuse_value &DISABLE_VIDEO_VPP1_BIT )) { - ret =dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs - [IRIS_VPP1_HW_POWER_DOMAIN ], hw_mode); + ret =iris_genpd_set_hwmode (core,IRIS_VPP1_HW_POWER_DOMAIN , hw_mode);if (ret) goto restore_vpp0_domain_mode; }if (!(efuse_value &DISABLE_VIDEO_APV_BIT )) { - ret =dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs - [IRIS_APV_HW_POWER_DOMAIN ], hw_mode); + ret =iris_genpd_set_hwmode (core,IRIS_APV_HW_POWER_DOMAIN , hw_mode);if (ret) goto restore_vpp1_domain_mode; }@@ -57,14 +53,12 @@ static int iris_vpu4x_genpd_set_hwmode(struct iris_core *core, bool hw_mode, u32 restore_vpp1_domain_mode:if (!(efuse_value &DISABLE_VIDEO_VPP1_BIT )) -dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VPP1_HW_POWER_DOMAIN ], - !hw_mode); +iris_genpd_set_hwmode (core,IRIS_VPP1_HW_POWER_DOMAIN , !hw_mode); restore_vpp0_domain_mode:if (!(efuse_value &DISABLE_VIDEO_VPP0_BIT )) -dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VPP0_HW_POWER_DOMAIN ], - !hw_mode); +iris_genpd_set_hwmode (core,IRIS_VPP0_HW_POWER_DOMAIN , !hw_mode); restore_hw_domain_mode: -dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], !hw_mode); +iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , !hw_mode);return ret; }@@ -73,8 +67,7 @@ static int iris_vpu4x_power_on_apv(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, - core->pmdomain_tbl->pd_devs[IRIS_APV_HW_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_APV_HW_POWER_DOMAIN );if (ret)return ret;@@ -85,7 +78,7 @@ static int iris_vpu4x_power_on_apv(struct iris_core *core)return 0 ; disable_apv_hw_power_domain: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_APV_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_APV_HW_POWER_DOMAIN );return ret; }@@ -140,7 +133,7 @@ static void iris_vpu4x_power_off_apv(struct iris_core *core) disable_clocks_and_power:iris_disable_unprepare_clock (core,IRIS_APV_HW_CLK ); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_APV_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_APV_HW_POWER_DOMAIN ); }static void iris_vpu4x_ahb_sync_reset_apv (struct iris_core *core)@@ -227,21 +220,18 @@ static int iris_vpu4x_power_on_hardware(struct iris_core *core)u32 efuse_value =readl (core->reg_base +WRAPPER_EFUSE_MONITOR );int ret; - ret =iris_enable_power_domains (core, - core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );if (ret)return ret;if (!(efuse_value &DISABLE_VIDEO_VPP0_BIT )) { - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs - [IRIS_VPP0_HW_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_VPP0_HW_POWER_DOMAIN );if (ret) goto disable_hw_power_domain; }if (!(efuse_value &DISABLE_VIDEO_VPP1_BIT )) { - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs - [IRIS_VPP1_HW_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_VPP1_HW_POWER_DOMAIN );if (ret) goto disable_vpp0_power_domain; }@@ -262,14 +252,12 @@ static int iris_vpu4x_power_on_hardware(struct iris_core *core)iris_vpu4x_disable_hardware_clocks (core, efuse_value); disable_vpp1_power_domain:if (!(efuse_value &DISABLE_VIDEO_VPP1_BIT )) -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs - [IRIS_VPP1_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VPP1_HW_POWER_DOMAIN ); disable_vpp0_power_domain:if (!(efuse_value &DISABLE_VIDEO_VPP0_BIT )) -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs - [IRIS_VPP0_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VPP0_HW_POWER_DOMAIN ); disable_hw_power_domain: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );return ret; }@@ -340,14 +328,12 @@ static void iris_vpu4x_power_off_hardware(struct iris_core *core)iris_vpu4x_disable_hardware_clocks (core, efuse_value);if (!(efuse_value &DISABLE_VIDEO_VPP1_BIT )) -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs - [IRIS_VPP1_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VPP1_HW_POWER_DOMAIN );if (!(efuse_value &DISABLE_VIDEO_VPP0_BIT )) -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs - [IRIS_VPP0_HW_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VPP0_HW_POWER_DOMAIN ); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN ); }static int iris_vpu4x_set_hwmode (struct iris_core *core)drivers/media/platform/qcom/iris/iris_vpu_common.c +11
-12@@ -214,15 +214,15 @@ int iris_vpu_power_off_controller(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_AHB_CLK );iris_disable_unprepare_clock (core,IRIS_CTRL_CLK );iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );return 0 ; }void iris_vpu_power_off_hw (struct iris_core *core) { -dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], false); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , false); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );iris_disable_unprepare_clock (core,IRIS_VCODEC_AHB_CLK );iris_disable_unprepare_clock (core,IRIS_VCODEC_CLK ); }@@ -243,7 +243,7 @@ int iris_vpu_power_on_controller(struct iris_core *core)u32 rst_tbl_size = core->iris_platform_data->clk_rst_tbl_size;int ret; - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );if (ret)return ret;@@ -270,7 +270,7 @@ int iris_vpu_power_on_controller(struct iris_core *core) err_disable_axi_clock:iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );return ret; }@@ -279,8 +279,7 @@ int iris_vpu_power_on_hw(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, - core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );if (ret)return ret;@@ -297,14 +296,14 @@ int iris_vpu_power_on_hw(struct iris_core *core) err_disable_hw_clock:iris_disable_unprepare_clock (core,IRIS_VCODEC_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_VCODEC_POWER_DOMAIN );return ret; }int iris_vpu_set_hwmode (struct iris_core *core) { -return dev_pm_genpd_set_hwmode (core->pmdomain_tbl->pd_devs[IRIS_VCODEC_POWER_DOMAIN ], true); +return iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , true); }int iris_vpu_switch_to_hwmode (struct iris_core *core)@@ -369,7 +368,7 @@ int iris_vpu35_vpu4x_power_off_controller(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_CTRL_FREERUN_CLK );iris_disable_unprepare_clock (core,IRIS_AXI_CTRL_CLK ); -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );reset_control_bulk_reset (clk_rst_tbl_size, core->resets);@@ -380,7 +379,7 @@ int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core) {int ret; - ret =iris_enable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); + ret =iris_enable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );if (ret)return ret;@@ -403,7 +402,7 @@ int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core) err_disable_axi1_clk:iris_disable_unprepare_clock (core,IRIS_AXI_CTRL_CLK ); err_disable_power: -iris_disable_power_domains (core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN ]); +iris_disable_power_domains (core,IRIS_CTRL_POWER_DOMAIN );return ret; }Signature · 2 lines
-- 2.34.1
PATCH v5 10/14 media: iris: Add power sequence for Glymur
In reply to Vishnu ReddyGlymur 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.
--- .../platform/qcom/iris/iris_platform_common.h | 4 + drivers/media/platform/qcom/iris/iris_vpu3x.c | 141 ++++++++++++++++++++- drivers/media/platform/qcom/iris/iris_vpu_common.h | 1 + .../platform/qcom/iris/iris_vpu_register_defines.h | 10 ++ 4 files changed, 154 insertions(+), 2 deletions(-)
drivers/media/platform/qcom/iris/iris_platform_common.h +4 -0
@@ -61,6 +61,9 @@ enum platform_clk_type {IRIS_VPP0_HW_CLK ,IRIS_VPP1_HW_CLK ,IRIS_APV_HW_CLK , +IRIS_AXI_VCODEC1_CLK , +IRIS_VCODEC1_CLK , + IRIS_VCODEC1_FREERUN_CLK, }; struct platform_clk_data {
@@ -210,6 +213,7 @@ enum platform_pm_domain_type {IRIS_VPP0_HW_POWER_DOMAIN ,IRIS_VPP1_HW_POWER_DOMAIN ,IRIS_APV_HW_POWER_DOMAIN , + IRIS_VCODEC1_POWER_DOMAIN, }; struct platform_pd_data {
drivers/media/platform/qcom/iris/iris_vpu3x.c +139 -2
157 lines not on this page · raw message
drivers/media/platform/qcom/iris/iris_vpu_common.h +1 -0
@@ -12,6 +12,7 @@ extern const struct vpu_ops iris_vpu2_ops;extern const struct vpu_ops iris_vpu3_ops;extern const struct vpu_ops iris_vpu33_ops;extern const struct vpu_ops iris_vpu35_ops; +extern const struct vpu_ops iris_vpu36_ops;extern const struct vpu_ops iris_vpu4x_ops;struct vpu_ops {
drivers/media/platform/qcom/iris/iris_vpu_register_defines.h +10 -0
@@ -7,6 +7,7 @@#define __IRIS_VPU_REGISTER_DEFINES_H__#define VCODEC_BASE_OFFS 0x00000000 +#define VCODEC1_BASE_OFFS 0x00040000#define AON_MVP_NOC_RESET 0x0001F000#define CPU_BASE_OFFS 0x000A0000#define WRAPPER_BASE_OFFS 0x000B0000
@@ -14,6 +15,8 @@#define AON_BASE_OFFS 0x000E0000#define VCODEC_SS_IDLE_STATUSN (VCODEC_BASE_OFFS + 0x70) +#define VCODEC1_SS_IDLE_STATUSN (VCODEC1_BASE_OFFS + 0x70) +#define DMA_NOC_IDLE BIT(22)#define AON_WRAPPER_MVP_NOC_RESET_REQ (AON_MVP_NOC_RESET + 0x000)#define VIDEO_NOC_RESET_REQ (BIT(0) | BIT(1))
@@ -35,6 +38,8 @@#define CPU_CS_AHB_BRIDGE_SYNC_RESET (CPU_CS_BASE_OFFS + 0x160)#define CORE_BRIDGE_SW_RESET BIT(0)#define CORE_BRIDGE_HW_RESET_DISABLE BIT(1) +#define VCODEC1_BRIDGE_SW_RESET BIT(2) +#define VCODEC1_BRIDGE_HW_RESET_DISABLE BIT(3)#define CPU_CS_X2RPMH (CPU_CS_BASE_OFFS + 0x168)#define MSK_SIGNAL_FROM_TENSILICA BIT(0)
@@ -52,14 +57,19 @@#define WRAPPER_DEBUG_BRIDGE_LPI_STATUS (WRAPPER_BASE_OFFS + 0x58)#define WRAPPER_IRIS_CPU_NOC_LPI_CONTROL (WRAPPER_BASE_OFFS + 0x5C)#define REQ_POWER_DOWN_PREP BIT(0) +#define REQ_VCODEC1_POWER_DOWN_PREP BIT(1)#define WRAPPER_IRIS_CPU_NOC_LPI_STATUS (WRAPPER_BASE_OFFS + 0x60)#define NOC_LPI_STATUS_DONE BIT(0)/* Indicates the NOC handshake is complete */ #define NOC_LPI_STATUS_DENY BIT(1)/* Indicates the NOC handshake is denied */ #define NOC_LPI_STATUS_ACTIVE BIT(2)/* Indicates the NOC is active */ +#define NOC_LPI_VCODEC1_STATUS_DONE BIT(8)#define WRAPPER_IRIS_VCODEC_VPU_WRAPPER_SPARE_0 (WRAPPER_BASE_OFFS + 0x78)#define WRAPPER_CORE_POWER_STATUS (WRAPPER_BASE_OFFS + 0x80) +#define VCODEC0_POWER_STATUS BIT(1) +#define VCODEC1_POWER_STATUS BIT(4) +#define WRAPPER_CORE_CLOCK_CONFIG (WRAPPER_BASE_OFFS + 0x88)#define CORE_CLK_RUN 0x0
Signature · 1 line
2.34.1
Re: [PATCH v5 10/14] media: iris: Add power sequence for Glymur
Quoted 19 lines · Vishnu Reddy
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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- .../platform/qcom/iris/iris_platform_common.h | 4 + drivers/media/platform/qcom/iris/iris_vpu3x.c | 141 ++++++++++++++++++++- drivers/media/platform/qcom/iris/iris_vpu_common.h | 1 + .../platform/qcom/iris/iris_vpu_register_defines.h | 10 ++ 4 files changed, 154 insertions(+), 2 deletions(-)drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0
drivers/media/platform/qcom/iris/iris_platform_common.h enum platform_clk_type { · line 66
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +3
-0@@ -61,6 +61,9 @@ enum platform_clk_type {IRIS_VPP0_HW_CLK ,IRIS_VPP1_HW_CLK ,IRIS_APV_HW_CLK , +IRIS_AXI_VCODEC1_CLK , +IRIS_VCODEC1_CLK , + IRIS_VCODEC1_FREERUN_CLK,
I think I have asked the same question while reviewing some other code. When seeing such enums my expectation would be that the set of clocks is more or less generic, while the platform specifics should be encapsulated in platform-specific code. Instead these lists keep on growing to accomodate platform details.
Can we stop that tradition? Adding a peculiarity of the platform should not require touching of the generic code.
Quoted 24 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0};struct platform_clk_data {@@ -210,6 +213,7 @@ enum platform_pm_domain_type {IRIS_VPP0_HW_POWER_DOMAIN ,IRIS_VPP1_HW_POWER_DOMAIN ,IRIS_APV_HW_POWER_DOMAIN , + IRIS_VCODEC1_POWER_DOMAIN, }; struct platform_pd_data {drivers/media/platform/qcom/iris/iris_vpu3x.c +2
-2@@ -22,9 +22,19 @@ static bool iris_vpu3x_hw_power_collapsed(struct iris_core *core)u32 value, pwr_status; value =readl (core->reg_base +WRAPPER_CORE_POWER_STATUS ); - pwr_status = value &BIT (1 ); + pwr_status = value &VCODEC0_POWER_STATUS ; -return pwr_status ? false : true; +return !pwr_status;
drivers/media/platform/qcom/iris/iris_vpu3x.c static bool iris_vpu3x_hw_power_collapsed(struct iris_core *core) · line 37
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +10
-0+} + +static bool iris_vpu36_hw1_power_collapsed (struct iris_core *core) +{ +u32 value, pwr_status; + + value =readl (core->reg_base +WRAPPER_CORE_POWER_STATUS ); + pwr_status = value &VCODEC1_POWER_STATUS ; + +return !pwr_status;
Add core as an argument to the function instead of c&p'ing it.
drivers/media/platform/qcom/iris/iris_vpu3x.c static void iris_vpu35_power_off_hw(struct iris_core *core) · line 267
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +1
-0}static void iris_vpu3_power_off_hardware (struct iris_core *core)@@ -254,6 +264,124 @@ static void iris_vpu35_power_off_hw(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); } +static int iris_vpu36_power_on_hw1 (struct iris_core *core)
Hmmm... And if 3.7 gets 4 cores, will we have 4 copies of the function?
Quoted 199 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +126
-0+{ +int ret; + + ret =iris_enable_power_domains (core,IRIS_VCODEC1_POWER_DOMAIN ); +if (ret) +return ret; + + ret =iris_prepare_enable_clock (core,IRIS_AXI_VCODEC1_CLK ); +if (ret) + goto err_disable_hw1_power; + + ret =iris_prepare_enable_clock (core,IRIS_VCODEC1_FREERUN_CLK ); +if (ret) + goto err_disable_axi1_clk; + + ret =iris_prepare_enable_clock (core,IRIS_VCODEC1_CLK ); +if (ret) + goto err_disable_hw1_free_clk; + +return 0 ; + +err_disable_hw1_free_clk: +iris_disable_unprepare_clock (core,IRIS_VCODEC1_FREERUN_CLK ); +err_disable_axi1_clk: +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC1_CLK ); +err_disable_hw1_power: +iris_disable_power_domains (core,IRIS_VCODEC1_POWER_DOMAIN ); + +return ret; +} + +static int iris_vpu36_power_on_hw (struct iris_core *core) +{ +int ret; + + ret =iris_vpu35_power_on_hw (core); +if (ret) +return ret; + + ret =iris_vpu36_power_on_hw1 (core); +if (ret) + goto err_power_off_hw; + +return 0 ; + +err_power_off_hw: +iris_vpu35_power_off_hw (core); + +return ret; +} + +static void iris_vpu36_power_off_hw1 (struct iris_core *core) +{ +u32 value, i; +int ret; + +if (iris_vpu36_hw1_power_collapsed (core)) + goto disable_power; + + value =readl (core->reg_base +WRAPPER_CORE_CLOCK_CONFIG ); +if (value) +writel (CORE_CLK_RUN , core->reg_base +WRAPPER_CORE_CLOCK_CONFIG ); + +for (i =0 ; i < core->iris_platform_data->num_vpp_pipe; i++) { + ret =readl_poll_timeout (core->reg_base +VCODEC1_SS_IDLE_STATUSN +4 * i, + value, value &DMA_NOC_IDLE ,2000 ,20000 ); +if (ret) + goto disable_power; + } + +writel (REQ_VCODEC1_POWER_DOWN_PREP , core->reg_base +AON_WRAPPER_MVP_NOC_LPI_CONTROL ); + ret =readl_poll_timeout (core->reg_base +AON_WRAPPER_MVP_NOC_LPI_STATUS , + value, value &NOC_LPI_VCODEC1_STATUS_DONE ,2000 ,20000 ); +if (ret) + goto disable_power; + +writel (0 , core->reg_base +AON_WRAPPER_MVP_NOC_LPI_CONTROL ); + +writel (VCODEC1_BRIDGE_SW_RESET |VCODEC1_BRIDGE_HW_RESET_DISABLE , core->reg_base + +CPU_CS_AHB_BRIDGE_SYNC_RESET ); +writel (VCODEC1_BRIDGE_HW_RESET_DISABLE , core->reg_base +CPU_CS_AHB_BRIDGE_SYNC_RESET ); +writel (0x0 , core->reg_base +CPU_CS_AHB_BRIDGE_SYNC_RESET ); + +disable_power: +iris_genpd_set_hwmode (core,IRIS_VCODEC1_POWER_DOMAIN , false); +iris_disable_unprepare_clock (core,IRIS_VCODEC1_CLK ); +iris_disable_unprepare_clock (core,IRIS_VCODEC1_FREERUN_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC1_CLK ); +iris_disable_power_domains (core,IRIS_VCODEC1_POWER_DOMAIN ); +} + +static void iris_vpu36_power_off_hw (struct iris_core *core) +{ +iris_vpu35_power_off_hw (core); +iris_vpu36_power_off_hw1 (core); +} + +static int iris_vpu36_set_hwmode (struct iris_core *core) +{ +int ret; + + ret =iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , true); +if (ret) +return ret; + + ret =iris_genpd_set_hwmode (core,IRIS_VCODEC1_POWER_DOMAIN , true); +if (ret) + goto error_disable_vcodec_hwmode; + +return 0 ; + +error_disable_vcodec_hwmode: +iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , false); + +return ret; +} +const struct vpu_ops iris_vpu3_ops = { .power_off_hw = iris_vpu3_power_off_hardware, .power_on_hw = iris_vpu_power_on_hw,@@ -281,3 +409,12 @@ const struct vpu_ops iris_vpu35_ops = { .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, .set_hwmode = iris_vpu_set_hwmode, }; + +const struct vpu_ops iris_vpu36_ops = { + .power_off_hw = iris_vpu36_power_off_hw, + .power_on_hw = iris_vpu36_power_on_hw, + .power_off_controller = iris_vpu35_vpu4x_power_off_controller, + .power_on_controller = iris_vpu35_vpu4x_power_on_controller, + .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, + .set_hwmode = iris_vpu36_set_hwmode, +};drivers/media/platform/qcom/iris/iris_vpu_common.h +1
-0@@ -12,6 +12,7 @@ extern const struct vpu_ops iris_vpu2_ops;extern const struct vpu_ops iris_vpu3_ops;extern const struct vpu_ops iris_vpu33_ops;extern const struct vpu_ops iris_vpu35_ops; +extern const struct vpu_ops iris_vpu36_ops;extern const struct vpu_ops iris_vpu4x_ops;struct vpu_ops {drivers/media/platform/qcom/iris/iris_vpu_register_defines.h +10
-0@@ -7,6 +7,7 @@#define __IRIS_VPU_REGISTER_DEFINES_H__#define VCODEC_BASE_OFFS 0x00000000 +#define VCODEC1_BASE_OFFS 0x00040000#define AON_MVP_NOC_RESET 0x0001F000#define CPU_BASE_OFFS 0x000A0000#define WRAPPER_BASE_OFFS 0x000B0000@@ -14,6 +15,8 @@#define AON_BASE_OFFS 0x000E0000#define VCODEC_SS_IDLE_STATUSN (VCODEC_BASE_OFFS + 0x70) +#define VCODEC1_SS_IDLE_STATUSN (VCODEC1_BASE_OFFS + 0x70) +#define DMA_NOC_IDLE BIT(22)#define AON_WRAPPER_MVP_NOC_RESET_REQ (AON_MVP_NOC_RESET + 0x000)#define VIDEO_NOC_RESET_REQ (BIT(0) | BIT(1))@@ -35,6 +38,8 @@#define CPU_CS_AHB_BRIDGE_SYNC_RESET (CPU_CS_BASE_OFFS + 0x160)#define CORE_BRIDGE_SW_RESET BIT(0)#define CORE_BRIDGE_HW_RESET_DISABLE BIT(1) +#define VCODEC1_BRIDGE_SW_RESET BIT(2) +#define VCODEC1_BRIDGE_HW_RESET_DISABLE BIT(3)#define CPU_CS_X2RPMH (CPU_CS_BASE_OFFS + 0x168)#define MSK_SIGNAL_FROM_TENSILICA BIT(0)@@ -52,14 +57,19 @@#define WRAPPER_DEBUG_BRIDGE_LPI_STATUS (WRAPPER_BASE_OFFS + 0x58)#define WRAPPER_IRIS_CPU_NOC_LPI_CONTROL (WRAPPER_BASE_OFFS + 0x5C)#define REQ_POWER_DOWN_PREP BIT(0) +#define REQ_VCODEC1_POWER_DOWN_PREP BIT(1)#define WRAPPER_IRIS_CPU_NOC_LPI_STATUS (WRAPPER_BASE_OFFS + 0x60)#define NOC_LPI_STATUS_DONE BIT(0)/* Indicates the NOC handshake is complete */ #define NOC_LPI_STATUS_DENY BIT(1)/* Indicates the NOC handshake is denied */ #define NOC_LPI_STATUS_ACTIVE BIT(2)/* Indicates the NOC is active */ +#define NOC_LPI_VCODEC1_STATUS_DONE BIT(8)#define WRAPPER_IRIS_VCODEC_VPU_WRAPPER_SPARE_0 (WRAPPER_BASE_OFFS + 0x78)#define WRAPPER_CORE_POWER_STATUS (WRAPPER_BASE_OFFS + 0x80) +#define VCODEC0_POWER_STATUS BIT(1) +#define VCODEC1_POWER_STATUS BIT(4) +#define WRAPPER_CORE_CLOCK_CONFIG (WRAPPER_BASE_OFFS + 0x88)#define CORE_CLK_RUN 0x0Signature · 2 lines
-- 2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 10/14] media: iris: Add power sequence for Glymur
Quoted 57 lines · Dmitry Baryshkov
Quoted 19 lines · Vishnu Reddy
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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- .../platform/qcom/iris/iris_platform_common.h | 4 + drivers/media/platform/qcom/iris/iris_vpu3x.c | 141 ++++++++++++++++++++- drivers/media/platform/qcom/iris/iris_vpu_common.h | 1 + .../platform/qcom/iris/iris_vpu_register_defines.h | 10 ++ 4 files changed, 154 insertions(+), 2 deletions(-)drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0drivers/media/platform/qcom/iris/iris_platform_common.h enum platform_clk_type { · line 66
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +3
-0@@ -61,6 +61,9 @@ enum platform_clk_type {IRIS_VPP0_HW_CLK ,IRIS_VPP1_HW_CLK ,IRIS_APV_HW_CLK , +IRIS_AXI_VCODEC1_CLK , +IRIS_VCODEC1_CLK , + IRIS_VCODEC1_FREERUN_CLK,I think I have asked the same question while reviewing some other code. When seeing such enums my expectation would be that the set of clocks is more or less generic, while the platform specifics should be encapsulated in platform-specific code. Instead these lists keep on growing to accomodate platform details.
Can we stop that tradition? Adding a peculiarity of the platform should not require touching of the generic code.
Quoted 22 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0};struct platform_clk_data {@@ -210,6 +213,7 @@ enum platform_pm_domain_type {IRIS_VPP0_HW_POWER_DOMAIN ,IRIS_VPP1_HW_POWER_DOMAIN ,IRIS_APV_HW_POWER_DOMAIN , + IRIS_VCODEC1_POWER_DOMAIN, }; struct platform_pd_data {drivers/media/platform/qcom/iris/iris_vpu3x.c +1
-1@@ -22,9 +22,19 @@ static bool iris_vpu3x_hw_power_collapsed(struct iris_core *core)u32 value, pwr_status; value =readl (core->reg_base +WRAPPER_CORE_POWER_STATUS ); - pwr_status = value &BIT (1 ); + pwr_status = value &VCODEC0_POWER_STATUS ;
Quoted 13 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c static bool iris_vpu3x_hw_power_collapsed(struct iris_core *core) · line 37
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +11
-1-return pwr_status ? false : true; +return !pwr_status; +} + +static bool iris_vpu36_hw1_power_collapsed (struct iris_core *core) +{ +u32 value, pwr_status; + + value =readl (core->reg_base +WRAPPER_CORE_POWER_STATUS ); + pwr_status = value &VCODEC1_POWER_STATUS ; + +return !pwr_status;Add core as an argument to the function instead of c&p'ing it.
Ack, will pass the vcodecx_power_status bit to this function.
Quoted 9 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c static void iris_vpu35_power_off_hw(struct iris_core *core) · line 267
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +1
-0}static void iris_vpu3_power_off_hardware (struct iris_core *core)@@ -254,6 +264,124 @@ static void iris_vpu35_power_off_hw(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); } +static int iris_vpu36_power_on_hw1 (struct iris_core *core)Hmmm... And if 3.7 gets 4 cores, will we have 4 copies of the function?
As of now, none of the near upcoming targets introduce a significantly higher number of cores. If that changes in the future, we can revisit and optimize it then.
Quoted 199 lines
Quoted 199 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +126
-0+{ +int ret; + + ret =iris_enable_power_domains (core,IRIS_VCODEC1_POWER_DOMAIN ); +if (ret) +return ret; + + ret =iris_prepare_enable_clock (core,IRIS_AXI_VCODEC1_CLK ); +if (ret) + goto err_disable_hw1_power; + + ret =iris_prepare_enable_clock (core,IRIS_VCODEC1_FREERUN_CLK ); +if (ret) + goto err_disable_axi1_clk; + + ret =iris_prepare_enable_clock (core,IRIS_VCODEC1_CLK ); +if (ret) + goto err_disable_hw1_free_clk; + +return 0 ; + +err_disable_hw1_free_clk: +iris_disable_unprepare_clock (core,IRIS_VCODEC1_FREERUN_CLK ); +err_disable_axi1_clk: +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC1_CLK ); +err_disable_hw1_power: +iris_disable_power_domains (core,IRIS_VCODEC1_POWER_DOMAIN ); + +return ret; +} + +static int iris_vpu36_power_on_hw (struct iris_core *core) +{ +int ret; + + ret =iris_vpu35_power_on_hw (core); +if (ret) +return ret; + + ret =iris_vpu36_power_on_hw1 (core); +if (ret) + goto err_power_off_hw; + +return 0 ; + +err_power_off_hw: +iris_vpu35_power_off_hw (core); + +return ret; +} + +static void iris_vpu36_power_off_hw1 (struct iris_core *core) +{ +u32 value, i; +int ret; + +if (iris_vpu36_hw1_power_collapsed (core)) + goto disable_power; + + value =readl (core->reg_base +WRAPPER_CORE_CLOCK_CONFIG ); +if (value) +writel (CORE_CLK_RUN , core->reg_base +WRAPPER_CORE_CLOCK_CONFIG ); + +for (i =0 ; i < core->iris_platform_data->num_vpp_pipe; i++) { + ret =readl_poll_timeout (core->reg_base +VCODEC1_SS_IDLE_STATUSN +4 * i, + value, value &DMA_NOC_IDLE ,2000 ,20000 ); +if (ret) + goto disable_power; + } + +writel (REQ_VCODEC1_POWER_DOWN_PREP , core->reg_base +AON_WRAPPER_MVP_NOC_LPI_CONTROL ); + ret =readl_poll_timeout (core->reg_base +AON_WRAPPER_MVP_NOC_LPI_STATUS , + value, value &NOC_LPI_VCODEC1_STATUS_DONE ,2000 ,20000 ); +if (ret) + goto disable_power; + +writel (0 , core->reg_base +AON_WRAPPER_MVP_NOC_LPI_CONTROL ); + +writel (VCODEC1_BRIDGE_SW_RESET |VCODEC1_BRIDGE_HW_RESET_DISABLE , core->reg_base + +CPU_CS_AHB_BRIDGE_SYNC_RESET ); +writel (VCODEC1_BRIDGE_HW_RESET_DISABLE , core->reg_base +CPU_CS_AHB_BRIDGE_SYNC_RESET ); +writel (0x0 , core->reg_base +CPU_CS_AHB_BRIDGE_SYNC_RESET ); + +disable_power: +iris_genpd_set_hwmode (core,IRIS_VCODEC1_POWER_DOMAIN , false); +iris_disable_unprepare_clock (core,IRIS_VCODEC1_CLK ); +iris_disable_unprepare_clock (core,IRIS_VCODEC1_FREERUN_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC1_CLK ); +iris_disable_power_domains (core,IRIS_VCODEC1_POWER_DOMAIN ); +} + +static void iris_vpu36_power_off_hw (struct iris_core *core) +{ +iris_vpu35_power_off_hw (core); +iris_vpu36_power_off_hw1 (core); +} + +static int iris_vpu36_set_hwmode (struct iris_core *core) +{ +int ret; + + ret =iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , true); +if (ret) +return ret; + + ret =iris_genpd_set_hwmode (core,IRIS_VCODEC1_POWER_DOMAIN , true); +if (ret) + goto error_disable_vcodec_hwmode; + +return 0 ; + +error_disable_vcodec_hwmode: +iris_genpd_set_hwmode (core,IRIS_VCODEC_POWER_DOMAIN , false); + +return ret; +} +const struct vpu_ops iris_vpu3_ops = { .power_off_hw = iris_vpu3_power_off_hardware, .power_on_hw = iris_vpu_power_on_hw,@@ -281,3 +409,12 @@ const struct vpu_ops iris_vpu35_ops = { .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, .set_hwmode = iris_vpu_set_hwmode, }; + +const struct vpu_ops iris_vpu36_ops = { + .power_off_hw = iris_vpu36_power_off_hw, + .power_on_hw = iris_vpu36_power_on_hw, + .power_off_controller = iris_vpu35_vpu4x_power_off_controller, + .power_on_controller = iris_vpu35_vpu4x_power_on_controller, + .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, + .set_hwmode = iris_vpu36_set_hwmode, +};drivers/media/platform/qcom/iris/iris_vpu_common.h +1
-0@@ -12,6 +12,7 @@ extern const struct vpu_ops iris_vpu2_ops;extern const struct vpu_ops iris_vpu3_ops;extern const struct vpu_ops iris_vpu33_ops;extern const struct vpu_ops iris_vpu35_ops; +extern const struct vpu_ops iris_vpu36_ops;extern const struct vpu_ops iris_vpu4x_ops;struct vpu_ops {drivers/media/platform/qcom/iris/iris_vpu_register_defines.h +10
-0@@ -7,6 +7,7 @@#define __IRIS_VPU_REGISTER_DEFINES_H__#define VCODEC_BASE_OFFS 0x00000000 +#define VCODEC1_BASE_OFFS 0x00040000#define AON_MVP_NOC_RESET 0x0001F000#define CPU_BASE_OFFS 0x000A0000#define WRAPPER_BASE_OFFS 0x000B0000@@ -14,6 +15,8 @@#define AON_BASE_OFFS 0x000E0000#define VCODEC_SS_IDLE_STATUSN (VCODEC_BASE_OFFS + 0x70) +#define VCODEC1_SS_IDLE_STATUSN (VCODEC1_BASE_OFFS + 0x70) +#define DMA_NOC_IDLE BIT(22)#define AON_WRAPPER_MVP_NOC_RESET_REQ (AON_MVP_NOC_RESET + 0x000)#define VIDEO_NOC_RESET_REQ (BIT(0) | BIT(1))@@ -35,6 +38,8 @@#define CPU_CS_AHB_BRIDGE_SYNC_RESET (CPU_CS_BASE_OFFS + 0x160)#define CORE_BRIDGE_SW_RESET BIT(0)#define CORE_BRIDGE_HW_RESET_DISABLE BIT(1) +#define VCODEC1_BRIDGE_SW_RESET BIT(2) +#define VCODEC1_BRIDGE_HW_RESET_DISABLE BIT(3)#define CPU_CS_X2RPMH (CPU_CS_BASE_OFFS + 0x168)#define MSK_SIGNAL_FROM_TENSILICA BIT(0)@@ -52,14 +57,19 @@#define WRAPPER_DEBUG_BRIDGE_LPI_STATUS (WRAPPER_BASE_OFFS + 0x58)#define WRAPPER_IRIS_CPU_NOC_LPI_CONTROL (WRAPPER_BASE_OFFS + 0x5C)#define REQ_POWER_DOWN_PREP BIT(0) +#define REQ_VCODEC1_POWER_DOWN_PREP BIT(1)#define WRAPPER_IRIS_CPU_NOC_LPI_STATUS (WRAPPER_BASE_OFFS + 0x60)#define NOC_LPI_STATUS_DONE BIT(0)/* Indicates the NOC handshake is complete */ #define NOC_LPI_STATUS_DENY BIT(1)/* Indicates the NOC handshake is denied */ #define NOC_LPI_STATUS_ACTIVE BIT(2)/* Indicates the NOC is active */ +#define NOC_LPI_VCODEC1_STATUS_DONE BIT(8)#define WRAPPER_IRIS_VCODEC_VPU_WRAPPER_SPARE_0 (WRAPPER_BASE_OFFS + 0x78)#define WRAPPER_CORE_POWER_STATUS (WRAPPER_BASE_OFFS + 0x80) +#define VCODEC0_POWER_STATUS BIT(1) +#define VCODEC1_POWER_STATUS BIT(4) +#define WRAPPER_CORE_CLOCK_CONFIG (WRAPPER_BASE_OFFS + 0x88)#define CORE_CLK_RUN 0x0Signature · 2 lines
-- 2.34.1
Re: [PATCH v5 10/14] media: iris: Add power sequence for Glymur
Quoted 73 lines · Vishnu Reddy
Quoted 57 lines · Dmitry Baryshkov
Quoted 19 lines · Vishnu Reddy
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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- .../platform/qcom/iris/iris_platform_common.h | 4 + drivers/media/platform/qcom/iris/iris_vpu3x.c | 141 ++++++++++++++++++++- drivers/media/platform/qcom/iris/iris_vpu_common.h | 1 + .../platform/qcom/iris/iris_vpu_register_defines.h | 10 ++ 4 files changed, 154 insertions(+), 2 deletions(-)drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0drivers/media/platform/qcom/iris/iris_platform_common.h enum platform_clk_type { · line 66
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +3
-0@@ -61,6 +61,9 @@ enum platform_clk_type {IRIS_VPP0_HW_CLK ,IRIS_VPP1_HW_CLK ,IRIS_APV_HW_CLK , +IRIS_AXI_VCODEC1_CLK , +IRIS_VCODEC1_CLK , + IRIS_VCODEC1_FREERUN_CLK,I think I have asked the same question while reviewing some other code. When seeing such enums my expectation would be that the set of clocks is more or less generic, while the platform specifics should be encapsulated in platform-specific code. Instead these lists keep on growing to accomodate platform details.
Can we stop that tradition? Adding a peculiarity of the platform should not require touching of the generic code.
Quoted 22 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0};struct platform_clk_data {@@ -210,6 +213,7 @@ enum platform_pm_domain_type {IRIS_VPP0_HW_POWER_DOMAIN ,IRIS_VPP1_HW_POWER_DOMAIN ,IRIS_APV_HW_POWER_DOMAIN , + IRIS_VCODEC1_POWER_DOMAIN, }; struct platform_pd_data {drivers/media/platform/qcom/iris/iris_vpu3x.c +1
-1@@ -22,9 +22,19 @@ static bool iris_vpu3x_hw_power_collapsed(struct iris_core *core)u32 value, pwr_status; value =readl (core->reg_base +WRAPPER_CORE_POWER_STATUS ); - pwr_status = value &BIT (1 ); + pwr_status = value &VCODEC0_POWER_STATUS ;Quoted 13 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c static bool iris_vpu3x_hw_power_collapsed(struct iris_core *core) · line 37
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +11
-1-return pwr_status ? false : true; +return !pwr_status; +} + +static bool iris_vpu36_hw1_power_collapsed (struct iris_core *core) +{ +u32 value, pwr_status; + + value =readl (core->reg_base +WRAPPER_CORE_POWER_STATUS ); + pwr_status = value &VCODEC1_POWER_STATUS ; + +return !pwr_status;Add core as an argument to the function instead of c&p'ing it.
Quoted 1 line
Ack, will pass the
vcodecx_power_statusbit to this function.
u32 core, please.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +0
-0}static void iris_vpu3_power_off_hardware (struct iris_core *core)@@ -254,6 +264,124 @@ static void iris_vpu35_power_off_hw(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); }
Quoted 6 lines
Quoted 2 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c static void iris_vpu35_power_off_hw(struct iris_core *core) · line 267
Quoted 1 line
drivers/media/platform/qcom/iris/iris_vpu3x.c +1
-0+static int iris_vpu36_power_on_hw1 (struct iris_core *core)Hmmm... And if 3.7 gets 4 cores, will we have 4 copies of the function?
As of now, none of the near upcoming targets introduce a significantly higher number of cores. If that changes in the future, we can revisit and optimize it then.
Okay....
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 10/14] media: iris: Add power sequence for Glymur
Quoted 72 lines · Dmitry Baryshkov
Quoted 71 lines · Vishnu Reddy
Quoted 70 lines · Dmitry Baryshkov
Quoted 19 lines · Vishnu Reddy
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.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- .../platform/qcom/iris/iris_platform_common.h | 4 + drivers/media/platform/qcom/iris/iris_vpu3x.c | 141 ++++++++++++++++++++- drivers/media/platform/qcom/iris/iris_vpu_common.h | 1 + .../platform/qcom/iris/iris_vpu_register_defines.h | 10 ++ 4 files changed, 154 insertions(+), 2 deletions(-)drivers/media/platform/qcom/iris/iris_platform_common.h +0
-0drivers/media/platform/qcom/iris/iris_platform_common.h enum platform_clk_type { · line 66
Quoted 6 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +3
-0@@ -61,6 +61,9 @@ enum platform_clk_type {IRIS_VPP0_HW_CLK ,IRIS_VPP1_HW_CLK ,IRIS_APV_HW_CLK , +IRIS_AXI_VCODEC1_CLK , +IRIS_VCODEC1_CLK , + IRIS_VCODEC1_FREERUN_CLK,I think I have asked the same question while reviewing some other code. When seeing such enums my expectation would be that the set of clocks is more or less generic, while the platform specifics should be encapsulated in platform-specific code. Instead these lists keep on growing to accomodate platform details.
Can we stop that tradition? Adding a peculiarity of the platform should not require touching of the generic code.
Quoted 24 lines
drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0};struct platform_clk_data {@@ -210,6 +213,7 @@ enum platform_pm_domain_type {IRIS_VPP0_HW_POWER_DOMAIN ,IRIS_VPP1_HW_POWER_DOMAIN ,IRIS_APV_HW_POWER_DOMAIN , + IRIS_VCODEC1_POWER_DOMAIN, }; struct platform_pd_data {drivers/media/platform/qcom/iris/iris_vpu3x.c +2
-2@@ -22,9 +22,19 @@ static bool iris_vpu3x_hw_power_collapsed(struct iris_core *core)u32 value, pwr_status; value =readl (core->reg_base +WRAPPER_CORE_POWER_STATUS ); - pwr_status = value &BIT (1 ); + pwr_status = value &VCODEC0_POWER_STATUS ; -return pwr_status ? false : true; +return !pwr_status;drivers/media/platform/qcom/iris/iris_vpu3x.c static bool iris_vpu3x_hw_power_collapsed(struct iris_core *core) · line 37
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +10
-0+} + +static bool iris_vpu36_hw1_power_collapsed (struct iris_core *core) +{ +u32 value, pwr_status; + + value =readl (core->reg_base +WRAPPER_CORE_POWER_STATUS ); + pwr_status = value &VCODEC1_POWER_STATUS ; + +return !pwr_status;Add core as an argument to the function instead of c&p'ing it.
Quoted 2 lines
Quoted 1 line
Ack, will pass the
vcodecx_power_statusbit to this function.u32 core, please.
core is already used as a struct iris_core * pointer in this function. I'll use a different name like pwr_status_bit for the u32 argument instead.
Quoted 14 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +0
-0}static void iris_vpu3_power_off_hardware (struct iris_core *core)@@ -254,6 +264,124 @@ static void iris_vpu35_power_off_hw(struct iris_core *core)iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC_CLK ); }Quoted 5 lines
Quoted 2 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c static void iris_vpu35_power_off_hw(struct iris_core *core) · line 267
Quoted 1 line
drivers/media/platform/qcom/iris/iris_vpu3x.c +1
-0+static int iris_vpu36_power_on_hw1 (struct iris_core *core)Hmmm... And if 3.7 gets 4 cores, will we have 4 copies of the function?
As of now, none of the near upcoming targets introduce a significantly higher number of cores. If that changes in the future, we can revisit and optimize it then.
Okay....
[email protected]
AI reviewRe: [PATCH v5 10/14] media: iris: Add power sequence for Glymur
In reply to Vishnu ReddyThank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: - [High] Improper hardware teardown sequence violates LIFO ordering. - [High] Hardware state leak on NOC…
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] Improper hardware teardown sequence violates LIFO ordering.
- [High] Hardware state leak on NOC LPI polling timeout error path.
- [High] Missing back-off and retry loop for VCODEC1 NOC LPI handshake.
- [High] Missing .program_bootup_registers callback in iris_vpu36_ops. --
commit d719c9ef4e0bf644111aeab34b3241be37fcf9c4
Author: Vishnu Reddy <[email protected]>
media: iris: Add power sequence for Glymur
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.
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +0
-0
[ ... ]
Quoted 1 line
drivers/media/platform/qcom/iris/iris_vpu3x.c +0
-0@@ -254,6 +264,124 @@ static void iris_vpu35_power_off_hw(struct iris_core *core)
[ ... ]
Quoted 14 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +14
-0+static void iris_vpu36_power_off_hw1 (struct iris_core *core) +{ +u32 value, i; +int ret; + +if (iris_vpu36_hw1_power_collapsed (core)) + goto disable_power; + + value =readl (core->reg_base +WRAPPER_CORE_CLOCK_CONFIG ); +if (value) +writel (CORE_CLK_RUN , core->reg_base +WRAPPER_CORE_CLOCK_CONFIG ); + +for (i =0 ; i < core->iris_platform_data->num_vpp_pipe; i++) { + ret = readl_poll_timeout(core->reg_base + VCODEC1_SS_IDLE_STATUSN + 4 * i,
drivers/media/platform/qcom/iris/iris_vpu3x.c static void iris_vpu35_power_off_hw(struct iris_core *core) · line 342
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +10
-0+ value, value & DMA_NOC_IDLE, 2000, 20000); +if (ret) + goto disable_power; + } + +writel (REQ_VCODEC1_POWER_DOWN_PREP , core->reg_base +AON_WRAPPER_MVP_NOC_LPI_CONTROL ); + ret =readl_poll_timeout (core->reg_base +AON_WRAPPER_MVP_NOC_LPI_STATUS , + value, value &NOC_LPI_VCODEC1_STATUS_DONE ,2000 ,20000 ); +if (ret) + goto disable_power;
Should this implement a back-off and retry loop? A single poll without clearing the request bit and retrying might timeout when the NOC is busy, causing an unclean hardware shutdown.
Also, if the readl_poll_timeout() fails and takes the goto, the code skips clearing the request bit in AON_WRAPPER_MVP_NOC_LPI_CONTROL. Because this register resides in the Always-On wrapper, will the power-down request bit remain asserted across power cycles and prevent the hardware from properly resuming on the next boot?
Quoted 11 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +11
-0+ +writel (0 , core->reg_base +AON_WRAPPER_MVP_NOC_LPI_CONTROL ); + +writel (VCODEC1_BRIDGE_SW_RESET |VCODEC1_BRIDGE_HW_RESET_DISABLE , core->reg_base + +CPU_CS_AHB_BRIDGE_SYNC_RESET ); +writel (VCODEC1_BRIDGE_HW_RESET_DISABLE , core->reg_base +CPU_CS_AHB_BRIDGE_SYNC_RESET ); +writel (0x0 , core->reg_base +CPU_CS_AHB_BRIDGE_SYNC_RESET ); + +disable_power: +iris_genpd_set_hwmode (core,IRIS_VCODEC1_POWER_DOMAIN , false); +iris_disable_unprepare_clock (core,IRIS_VCODEC1_CLK );
drivers/media/platform/qcom/iris/iris_vpu3x.c static void iris_vpu35_power_off_hw(struct iris_core *core) · line 363
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +10
-0+iris_disable_unprepare_clock (core,IRIS_VCODEC1_FREERUN_CLK ); +iris_disable_unprepare_clock (core,IRIS_AXI_VCODEC1_CLK ); +iris_disable_power_domains (core,IRIS_VCODEC1_POWER_DOMAIN ); +} + +static void iris_vpu36_power_off_hw (struct iris_core *core) +{ +iris_vpu35_power_off_hw (core); +iris_vpu36_power_off_hw1 (core); +}
Does this hardware teardown sequence violate LIFO ordering? The power-on sequence initializes the primary codec before the secondary codec, so tearing down the primary codec first in iris_vpu35_power_off_hw() triggers a full video NOC reset and disables the shared primary clock domains.
Consequently, when vcodec1's teardown sequence executes, will its attempts to read registers trigger bus hangs or timeouts?
[ ... ]
drivers/media/platform/qcom/iris/iris_vpu3x.c const struct vpu_ops iris_vpu35_ops = { · line 420
Quoted 13 lines
drivers/media/platform/qcom/iris/iris_vpu3x.c +9
-0@@ -281,3 +409,12 @@ const struct vpu_ops iris_vpu35_ops = { .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, .set_hwmode = iris_vpu_set_hwmode, }; + +const struct vpu_ops iris_vpu36_ops = { + .power_off_hw = iris_vpu36_power_off_hw, + .power_on_hw = iris_vpu36_power_on_hw, + .power_off_controller = iris_vpu35_vpu4x_power_off_controller, + .power_on_controller = iris_vpu35_vpu4x_power_on_controller, + .calc_freq = iris_vpu3x_vpu4x_calculate_frequency, + .set_hwmode = iris_vpu36_set_hwmode, +};
Is the .program_bootup_registers callback intentionally omitted here? It is present in the closely related iris_vpu35_ops struct. Without it, the core framework function might skip writing to WRAPPER_IRIS_VCODEC_VPU_WRAPPER_SPARE_0, which could leave the hardware improperly configured.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=10
PATCH v5 11/14 media: iris: Add support to select core for dual core platforms
In reply to Vishnu ReddyOn 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.
--- drivers/media/platform/qcom/iris/iris_common.c | 10 +++ drivers/media/platform/qcom/iris/iris_common.h | 1 + drivers/media/platform/qcom/iris/iris_core.h | 5 ++ drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + .../platform/qcom/iris/iris_hfi_gen2_command.c | 19 ++++++ .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + drivers/media/platform/qcom/iris/iris_instance.h | 2 + .../platform/qcom/iris/iris_platform_common.h | 1 + drivers/media/platform/qcom/iris/iris_power.c | 11 ++-- drivers/media/platform/qcom/iris/iris_utils.c | 75 ++++++++++++++++------ drivers/media/platform/qcom/iris/iris_vb2.c | 4 ++ drivers/media/platform/qcom/iris/iris_vidc.c | 6 +- 12 files changed, 113 insertions(+), 23 deletions(-)
drivers/media/platform/qcom/iris/iris_common.c +10 -0
@@ -46,6 +46,16 @@ void iris_set_ts_metadata(struct iris_inst *inst, struct vb2_v4l2_buffer *vbuf) inst->metadata_idx++; } +int iris_set_core_id (struct iris_inst *inst) +{ +const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops; + +if (!inst->core->iris_platform_data->dual_core) +return 0 ; + +return hfi_ops->session_set_core_id (inst, inst->core_id); +} +int iris_process_streamon_input (struct iris_inst *inst) {const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;
drivers/media/platform/qcom/iris/iris_common.h +1 -0
@@ -11,6 +11,7 @@ struct iris_buffer;int iris_vb2_buffer_to_driver (struct vb2_buffer *vb2,struct iris_buffer *buf);void iris_set_ts_metadata (struct iris_inst *inst,struct vb2_v4l2_buffer *vbuf); +int iris_set_core_id (struct iris_inst *inst);int iris_process_streamon_input (struct iris_inst *inst);int iris_process_streamon_output (struct iris_inst *inst);int iris_session_streamoff (struct iris_inst *inst,u32 plane);
drivers/media/platform/qcom/iris/iris_core.h +5 -0
@@ -30,6 +30,11 @@ enum domain_type { DECODER = BIT(1), }; +enum iris_vcodec_core_id { +IRIS_VCODEC0 =1 , +IRIS_VCODEC1 , +}; +/** * struct iris_core - holds core parameters valid for all instances *
drivers/media/platform/qcom/iris/iris_hfi_common.h +1 -0
@@ -124,6 +124,7 @@ struct iris_hfi_command_ops {int (*session_drain)(struct iris_inst *inst,u32 plane);int (*session_resume_drain)(struct iris_inst *inst,u32 plane);int (*session_close)(struct iris_inst *inst); +int (*session_set_core_id)(struct iris_inst *inst,u32 core_id); };struct iris_hfi_response_ops {
drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c +19 -0
@@ -1300,6 +1300,24 @@ static int iris_hfi_gen2_session_release_buffer(struct iris_inst *inst, struct i inst_hfi_gen2->packet->size); } +static int iris_hfi_gen2_set_core_id (struct iris_inst *inst,u32 core_id) +{ +struct iris_inst_hfi_gen2 *inst_hfi_gen2 =to_iris_inst_hfi_gen2 (inst); +u32 payload = core_id; + +iris_hfi_gen2_packet_session_command (inst, +HFI_PROP_CORE_ID , +HFI_HOST_FLAGS_NONE , +HFI_PORT_NONE , + inst->session_id, +HFI_PAYLOAD_U32 , + &payload, +sizeof (u32)); + +return iris_hfi_queue_cmd_write (inst->core, inst_hfi_gen2->packet, + inst_hfi_gen2->packet->size); +} +static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .sys_init = iris_hfi_gen2_sys_init, .sys_image_version = iris_hfi_gen2_sys_image_version,
@@ -1317,6 +1335,7 @@ static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .session_drain = iris_hfi_gen2_session_drain, .session_resume_drain = iris_hfi_gen2_session_resume_drain, .session_close = iris_hfi_gen2_session_close, + .session_set_core_id = iris_hfi_gen2_set_core_id, };void iris_hfi_gen2_command_ops_init (struct iris_core *core)
drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h +1 -0
@@ -56,6 +56,7 @@#define HFI_PROP_BUFFER_HOST_MAX_COUNT 0x03000123#define HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT 0x03000124#define HFI_PROP_PIC_ORDER_CNT_TYPE 0x03000128 +#define HFI_PROP_CORE_ID 0x030001a9enum hfi_rate_control {HFI_RC_VBR_CFR =0x00000000 ,
drivers/media/platform/qcom/iris/iris_instance.h +2 -0
@@ -37,6 +37,7 @@ struct iris_fmt {* * @list: used for attach an instance to the core * @core: pointer to core structure +* @core_id: specifies the hardware core on which the session runs * @session_id: id of current video session * @ctx_q_lock: lock to serialize queues related ioctls * @lock: lock to seralise forward and reverse threads
@@ -79,6 +80,7 @@ struct iris_fmt {struct iris_inst {struct list_head list;struct iris_core *core; +u32 core_id;u32 session_id;struct mutex ctx_q_lock;/* lock to serialize queues related ioctls */ struct mutex lock;/* lock to serialize forward and reverse threads */
drivers/media/platform/qcom/iris/iris_platform_common.h +1 -0
@@ -258,6 +258,7 @@ struct iris_platform_data {const struct tz_cp_config *tz_cp_config_data;u32 tz_cp_config_data_size;u32 core_arch; +bool dual_core;u32 hw_response_timeout;struct ubwc_config_data *ubwc_config;u32 num_vpp_pipe;
drivers/media/platform/qcom/iris/iris_power.c +7 -4
@@ -77,9 +77,9 @@ static int iris_vote_interconnects(struct iris_inst *inst)static int iris_set_clocks (struct iris_inst *inst) { +u64 vcodec0_freq =0 , vcodec1_freq =0 ;struct iris_core *core = inst->core;struct iris_inst *instance; -u64 freq =0 ;int ret;mutex_lock (&core->lock);
@@ -87,11 +87,14 @@ static int iris_set_clocks(struct iris_inst *inst)if (!instance->max_input_data_size)continue ; - freq += instance->power.min_freq; +if (instance->core_id ==IRIS_VCODEC0 ) + vcodec0_freq += instance->power.min_freq; +else + vcodec1_freq += instance->power.min_freq; } - core->power.clk_freq = freq; - ret =iris_opp_set_rate (core->dev, freq); + core->power.clk_freq =max (vcodec0_freq, vcodec1_freq); + ret =iris_opp_set_rate (core->dev, core->power.clk_freq);mutex_unlock (&core->lock);return ret;
drivers/media/platform/qcom/iris/iris_utils.c +57 -18
97 lines not on this page · raw message
drivers/media/platform/qcom/iris/iris_vb2.c +4 -0
@@ -176,6 +176,10 @@ int iris_vb2_start_streaming(struct vb2_queue *q, unsigned int count)if (ret) goto error; + ret =iris_set_core_id (inst); +if (ret) + goto error; +if (V4L2_TYPE_IS_OUTPUT (q->type)) {if (inst->domain ==DECODER ) ret =iris_vdec_streamon_input (inst);
drivers/media/platform/qcom/iris/iris_vidc.c +5 -1
@@ -41,16 +41,20 @@ static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp)static void iris_add_session (struct iris_inst *inst) { +u32 max_session_count = inst->core->iris_platform_data->max_session_count;struct iris_core *core = inst->core;struct iris_inst *iter;u32 count =0 ; +if (inst->core->iris_platform_data->dual_core) + max_session_count *=2 ; +mutex_lock (&core->lock);list_for_each_entry (iter, &core->instances, list) count++; -if (count < core->iris_platform_data->max_session_count) +if (count < max_session_count)list_add_tail (&inst->list, &core->instances);mutex_unlock (&core->lock);
Signature · 1 line
2.34.1
Re: [PATCH v5 11/14] media: iris: Add support to select core for dual core platforms
Quoted 210 lines · Vishnu Reddy
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_IDproperty.Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_common.c | 10 +++ drivers/media/platform/qcom/iris/iris_common.h | 1 + drivers/media/platform/qcom/iris/iris_core.h | 5 ++ drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + .../platform/qcom/iris/iris_hfi_gen2_command.c | 19 ++++++ .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + drivers/media/platform/qcom/iris/iris_instance.h | 2 + .../platform/qcom/iris/iris_platform_common.h | 1 + drivers/media/platform/qcom/iris/iris_power.c | 11 ++-- drivers/media/platform/qcom/iris/iris_utils.c | 75 ++++++++++++++++------ drivers/media/platform/qcom/iris/iris_vb2.c | 4 ++ drivers/media/platform/qcom/iris/iris_vidc.c | 6 +- 12 files changed, 113 insertions(+), 23 deletions(-)drivers/media/platform/qcom/iris/iris_common.c +10
-0@@ -46,6 +46,16 @@ void iris_set_ts_metadata(struct iris_inst *inst, struct vb2_v4l2_buffer *vbuf) inst->metadata_idx++; } +int iris_set_core_id (struct iris_inst *inst) +{ +const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops; + +if (!inst->core->iris_platform_data->dual_core) +return 0 ; + +return hfi_ops->session_set_core_id (inst, inst->core_id); +} +int iris_process_streamon_input (struct iris_inst *inst) {const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;drivers/media/platform/qcom/iris/iris_common.h +1
-0@@ -11,6 +11,7 @@ struct iris_buffer;int iris_vb2_buffer_to_driver (struct vb2_buffer *vb2,struct iris_buffer *buf);void iris_set_ts_metadata (struct iris_inst *inst,struct vb2_v4l2_buffer *vbuf); +int iris_set_core_id (struct iris_inst *inst);int iris_process_streamon_input (struct iris_inst *inst);int iris_process_streamon_output (struct iris_inst *inst);int iris_session_streamoff (struct iris_inst *inst,u32 plane);drivers/media/platform/qcom/iris/iris_core.h +5
-0@@ -30,6 +30,11 @@ enum domain_type { DECODER = BIT(1), }; +enum iris_vcodec_core_id { +IRIS_VCODEC0 =1 , +IRIS_VCODEC1 , +}; +/** * struct iris_core - holds core parameters valid for all instances * drivers/media/platform/qcom/iris/iris_hfi_common.h +1
-0@@ -124,6 +124,7 @@ struct iris_hfi_command_ops {int (*session_drain)(struct iris_inst *inst,u32 plane);int (*session_resume_drain)(struct iris_inst *inst,u32 plane);int (*session_close)(struct iris_inst *inst); +int (*session_set_core_id)(struct iris_inst *inst,u32 core_id); };struct iris_hfi_response_ops {drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c +19
-0@@ -1300,6 +1300,24 @@ static int iris_hfi_gen2_session_release_buffer(struct iris_inst *inst, struct i inst_hfi_gen2->packet->size); } +static int iris_hfi_gen2_set_core_id (struct iris_inst *inst,u32 core_id) +{ +struct iris_inst_hfi_gen2 *inst_hfi_gen2 =to_iris_inst_hfi_gen2 (inst); +u32 payload = core_id; + +iris_hfi_gen2_packet_session_command (inst, +HFI_PROP_CORE_ID , +HFI_HOST_FLAGS_NONE , +HFI_PORT_NONE , + inst->session_id, +HFI_PAYLOAD_U32 , + &payload, +sizeof (u32)); + +return iris_hfi_queue_cmd_write (inst->core, inst_hfi_gen2->packet, + inst_hfi_gen2->packet->size); +} +static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .sys_init = iris_hfi_gen2_sys_init, .sys_image_version = iris_hfi_gen2_sys_image_version,@@ -1317,6 +1335,7 @@ static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .session_drain = iris_hfi_gen2_session_drain, .session_resume_drain = iris_hfi_gen2_session_resume_drain, .session_close = iris_hfi_gen2_session_close, + .session_set_core_id = iris_hfi_gen2_set_core_id, };void iris_hfi_gen2_command_ops_init (struct iris_core *core)drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h +1
-0@@ -56,6 +56,7 @@#define HFI_PROP_BUFFER_HOST_MAX_COUNT 0x03000123#define HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT 0x03000124#define HFI_PROP_PIC_ORDER_CNT_TYPE 0x03000128 +#define HFI_PROP_CORE_ID 0x030001a9enum hfi_rate_control {HFI_RC_VBR_CFR =0x00000000 ,drivers/media/platform/qcom/iris/iris_instance.h +2
-0@@ -37,6 +37,7 @@ struct iris_fmt {* * @list: used for attach an instance to the core * @core: pointer to core structure +* @core_id: specifies the hardware core on which the session runs * @session_id: id of current video session * @ctx_q_lock: lock to serialize queues related ioctls * @lock: lock to seralise forward and reverse threads @@ -79,6 +80,7 @@ struct iris_fmt {struct iris_inst {struct list_head list;struct iris_core *core; +u32 core_id;u32 session_id;struct mutex ctx_q_lock;/* lock to serialize queues related ioctls */ struct mutex lock;/* lock to serialize forward and reverse threads */ drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0@@ -258,6 +258,7 @@ struct iris_platform_data {const struct tz_cp_config *tz_cp_config_data;u32 tz_cp_config_data_size;u32 core_arch; +bool dual_core;u32 hw_response_timeout;struct ubwc_config_data *ubwc_config;u32 num_vpp_pipe;drivers/media/platform/qcom/iris/iris_power.c +7
-4@@ -77,9 +77,9 @@ static int iris_vote_interconnects(struct iris_inst *inst)static int iris_set_clocks (struct iris_inst *inst) { +u64 vcodec0_freq =0 , vcodec1_freq =0 ;struct iris_core *core = inst->core;struct iris_inst *instance; -u64 freq =0 ;int ret;mutex_lock (&core->lock);@@ -87,11 +87,14 @@ static int iris_set_clocks(struct iris_inst *inst)if (!instance->max_input_data_size)continue ; - freq += instance->power.min_freq; +if (instance->core_id ==IRIS_VCODEC0 ) + vcodec0_freq += instance->power.min_freq; +else + vcodec1_freq += instance->power.min_freq; } - core->power.clk_freq = freq; - ret =iris_opp_set_rate (core->dev, freq); + core->power.clk_freq =max (vcodec0_freq, vcodec1_freq); + ret =iris_opp_set_rate (core->dev, core->power.clk_freq);mutex_unlock (&core->lock);return ret;drivers/media/platform/qcom/iris/iris_utils.c +3
-2@@ -90,40 +90,79 @@ struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id)return NULL ; } -int iris_check_core_mbpf (struct iris_inst *inst) +static u32 iris_get_mbps (struct iris_inst *inst) { -struct iris_core *core = inst->core; +u32 fps =max (inst->frame_rate, inst->operating_rate); +
drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 106
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_utils.c +10
-0+return iris_get_mbpf (inst) * fps; +} + +static int iris_check_and_assign_core (struct iris_inst *inst,bool mbpf) +{ +const struct iris_platform_data *platform_data = inst->core->iris_platform_data; +u32 max_load = mbpf ? platform_data->max_core_mbpf : platform_data->max_core_mbps; +u32 max_session_cnt = platform_data->max_session_count; +u32 core0_session_cnt =0 , core1_session_cnt =0 ; +bool dual_core = platform_data->dual_core;
num_cores
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_utils.c +4
-5+u32 core0_load =0 , core1_load =0 ; +bool select_core0, select_core1;struct iris_inst *instance; -u32 total_mbpf =0 ; +u32 load, new_load; -mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) - total_mbpf +=iris_get_mbpf (instance); -mutex_unlock (&core->lock); + inst->core_id =0 ;
drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 122
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_utils.c +9
-1-if (total_mbpf > core->iris_platform_data->max_core_mbpf) +list_for_each_entry (instance, &inst->core->instances, list) { + load = mbpf ?iris_get_mbpf (instance) :iris_get_mbps (instance); + +if (instance->core_id ==IRIS_VCODEC0 ) { + core0_load += load; + core0_session_cnt++; + }else if (instance->core_id ==IRIS_VCODEC1 ) { + core1_load += load; + core1_session_cnt++;
Arrays, please.
Quoted 76 lines
drivers/media/platform/qcom/iris/iris_utils.c +31
-10+ } + } + + new_load = mbpf ?iris_get_mbpf (inst) :iris_get_mbps (inst); + + select_core0 = core0_load + new_load <= max_load && core0_session_cnt < max_session_cnt; + select_core1 = dual_core && core1_load + new_load <= max_load && + core1_session_cnt < max_session_cnt; + +if (select_core0 && select_core1) + inst->core_id = (core0_load <= core1_load) ?IRIS_VCODEC0 :IRIS_VCODEC1 ; +else if (select_core0) + inst->core_id =IRIS_VCODEC0 ; +else if (select_core1) + inst->core_id =IRIS_VCODEC1 ; +else return -ENOMEM ;return 0 ; } -int iris_check_core_mbps (struct iris_inst *inst) +int iris_check_core_mbpf (struct iris_inst *inst) {struct iris_core *core = inst->core; -struct iris_inst *instance; -u32 total_mbps =0 , fps =0 ; +int ret;mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) { - fps =max (instance->frame_rate, instance->operating_rate); - total_mbps +=iris_get_mbpf (instance) * fps; - } + ret =iris_check_and_assign_core (inst, true);mutex_unlock (&core->lock); -if (total_mbps > core->iris_platform_data->max_core_mbps) -return -ENOMEM ; +return ret; +} -return 0 ; +int iris_check_core_mbps (struct iris_inst *inst) +{ +struct iris_core *core = inst->core; +int ret; + +mutex_lock (&core->lock); + ret =iris_check_and_assign_core (inst, false); +mutex_unlock (&core->lock); + +return ret; }bool is_rotation_90_or_270 (struct iris_inst *inst)drivers/media/platform/qcom/iris/iris_vb2.c +4
-0@@ -176,6 +176,10 @@ int iris_vb2_start_streaming(struct vb2_queue *q, unsigned int count)if (ret) goto error; + ret =iris_set_core_id (inst); +if (ret) + goto error; +if (V4L2_TYPE_IS_OUTPUT (q->type)) {if (inst->domain ==DECODER ) ret =iris_vdec_streamon_input (inst);drivers/media/platform/qcom/iris/iris_vidc.c +0
-0
drivers/media/platform/qcom/iris/iris_vidc.c static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp) · line 50
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vidc.c +3
-0@@ -41,16 +41,20 @@ static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp)static void iris_add_session (struct iris_inst *inst) { +u32 max_session_count = inst->core->iris_platform_data->max_session_count;struct iris_core *core = inst->core;struct iris_inst *iter;u32 count =0 ; +if (inst->core->iris_platform_data->dual_core) + max_session_count *=2 ;
max_session_count *= num_cores.
Quoted 15 lines
drivers/media/platform/qcom/iris/iris_vidc.c +2
-1+mutex_lock (&core->lock);list_for_each_entry (iter, &core->instances, list) count++; -if (count < core->iris_platform_data->max_session_count) +if (count < max_session_count)list_add_tail (&inst->list, &core->instances);mutex_unlock (&core->lock);Signature · 2 lines
-- 2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 11/14] media: iris: Add support to select core for dual core platforms
Quoted 214 lines · Dmitry Baryshkov
Quoted 213 lines · Vishnu Reddy
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_IDproperty.Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_common.c | 10 +++ drivers/media/platform/qcom/iris/iris_common.h | 1 + drivers/media/platform/qcom/iris/iris_core.h | 5 ++ drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + .../platform/qcom/iris/iris_hfi_gen2_command.c | 19 ++++++ .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + drivers/media/platform/qcom/iris/iris_instance.h | 2 + .../platform/qcom/iris/iris_platform_common.h | 1 + drivers/media/platform/qcom/iris/iris_power.c | 11 ++-- drivers/media/platform/qcom/iris/iris_utils.c | 75 ++++++++++++++++------ drivers/media/platform/qcom/iris/iris_vb2.c | 4 ++ drivers/media/platform/qcom/iris/iris_vidc.c | 6 +- 12 files changed, 113 insertions(+), 23 deletions(-)drivers/media/platform/qcom/iris/iris_common.c +10
-0@@ -46,6 +46,16 @@ void iris_set_ts_metadata(struct iris_inst *inst, struct vb2_v4l2_buffer *vbuf) inst->metadata_idx++; } +int iris_set_core_id (struct iris_inst *inst) +{ +const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops; + +if (!inst->core->iris_platform_data->dual_core) +return 0 ; + +return hfi_ops->session_set_core_id (inst, inst->core_id); +} +int iris_process_streamon_input (struct iris_inst *inst) {const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;drivers/media/platform/qcom/iris/iris_common.h +1
-0@@ -11,6 +11,7 @@ struct iris_buffer;int iris_vb2_buffer_to_driver (struct vb2_buffer *vb2,struct iris_buffer *buf);void iris_set_ts_metadata (struct iris_inst *inst,struct vb2_v4l2_buffer *vbuf); +int iris_set_core_id (struct iris_inst *inst);int iris_process_streamon_input (struct iris_inst *inst);int iris_process_streamon_output (struct iris_inst *inst);int iris_session_streamoff (struct iris_inst *inst,u32 plane);drivers/media/platform/qcom/iris/iris_core.h +5
-0@@ -30,6 +30,11 @@ enum domain_type { DECODER = BIT(1), }; +enum iris_vcodec_core_id { +IRIS_VCODEC0 =1 , +IRIS_VCODEC1 , +}; +/** * struct iris_core - holds core parameters valid for all instances * drivers/media/platform/qcom/iris/iris_hfi_common.h +1
-0@@ -124,6 +124,7 @@ struct iris_hfi_command_ops {int (*session_drain)(struct iris_inst *inst,u32 plane);int (*session_resume_drain)(struct iris_inst *inst,u32 plane);int (*session_close)(struct iris_inst *inst); +int (*session_set_core_id)(struct iris_inst *inst,u32 core_id); };struct iris_hfi_response_ops {drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c +19
-0@@ -1300,6 +1300,24 @@ static int iris_hfi_gen2_session_release_buffer(struct iris_inst *inst, struct i inst_hfi_gen2->packet->size); } +static int iris_hfi_gen2_set_core_id (struct iris_inst *inst,u32 core_id) +{ +struct iris_inst_hfi_gen2 *inst_hfi_gen2 =to_iris_inst_hfi_gen2 (inst); +u32 payload = core_id; + +iris_hfi_gen2_packet_session_command (inst, +HFI_PROP_CORE_ID , +HFI_HOST_FLAGS_NONE , +HFI_PORT_NONE , + inst->session_id, +HFI_PAYLOAD_U32 , + &payload, +sizeof (u32)); + +return iris_hfi_queue_cmd_write (inst->core, inst_hfi_gen2->packet, + inst_hfi_gen2->packet->size); +} +static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .sys_init = iris_hfi_gen2_sys_init, .sys_image_version = iris_hfi_gen2_sys_image_version,@@ -1317,6 +1335,7 @@ static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .session_drain = iris_hfi_gen2_session_drain, .session_resume_drain = iris_hfi_gen2_session_resume_drain, .session_close = iris_hfi_gen2_session_close, + .session_set_core_id = iris_hfi_gen2_set_core_id, };void iris_hfi_gen2_command_ops_init (struct iris_core *core)drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h +1
-0@@ -56,6 +56,7 @@#define HFI_PROP_BUFFER_HOST_MAX_COUNT 0x03000123#define HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT 0x03000124#define HFI_PROP_PIC_ORDER_CNT_TYPE 0x03000128 +#define HFI_PROP_CORE_ID 0x030001a9enum hfi_rate_control {HFI_RC_VBR_CFR =0x00000000 ,drivers/media/platform/qcom/iris/iris_instance.h +2
-0@@ -37,6 +37,7 @@ struct iris_fmt {* * @list: used for attach an instance to the core * @core: pointer to core structure +* @core_id: specifies the hardware core on which the session runs * @session_id: id of current video session * @ctx_q_lock: lock to serialize queues related ioctls * @lock: lock to seralise forward and reverse threads @@ -79,6 +80,7 @@ struct iris_fmt {struct iris_inst {struct list_head list;struct iris_core *core; +u32 core_id;u32 session_id;struct mutex ctx_q_lock;/* lock to serialize queues related ioctls */ struct mutex lock;/* lock to serialize forward and reverse threads */ drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0@@ -258,6 +258,7 @@ struct iris_platform_data {const struct tz_cp_config *tz_cp_config_data;u32 tz_cp_config_data_size;u32 core_arch; +bool dual_core;u32 hw_response_timeout;struct ubwc_config_data *ubwc_config;u32 num_vpp_pipe;drivers/media/platform/qcom/iris/iris_power.c +7
-4@@ -77,9 +77,9 @@ static int iris_vote_interconnects(struct iris_inst *inst)static int iris_set_clocks (struct iris_inst *inst) { +u64 vcodec0_freq =0 , vcodec1_freq =0 ;struct iris_core *core = inst->core;struct iris_inst *instance; -u64 freq =0 ;int ret;mutex_lock (&core->lock);@@ -87,11 +87,14 @@ static int iris_set_clocks(struct iris_inst *inst)if (!instance->max_input_data_size)continue ; - freq += instance->power.min_freq; +if (instance->core_id ==IRIS_VCODEC0 ) + vcodec0_freq += instance->power.min_freq; +else + vcodec1_freq += instance->power.min_freq; } - core->power.clk_freq = freq; - ret =iris_opp_set_rate (core->dev, freq); + core->power.clk_freq =max (vcodec0_freq, vcodec1_freq); + ret =iris_opp_set_rate (core->dev, core->power.clk_freq);mutex_unlock (&core->lock);return ret;drivers/media/platform/qcom/iris/iris_utils.c +6
-2@@ -90,40 +90,79 @@ struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id)return NULL ; } -int iris_check_core_mbpf (struct iris_inst *inst) +static u32 iris_get_mbps (struct iris_inst *inst) { -struct iris_core *core = inst->core; +u32 fps =max (inst->frame_rate, inst->operating_rate); + +return iris_get_mbpf (inst) * fps; +} +
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 106
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_utils.c +7
-0+static int iris_check_and_assign_core (struct iris_inst *inst,bool mbpf) +{ +const struct iris_platform_data *platform_data = inst->core->iris_platform_data; +u32 max_load = mbpf ? platform_data->max_core_mbpf : platform_data->max_core_mbps; +u32 max_session_cnt = platform_data->max_session_count; +u32 core0_session_cnt =0 , core1_session_cnt =0 ; +bool dual_core = platform_data->dual_core;
num_cores
A num_cores field would require updating all platform data entries. For two cores, a simple boolean flag feels sufficient here.
Quoted 12 lines
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_utils.c +4
-5+u32 core0_load =0 , core1_load =0 ; +bool select_core0, select_core1;struct iris_inst *instance; -u32 total_mbpf =0 ; +u32 load, new_load; -mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) - total_mbpf +=iris_get_mbpf (instance); -mutex_unlock (&core->lock); + inst->core_id =0 ;
Quoted 11 lines
drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 122
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_utils.c +9
-1-if (total_mbpf > core->iris_platform_data->max_core_mbpf) +list_for_each_entry (instance, &inst->core->instances, list) { + load = mbpf ?iris_get_mbpf (instance) :iris_get_mbps (instance); + +if (instance->core_id ==IRIS_VCODEC0 ) { + core0_load += load; + core0_session_cnt++; + }else if (instance->core_id ==IRIS_VCODEC1 ) { + core1_load += load; + core1_session_cnt++;Arrays, please.
Since we only have two cores, explicit variables feel cleaner and easier to read than arrays.
Quoted 103 lines
Quoted 76 lines
drivers/media/platform/qcom/iris/iris_utils.c +31
-10+ } + } + + new_load = mbpf ?iris_get_mbpf (inst) :iris_get_mbps (inst); + + select_core0 = core0_load + new_load <= max_load && core0_session_cnt < max_session_cnt; + select_core1 = dual_core && core1_load + new_load <= max_load && + core1_session_cnt < max_session_cnt; + +if (select_core0 && select_core1) + inst->core_id = (core0_load <= core1_load) ?IRIS_VCODEC0 :IRIS_VCODEC1 ; +else if (select_core0) + inst->core_id =IRIS_VCODEC0 ; +else if (select_core1) + inst->core_id =IRIS_VCODEC1 ; +else return -ENOMEM ;return 0 ; } -int iris_check_core_mbps (struct iris_inst *inst) +int iris_check_core_mbpf (struct iris_inst *inst) {struct iris_core *core = inst->core; -struct iris_inst *instance; -u32 total_mbps =0 , fps =0 ; +int ret;mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) { - fps =max (instance->frame_rate, instance->operating_rate); - total_mbps +=iris_get_mbpf (instance) * fps; - } + ret =iris_check_and_assign_core (inst, true);mutex_unlock (&core->lock); -if (total_mbps > core->iris_platform_data->max_core_mbps) -return -ENOMEM ; +return ret; +} -return 0 ; +int iris_check_core_mbps (struct iris_inst *inst) +{ +struct iris_core *core = inst->core; +int ret; + +mutex_lock (&core->lock); + ret =iris_check_and_assign_core (inst, false); +mutex_unlock (&core->lock); + +return ret; }bool is_rotation_90_or_270 (struct iris_inst *inst)drivers/media/platform/qcom/iris/iris_vb2.c +4
-0@@ -176,6 +176,10 @@ int iris_vb2_start_streaming(struct vb2_queue *q, unsigned int count)if (ret) goto error; + ret =iris_set_core_id (inst); +if (ret) + goto error; +if (V4L2_TYPE_IS_OUTPUT (q->type)) {if (inst->domain ==DECODER ) ret =iris_vdec_streamon_input (inst);drivers/media/platform/qcom/iris/iris_vidc.c +0
-0drivers/media/platform/qcom/iris/iris_vidc.c static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp) · line 50
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vidc.c +3
-0@@ -41,16 +41,20 @@ static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp)static void iris_add_session (struct iris_inst *inst) { +u32 max_session_count = inst->core->iris_platform_data->max_session_count;struct iris_core *core = inst->core;struct iris_inst *iter;u32 count =0 ; +if (inst->core->iris_platform_data->dual_core) + max_session_count *=2 ;
max_session_count*=num_cores.Quoted 15 lines
drivers/media/platform/qcom/iris/iris_vidc.c +2
-1+mutex_lock (&core->lock);list_for_each_entry (iter, &core->instances, list) count++; -if (count < core->iris_platform_data->max_session_count) +if (count < max_session_count)list_add_tail (&inst->list, &core->instances);mutex_unlock (&core->lock);Signature · 2 lines
-- 2.34.1
Re: [PATCH v5 11/14] media: iris: Add support to select core for dual core platforms
Quoted 225 lines · Vishnu Reddy
Quoted 214 lines · Dmitry Baryshkov
Quoted 213 lines · Vishnu Reddy
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_IDproperty.Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_common.c | 10 +++ drivers/media/platform/qcom/iris/iris_common.h | 1 + drivers/media/platform/qcom/iris/iris_core.h | 5 ++ drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + .../platform/qcom/iris/iris_hfi_gen2_command.c | 19 ++++++ .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + drivers/media/platform/qcom/iris/iris_instance.h | 2 + .../platform/qcom/iris/iris_platform_common.h | 1 + drivers/media/platform/qcom/iris/iris_power.c | 11 ++-- drivers/media/platform/qcom/iris/iris_utils.c | 75 ++++++++++++++++------ drivers/media/platform/qcom/iris/iris_vb2.c | 4 ++ drivers/media/platform/qcom/iris/iris_vidc.c | 6 +- 12 files changed, 113 insertions(+), 23 deletions(-)drivers/media/platform/qcom/iris/iris_common.c +10
-0@@ -46,6 +46,16 @@ void iris_set_ts_metadata(struct iris_inst *inst, struct vb2_v4l2_buffer *vbuf) inst->metadata_idx++; } +int iris_set_core_id (struct iris_inst *inst) +{ +const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops; + +if (!inst->core->iris_platform_data->dual_core) +return 0 ; + +return hfi_ops->session_set_core_id (inst, inst->core_id); +} +int iris_process_streamon_input (struct iris_inst *inst) {const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;drivers/media/platform/qcom/iris/iris_common.h +1
-0@@ -11,6 +11,7 @@ struct iris_buffer;int iris_vb2_buffer_to_driver (struct vb2_buffer *vb2,struct iris_buffer *buf);void iris_set_ts_metadata (struct iris_inst *inst,struct vb2_v4l2_buffer *vbuf); +int iris_set_core_id (struct iris_inst *inst);int iris_process_streamon_input (struct iris_inst *inst);int iris_process_streamon_output (struct iris_inst *inst);int iris_session_streamoff (struct iris_inst *inst,u32 plane);drivers/media/platform/qcom/iris/iris_core.h +5
-0@@ -30,6 +30,11 @@ enum domain_type { DECODER = BIT(1), }; +enum iris_vcodec_core_id { +IRIS_VCODEC0 =1 , +IRIS_VCODEC1 , +}; +/** * struct iris_core - holds core parameters valid for all instances * drivers/media/platform/qcom/iris/iris_hfi_common.h +1
-0@@ -124,6 +124,7 @@ struct iris_hfi_command_ops {int (*session_drain)(struct iris_inst *inst,u32 plane);int (*session_resume_drain)(struct iris_inst *inst,u32 plane);int (*session_close)(struct iris_inst *inst); +int (*session_set_core_id)(struct iris_inst *inst,u32 core_id); };struct iris_hfi_response_ops {drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c +19
-0@@ -1300,6 +1300,24 @@ static int iris_hfi_gen2_session_release_buffer(struct iris_inst *inst, struct i inst_hfi_gen2->packet->size); } +static int iris_hfi_gen2_set_core_id (struct iris_inst *inst,u32 core_id) +{ +struct iris_inst_hfi_gen2 *inst_hfi_gen2 =to_iris_inst_hfi_gen2 (inst); +u32 payload = core_id; + +iris_hfi_gen2_packet_session_command (inst, +HFI_PROP_CORE_ID , +HFI_HOST_FLAGS_NONE , +HFI_PORT_NONE , + inst->session_id, +HFI_PAYLOAD_U32 , + &payload, +sizeof (u32)); + +return iris_hfi_queue_cmd_write (inst->core, inst_hfi_gen2->packet, + inst_hfi_gen2->packet->size); +} +static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .sys_init = iris_hfi_gen2_sys_init, .sys_image_version = iris_hfi_gen2_sys_image_version,@@ -1317,6 +1335,7 @@ static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .session_drain = iris_hfi_gen2_session_drain, .session_resume_drain = iris_hfi_gen2_session_resume_drain, .session_close = iris_hfi_gen2_session_close, + .session_set_core_id = iris_hfi_gen2_set_core_id, };void iris_hfi_gen2_command_ops_init (struct iris_core *core)drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h +1
-0@@ -56,6 +56,7 @@#define HFI_PROP_BUFFER_HOST_MAX_COUNT 0x03000123#define HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT 0x03000124#define HFI_PROP_PIC_ORDER_CNT_TYPE 0x03000128 +#define HFI_PROP_CORE_ID 0x030001a9enum hfi_rate_control {HFI_RC_VBR_CFR =0x00000000 ,drivers/media/platform/qcom/iris/iris_instance.h +2
-0@@ -37,6 +37,7 @@ struct iris_fmt {* * @list: used for attach an instance to the core * @core: pointer to core structure +* @core_id: specifies the hardware core on which the session runs * @session_id: id of current video session * @ctx_q_lock: lock to serialize queues related ioctls * @lock: lock to seralise forward and reverse threads @@ -79,6 +80,7 @@ struct iris_fmt {struct iris_inst {struct list_head list;struct iris_core *core; +u32 core_id;u32 session_id;struct mutex ctx_q_lock;/* lock to serialize queues related ioctls */ struct mutex lock;/* lock to serialize forward and reverse threads */ drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0@@ -258,6 +258,7 @@ struct iris_platform_data {const struct tz_cp_config *tz_cp_config_data;u32 tz_cp_config_data_size;u32 core_arch; +bool dual_core;u32 hw_response_timeout;struct ubwc_config_data *ubwc_config;u32 num_vpp_pipe;drivers/media/platform/qcom/iris/iris_power.c +7
-4@@ -77,9 +77,9 @@ static int iris_vote_interconnects(struct iris_inst *inst)static int iris_set_clocks (struct iris_inst *inst) { +u64 vcodec0_freq =0 , vcodec1_freq =0 ;struct iris_core *core = inst->core;struct iris_inst *instance; -u64 freq =0 ;int ret;mutex_lock (&core->lock);@@ -87,11 +87,14 @@ static int iris_set_clocks(struct iris_inst *inst)if (!instance->max_input_data_size)continue ; - freq += instance->power.min_freq; +if (instance->core_id ==IRIS_VCODEC0 ) + vcodec0_freq += instance->power.min_freq; +else + vcodec1_freq += instance->power.min_freq; } - core->power.clk_freq = freq; - ret =iris_opp_set_rate (core->dev, freq); + core->power.clk_freq =max (vcodec0_freq, vcodec1_freq); + ret =iris_opp_set_rate (core->dev, core->power.clk_freq);mutex_unlock (&core->lock);return ret;drivers/media/platform/qcom/iris/iris_utils.c +6
-2@@ -90,40 +90,79 @@ struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id)return NULL ; } -int iris_check_core_mbpf (struct iris_inst *inst) +static u32 iris_get_mbps (struct iris_inst *inst) { -struct iris_core *core = inst->core; +u32 fps =max (inst->frame_rate, inst->operating_rate); + +return iris_get_mbpf (inst) * fps; +} +Quoted 8 lines
drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 106
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_utils.c +7
-0+static int iris_check_and_assign_core (struct iris_inst *inst,bool mbpf) +{ +const struct iris_platform_data *platform_data = inst->core->iris_platform_data; +u32 max_load = mbpf ? platform_data->max_core_mbpf : platform_data->max_core_mbps; +u32 max_session_cnt = platform_data->max_session_count; +u32 core0_session_cnt =0 , core1_session_cnt =0 ; +bool dual_core = platform_data->dual_core;
num_cores
Quoted 1 line
A
num_coresfield would require updating all platform data entries. For two
I was thinking about adding num_cores to platform_data and to iris_inst (or iris_core) and setting it to 1 if the value is unset in platform_data.
A better option would be to move all these multi-core functions to a separate file.
Quoted 132 lines
cores, a simple boolean flag feels sufficient here.
Quoted 12 lines
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_utils.c +4
-5+u32 core0_load =0 , core1_load =0 ; +bool select_core0, select_core1;struct iris_inst *instance; -u32 total_mbpf =0 ; +u32 load, new_load; -mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) - total_mbpf +=iris_get_mbpf (instance); -mutex_unlock (&core->lock); + inst->core_id =0 ;Quoted 11 lines
drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 122
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_utils.c +9
-1-if (total_mbpf > core->iris_platform_data->max_core_mbpf) +list_for_each_entry (instance, &inst->core->instances, list) { + load = mbpf ?iris_get_mbpf (instance) :iris_get_mbps (instance); + +if (instance->core_id ==IRIS_VCODEC0 ) { + core0_load += load; + core0_session_cnt++; + }else if (instance->core_id ==IRIS_VCODEC1 ) { + core1_load += load; + core1_session_cnt++;Arrays, please.
Since we only have two cores, explicit variables feel cleaner and easier to read than arrays.
Quoted 103 lines
Quoted 76 lines
drivers/media/platform/qcom/iris/iris_utils.c +31
-10+ } + } + + new_load = mbpf ?iris_get_mbpf (inst) :iris_get_mbps (inst); + + select_core0 = core0_load + new_load <= max_load && core0_session_cnt < max_session_cnt; + select_core1 = dual_core && core1_load + new_load <= max_load && + core1_session_cnt < max_session_cnt; + +if (select_core0 && select_core1) + inst->core_id = (core0_load <= core1_load) ?IRIS_VCODEC0 :IRIS_VCODEC1 ; +else if (select_core0) + inst->core_id =IRIS_VCODEC0 ; +else if (select_core1) + inst->core_id =IRIS_VCODEC1 ; +else return -ENOMEM ;return 0 ; } -int iris_check_core_mbps (struct iris_inst *inst) +int iris_check_core_mbpf (struct iris_inst *inst) {struct iris_core *core = inst->core; -struct iris_inst *instance; -u32 total_mbps =0 , fps =0 ; +int ret;mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) { - fps =max (instance->frame_rate, instance->operating_rate); - total_mbps +=iris_get_mbpf (instance) * fps; - } + ret =iris_check_and_assign_core (inst, true);mutex_unlock (&core->lock); -if (total_mbps > core->iris_platform_data->max_core_mbps) -return -ENOMEM ; +return ret; +} -return 0 ; +int iris_check_core_mbps (struct iris_inst *inst) +{ +struct iris_core *core = inst->core; +int ret; + +mutex_lock (&core->lock); + ret =iris_check_and_assign_core (inst, false); +mutex_unlock (&core->lock); + +return ret; }bool is_rotation_90_or_270 (struct iris_inst *inst)drivers/media/platform/qcom/iris/iris_vb2.c +4
-0@@ -176,6 +176,10 @@ int iris_vb2_start_streaming(struct vb2_queue *q, unsigned int count)if (ret) goto error; + ret =iris_set_core_id (inst); +if (ret) + goto error; +if (V4L2_TYPE_IS_OUTPUT (q->type)) {if (inst->domain ==DECODER ) ret =iris_vdec_streamon_input (inst);drivers/media/platform/qcom/iris/iris_vidc.c +0
-0drivers/media/platform/qcom/iris/iris_vidc.c static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp) · line 50
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vidc.c +3
-0@@ -41,16 +41,20 @@ static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp)static void iris_add_session (struct iris_inst *inst) { +u32 max_session_count = inst->core->iris_platform_data->max_session_count;struct iris_core *core = inst->core;struct iris_inst *iter;u32 count =0 ; +if (inst->core->iris_platform_data->dual_core) + max_session_count *=2 ;
max_session_count*=num_cores.Quoted 15 lines
drivers/media/platform/qcom/iris/iris_vidc.c +2
-1+mutex_lock (&core->lock);list_for_each_entry (iter, &core->instances, list) count++; -if (count < core->iris_platform_data->max_session_count) +if (count < max_session_count)list_add_tail (&inst->list, &core->instances);mutex_unlock (&core->lock);Signature · 2 lines
-- 2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 11/14] media: iris: Add support to select core for dual core platforms
Quoted 224 lines · Dmitry Baryshkov
Quoted 223 lines · Vishnu Reddy
Quoted 222 lines · Dmitry Baryshkov
Quoted 210 lines · Vishnu Reddy
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_IDproperty.Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_common.c | 10 +++ drivers/media/platform/qcom/iris/iris_common.h | 1 + drivers/media/platform/qcom/iris/iris_core.h | 5 ++ drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + .../platform/qcom/iris/iris_hfi_gen2_command.c | 19 ++++++ .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + drivers/media/platform/qcom/iris/iris_instance.h | 2 + .../platform/qcom/iris/iris_platform_common.h | 1 + drivers/media/platform/qcom/iris/iris_power.c | 11 ++-- drivers/media/platform/qcom/iris/iris_utils.c | 75 ++++++++++++++++------ drivers/media/platform/qcom/iris/iris_vb2.c | 4 ++ drivers/media/platform/qcom/iris/iris_vidc.c | 6 +- 12 files changed, 113 insertions(+), 23 deletions(-)drivers/media/platform/qcom/iris/iris_common.c +10
-0@@ -46,6 +46,16 @@ void iris_set_ts_metadata(struct iris_inst *inst, struct vb2_v4l2_buffer *vbuf) inst->metadata_idx++; } +int iris_set_core_id (struct iris_inst *inst) +{ +const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops; + +if (!inst->core->iris_platform_data->dual_core) +return 0 ; + +return hfi_ops->session_set_core_id (inst, inst->core_id); +} +int iris_process_streamon_input (struct iris_inst *inst) {const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;drivers/media/platform/qcom/iris/iris_common.h +1
-0@@ -11,6 +11,7 @@ struct iris_buffer;int iris_vb2_buffer_to_driver (struct vb2_buffer *vb2,struct iris_buffer *buf);void iris_set_ts_metadata (struct iris_inst *inst,struct vb2_v4l2_buffer *vbuf); +int iris_set_core_id (struct iris_inst *inst);int iris_process_streamon_input (struct iris_inst *inst);int iris_process_streamon_output (struct iris_inst *inst);int iris_session_streamoff (struct iris_inst *inst,u32 plane);drivers/media/platform/qcom/iris/iris_core.h +5
-0@@ -30,6 +30,11 @@ enum domain_type { DECODER = BIT(1), }; +enum iris_vcodec_core_id { +IRIS_VCODEC0 =1 , +IRIS_VCODEC1 , +}; +/** * struct iris_core - holds core parameters valid for all instances * drivers/media/platform/qcom/iris/iris_hfi_common.h +1
-0@@ -124,6 +124,7 @@ struct iris_hfi_command_ops {int (*session_drain)(struct iris_inst *inst,u32 plane);int (*session_resume_drain)(struct iris_inst *inst,u32 plane);int (*session_close)(struct iris_inst *inst); +int (*session_set_core_id)(struct iris_inst *inst,u32 core_id); };struct iris_hfi_response_ops {drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c +19
-0@@ -1300,6 +1300,24 @@ static int iris_hfi_gen2_session_release_buffer(struct iris_inst *inst, struct i inst_hfi_gen2->packet->size); } +static int iris_hfi_gen2_set_core_id (struct iris_inst *inst,u32 core_id) +{ +struct iris_inst_hfi_gen2 *inst_hfi_gen2 =to_iris_inst_hfi_gen2 (inst); +u32 payload = core_id; + +iris_hfi_gen2_packet_session_command (inst, +HFI_PROP_CORE_ID , +HFI_HOST_FLAGS_NONE , +HFI_PORT_NONE , + inst->session_id, +HFI_PAYLOAD_U32 , + &payload, +sizeof (u32)); + +return iris_hfi_queue_cmd_write (inst->core, inst_hfi_gen2->packet, + inst_hfi_gen2->packet->size); +} +static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .sys_init = iris_hfi_gen2_sys_init, .sys_image_version = iris_hfi_gen2_sys_image_version,@@ -1317,6 +1335,7 @@ static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .session_drain = iris_hfi_gen2_session_drain, .session_resume_drain = iris_hfi_gen2_session_resume_drain, .session_close = iris_hfi_gen2_session_close, + .session_set_core_id = iris_hfi_gen2_set_core_id, };void iris_hfi_gen2_command_ops_init (struct iris_core *core)drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h +1
-0@@ -56,6 +56,7 @@#define HFI_PROP_BUFFER_HOST_MAX_COUNT 0x03000123#define HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT 0x03000124#define HFI_PROP_PIC_ORDER_CNT_TYPE 0x03000128 +#define HFI_PROP_CORE_ID 0x030001a9enum hfi_rate_control {HFI_RC_VBR_CFR =0x00000000 ,drivers/media/platform/qcom/iris/iris_instance.h +2
-0@@ -37,6 +37,7 @@ struct iris_fmt {* * @list: used for attach an instance to the core * @core: pointer to core structure +* @core_id: specifies the hardware core on which the session runs * @session_id: id of current video session * @ctx_q_lock: lock to serialize queues related ioctls * @lock: lock to seralise forward and reverse threads @@ -79,6 +80,7 @@ struct iris_fmt {struct iris_inst {struct list_head list;struct iris_core *core; +u32 core_id;u32 session_id;struct mutex ctx_q_lock;/* lock to serialize queues related ioctls */ struct mutex lock;/* lock to serialize forward and reverse threads */ drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0@@ -258,6 +258,7 @@ struct iris_platform_data {const struct tz_cp_config *tz_cp_config_data;u32 tz_cp_config_data_size;u32 core_arch; +bool dual_core;u32 hw_response_timeout;struct ubwc_config_data *ubwc_config;u32 num_vpp_pipe;drivers/media/platform/qcom/iris/iris_power.c +7
-4@@ -77,9 +77,9 @@ static int iris_vote_interconnects(struct iris_inst *inst)static int iris_set_clocks (struct iris_inst *inst) { +u64 vcodec0_freq =0 , vcodec1_freq =0 ;struct iris_core *core = inst->core;struct iris_inst *instance; -u64 freq =0 ;int ret;mutex_lock (&core->lock);@@ -87,11 +87,14 @@ static int iris_set_clocks(struct iris_inst *inst)if (!instance->max_input_data_size)continue ; - freq += instance->power.min_freq; +if (instance->core_id ==IRIS_VCODEC0 ) + vcodec0_freq += instance->power.min_freq; +else + vcodec1_freq += instance->power.min_freq; } - core->power.clk_freq = freq; - ret =iris_opp_set_rate (core->dev, freq); + core->power.clk_freq =max (vcodec0_freq, vcodec1_freq); + ret =iris_opp_set_rate (core->dev, core->power.clk_freq);mutex_unlock (&core->lock);return ret;drivers/media/platform/qcom/iris/iris_utils.c +3
-2@@ -90,40 +90,79 @@ struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id)return NULL ; } -int iris_check_core_mbpf (struct iris_inst *inst) +static u32 iris_get_mbps (struct iris_inst *inst) { -struct iris_core *core = inst->core; +u32 fps =max (inst->frame_rate, inst->operating_rate); +drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 106
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_utils.c +10
-0+return iris_get_mbpf (inst) * fps; +} + +static int iris_check_and_assign_core (struct iris_inst *inst,bool mbpf) +{ +const struct iris_platform_data *platform_data = inst->core->iris_platform_data; +u32 max_load = mbpf ? platform_data->max_core_mbpf : platform_data->max_core_mbps; +u32 max_session_cnt = platform_data->max_session_count; +u32 core0_session_cnt =0 , core1_session_cnt =0 ; +bool dual_core = platform_data->dual_core;
num_cores
Quoted 7 lines
Quoted 1 line
A
num_coresfield would require updating all platform data entries. For twoI was thinking about adding
num_corestoplatform_dataand toiris_inst(oriris_core) and setting it to 1 if the value is unset inplatform_data.A better option would be to move all these multi-core functions to a separate file.
Thanks for your point, Adding num_cores to platform_data makes sense if the number of cores grows beyond two. For now, since we only handle single and dual core, the current logic feels simpler and sufficient to cover both cases. Happy to adopt the num_cores approach in the future if we have any platform with more than dual core.
Quoted 131 lines
Quoted 131 lines
cores, a simple boolean flag feels sufficient here.
Quoted 12 lines
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_utils.c +4
-5+u32 core0_load =0 , core1_load =0 ; +bool select_core0, select_core1;struct iris_inst *instance; -u32 total_mbpf =0 ; +u32 load, new_load; -mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) - total_mbpf +=iris_get_mbpf (instance); -mutex_unlock (&core->lock); + inst->core_id =0 ;Quoted 11 lines
drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 122
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_utils.c +9
-1-if (total_mbpf > core->iris_platform_data->max_core_mbpf) +list_for_each_entry (instance, &inst->core->instances, list) { + load = mbpf ?iris_get_mbpf (instance) :iris_get_mbps (instance); + +if (instance->core_id ==IRIS_VCODEC0 ) { + core0_load += load; + core0_session_cnt++; + }else if (instance->core_id ==IRIS_VCODEC1 ) { + core1_load += load; + core1_session_cnt++;Arrays, please.
Since we only have two cores, explicit variables feel cleaner and easier to read than arrays.
Quoted 103 lines
Quoted 76 lines
drivers/media/platform/qcom/iris/iris_utils.c +31
-10+ } + } + + new_load = mbpf ?iris_get_mbpf (inst) :iris_get_mbps (inst); + + select_core0 = core0_load + new_load <= max_load && core0_session_cnt < max_session_cnt; + select_core1 = dual_core && core1_load + new_load <= max_load && + core1_session_cnt < max_session_cnt; + +if (select_core0 && select_core1) + inst->core_id = (core0_load <= core1_load) ?IRIS_VCODEC0 :IRIS_VCODEC1 ; +else if (select_core0) + inst->core_id =IRIS_VCODEC0 ; +else if (select_core1) + inst->core_id =IRIS_VCODEC1 ; +else return -ENOMEM ;return 0 ; } -int iris_check_core_mbps (struct iris_inst *inst) +int iris_check_core_mbpf (struct iris_inst *inst) {struct iris_core *core = inst->core; -struct iris_inst *instance; -u32 total_mbps =0 , fps =0 ; +int ret;mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) { - fps =max (instance->frame_rate, instance->operating_rate); - total_mbps +=iris_get_mbpf (instance) * fps; - } + ret =iris_check_and_assign_core (inst, true);mutex_unlock (&core->lock); -if (total_mbps > core->iris_platform_data->max_core_mbps) -return -ENOMEM ; +return ret; +} -return 0 ; +int iris_check_core_mbps (struct iris_inst *inst) +{ +struct iris_core *core = inst->core; +int ret; + +mutex_lock (&core->lock); + ret =iris_check_and_assign_core (inst, false); +mutex_unlock (&core->lock); + +return ret; }bool is_rotation_90_or_270 (struct iris_inst *inst)drivers/media/platform/qcom/iris/iris_vb2.c +4
-0@@ -176,6 +176,10 @@ int iris_vb2_start_streaming(struct vb2_queue *q, unsigned int count)if (ret) goto error; + ret =iris_set_core_id (inst); +if (ret) + goto error; +if (V4L2_TYPE_IS_OUTPUT (q->type)) {if (inst->domain ==DECODER ) ret =iris_vdec_streamon_input (inst);drivers/media/platform/qcom/iris/iris_vidc.c +0
-0drivers/media/platform/qcom/iris/iris_vidc.c static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp) · line 50
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vidc.c +3
-0@@ -41,16 +41,20 @@ static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp)static void iris_add_session (struct iris_inst *inst) { +u32 max_session_count = inst->core->iris_platform_data->max_session_count;struct iris_core *core = inst->core;struct iris_inst *iter;u32 count =0 ; +if (inst->core->iris_platform_data->dual_core) + max_session_count *=2 ;
max_session_count*=num_cores.Quoted 15 lines
drivers/media/platform/qcom/iris/iris_vidc.c +2
-1+mutex_lock (&core->lock);list_for_each_entry (iter, &core->instances, list) count++; -if (count < core->iris_platform_data->max_session_count) +if (count < max_session_count)list_add_tail (&inst->list, &core->instances);mutex_unlock (&core->lock);Signature · 2 lines
-- 2.34.1
Re: [PATCH v5 11/14] media: iris: Add support to select core for dual core platforms
Quoted 231 lines · Vishnu Reddy
Quoted 229 lines · Dmitry Baryshkov
Quoted 223 lines · Vishnu Reddy
Quoted 214 lines · Dmitry Baryshkov
Quoted 213 lines · Vishnu Reddy
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_IDproperty.Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_common.c | 10 +++ drivers/media/platform/qcom/iris/iris_common.h | 1 + drivers/media/platform/qcom/iris/iris_core.h | 5 ++ drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + .../platform/qcom/iris/iris_hfi_gen2_command.c | 19 ++++++ .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + drivers/media/platform/qcom/iris/iris_instance.h | 2 + .../platform/qcom/iris/iris_platform_common.h | 1 + drivers/media/platform/qcom/iris/iris_power.c | 11 ++-- drivers/media/platform/qcom/iris/iris_utils.c | 75 ++++++++++++++++------ drivers/media/platform/qcom/iris/iris_vb2.c | 4 ++ drivers/media/platform/qcom/iris/iris_vidc.c | 6 +- 12 files changed, 113 insertions(+), 23 deletions(-)drivers/media/platform/qcom/iris/iris_common.c +10
-0@@ -46,6 +46,16 @@ void iris_set_ts_metadata(struct iris_inst *inst, struct vb2_v4l2_buffer *vbuf) inst->metadata_idx++; } +int iris_set_core_id (struct iris_inst *inst) +{ +const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops; + +if (!inst->core->iris_platform_data->dual_core) +return 0 ; + +return hfi_ops->session_set_core_id (inst, inst->core_id); +} +int iris_process_streamon_input (struct iris_inst *inst) {const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;drivers/media/platform/qcom/iris/iris_common.h +1
-0@@ -11,6 +11,7 @@ struct iris_buffer;int iris_vb2_buffer_to_driver (struct vb2_buffer *vb2,struct iris_buffer *buf);void iris_set_ts_metadata (struct iris_inst *inst,struct vb2_v4l2_buffer *vbuf); +int iris_set_core_id (struct iris_inst *inst);int iris_process_streamon_input (struct iris_inst *inst);int iris_process_streamon_output (struct iris_inst *inst);int iris_session_streamoff (struct iris_inst *inst,u32 plane);drivers/media/platform/qcom/iris/iris_core.h +5
-0@@ -30,6 +30,11 @@ enum domain_type { DECODER = BIT(1), }; +enum iris_vcodec_core_id { +IRIS_VCODEC0 =1 , +IRIS_VCODEC1 , +}; +/** * struct iris_core - holds core parameters valid for all instances * drivers/media/platform/qcom/iris/iris_hfi_common.h +1
-0@@ -124,6 +124,7 @@ struct iris_hfi_command_ops {int (*session_drain)(struct iris_inst *inst,u32 plane);int (*session_resume_drain)(struct iris_inst *inst,u32 plane);int (*session_close)(struct iris_inst *inst); +int (*session_set_core_id)(struct iris_inst *inst,u32 core_id); };struct iris_hfi_response_ops {drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c +19
-0@@ -1300,6 +1300,24 @@ static int iris_hfi_gen2_session_release_buffer(struct iris_inst *inst, struct i inst_hfi_gen2->packet->size); } +static int iris_hfi_gen2_set_core_id (struct iris_inst *inst,u32 core_id) +{ +struct iris_inst_hfi_gen2 *inst_hfi_gen2 =to_iris_inst_hfi_gen2 (inst); +u32 payload = core_id; + +iris_hfi_gen2_packet_session_command (inst, +HFI_PROP_CORE_ID , +HFI_HOST_FLAGS_NONE , +HFI_PORT_NONE , + inst->session_id, +HFI_PAYLOAD_U32 , + &payload, +sizeof (u32)); + +return iris_hfi_queue_cmd_write (inst->core, inst_hfi_gen2->packet, + inst_hfi_gen2->packet->size); +} +static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .sys_init = iris_hfi_gen2_sys_init, .sys_image_version = iris_hfi_gen2_sys_image_version,@@ -1317,6 +1335,7 @@ static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .session_drain = iris_hfi_gen2_session_drain, .session_resume_drain = iris_hfi_gen2_session_resume_drain, .session_close = iris_hfi_gen2_session_close, + .session_set_core_id = iris_hfi_gen2_set_core_id, };void iris_hfi_gen2_command_ops_init (struct iris_core *core)drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h +1
-0@@ -56,6 +56,7 @@#define HFI_PROP_BUFFER_HOST_MAX_COUNT 0x03000123#define HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT 0x03000124#define HFI_PROP_PIC_ORDER_CNT_TYPE 0x03000128 +#define HFI_PROP_CORE_ID 0x030001a9enum hfi_rate_control {HFI_RC_VBR_CFR =0x00000000 ,drivers/media/platform/qcom/iris/iris_instance.h +2
-0@@ -37,6 +37,7 @@ struct iris_fmt {* * @list: used for attach an instance to the core * @core: pointer to core structure +* @core_id: specifies the hardware core on which the session runs * @session_id: id of current video session * @ctx_q_lock: lock to serialize queues related ioctls * @lock: lock to seralise forward and reverse threads @@ -79,6 +80,7 @@ struct iris_fmt {struct iris_inst {struct list_head list;struct iris_core *core; +u32 core_id;u32 session_id;struct mutex ctx_q_lock;/* lock to serialize queues related ioctls */ struct mutex lock;/* lock to serialize forward and reverse threads */ drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0@@ -258,6 +258,7 @@ struct iris_platform_data {const struct tz_cp_config *tz_cp_config_data;u32 tz_cp_config_data_size;u32 core_arch; +bool dual_core;u32 hw_response_timeout;struct ubwc_config_data *ubwc_config;u32 num_vpp_pipe;drivers/media/platform/qcom/iris/iris_power.c +7
-4@@ -77,9 +77,9 @@ static int iris_vote_interconnects(struct iris_inst *inst)static int iris_set_clocks (struct iris_inst *inst) { +u64 vcodec0_freq =0 , vcodec1_freq =0 ;struct iris_core *core = inst->core;struct iris_inst *instance; -u64 freq =0 ;int ret;mutex_lock (&core->lock);@@ -87,11 +87,14 @@ static int iris_set_clocks(struct iris_inst *inst)if (!instance->max_input_data_size)continue ; - freq += instance->power.min_freq; +if (instance->core_id ==IRIS_VCODEC0 ) + vcodec0_freq += instance->power.min_freq; +else + vcodec1_freq += instance->power.min_freq; } - core->power.clk_freq = freq; - ret =iris_opp_set_rate (core->dev, freq); + core->power.clk_freq =max (vcodec0_freq, vcodec1_freq); + ret =iris_opp_set_rate (core->dev, core->power.clk_freq);mutex_unlock (&core->lock);return ret;drivers/media/platform/qcom/iris/iris_utils.c +6
-2@@ -90,40 +90,79 @@ struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id)return NULL ; } -int iris_check_core_mbpf (struct iris_inst *inst) +static u32 iris_get_mbps (struct iris_inst *inst) { -struct iris_core *core = inst->core; +u32 fps =max (inst->frame_rate, inst->operating_rate); + +return iris_get_mbpf (inst) * fps; +} +Quoted 8 lines
drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 106
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_utils.c +7
-0+static int iris_check_and_assign_core (struct iris_inst *inst,bool mbpf) +{ +const struct iris_platform_data *platform_data = inst->core->iris_platform_data; +u32 max_load = mbpf ? platform_data->max_core_mbpf : platform_data->max_core_mbps; +u32 max_session_cnt = platform_data->max_session_count; +u32 core0_session_cnt =0 , core1_session_cnt =0 ; +bool dual_core = platform_data->dual_core;
num_coresQuoted 1 line
A
num_coresfield would require updating all platform data entries. For twoI was thinking about adding
num_corestoplatform_dataand toiris_inst(oriris_core) and setting it to 1 if the value is unset inplatform_data.
Quoted 8 lines
Quoted 2 lines
A better option would be to move all these multi-core functions to a separate file.
Thanks for your point, Adding
num_corestoplatform_datamakes sense if the number of cores grows beyond two. For now, since we only handle single and dual core, the current logic feels simpler and sufficient to cover both cases. Happy to adopt thenum_coresapproach in the future if we have any platform with more than dual core.
Again, an alternative approach is to get all the platform specifics into the corresponding iris_vpuXX.c file.
Quoted 132 lines
Quoted 132 lines
Quoted 132 lines
cores, a simple boolean flag feels sufficient here.
Quoted 12 lines
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_utils.c +4
-5+u32 core0_load =0 , core1_load =0 ; +bool select_core0, select_core1;struct iris_inst *instance; -u32 total_mbpf =0 ; +u32 load, new_load; -mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) - total_mbpf +=iris_get_mbpf (instance); -mutex_unlock (&core->lock); + inst->core_id =0 ;Quoted 11 lines
drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 122
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_utils.c +9
-1-if (total_mbpf > core->iris_platform_data->max_core_mbpf) +list_for_each_entry (instance, &inst->core->instances, list) { + load = mbpf ?iris_get_mbpf (instance) :iris_get_mbps (instance); + +if (instance->core_id ==IRIS_VCODEC0 ) { + core0_load += load; + core0_session_cnt++; + }else if (instance->core_id ==IRIS_VCODEC1 ) { + core1_load += load; + core1_session_cnt++;Arrays, please.
Since we only have two cores, explicit variables feel cleaner and easier to read than arrays.
Quoted 103 lines
Quoted 76 lines
drivers/media/platform/qcom/iris/iris_utils.c +31
-10+ } + } + + new_load = mbpf ?iris_get_mbpf (inst) :iris_get_mbps (inst); + + select_core0 = core0_load + new_load <= max_load && core0_session_cnt < max_session_cnt; + select_core1 = dual_core && core1_load + new_load <= max_load && + core1_session_cnt < max_session_cnt; + +if (select_core0 && select_core1) + inst->core_id = (core0_load <= core1_load) ?IRIS_VCODEC0 :IRIS_VCODEC1 ; +else if (select_core0) + inst->core_id =IRIS_VCODEC0 ; +else if (select_core1) + inst->core_id =IRIS_VCODEC1 ; +else return -ENOMEM ;return 0 ; } -int iris_check_core_mbps (struct iris_inst *inst) +int iris_check_core_mbpf (struct iris_inst *inst) {struct iris_core *core = inst->core; -struct iris_inst *instance; -u32 total_mbps =0 , fps =0 ; +int ret;mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) { - fps =max (instance->frame_rate, instance->operating_rate); - total_mbps +=iris_get_mbpf (instance) * fps; - } + ret =iris_check_and_assign_core (inst, true);mutex_unlock (&core->lock); -if (total_mbps > core->iris_platform_data->max_core_mbps) -return -ENOMEM ; +return ret; +} -return 0 ; +int iris_check_core_mbps (struct iris_inst *inst) +{ +struct iris_core *core = inst->core; +int ret; + +mutex_lock (&core->lock); + ret =iris_check_and_assign_core (inst, false); +mutex_unlock (&core->lock); + +return ret; }bool is_rotation_90_or_270 (struct iris_inst *inst)drivers/media/platform/qcom/iris/iris_vb2.c +4
-0@@ -176,6 +176,10 @@ int iris_vb2_start_streaming(struct vb2_queue *q, unsigned int count)if (ret) goto error; + ret =iris_set_core_id (inst); +if (ret) + goto error; +if (V4L2_TYPE_IS_OUTPUT (q->type)) {if (inst->domain ==DECODER ) ret =iris_vdec_streamon_input (inst);drivers/media/platform/qcom/iris/iris_vidc.c +0
-0drivers/media/platform/qcom/iris/iris_vidc.c static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp) · line 50
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vidc.c +3
-0@@ -41,16 +41,20 @@ static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp)static void iris_add_session (struct iris_inst *inst) { +u32 max_session_count = inst->core->iris_platform_data->max_session_count;struct iris_core *core = inst->core;struct iris_inst *iter;u32 count =0 ; +if (inst->core->iris_platform_data->dual_core) + max_session_count *=2 ;
max_session_count*=num_cores.Quoted 15 lines
drivers/media/platform/qcom/iris/iris_vidc.c +2
-1+mutex_lock (&core->lock);list_for_each_entry (iter, &core->instances, list) count++; -if (count < core->iris_platform_data->max_session_count) +if (count < max_session_count)list_add_tail (&inst->list, &core->instances);mutex_unlock (&core->lock);Signature · 2 lines
-- 2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 11/14] media: iris: Add support to select core for dual core platforms
Quoted 233 lines · Dmitry Baryshkov
Quoted 232 lines · Vishnu Reddy
Quoted 231 lines · Dmitry Baryshkov
Quoted 223 lines · Vishnu Reddy
Quoted 214 lines · Dmitry Baryshkov
Quoted 213 lines · Vishnu Reddy
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_IDproperty.Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_common.c | 10 +++ drivers/media/platform/qcom/iris/iris_common.h | 1 + drivers/media/platform/qcom/iris/iris_core.h | 5 ++ drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + .../platform/qcom/iris/iris_hfi_gen2_command.c | 19 ++++++ .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + drivers/media/platform/qcom/iris/iris_instance.h | 2 + .../platform/qcom/iris/iris_platform_common.h | 1 + drivers/media/platform/qcom/iris/iris_power.c | 11 ++-- drivers/media/platform/qcom/iris/iris_utils.c | 75 ++++++++++++++++------ drivers/media/platform/qcom/iris/iris_vb2.c | 4 ++ drivers/media/platform/qcom/iris/iris_vidc.c | 6 +- 12 files changed, 113 insertions(+), 23 deletions(-)drivers/media/platform/qcom/iris/iris_common.c +10
-0@@ -46,6 +46,16 @@ void iris_set_ts_metadata(struct iris_inst *inst, struct vb2_v4l2_buffer *vbuf) inst->metadata_idx++; } +int iris_set_core_id (struct iris_inst *inst) +{ +const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops; + +if (!inst->core->iris_platform_data->dual_core) +return 0 ; + +return hfi_ops->session_set_core_id (inst, inst->core_id); +} +int iris_process_streamon_input (struct iris_inst *inst) {const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;drivers/media/platform/qcom/iris/iris_common.h +1
-0@@ -11,6 +11,7 @@ struct iris_buffer;int iris_vb2_buffer_to_driver (struct vb2_buffer *vb2,struct iris_buffer *buf);void iris_set_ts_metadata (struct iris_inst *inst,struct vb2_v4l2_buffer *vbuf); +int iris_set_core_id (struct iris_inst *inst);int iris_process_streamon_input (struct iris_inst *inst);int iris_process_streamon_output (struct iris_inst *inst);int iris_session_streamoff (struct iris_inst *inst,u32 plane);drivers/media/platform/qcom/iris/iris_core.h +5
-0@@ -30,6 +30,11 @@ enum domain_type { DECODER = BIT(1), }; +enum iris_vcodec_core_id { +IRIS_VCODEC0 =1 , +IRIS_VCODEC1 , +}; +/** * struct iris_core - holds core parameters valid for all instances * drivers/media/platform/qcom/iris/iris_hfi_common.h +1
-0@@ -124,6 +124,7 @@ struct iris_hfi_command_ops {int (*session_drain)(struct iris_inst *inst,u32 plane);int (*session_resume_drain)(struct iris_inst *inst,u32 plane);int (*session_close)(struct iris_inst *inst); +int (*session_set_core_id)(struct iris_inst *inst,u32 core_id); };struct iris_hfi_response_ops {drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c +19
-0@@ -1300,6 +1300,24 @@ static int iris_hfi_gen2_session_release_buffer(struct iris_inst *inst, struct i inst_hfi_gen2->packet->size); } +static int iris_hfi_gen2_set_core_id (struct iris_inst *inst,u32 core_id) +{ +struct iris_inst_hfi_gen2 *inst_hfi_gen2 =to_iris_inst_hfi_gen2 (inst); +u32 payload = core_id; + +iris_hfi_gen2_packet_session_command (inst, +HFI_PROP_CORE_ID , +HFI_HOST_FLAGS_NONE , +HFI_PORT_NONE , + inst->session_id, +HFI_PAYLOAD_U32 , + &payload, +sizeof (u32)); + +return iris_hfi_queue_cmd_write (inst->core, inst_hfi_gen2->packet, + inst_hfi_gen2->packet->size); +} +static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .sys_init = iris_hfi_gen2_sys_init, .sys_image_version = iris_hfi_gen2_sys_image_version,@@ -1317,6 +1335,7 @@ static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .session_drain = iris_hfi_gen2_session_drain, .session_resume_drain = iris_hfi_gen2_session_resume_drain, .session_close = iris_hfi_gen2_session_close, + .session_set_core_id = iris_hfi_gen2_set_core_id, };void iris_hfi_gen2_command_ops_init (struct iris_core *core)drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h +1
-0@@ -56,6 +56,7 @@#define HFI_PROP_BUFFER_HOST_MAX_COUNT 0x03000123#define HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT 0x03000124#define HFI_PROP_PIC_ORDER_CNT_TYPE 0x03000128 +#define HFI_PROP_CORE_ID 0x030001a9enum hfi_rate_control {HFI_RC_VBR_CFR =0x00000000 ,drivers/media/platform/qcom/iris/iris_instance.h +2
-0@@ -37,6 +37,7 @@ struct iris_fmt {* * @list: used for attach an instance to the core * @core: pointer to core structure +* @core_id: specifies the hardware core on which the session runs * @session_id: id of current video session * @ctx_q_lock: lock to serialize queues related ioctls * @lock: lock to seralise forward and reverse threads @@ -79,6 +80,7 @@ struct iris_fmt {struct iris_inst {struct list_head list;struct iris_core *core; +u32 core_id;u32 session_id;struct mutex ctx_q_lock;/* lock to serialize queues related ioctls */ struct mutex lock;/* lock to serialize forward and reverse threads */ drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0@@ -258,6 +258,7 @@ struct iris_platform_data {const struct tz_cp_config *tz_cp_config_data;u32 tz_cp_config_data_size;u32 core_arch; +bool dual_core;u32 hw_response_timeout;struct ubwc_config_data *ubwc_config;u32 num_vpp_pipe;drivers/media/platform/qcom/iris/iris_power.c +7
-4@@ -77,9 +77,9 @@ static int iris_vote_interconnects(struct iris_inst *inst)static int iris_set_clocks (struct iris_inst *inst) { +u64 vcodec0_freq =0 , vcodec1_freq =0 ;struct iris_core *core = inst->core;struct iris_inst *instance; -u64 freq =0 ;int ret;mutex_lock (&core->lock);@@ -87,11 +87,14 @@ static int iris_set_clocks(struct iris_inst *inst)if (!instance->max_input_data_size)continue ; - freq += instance->power.min_freq; +if (instance->core_id ==IRIS_VCODEC0 ) + vcodec0_freq += instance->power.min_freq; +else + vcodec1_freq += instance->power.min_freq; } - core->power.clk_freq = freq; - ret =iris_opp_set_rate (core->dev, freq); + core->power.clk_freq =max (vcodec0_freq, vcodec1_freq); + ret =iris_opp_set_rate (core->dev, core->power.clk_freq);mutex_unlock (&core->lock);return ret;drivers/media/platform/qcom/iris/iris_utils.c +6
-2@@ -90,40 +90,79 @@ struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id)return NULL ; } -int iris_check_core_mbpf (struct iris_inst *inst) +static u32 iris_get_mbps (struct iris_inst *inst) { -struct iris_core *core = inst->core; +u32 fps =max (inst->frame_rate, inst->operating_rate); + +return iris_get_mbpf (inst) * fps; +} +Quoted 8 lines
drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 106
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_utils.c +7
-0+static int iris_check_and_assign_core (struct iris_inst *inst,bool mbpf) +{ +const struct iris_platform_data *platform_data = inst->core->iris_platform_data; +u32 max_load = mbpf ? platform_data->max_core_mbpf : platform_data->max_core_mbps; +u32 max_session_cnt = platform_data->max_session_count; +u32 core0_session_cnt =0 , core1_session_cnt =0 ; +bool dual_core = platform_data->dual_core;
num_coresQuoted 1 line
A
num_coresfield would require updating all platform data entries. For twoI was thinking about adding
num_corestoplatform_dataand toiris_inst(oriris_core) and setting it to 1 if the value is unset inplatform_data.A better option would be to move all these multi-core functions to a separate file.
Quoted 7 lines
Quoted 5 lines
Thanks for your point, Adding
num_corestoplatform_datamakes sense if the number of cores grows beyond two. For now, since we only handle single and dual core, the current logic feels simpler and sufficient to cover both cases. Happy to adopt thenum_coresapproach in the future if we have any platform with more than dual core.Again, an alternative approach is to get all the platform specifics into the corresponding
iris_vpuXX.cfile.
Are you suggesting moving this function to the corresponding iris_vpuXX.c file and hooking it into the platform-specific ops?
Quoted 131 lines
Quoted 131 lines
Quoted 131 lines
Quoted 131 lines
cores, a simple boolean flag feels sufficient here.
Quoted 12 lines
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_utils.c +4
-5+u32 core0_load =0 , core1_load =0 ; +bool select_core0, select_core1;struct iris_inst *instance; -u32 total_mbpf =0 ; +u32 load, new_load; -mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) - total_mbpf +=iris_get_mbpf (instance); -mutex_unlock (&core->lock); + inst->core_id =0 ;Quoted 11 lines
drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 122
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_utils.c +9
-1-if (total_mbpf > core->iris_platform_data->max_core_mbpf) +list_for_each_entry (instance, &inst->core->instances, list) { + load = mbpf ?iris_get_mbpf (instance) :iris_get_mbps (instance); + +if (instance->core_id ==IRIS_VCODEC0 ) { + core0_load += load; + core0_session_cnt++; + }else if (instance->core_id ==IRIS_VCODEC1 ) { + core1_load += load; + core1_session_cnt++;Arrays, please.
Since we only have two cores, explicit variables feel cleaner and easier to read than arrays.
Quoted 103 lines
Quoted 76 lines
drivers/media/platform/qcom/iris/iris_utils.c +31
-10+ } + } + + new_load = mbpf ?iris_get_mbpf (inst) :iris_get_mbps (inst); + + select_core0 = core0_load + new_load <= max_load && core0_session_cnt < max_session_cnt; + select_core1 = dual_core && core1_load + new_load <= max_load && + core1_session_cnt < max_session_cnt; + +if (select_core0 && select_core1) + inst->core_id = (core0_load <= core1_load) ?IRIS_VCODEC0 :IRIS_VCODEC1 ; +else if (select_core0) + inst->core_id =IRIS_VCODEC0 ; +else if (select_core1) + inst->core_id =IRIS_VCODEC1 ; +else return -ENOMEM ;return 0 ; } -int iris_check_core_mbps (struct iris_inst *inst) +int iris_check_core_mbpf (struct iris_inst *inst) {struct iris_core *core = inst->core; -struct iris_inst *instance; -u32 total_mbps =0 , fps =0 ; +int ret;mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) { - fps =max (instance->frame_rate, instance->operating_rate); - total_mbps +=iris_get_mbpf (instance) * fps; - } + ret =iris_check_and_assign_core (inst, true);mutex_unlock (&core->lock); -if (total_mbps > core->iris_platform_data->max_core_mbps) -return -ENOMEM ; +return ret; +} -return 0 ; +int iris_check_core_mbps (struct iris_inst *inst) +{ +struct iris_core *core = inst->core; +int ret; + +mutex_lock (&core->lock); + ret =iris_check_and_assign_core (inst, false); +mutex_unlock (&core->lock); + +return ret; }bool is_rotation_90_or_270 (struct iris_inst *inst)drivers/media/platform/qcom/iris/iris_vb2.c +4
-0@@ -176,6 +176,10 @@ int iris_vb2_start_streaming(struct vb2_queue *q, unsigned int count)if (ret) goto error; + ret =iris_set_core_id (inst); +if (ret) + goto error; +if (V4L2_TYPE_IS_OUTPUT (q->type)) {if (inst->domain ==DECODER ) ret =iris_vdec_streamon_input (inst);drivers/media/platform/qcom/iris/iris_vidc.c +0
-0drivers/media/platform/qcom/iris/iris_vidc.c static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp) · line 50
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_vidc.c +3
-0@@ -41,16 +41,20 @@ static void iris_v4l2_fh_deinit(struct iris_inst *inst, struct file *filp)static void iris_add_session (struct iris_inst *inst) { +u32 max_session_count = inst->core->iris_platform_data->max_session_count;struct iris_core *core = inst->core;struct iris_inst *iter;u32 count =0 ; +if (inst->core->iris_platform_data->dual_core) + max_session_count *=2 ;
max_session_count*=num_cores.Quoted 15 lines
drivers/media/platform/qcom/iris/iris_vidc.c +2
-1+mutex_lock (&core->lock);list_for_each_entry (iter, &core->instances, list) count++; -if (count < core->iris_platform_data->max_session_count) +if (count < max_session_count)list_add_tail (&inst->list, &core->instances);mutex_unlock (&core->lock);Signature · 2 lines
-- 2.34.1
Re: [PATCH v5 11/14] media: iris: Add support to select core for dual core platforms
Quoted 240 lines · Vishnu Reddy
Quoted 238 lines · Dmitry Baryshkov
Quoted 237 lines · Vishnu Reddy
Quoted 224 lines · Dmitry Baryshkov
Quoted 223 lines · Vishnu Reddy
Quoted 222 lines · Dmitry Baryshkov
Quoted 210 lines · Vishnu Reddy
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_IDproperty.Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/iris_common.c | 10 +++ drivers/media/platform/qcom/iris/iris_common.h | 1 + drivers/media/platform/qcom/iris/iris_core.h | 5 ++ drivers/media/platform/qcom/iris/iris_hfi_common.h | 1 + .../platform/qcom/iris/iris_hfi_gen2_command.c | 19 ++++++ .../platform/qcom/iris/iris_hfi_gen2_defines.h | 1 + drivers/media/platform/qcom/iris/iris_instance.h | 2 + .../platform/qcom/iris/iris_platform_common.h | 1 + drivers/media/platform/qcom/iris/iris_power.c | 11 ++-- drivers/media/platform/qcom/iris/iris_utils.c | 75 ++++++++++++++++------ drivers/media/platform/qcom/iris/iris_vb2.c | 4 ++ drivers/media/platform/qcom/iris/iris_vidc.c | 6 +- 12 files changed, 113 insertions(+), 23 deletions(-)drivers/media/platform/qcom/iris/iris_common.c +10
-0@@ -46,6 +46,16 @@ void iris_set_ts_metadata(struct iris_inst *inst, struct vb2_v4l2_buffer *vbuf) inst->metadata_idx++; } +int iris_set_core_id (struct iris_inst *inst) +{ +const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops; + +if (!inst->core->iris_platform_data->dual_core) +return 0 ; + +return hfi_ops->session_set_core_id (inst, inst->core_id); +} +int iris_process_streamon_input (struct iris_inst *inst) {const struct iris_hfi_command_ops *hfi_ops = inst->core->hfi_ops;drivers/media/platform/qcom/iris/iris_common.h +1
-0@@ -11,6 +11,7 @@ struct iris_buffer;int iris_vb2_buffer_to_driver (struct vb2_buffer *vb2,struct iris_buffer *buf);void iris_set_ts_metadata (struct iris_inst *inst,struct vb2_v4l2_buffer *vbuf); +int iris_set_core_id (struct iris_inst *inst);int iris_process_streamon_input (struct iris_inst *inst);int iris_process_streamon_output (struct iris_inst *inst);int iris_session_streamoff (struct iris_inst *inst,u32 plane);drivers/media/platform/qcom/iris/iris_core.h +5
-0@@ -30,6 +30,11 @@ enum domain_type { DECODER = BIT(1), }; +enum iris_vcodec_core_id { +IRIS_VCODEC0 =1 , +IRIS_VCODEC1 , +}; +/** * struct iris_core - holds core parameters valid for all instances * drivers/media/platform/qcom/iris/iris_hfi_common.h +1
-0@@ -124,6 +124,7 @@ struct iris_hfi_command_ops {int (*session_drain)(struct iris_inst *inst,u32 plane);int (*session_resume_drain)(struct iris_inst *inst,u32 plane);int (*session_close)(struct iris_inst *inst); +int (*session_set_core_id)(struct iris_inst *inst,u32 core_id); };struct iris_hfi_response_ops {drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c +19
-0@@ -1300,6 +1300,24 @@ static int iris_hfi_gen2_session_release_buffer(struct iris_inst *inst, struct i inst_hfi_gen2->packet->size); } +static int iris_hfi_gen2_set_core_id (struct iris_inst *inst,u32 core_id) +{ +struct iris_inst_hfi_gen2 *inst_hfi_gen2 =to_iris_inst_hfi_gen2 (inst); +u32 payload = core_id; + +iris_hfi_gen2_packet_session_command (inst, +HFI_PROP_CORE_ID , +HFI_HOST_FLAGS_NONE , +HFI_PORT_NONE , + inst->session_id, +HFI_PAYLOAD_U32 , + &payload, +sizeof (u32)); + +return iris_hfi_queue_cmd_write (inst->core, inst_hfi_gen2->packet, + inst_hfi_gen2->packet->size); +} +static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .sys_init = iris_hfi_gen2_sys_init, .sys_image_version = iris_hfi_gen2_sys_image_version,@@ -1317,6 +1335,7 @@ static const struct iris_hfi_command_ops iris_hfi_gen2_command_ops = { .session_drain = iris_hfi_gen2_session_drain, .session_resume_drain = iris_hfi_gen2_session_resume_drain, .session_close = iris_hfi_gen2_session_close, + .session_set_core_id = iris_hfi_gen2_set_core_id, };void iris_hfi_gen2_command_ops_init (struct iris_core *core)drivers/media/platform/qcom/iris/iris_hfi_gen2_defines.h +1
-0@@ -56,6 +56,7 @@#define HFI_PROP_BUFFER_HOST_MAX_COUNT 0x03000123#define HFI_PROP_BUFFER_FW_MIN_OUTPUT_COUNT 0x03000124#define HFI_PROP_PIC_ORDER_CNT_TYPE 0x03000128 +#define HFI_PROP_CORE_ID 0x030001a9enum hfi_rate_control {HFI_RC_VBR_CFR =0x00000000 ,drivers/media/platform/qcom/iris/iris_instance.h +2
-0@@ -37,6 +37,7 @@ struct iris_fmt {* * @list: used for attach an instance to the core * @core: pointer to core structure +* @core_id: specifies the hardware core on which the session runs * @session_id: id of current video session * @ctx_q_lock: lock to serialize queues related ioctls * @lock: lock to seralise forward and reverse threads @@ -79,6 +80,7 @@ struct iris_fmt {struct iris_inst {struct list_head list;struct iris_core *core; +u32 core_id;u32 session_id;struct mutex ctx_q_lock;/* lock to serialize queues related ioctls */ struct mutex lock;/* lock to serialize forward and reverse threads */ drivers/media/platform/qcom/iris/iris_platform_common.h +1
-0@@ -258,6 +258,7 @@ struct iris_platform_data {const struct tz_cp_config *tz_cp_config_data;u32 tz_cp_config_data_size;u32 core_arch; +bool dual_core;u32 hw_response_timeout;struct ubwc_config_data *ubwc_config;u32 num_vpp_pipe;drivers/media/platform/qcom/iris/iris_power.c +7
-4@@ -77,9 +77,9 @@ static int iris_vote_interconnects(struct iris_inst *inst)static int iris_set_clocks (struct iris_inst *inst) { +u64 vcodec0_freq =0 , vcodec1_freq =0 ;struct iris_core *core = inst->core;struct iris_inst *instance; -u64 freq =0 ;int ret;mutex_lock (&core->lock);@@ -87,11 +87,14 @@ static int iris_set_clocks(struct iris_inst *inst)if (!instance->max_input_data_size)continue ; - freq += instance->power.min_freq; +if (instance->core_id ==IRIS_VCODEC0 ) + vcodec0_freq += instance->power.min_freq; +else + vcodec1_freq += instance->power.min_freq; } - core->power.clk_freq = freq; - ret =iris_opp_set_rate (core->dev, freq); + core->power.clk_freq =max (vcodec0_freq, vcodec1_freq); + ret =iris_opp_set_rate (core->dev, core->power.clk_freq);mutex_unlock (&core->lock);return ret;drivers/media/platform/qcom/iris/iris_utils.c +3
-2@@ -90,40 +90,79 @@ struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id)return NULL ; } -int iris_check_core_mbpf (struct iris_inst *inst) +static u32 iris_get_mbps (struct iris_inst *inst) { -struct iris_core *core = inst->core; +u32 fps =max (inst->frame_rate, inst->operating_rate); +drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 106
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_utils.c +10
-0+return iris_get_mbpf (inst) * fps; +} + +static int iris_check_and_assign_core (struct iris_inst *inst,bool mbpf) +{ +const struct iris_platform_data *platform_data = inst->core->iris_platform_data; +u32 max_load = mbpf ? platform_data->max_core_mbpf : platform_data->max_core_mbps; +u32 max_session_cnt = platform_data->max_session_count; +u32 core0_session_cnt =0 , core1_session_cnt =0 ; +bool dual_core = platform_data->dual_core;
num_coresQuoted 7 lines
Quoted 1 line
A
num_coresfield would require updating all platform data entries. For twoI was thinking about adding
num_corestoplatform_dataand toiris_inst(oriris_core) and setting it to 1 if the value is unset inplatform_data.A better option would be to move all these multi-core functions to a separate file.
Thanks for your point, Adding
num_corestoplatform_datamakes sense if the number of cores grows beyond two. For now, since we only handle single and dual core, the current logic feels simpler and sufficient to cover both cases. Happy to adopt thenum_coresapproach in the future if we have any platform with more than dual core.
Quoted 5 lines
Quoted 2 lines
Again, an alternative approach is to get all the platform specifics into the corresponding
iris_vpuXX.cfile.Are you suggesting moving this function to the corresponding
iris_vpuXX.cfile and hooking it into the platform-specific ops?
Yes, where that makes sense. If it is the only dual-core platform we should not introduce code into the generic codepaths...
Signature · 2 lines
With best wishes Dmitry
[email protected]
AI reviewRe: [PATCH v5 11/14] media: iris: Add support to select core for dual core platforms
In reply to Vishnu ReddyThank you for your contribution! Sashiko AI review found 6 potential issue(s) to consider: - [Critical] State Corruption / Admission Control Bypass via core_id error handling - [High] Hardware…
Thank you for your contribution! Sashiko AI review found 6 potential issue(s) to consider:
- [Critical] State Corruption / Admission Control Bypass via core_id error handling
- [High] Hardware Constraint Bypass via sequential core capacity checks
- [High] Permanent Clock Overprovisioning on failed stream initialization
- [High] Hardware Desynchronization and Under-clocking on dynamic core reassignment
- [High] MBPS Capacity Limit Validation is bypassed during stream initialization
- [High] Conflicting HFI Commands and Core Flipping across M2M Queue starts --
commit a24b550f95eaa9370c3d20dc544af695464b53d4
Author: Vishnu Reddy <[email protected]>
media: iris: Add support to select core for dual core platforms
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.
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_power.c +0
-0
[ ... ]
drivers/media/platform/qcom/iris/iris_power.c static int iris_set_clocks(struct iris_inst *inst) · line 94
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_power.c +4
-1@@ -87,11 +87,14 @@ static int iris_set_clocks(struct iris_inst *inst)if (!instance->max_input_data_size)continue ; - freq += instance->power.min_freq; +if (instance->core_id ==IRIS_VCODEC0 ) + vcodec0_freq += instance->power.min_freq; +else + vcodec1_freq += instance->power.min_freq; }
If stream initialization fails in iris_vb2_start_streaming() after calculating session power requirements but before a valid core is assigned, inst->core_id remains 0.
Because 0 does not equal IRIS_VCODEC0, does this cause the failed session's clock frequency to be permanently aggregated into vcodec1_freq during all future clock recalculations?
Quoted 4 lines
drivers/media/platform/qcom/iris/iris_utils.c +0
-0
[ ... ]
Quoted 2 lines
drivers/media/platform/qcom/iris/iris_utils.c +2
-0+static int iris_check_and_assign_core (struct iris_inst *inst,bool mbpf) +{
[ ... ]
Quoted 3 lines
drivers/media/platform/qcom/iris/iris_utils.c +3
-0+ inst->core_id =0 ; + +list_for_each_entry (instance, &inst->core->instances, list) {
[ ... ]
drivers/media/platform/qcom/iris/iris_utils.c struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id) · line 166
Quoted 11 lines
drivers/media/platform/qcom/iris/iris_utils.c +9
-0+if (select_core0 && select_core1) + inst->core_id = (core0_load <= core1_load) ?IRIS_VCODEC0 :IRIS_VCODEC1 ; +else if (select_core0) + inst->core_id =IRIS_VCODEC0 ; +else if (select_core1) + inst->core_id =IRIS_VCODEC1 ; +else +return -ENOMEM ; +return 0 ; }
If the requested load exceeds available capacity, this function returns -ENOMEM but leaves inst->core_id set to 0.
If this happens dynamically, for example when userspace calls VIDIOC_S_PARM to change the frame rate on an already active stream, does leaving core_id as 0 exclude this session from future global load calculations?
Could this allow an attacker to bypass dual-core admission controls (such as max_session_count and MBPS limits) by intentionally triggering an out of memory condition?
Additionally, when system load shifts and this function dynamically reassigns an active session to a different hardware core, is the new core assignment ever communicated to firmware?
Since session_set_core_id() appears to only be called during stream initialization, would dynamic reassignment cause iris_set_clocks() to route the session's clock frequency requirements to the newly assigned core, starving the original executing hardware core and risking hardware hangs?
Quoted 27 lines
drivers/media/platform/qcom/iris/iris_utils.c +6
-9-int iris_check_core_mbpf (struct iris_inst *inst) +int iris_check_core_mbpf (struct iris_inst *inst) {struct iris_core *core = inst->core; +int ret;mutex_lock (&core->lock); + ret =iris_check_and_assign_core (inst, true);mutex_unlock (&core->lock); -if (total_mbpf > core->iris_platform_data->max_core_mbpf) -return -ENOMEM ; +return ret; } -int iris_check_core_mbps (struct iris_inst *inst) +int iris_check_core_mbps (struct iris_inst *inst) {struct iris_core *core = inst->core; -struct iris_inst *instance; -u32 total_mbps =0 , fps =0 ; +int ret;mutex_lock (&core->lock); -list_for_each_entry (instance, &core->instances, list) { - fps =max (instance->frame_rate, instance->operating_rate); - total_mbps +=iris_get_mbpf (instance) * fps;
drivers/media/platform/qcom/iris/iris_utils.c
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_utils.c +2
-5- } + ret =iris_check_and_assign_core (inst, false);mutex_unlock (&core->lock); -if (total_mbps > core->iris_platform_data->max_core_mbps) -return -ENOMEM ; - -return 0 ; +return ret; }
If a caller executes iris_check_core_mbpf() and immediately follows it with iris_check_core_mbps(), won't the second call wipe the core assignment made by the first pass?
Does this allow sessions to bypass hardware MBPF limits, as the final assignment checks only MBPS capacity and ignores whether the core can handle the session's MBPF load?
drivers/media/platform/qcom/iris/iris_vb2.c int iris_vb2_start_streaming(struct vb2_queue *q, unsigned int count) · line 182
Quoted 12 lines
drivers/media/platform/qcom/iris/iris_vb2.c +4
-0@@ -176,6 +176,10 @@ int iris_vb2_start_streaming(struct vb2_queue *q, unsigned int count)if (ret) goto error; + ret =iris_set_core_id (inst); +if (ret) + goto error; +
In this function, the driver validates hardware capacity before setting the core ID. Does the validation check (iris_check_session_supported()) exclusively enforce the MBPF limit and omit the MBPS check entirely?
If the MBPS limit is bypassed during stream initialization, could users start sessions that exceed the max_core_mbps limit right away, instead of only being checked during dynamic frame rate changes?
Furthermore, V4L2 memory-to-memory drivers allow userspace to call VIDIOC_STREAMON independently for the OUTPUT and CAPTURE queues.
Because iris_set_core_id() is called unconditionally for each queue start, could concurrent session starts on other instances alter the global load between a session's two STREAMON calls?
Would this cause the driver to assign and notify firmware of one core during the first STREAMON, but then reassign and send a conflicting HFI_PROP_CORE_ID during the second STREAMON while the session is already active?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=11
PATCH v5 12/14 media: iris: Add platform data for glymur
In reply to Vishnu ReddyOn 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.
--- drivers/media/platform/qcom/iris/Makefile | 1 + .../platform/qcom/iris/iris_platform_common.h | 5 ++ .../media/platform/qcom/iris/iris_platform_gen2.c | 99 ++++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.c | 97 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.h | 17 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + 6 files changed, 223 insertions(+)
drivers/media/platform/qcom/iris/Makefile +1 -0
@@ -11,6 +11,7 @@ qcom-iris-objs += iris_buffer.o \ iris_hfi_gen2_response.o \ iris_hfi_queue.o \ iris_platform_gen2.o \ + iris_platform_glymur.o \ iris_power.o \ iris_probe.o \ iris_resources.o \
drivers/media/platform/qcom/iris/iris_platform_common.h +5 -0
@@ -30,6 +30,10 @@ struct iris_inst;#define DEFAULT_QP 20#define BITRATE_DEFAULT 20000000 +#define VIDEO_REGION_SECURE_FW_REGION_ID 0 +#define VIDEO_REGION_VM0_SECURE_NP_ID 1 +#define VIDEO_REGION_VM0_NONSECURE_NP_ID 5 +enum stage_type {STAGE_1 =1 ,STAGE_2 =2 ,
@@ -41,6 +45,7 @@ enum pipe_type { PIPE_4 = 4, }; +extern const struct iris_platform_data glymur_data;extern const struct iris_platform_data qcs8300_data;extern const struct iris_platform_data sc7280_data;extern const struct iris_platform_data sm8250_data;
drivers/media/platform/qcom/iris/iris_platform_gen2.c +99 -0
111 lines not on this page · raw message
drivers/media/platform/qcom/iris/iris_platform_glymur.c new file +97 -0
97 lines not on this page · raw message
drivers/media/platform/qcom/iris/iris_platform_glymur.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#ifndef __IRIS_PLATFORM_GLYMUR_H__ +#define __IRIS_PLATFORM_GLYMUR_H__ + +extern const struct platform_clk_data iris_glymur_clk_table[9 ]; +extern const char *const iris_glymur_clk_reset_table[6 ]; +extern const char *const iris_glymur_opp_clk_table[4 ]; +extern const struct platform_pd_data iris_glymur_pmdomain_table; +extern const struct tz_cp_config iris_glymur_tz_cp_config[3 ]; +int iris_glymur_init_cb_devs (struct iris_core *core); +void iris_glymur_deinit_cb_devs (struct iris_core *core); + +#endif /* __IRIS_PLATFORM_GLYMUR_H__ */
drivers/media/platform/qcom/iris/iris_probe.c +4 -0
@@ -369,6 +369,10 @@ static const struct dev_pm_ops iris_pm_ops = { };static const struct of_device_id iris_dt_match[] = { + { + .compatible ="qcom,glymur-iris" , + .data = &glymur_data, + }, { .compatible ="qcom,qcs8300-iris" , .data = &qcs8300_data,
Signature · 1 line
2.34.1
Re: [PATCH v5 12/14] media: iris: Add platform data for glymur
Quoted 5 lines · Vishnu Reddy
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.
This leave me in confusion. Having two cores, each with its own set of clocks and pm domains, I'd have expected that each core scales independently. I.e. if the load is pushed to the core0, it requires core0 clocks to go higher (while core1 clocks can stay at the low freq). Or, at least, the clocks would be set to the frequency corresponding to the max of the workloads (if for some reason the cores should stay in sync).
However, I don't see it in the code. All clocks and all power domains seem do be scaled using the common workload. If my assumptions were not correct, please explain it in the commit message.
Quoted 229 lines
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/Makefile | 1 + .../platform/qcom/iris/iris_platform_common.h | 5 ++ .../media/platform/qcom/iris/iris_platform_gen2.c | 99 ++++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.c | 97 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.h | 17 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + 6 files changed, 223 insertions(+)drivers/media/platform/qcom/iris/Makefile +1
-0@@ -11,6 +11,7 @@ qcom-iris-objs += iris_buffer.o \ iris_hfi_gen2_response.o \ iris_hfi_queue.o \ iris_platform_gen2.o \ + iris_platform_glymur.o \ iris_power.o \ iris_probe.o \ iris_resources.o \drivers/media/platform/qcom/iris/iris_platform_common.h +5
-0@@ -30,6 +30,10 @@ struct iris_inst;#define DEFAULT_QP 20#define BITRATE_DEFAULT 20000000 +#define VIDEO_REGION_SECURE_FW_REGION_ID 0 +#define VIDEO_REGION_VM0_SECURE_NP_ID 1 +#define VIDEO_REGION_VM0_NONSECURE_NP_ID 5 +enum stage_type {STAGE_1 =1 ,STAGE_2 =2 ,@@ -41,6 +45,7 @@ enum pipe_type { PIPE_4 = 4, }; +extern const struct iris_platform_data glymur_data;extern const struct iris_platform_data qcs8300_data;extern const struct iris_platform_data sc7280_data;extern const struct iris_platform_data sm8250_data;drivers/media/platform/qcom/iris/iris_platform_gen2.c +99
-0@@ -12,6 +12,7 @@#include "iris_vpu_buffer.h" #include "iris_vpu_common.h" +#include "iris_platform_glymur.h" #include "iris_platform_qcs8300.h" #include "iris_platform_sm8650.h" #include "iris_platform_sm8750.h" @@ -931,6 +932,104 @@ static const u32 sm8550_enc_op_int_buf_tbl[] = { BUF_SCRATCH_2, }; +const struct iris_platform_data glymur_data = { + .get_instance = iris_hfi_gen2_get_instance, + .init_hfi_command_ops = iris_hfi_gen2_command_ops_init, + .init_hfi_response_ops = iris_hfi_gen2_response_ops_init, + .get_vpu_buffer_size = iris_vpu_buf_size, + .vpu_ops = &iris_vpu36_ops, + .set_preset_registers = iris_set_sm8550_preset_registers, + .init_cb_devs = iris_glymur_init_cb_devs, + .deinit_cb_devs = iris_glymur_deinit_cb_devs, + .icc_tbl = sm8550_icc_table, + .icc_tbl_size =ARRAY_SIZE (sm8550_icc_table), + .clk_rst_tbl = iris_glymur_clk_reset_table, + .clk_rst_tbl_size =ARRAY_SIZE (iris_glymur_clk_reset_table), + .bw_tbl_dec = sm8550_bw_table_dec, + .bw_tbl_dec_size =ARRAY_SIZE (sm8550_bw_table_dec), + .pmdomain_tbl = &iris_glymur_pmdomain_table, + .opp_pd_tbl = sm8550_opp_pd_table, + .opp_pd_tbl_size =ARRAY_SIZE (sm8550_opp_pd_table), + .clk_tbl = iris_glymur_clk_table, + .clk_tbl_size =ARRAY_SIZE (iris_glymur_clk_table), + .opp_clk_tbl = iris_glymur_opp_clk_table, +/* Upper bound of DMA address range */ + .dma_mask =0xffe00000 -1 , + .fwname ="qcom/vpu/vpu36_p4_s7.mbn" , + .pas_id =IRIS_PAS_ID , + .dual_core = true, + .inst_iris_fmts = platform_fmts_sm8550_dec, + .inst_iris_fmts_size =ARRAY_SIZE (platform_fmts_sm8550_dec), + .inst_caps = &platform_inst_cap_sm8550, + .inst_fw_caps_dec = inst_fw_cap_sm8550_dec, + .inst_fw_caps_dec_size =ARRAY_SIZE (inst_fw_cap_sm8550_dec), + .inst_fw_caps_enc = inst_fw_cap_sm8550_enc, + .inst_fw_caps_enc_size =ARRAY_SIZE (inst_fw_cap_sm8550_enc), + .tz_cp_config_data = iris_glymur_tz_cp_config, + .tz_cp_config_data_size =ARRAY_SIZE (iris_glymur_tz_cp_config), + .core_arch =VIDEO_ARCH_LX , + .hw_response_timeout =HW_RESPONSE_TIMEOUT_VALUE , + .ubwc_config = &ubwc_config_sm8550, + .num_vpp_pipe =4 , + .max_session_count =16 , + .max_core_mbpf =NUM_MBS_8K *2 , + .max_core_mbps = ((8192 *4320 ) /256 ) *60 , + .dec_input_config_params_default = + sm8550_vdec_input_config_params_default, + .dec_input_config_params_default_size = +ARRAY_SIZE (sm8550_vdec_input_config_params_default), + .dec_input_config_params_hevc = + sm8550_vdec_input_config_param_hevc, + .dec_input_config_params_hevc_size = +ARRAY_SIZE (sm8550_vdec_input_config_param_hevc), + .dec_input_config_params_vp9 = + sm8550_vdec_input_config_param_vp9, + .dec_input_config_params_vp9_size = +ARRAY_SIZE (sm8550_vdec_input_config_param_vp9), + .dec_input_config_params_av1 = + sm8550_vdec_input_config_param_av1, + .dec_input_config_params_av1_size = +ARRAY_SIZE (sm8550_vdec_input_config_param_av1), + .dec_output_config_params = + sm8550_vdec_output_config_params, + .dec_output_config_params_size = +ARRAY_SIZE (sm8550_vdec_output_config_params), + + .enc_input_config_params = + sm8550_venc_input_config_params, + .enc_input_config_params_size = +ARRAY_SIZE (sm8550_venc_input_config_params), + .enc_output_config_params = + sm8550_venc_output_config_params, + .enc_output_config_params_size = +ARRAY_SIZE (sm8550_venc_output_config_params), + + .dec_input_prop = sm8550_vdec_subscribe_input_properties, + .dec_input_prop_size =ARRAY_SIZE (sm8550_vdec_subscribe_input_properties), + .dec_output_prop_avc = sm8550_vdec_subscribe_output_properties_avc, + .dec_output_prop_avc_size = +ARRAY_SIZE (sm8550_vdec_subscribe_output_properties_avc), + .dec_output_prop_hevc = sm8550_vdec_subscribe_output_properties_hevc, + .dec_output_prop_hevc_size = +ARRAY_SIZE (sm8550_vdec_subscribe_output_properties_hevc), + .dec_output_prop_vp9 = sm8550_vdec_subscribe_output_properties_vp9, + .dec_output_prop_vp9_size = +ARRAY_SIZE (sm8550_vdec_subscribe_output_properties_vp9), + .dec_output_prop_av1 = sm8550_vdec_subscribe_output_properties_av1, + .dec_output_prop_av1_size = +ARRAY_SIZE (sm8550_vdec_subscribe_output_properties_av1), + + .dec_ip_int_buf_tbl = sm8550_dec_ip_int_buf_tbl, + .dec_ip_int_buf_tbl_size =ARRAY_SIZE (sm8550_dec_ip_int_buf_tbl), + .dec_op_int_buf_tbl = sm8550_dec_op_int_buf_tbl, + .dec_op_int_buf_tbl_size =ARRAY_SIZE (sm8550_dec_op_int_buf_tbl), + + .enc_ip_int_buf_tbl = sm8550_enc_ip_int_buf_tbl, + .enc_ip_int_buf_tbl_size =ARRAY_SIZE (sm8550_enc_ip_int_buf_tbl), + .enc_op_int_buf_tbl = sm8550_enc_op_int_buf_tbl, + .enc_op_int_buf_tbl_size =ARRAY_SIZE (sm8550_enc_op_int_buf_tbl), +}; +const struct iris_platform_data sm8550_data = { .get_instance = iris_hfi_gen2_get_instance, .init_hfi_command_ops = iris_hfi_gen2_command_ops_init,drivers/media/platform/qcom/iris/iris_platform_glymur.c new file +59
-0@@ -0,0 +1,97 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#include <dt-bindings/media/qcom,glymur-iris.h> +#include <linux/iris_vpu_bus.h> +#include "iris_core.h" +#include "iris_platform_common.h" +#include "iris_platform_glymur.h" + +const struct platform_clk_data iris_glymur_clk_table[] = { + {IRIS_AXI_VCODEC_CLK ,"iface" }, + {IRIS_CTRL_CLK ,"core" }, + {IRIS_VCODEC_CLK ,"vcodec0_core" }, + {IRIS_AXI_CTRL_CLK ,"iface1" }, + {IRIS_CTRL_FREERUN_CLK ,"core_freerun" }, + {IRIS_VCODEC_FREERUN_CLK ,"vcodec0_core_freerun" }, + {IRIS_AXI_VCODEC1_CLK ,"iface2" }, + {IRIS_VCODEC1_CLK ,"vcodec1_core" }, + {IRIS_VCODEC1_FREERUN_CLK ,"vcodec1_core_freerun" }, +}; + +const char *const iris_glymur_clk_reset_table[] = { +"bus0" , +"bus1" , +"core" , +"vcodec0_core" , +"bus2" , +"vcodec1_core" , +}; + +const char *const iris_glymur_opp_clk_table[] = { +"vcodec0_core" , +"vcodec1_core" , +"core" , +NULL , +}; + +const struct platform_pd_data iris_glymur_pmdomain_table = { + .pd_types = (enum platform_pm_domain_type []) { +IRIS_CTRL_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN , +IRIS_VCODEC1_POWER_DOMAIN , + }, + .pd_names = (const char *[]) { +"venus" , +"vcodec0" , +"vcodec1" , + }, + .pd_count =3 , +}; + +const struct tz_cp_config iris_glymur_tz_cp_config[] = { + { + .cp_start =VIDEO_REGION_SECURE_FW_REGION_ID , + .cp_size =0 , + .cp_nonpixel_start =0 , + .cp_nonpixel_size =0x1000000 ,
drivers/media/platform/qcom/iris/iris_platform_glymur.c line 69
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_platform_glymur.c new file +10
-0+ }, + { + .cp_start = VIDEO_REGION_VM0_SECURE_NP_ID, + .cp_size = 0, + .cp_nonpixel_start = 0x1000000, + .cp_nonpixel_size = 0x24800000, + }, + { + .cp_start = VIDEO_REGION_VM0_NONSECURE_NP_ID, + .cp_size = 0,
Whys is cp_size 0 for all entries?
Quoted 70 lines
drivers/media/platform/qcom/iris/iris_platform_glymur.c new file +28
-0+ .cp_nonpixel_start = 0x25800000, + .cp_nonpixel_size = 0xda600000, + }, +}; + +int iris_glymur_init_cb_devs (struct iris_core *core) +{ +u64 dma_mask = core->iris_platform_data->dma_mask; +const u32 fw_fid =IOMMU_FID_IRIS_FIRMWARE ; +struct device *dev; + + dev =create_iris_vpu_bus_device (core->dev,"iris-firmware" , dma_mask, &fw_fid); +if (IS_ERR (dev)) +return PTR_ERR (dev); + +if (device_iommu_mapped (dev)) + core->fw_dev = dev; +else +device_unregister (dev); + +return 0 ; +} + +void iris_glymur_deinit_cb_devs (struct iris_core *core) +{ +if (core->fw_dev) +device_unregister (core->fw_dev); +}drivers/media/platform/qcom/iris/iris_platform_glymur.h new file +17
-0@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#ifndef __IRIS_PLATFORM_GLYMUR_H__ +#define __IRIS_PLATFORM_GLYMUR_H__ + +extern const struct platform_clk_data iris_glymur_clk_table[9 ]; +extern const char *const iris_glymur_clk_reset_table[6 ]; +extern const char *const iris_glymur_opp_clk_table[4 ]; +extern const struct platform_pd_data iris_glymur_pmdomain_table; +extern const struct tz_cp_config iris_glymur_tz_cp_config[3 ]; +int iris_glymur_init_cb_devs (struct iris_core *core); +void iris_glymur_deinit_cb_devs (struct iris_core *core); + +#endif /* __IRIS_PLATFORM_GLYMUR_H__ */ drivers/media/platform/qcom/iris/iris_probe.c +4
-0@@ -369,6 +369,10 @@ static const struct dev_pm_ops iris_pm_ops = { };static const struct of_device_id iris_dt_match[] = { + { + .compatible ="qcom,glymur-iris" , + .data = &glymur_data, + }, { .compatible ="qcom,qcs8300-iris" , .data = &qcs8300_data,Signature · 2 lines
-- 2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 12/14] media: iris: Add platform data for glymur
Quoted 14 lines · Dmitry Baryshkov
Quoted 5 lines · Vishnu Reddy
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.
This leave me in confusion. Having two cores, each with its own set of clocks and pm domains, I'd have expected that each core scales independently. I.e. if the load is pushed to the core0, it requires core0 clocks to go higher (while core1 clocks can stay at the low freq). Or, at least, the clocks would be set to the frequency corresponding to the max of the workloads (if for some reason the cores should stay in sync).
Quoted 3 lines
However, I don't see it in the code. All clocks and all power domains seem do be scaled using the common workload. If my assumptions were not correct, please explain it in the commit message.
The OPP core logic sets the rpmhpd level and clock rate based on the OPP table defined in the DT node, where the clock frequency and power rail level are tightly coupled together. Since vcodec0 and vcodec1 share the same power rails, independently scaling one clock high while keeping the other low is not straightforward within this OPP framework.
Do you have any suggestion on how best to handle per core independent clock scaling within these constraints?
Quoted 310 lines
Quoted 228 lines
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/Makefile | 1 + .../platform/qcom/iris/iris_platform_common.h | 5 ++ .../media/platform/qcom/iris/iris_platform_gen2.c | 99 ++++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.c | 97 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.h | 17 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + 6 files changed, 223 insertions(+)drivers/media/platform/qcom/iris/Makefile +1
-0@@ -11,6 +11,7 @@ qcom-iris-objs += iris_buffer.o \ iris_hfi_gen2_response.o \ iris_hfi_queue.o \ iris_platform_gen2.o \ + iris_platform_glymur.o \ iris_power.o \ iris_probe.o \ iris_resources.o \drivers/media/platform/qcom/iris/iris_platform_common.h +5
-0@@ -30,6 +30,10 @@ struct iris_inst;#define DEFAULT_QP 20#define BITRATE_DEFAULT 20000000 +#define VIDEO_REGION_SECURE_FW_REGION_ID 0 +#define VIDEO_REGION_VM0_SECURE_NP_ID 1 +#define VIDEO_REGION_VM0_NONSECURE_NP_ID 5 +enum stage_type {STAGE_1 =1 ,STAGE_2 =2 ,@@ -41,6 +45,7 @@ enum pipe_type { PIPE_4 = 4, }; +extern const struct iris_platform_data glymur_data;extern const struct iris_platform_data qcs8300_data;extern const struct iris_platform_data sc7280_data;extern const struct iris_platform_data sm8250_data;drivers/media/platform/qcom/iris/iris_platform_gen2.c +99
-0@@ -12,6 +12,7 @@#include "iris_vpu_buffer.h" #include "iris_vpu_common.h" +#include "iris_platform_glymur.h" #include "iris_platform_qcs8300.h" #include "iris_platform_sm8650.h" #include "iris_platform_sm8750.h" @@ -931,6 +932,104 @@ static const u32 sm8550_enc_op_int_buf_tbl[] = { BUF_SCRATCH_2, }; +const struct iris_platform_data glymur_data = { + .get_instance = iris_hfi_gen2_get_instance, + .init_hfi_command_ops = iris_hfi_gen2_command_ops_init, + .init_hfi_response_ops = iris_hfi_gen2_response_ops_init, + .get_vpu_buffer_size = iris_vpu_buf_size, + .vpu_ops = &iris_vpu36_ops, + .set_preset_registers = iris_set_sm8550_preset_registers, + .init_cb_devs = iris_glymur_init_cb_devs, + .deinit_cb_devs = iris_glymur_deinit_cb_devs, + .icc_tbl = sm8550_icc_table, + .icc_tbl_size =ARRAY_SIZE (sm8550_icc_table), + .clk_rst_tbl = iris_glymur_clk_reset_table, + .clk_rst_tbl_size =ARRAY_SIZE (iris_glymur_clk_reset_table), + .bw_tbl_dec = sm8550_bw_table_dec, + .bw_tbl_dec_size =ARRAY_SIZE (sm8550_bw_table_dec), + .pmdomain_tbl = &iris_glymur_pmdomain_table, + .opp_pd_tbl = sm8550_opp_pd_table, + .opp_pd_tbl_size =ARRAY_SIZE (sm8550_opp_pd_table), + .clk_tbl = iris_glymur_clk_table, + .clk_tbl_size =ARRAY_SIZE (iris_glymur_clk_table), + .opp_clk_tbl = iris_glymur_opp_clk_table, +/* Upper bound of DMA address range */ + .dma_mask =0xffe00000 -1 , + .fwname ="qcom/vpu/vpu36_p4_s7.mbn" , + .pas_id =IRIS_PAS_ID , + .dual_core = true, + .inst_iris_fmts = platform_fmts_sm8550_dec, + .inst_iris_fmts_size =ARRAY_SIZE (platform_fmts_sm8550_dec), + .inst_caps = &platform_inst_cap_sm8550, + .inst_fw_caps_dec = inst_fw_cap_sm8550_dec, + .inst_fw_caps_dec_size =ARRAY_SIZE (inst_fw_cap_sm8550_dec), + .inst_fw_caps_enc = inst_fw_cap_sm8550_enc, + .inst_fw_caps_enc_size =ARRAY_SIZE (inst_fw_cap_sm8550_enc), + .tz_cp_config_data = iris_glymur_tz_cp_config, + .tz_cp_config_data_size =ARRAY_SIZE (iris_glymur_tz_cp_config), + .core_arch =VIDEO_ARCH_LX , + .hw_response_timeout =HW_RESPONSE_TIMEOUT_VALUE , + .ubwc_config = &ubwc_config_sm8550, + .num_vpp_pipe =4 , + .max_session_count =16 , + .max_core_mbpf =NUM_MBS_8K *2 , + .max_core_mbps = ((8192 *4320 ) /256 ) *60 , + .dec_input_config_params_default = + sm8550_vdec_input_config_params_default, + .dec_input_config_params_default_size = +ARRAY_SIZE (sm8550_vdec_input_config_params_default), + .dec_input_config_params_hevc = + sm8550_vdec_input_config_param_hevc, + .dec_input_config_params_hevc_size = +ARRAY_SIZE (sm8550_vdec_input_config_param_hevc), + .dec_input_config_params_vp9 = + sm8550_vdec_input_config_param_vp9, + .dec_input_config_params_vp9_size = +ARRAY_SIZE (sm8550_vdec_input_config_param_vp9), + .dec_input_config_params_av1 = + sm8550_vdec_input_config_param_av1, + .dec_input_config_params_av1_size = +ARRAY_SIZE (sm8550_vdec_input_config_param_av1), + .dec_output_config_params = + sm8550_vdec_output_config_params, + .dec_output_config_params_size = +ARRAY_SIZE (sm8550_vdec_output_config_params), + + .enc_input_config_params = + sm8550_venc_input_config_params, + .enc_input_config_params_size = +ARRAY_SIZE (sm8550_venc_input_config_params), + .enc_output_config_params = + sm8550_venc_output_config_params, + .enc_output_config_params_size = +ARRAY_SIZE (sm8550_venc_output_config_params), + + .dec_input_prop = sm8550_vdec_subscribe_input_properties, + .dec_input_prop_size =ARRAY_SIZE (sm8550_vdec_subscribe_input_properties), + .dec_output_prop_avc = sm8550_vdec_subscribe_output_properties_avc, + .dec_output_prop_avc_size = +ARRAY_SIZE (sm8550_vdec_subscribe_output_properties_avc), + .dec_output_prop_hevc = sm8550_vdec_subscribe_output_properties_hevc, + .dec_output_prop_hevc_size = +ARRAY_SIZE (sm8550_vdec_subscribe_output_properties_hevc), + .dec_output_prop_vp9 = sm8550_vdec_subscribe_output_properties_vp9, + .dec_output_prop_vp9_size = +ARRAY_SIZE (sm8550_vdec_subscribe_output_properties_vp9), + .dec_output_prop_av1 = sm8550_vdec_subscribe_output_properties_av1, + .dec_output_prop_av1_size = +ARRAY_SIZE (sm8550_vdec_subscribe_output_properties_av1), + + .dec_ip_int_buf_tbl = sm8550_dec_ip_int_buf_tbl, + .dec_ip_int_buf_tbl_size =ARRAY_SIZE (sm8550_dec_ip_int_buf_tbl), + .dec_op_int_buf_tbl = sm8550_dec_op_int_buf_tbl, + .dec_op_int_buf_tbl_size =ARRAY_SIZE (sm8550_dec_op_int_buf_tbl), + + .enc_ip_int_buf_tbl = sm8550_enc_ip_int_buf_tbl, + .enc_ip_int_buf_tbl_size =ARRAY_SIZE (sm8550_enc_ip_int_buf_tbl), + .enc_op_int_buf_tbl = sm8550_enc_op_int_buf_tbl, + .enc_op_int_buf_tbl_size =ARRAY_SIZE (sm8550_enc_op_int_buf_tbl), +}; +const struct iris_platform_data sm8550_data = { .get_instance = iris_hfi_gen2_get_instance, .init_hfi_command_ops = iris_hfi_gen2_command_ops_init,drivers/media/platform/qcom/iris/iris_platform_glymur.c new file +59
-0@@ -0,0 +1,97 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#include <dt-bindings/media/qcom,glymur-iris.h> +#include <linux/iris_vpu_bus.h> +#include "iris_core.h" +#include "iris_platform_common.h" +#include "iris_platform_glymur.h" + +const struct platform_clk_data iris_glymur_clk_table[] = { + {IRIS_AXI_VCODEC_CLK ,"iface" }, + {IRIS_CTRL_CLK ,"core" }, + {IRIS_VCODEC_CLK ,"vcodec0_core" }, + {IRIS_AXI_CTRL_CLK ,"iface1" }, + {IRIS_CTRL_FREERUN_CLK ,"core_freerun" }, + {IRIS_VCODEC_FREERUN_CLK ,"vcodec0_core_freerun" }, + {IRIS_AXI_VCODEC1_CLK ,"iface2" }, + {IRIS_VCODEC1_CLK ,"vcodec1_core" }, + {IRIS_VCODEC1_FREERUN_CLK ,"vcodec1_core_freerun" }, +}; + +const char *const iris_glymur_clk_reset_table[] = { +"bus0" , +"bus1" , +"core" , +"vcodec0_core" , +"bus2" , +"vcodec1_core" , +}; + +const char *const iris_glymur_opp_clk_table[] = { +"vcodec0_core" , +"vcodec1_core" , +"core" , +NULL , +}; + +const struct platform_pd_data iris_glymur_pmdomain_table = { + .pd_types = (enum platform_pm_domain_type []) { +IRIS_CTRL_POWER_DOMAIN , +IRIS_VCODEC_POWER_DOMAIN , +IRIS_VCODEC1_POWER_DOMAIN , + }, + .pd_names = (const char *[]) { +"venus" , +"vcodec0" , +"vcodec1" , + }, + .pd_count =3 , +}; + +const struct tz_cp_config iris_glymur_tz_cp_config[] = { + { + .cp_start =VIDEO_REGION_SECURE_FW_REGION_ID , + .cp_size =0 , + .cp_nonpixel_start =0 , + .cp_nonpixel_size =0x1000000 ,drivers/media/platform/qcom/iris/iris_platform_glymur.c line 69
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_platform_glymur.c new file +10
-0+ }, + { + .cp_start = VIDEO_REGION_VM0_SECURE_NP_ID, + .cp_size = 0, + .cp_nonpixel_start = 0x1000000, + .cp_nonpixel_size = 0x24800000, + }, + { + .cp_start = VIDEO_REGION_VM0_NONSECURE_NP_ID, + .cp_size = 0,Whys is
cp_size0 for all entries?Quoted 70 lines
drivers/media/platform/qcom/iris/iris_platform_glymur.c new file +28
-0+ .cp_nonpixel_start = 0x25800000, + .cp_nonpixel_size = 0xda600000, + }, +}; + +int iris_glymur_init_cb_devs (struct iris_core *core) +{ +u64 dma_mask = core->iris_platform_data->dma_mask; +const u32 fw_fid =IOMMU_FID_IRIS_FIRMWARE ; +struct device *dev; + + dev =create_iris_vpu_bus_device (core->dev,"iris-firmware" , dma_mask, &fw_fid); +if (IS_ERR (dev)) +return PTR_ERR (dev); + +if (device_iommu_mapped (dev)) + core->fw_dev = dev; +else +device_unregister (dev); + +return 0 ; +} + +void iris_glymur_deinit_cb_devs (struct iris_core *core) +{ +if (core->fw_dev) +device_unregister (core->fw_dev); +}drivers/media/platform/qcom/iris/iris_platform_glymur.h new file +17
-0@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) Qualcomm Innovation Center, Inc. All rights reserved. +*/ + +#ifndef __IRIS_PLATFORM_GLYMUR_H__ +#define __IRIS_PLATFORM_GLYMUR_H__ + +extern const struct platform_clk_data iris_glymur_clk_table[9 ]; +extern const char *const iris_glymur_clk_reset_table[6 ]; +extern const char *const iris_glymur_opp_clk_table[4 ]; +extern const struct platform_pd_data iris_glymur_pmdomain_table; +extern const struct tz_cp_config iris_glymur_tz_cp_config[3 ]; +int iris_glymur_init_cb_devs (struct iris_core *core); +void iris_glymur_deinit_cb_devs (struct iris_core *core); + +#endif /* __IRIS_PLATFORM_GLYMUR_H__ */ drivers/media/platform/qcom/iris/iris_probe.c +4
-0@@ -369,6 +369,10 @@ static const struct dev_pm_ops iris_pm_ops = { };static const struct of_device_id iris_dt_match[] = { + { + .compatible ="qcom,glymur-iris" , + .data = &glymur_data, + }, { .compatible ="qcom,qcs8300-iris" , .data = &qcs8300_data,Signature · 2 lines
-- 2.34.1
Re: [PATCH v5 12/14] media: iris: Add platform data for glymur
Quoted 20 lines · Vishnu Reddy
Quoted 14 lines · Dmitry Baryshkov
Quoted 5 lines · Vishnu Reddy
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.
This leave me in confusion. Having two cores, each with its own set of clocks and pm domains, I'd have expected that each core scales independently. I.e. if the load is pushed to the core0, it requires core0 clocks to go higher (while core1 clocks can stay at the low freq). Or, at least, the clocks would be set to the frequency corresponding to the max of the workloads (if for some reason the cores should stay in sync).
Quoted 3 lines
However, I don't see it in the code. All clocks and all power domains seem do be scaled using the common workload. If my assumptions were not correct, please explain it in the commit message.
Quoted 8 lines
The OPP core logic sets the rpmhpd level and clock rate based on the OPP table defined in the DT node, where the clock frequency and power rail level are tightly coupled together. Since vcodec0 and vcodec1 share the same power rails, independently scaling one clock high while keeping the other low is not straightforward within this OPP framework.
Do you have any suggestion on how best to handle per core independent clock scaling within these constraints?
This would require more plumbing and driver changes, but:
iris: video-codec@foo {
compatible = "qcom,glymur-iris",
clocks = <only-core-clocks>;
resets = <only-core-resets>;
/* or core@0 */
codec@0 {
clocks, resets, power-domains;
operating-points-v2 = <&iris_opp_table>
};
/* or core@1 */
codec@1 {
clocks, resets, power-domains;
operating-points-v2 = <&iris_opp_table>
};
iris_opp_table: opp-table {
compatible = "operating-points-v2"
};
};Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/Makefile | 1 + .../platform/qcom/iris/iris_platform_common.h | 5 ++ .../media/platform/qcom/iris/iris_platform_gen2.c | 99 ++++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.c | 97 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.h | 17 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + 6 files changed, 223 insertions(+)
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerRe: [PATCH v5 12/14] media: iris: Add platform data for glymur
Quoted 45 lines · Dmitry Baryshkov
Quoted 20 lines · Vishnu Reddy
Quoted 14 lines · Dmitry Baryshkov
Quoted 5 lines · Vishnu Reddy
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.
This leave me in confusion. Having two cores, each with its own set of clocks and pm domains, I'd have expected that each core scales independently. I.e. if the load is pushed to the core0, it requires core0 clocks to go higher (while core1 clocks can stay at the low freq). Or, at least, the clocks would be set to the frequency corresponding to the max of the workloads (if for some reason the cores should stay in sync).
Quoted 3 lines
However, I don't see it in the code. All clocks and all power domains seem do be scaled using the common workload. If my assumptions were not correct, please explain it in the commit message.
Quoted 8 lines
The OPP core logic sets the rpmhpd level and clock rate based on the OPP table defined in the DT node, where the clock frequency and power rail level are tightly coupled together. Since vcodec0 and vcodec1 share the same power rails, independently scaling one clock high while keeping the other low is not straightforward within this OPP framework.
Do you have any suggestion on how best to handle per core independent clock scaling within these constraints?
This would require more plumbing and driver changes, but:
iris: video-codec@foo { compatible = "qcom,glymur-iris", clocks = <only-core-clocks>; resets = <only-core-resets>; /* or core@0 */ codec@0 { clocks, resets, power-domains; operating-points-v2 = <&iris_opp_table> }; /* or core@1 */ codec@1 {
Quoted 9 lines
clocks, resets, power-domains;
operating-points-v2 = <&iris_opp_table>
};
iris_opp_table: opp-table {
compatible = "operating-points-v2"
};
};clock source "video_cc_mvs0_clk_src" is common for both the cores. It would not matter if core0 is scaled for a specific workload and core1 is scaled for different (let say lower), as the common PLL would always generate the higher of them.
Infact, going with the approach of exclusive scaling would be an issue here. The later core scaling command would bring down/up the corner for other core, and could lead to under/over-voting.
Quoted 13 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/Makefile | 1 + .../platform/qcom/iris/iris_platform_common.h | 5 ++ .../media/platform/qcom/iris/iris_platform_gen2.c | 99 ++++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.c | 97 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.h | 17 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + 6 files changed, 223 insertions(+)
Re: [PATCH v5 12/14] media: iris: Add platform data for glymur
Quoted 58 lines · Vikash Garodia
Quoted 45 lines · Dmitry Baryshkov
Quoted 20 lines · Vishnu Reddy
Quoted 14 lines · Dmitry Baryshkov
Quoted 5 lines · Vishnu Reddy
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.
This leave me in confusion. Having two cores, each with its own set of clocks and pm domains, I'd have expected that each core scales independently. I.e. if the load is pushed to the core0, it requires core0 clocks to go higher (while core1 clocks can stay at the low freq). Or, at least, the clocks would be set to the frequency corresponding to the max of the workloads (if for some reason the cores should stay in sync).
Quoted 3 lines
However, I don't see it in the code. All clocks and all power domains seem do be scaled using the common workload. If my assumptions were not correct, please explain it in the commit message.
Quoted 8 lines
The OPP core logic sets the rpmhpd level and clock rate based on the OPP table defined in the DT node, where the clock frequency and power rail level are tightly coupled together. Since vcodec0 and vcodec1 share the same power rails, independently scaling one clock high while keeping the other low is not straightforward within this OPP framework.
Do you have any suggestion on how best to handle per core independent clock scaling within these constraints?
This would require more plumbing and driver changes, but:
iris: video-codec@foo { compatible = "qcom,glymur-iris", clocks = <only-core-clocks>; resets = <only-core-resets>; /* or core@0 */ codec@0 { clocks, resets, power-domains; operating-points-v2 = <&iris_opp_table> }; /* or core@1 */ codec@1 {Quoted 9 lines
clocks, resets, power-domains; operating-points-v2 = <&iris_opp_table> }; iris_opp_table: opp-table { compatible = "operating-points-v2" }; };
Quoted 8 lines
clock source "
video_cc_mvs0_clk_src" is common for both the cores. It would not matter if core0 is scaled for a specific workload and core1 is scaled for different (let say lower), as the common PLL would always generate the higher of them.Infact, going with the approach of exclusive scaling would be an issue here. The later core scaling command would bring down/up the corner for other core, and could lead to under/over-voting.
Are the dividers between mvs0_clk_src and the branch clocks really R/O in the hardware? Can they be scaled to account for the different workloads? The commit message should capture the details of the interaction between cores:
- Can either of them be turned off, while retaining the other one running?
- Can either of them run at a different frequency than the other one?
- etc.
Quoted 14 lines
Quoted 13 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/Makefile | 1 + .../platform/qcom/iris/iris_platform_common.h | 5 ++ .../media/platform/qcom/iris/iris_platform_gen2.c | 99 ++++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.c | 97 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.h | 17 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + 6 files changed, 223 insertions(+)
Signature · 2 lines
With best wishes Dmitry
Vikash Garodia
maintainerRe: [PATCH v5 12/14] media: iris: Add platform data for glymur
Quoted 64 lines · Dmitry Baryshkov
Quoted 63 lines · Vikash Garodia
Quoted 45 lines · Dmitry Baryshkov
Quoted 20 lines · Vishnu Reddy
Quoted 14 lines · Dmitry Baryshkov
Quoted 5 lines · Vishnu Reddy
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.
This leave me in confusion. Having two cores, each with its own set of clocks and pm domains, I'd have expected that each core scales independently. I.e. if the load is pushed to the core0, it requires core0 clocks to go higher (while core1 clocks can stay at the low freq). Or, at least, the clocks would be set to the frequency corresponding to the max of the workloads (if for some reason the cores should stay in sync).
Quoted 3 lines
However, I don't see it in the code. All clocks and all power domains seem do be scaled using the common workload. If my assumptions were not correct, please explain it in the commit message.
Quoted 8 lines
The OPP core logic sets the rpmhpd level and clock rate based on the OPP table defined in the DT node, where the clock frequency and power rail level are tightly coupled together. Since vcodec0 and vcodec1 share the same power rails, independently scaling one clock high while keeping the other low is not straightforward within this OPP framework.
Do you have any suggestion on how best to handle per core independent clock scaling within these constraints?
This would require more plumbing and driver changes, but:
iris: video-codec@foo { compatible = "qcom,glymur-iris", clocks = <only-core-clocks>; resets = <only-core-resets>; /* or core@0 */ codec@0 { clocks, resets, power-domains; operating-points-v2 = <&iris_opp_table> }; /* or core@1 */ codec@1 {Quoted 9 lines
clocks, resets, power-domains; operating-points-v2 = <&iris_opp_table> }; iris_opp_table: opp-table { compatible = "operating-points-v2" }; };clock source "
video_cc_mvs0_clk_src" is common for both the cores. It would not matter if core0 is scaled for a specific workload and core1 is scaled for different (let say lower), as the common PLL would always generate the higher of them.
Quoted 7 lines
Quoted 3 lines
Infact, going with the approach of exclusive scaling would be an issue here. The later core scaling command would bring down/up the corner for other core, and could lead to under/over-voting.
Are the dividers between
mvs0_clk_srcand the branch clocks really R/O in the hardware? Can they be scaled to account for the different workloads?
dividers div ratio is pre-fixed in nature, does not vary with workload.
Again, you need to look at the source clock, rather than the ones at different core. Even if they are scaled differently, either in software or hardware (assume for now, hw does), the source would always pick the higher of the scaled frequency corner.
Quoted 6 lines
The commit message should capture the details of the interaction between cores:
- Can either of them be turned off, while retaining the other one running?
- Can either of them run at a different frequency than the other one?
- etc.
Lets capture these details in the patch which enables the power sequence for the dual core.
Quoted 16 lines
Quoted 15 lines
Quoted 14 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/Makefile | 1 + .../platform/qcom/iris/iris_platform_common.h | 5 ++ .../media/platform/qcom/iris/iris_platform_gen2.c | 99 ++++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.c | 97 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.h | 17 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + 6 files changed, 223 insertions(+)
Re: [PATCH v5 12/14] media: iris: Add platform data for glymur
Quoted 87 lines · Vikash Garodia
Quoted 64 lines · Dmitry Baryshkov
Quoted 63 lines · Vikash Garodia
Quoted 45 lines · Dmitry Baryshkov
Quoted 20 lines · Vishnu Reddy
Quoted 14 lines · Dmitry Baryshkov
Quoted 5 lines · Vishnu Reddy
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.
This leave me in confusion. Having two cores, each with its own set of clocks and pm domains, I'd have expected that each core scales independently. I.e. if the load is pushed to the core0, it requires core0 clocks to go higher (while core1 clocks can stay at the low freq). Or, at least, the clocks would be set to the frequency corresponding to the max of the workloads (if for some reason the cores should stay in sync).
Quoted 3 lines
However, I don't see it in the code. All clocks and all power domains seem do be scaled using the common workload. If my assumptions were not correct, please explain it in the commit message.
Quoted 8 lines
The OPP core logic sets the rpmhpd level and clock rate based on the OPP table defined in the DT node, where the clock frequency and power rail level are tightly coupled together. Since vcodec0 and vcodec1 share the same power rails, independently scaling one clock high while keeping the other low is not straightforward within this OPP framework.
Do you have any suggestion on how best to handle per core independent clock scaling within these constraints?
This would require more plumbing and driver changes, but:
iris: video-codec@foo { compatible = "qcom,glymur-iris", clocks = <only-core-clocks>; resets = <only-core-resets>; /* or core@0 */ codec@0 { clocks, resets, power-domains; operating-points-v2 = <&iris_opp_table> }; /* or core@1 */ codec@1 {Quoted 9 lines
clocks, resets, power-domains; operating-points-v2 = <&iris_opp_table> }; iris_opp_table: opp-table { compatible = "operating-points-v2" }; };clock source "
video_cc_mvs0_clk_src" is common for both the cores. It would not matter if core0 is scaled for a specific workload and core1 is scaled for different (let say lower), as the common PLL would always generate the higher of them.Quoted 7 lines
Quoted 3 lines
Infact, going with the approach of exclusive scaling would be an issue here. The later core scaling command would bring down/up the corner for other core, and could lead to under/over-voting.
Are the dividers between
mvs0_clk_srcand the branch clocks really R/O in the hardware? Can they be scaled to account for the different workloads?dividers div ratio is pre-fixed in nature, does not vary with workload. Again, you need to look at the source clock, rather than the ones at different core. Even if they are scaled differently, either in software or hardware (assume for now, hw does), the source would always pick the higher of the scaled frequency corner.
Quoted 6 lines
The commit message should capture the details of the interaction between cores:
- Can either of them be turned off, while retaining the other one running?
- Can either of them run at a different frequency than the other one?
- etc.
Quoted 2 lines
Lets capture these details in the patch which enables the power sequence for the dual core.
Agree, thank you.
Quoted 18 lines
Quoted 17 lines
Quoted 16 lines
Quoted 15 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- drivers/media/platform/qcom/iris/Makefile | 1 + .../platform/qcom/iris/iris_platform_common.h | 5 ++ .../media/platform/qcom/iris/iris_platform_gen2.c | 99 ++++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.c | 97 +++++++++++++++++++++ .../platform/qcom/iris/iris_platform_glymur.h | 17 ++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + 6 files changed, 223 insertions(+)
Signature · 2 lines
With best wishes Dmitry
[email protected]
AI reviewRe: [PATCH v5 12/14] media: iris: Add platform data for glymur
In reply to Vishnu ReddyThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Stack use-after-return / dangling pointer due to storing a local variable's address in device…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Stack use-after-return / dangling pointer due to storing a local variable's address in device driver data. --
commit 93f713f9565a33672387c6d251540a853b65cebf
Author: Vishnu Reddy <[email protected]>
media: iris: Add platform data for glymur
On glymur platform, the iris core shares most properties with the iris core on the SM8550 platform, but integrates two codec cores instead of one. Add glymur specific platform data, reusing SM8550 definitions wherever applicable.
Quoted 5 lines
drivers/media/platform/qcom/iris/iris_platform_glymur.c new file +0
-0
[ ... ]
drivers/media/platform/qcom/iris/iris_platform_glymur.c line 81
Quoted 7 lines
drivers/media/platform/qcom/iris/iris_platform_glymur.c new file +7
-0+int iris_glymur_init_cb_devs (struct iris_core *core) +{ +u64 dma_mask = core->iris_platform_data->dma_mask; +const u32 fw_fid =IOMMU_FID_IRIS_FIRMWARE ; +struct device *dev; + + dev =create_iris_vpu_bus_device (core->dev,"iris-firmware" , dma_mask, &fw_fid);
Does this leave a dangling pointer in the device driver data?
Looking at create_iris_vpu_bus_device(), it calls dev_set_drvdata() to store the address of fw_fid in the newly registered device.
Since fw_fid is a local variable on the stack, its lifetime ends when iris_glymur_init_cb_devs() returns. Any later dereference of this pointer from the device's driver data will read invalid stack memory.
Could fw_fid be declared as static, or its lifetime otherwise tied to the device?
Quoted 10 lines
drivers/media/platform/qcom/iris/iris_platform_glymur.c new file +10
-0+if (IS_ERR (dev)) +return PTR_ERR (dev); + +if (device_iommu_mapped (dev)) + core->fw_dev = dev; +else +device_unregister (dev); + +return 0 ; +}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=12
PATCH v5 13/14 arm64: dts: qcom: glymur: Add iris video node
In reply to Vishnu ReddyAdd iris video codec to glymur SoC, which comes with significantly different powering up sequence than previous platforms, thus different clocks and resets.
--- arch/arm64/boot/dts/qcom/glymur.dtsi | 118 +++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+)
arch/arm64/boot/dts/qcom/glymur.dtsi +118 -0
@@ -13,6 +13,7 @@ #include <dt-bindings/interconnect/qcom,glymur-rpmh.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/mailbox/qcom-ipcc.h> +#include <dt-bindings/media/qcom,glymur-iris.h> #include <dt-bindings/phy/phy-qcom-qmp.h> #include <dt-bindings/power/qcom,rpmhpd.h> #include <dt-bindings/power/qcom-rpmpd.h>
@@ -4163,6 +4164,123 @@ usb_mp: usb@a400000 { status = "disabled"; }; + iris: video-codec@aa00000 { + compatible = "qcom,glymur-iris"; + reg = <0x0 0xaa00000 0x0 0xf0000>; + + clocks = <&gcc GCC_VIDEO_AXI0_CLK>, + <&videocc VIDEO_CC_MVS0C_CLK>, + <&videocc VIDEO_CC_MVS0_CLK>, + <&gcc GCC_VIDEO_AXI0C_CLK>, + <&videocc VIDEO_CC_MVS0C_FREERUN_CLK>, + <&videocc VIDEO_CC_MVS0_FREERUN_CLK>, + <&gcc GCC_VIDEO_AXI1_CLK>, + <&videocc VIDEO_CC_MVS1_CLK>, + <&videocc VIDEO_CC_MVS1_FREERUN_CLK>; + clock-names = "iface", + "core", + "vcodec0_core", + "iface1", + "core_freerun", + "vcodec0_core_freerun", + "iface2", + "vcodec1_core", + "vcodec1_core_freerun"; + + dma-coherent; + + interconnects = <&hsc_noc MASTER_APPSS_PROC QCOM_ICC_TAG_ACTIVE_ONLY + &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, + <&mmss_noc MASTER_VIDEO QCOM_ICC_TAG_ALWAYS + &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>; + interconnect-names = "cpu-cfg", + "video-mem"; + + interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; + + iommus = <&apps_smmu 0x1940 0x0>, + <&apps_smmu 0x1943 0x0>, + <&apps_smmu 0x1944 0x0>, + <&apps_smmu 0x19e0 0x0>; + + iommu-map = <IOMMU_FID_IRIS_FIRMWARE &apps_smmu 0x19e2 0x1>; + + memory-region = <&video_mem>; + + operating-points-v2 = <&iris_opp_table>; + + power-domains = <&videocc VIDEO_CC_MVS0C_GDSC>, + <&videocc VIDEO_CC_MVS0_GDSC>, + <&rpmhpd RPMHPD_MXC>, + <&rpmhpd RPMHPD_MMCX>, + <&videocc VIDEO_CC_MVS1_GDSC>; + power-domain-names = "venus", + "vcodec0", + "mxc", + "mmcx", + "vcodec1"; + + resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>, + <&gcc GCC_VIDEO_AXI0C_CLK_ARES>, + <&videocc VIDEO_CC_MVS0C_FREERUN_CLK_ARES>, + <&videocc VIDEO_CC_MVS0_FREERUN_CLK_ARES>, + <&gcc GCC_VIDEO_AXI1_CLK_ARES>, + <&videocc VIDEO_CC_MVS1_FREERUN_CLK_ARES>; + reset-names = "bus0", + "bus1", + "core", + "vcodec0_core", + "bus2", + "vcodec1_core"; + + /* + * IRIS firmware is signed by vendors, only + * enable on boards where the proper signed firmware + * is available. + */ + status = "disabled"; + + iris_opp_table: opp-table { + compatible = "operating-points-v2"; + + opp-240000000 { + opp-hz = /bits/ 64 <240000000 240000000 360000000>; + required-opps = <&rpmhpd_opp_svs>, + <&rpmhpd_opp_low_svs>; + }; + + opp-338000000 { + opp-hz = /bits/ 64 <338000000 338000000 507000000>; + required-opps = <&rpmhpd_opp_svs>, + <&rpmhpd_opp_svs>; + }; + + opp-366000000 { + opp-hz = /bits/ 64 <366000000 366000000 549000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_svs_l1>; + }; + + opp-444000000 { + opp-hz = /bits/ 64 <444000000 444000000 666000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_nom>; + }; + + opp-533333334 { + opp-hz = /bits/ 64 <533333334 533333334 800000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_turbo>; + }; + + opp-655000000 { + opp-hz = /bits/ 64 <655000000 655000000 982000000>; + required-opps = <&rpmhpd_opp_nom>, + <&rpmhpd_opp_turbo_l1>; + }; + }; + }; + mdss: display-subsystem@ae00000 { compatible = "qcom,glymur-mdss"; reg = <0x0 0x0ae00000 0x0 0x1000>;
Signature · 1 line
2.34.1
Re: [PATCH v5 13/14] arm64: dts: qcom: glymur: Add iris video node
Quoted 33 lines · Vishnu Reddy
Add iris video codec to glymur SoC, which comes with significantly different powering up sequence than previous platforms, thus different clocks and resets.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- arch/arm64/boot/dts/qcom/glymur.dtsi | 118 +++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+)arch/arm64/boot/dts/qcom/glymur.dtsi +8
-0@@ -13,6 +13,7 @@ #include <dt-bindings/interconnect/qcom,glymur-rpmh.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/mailbox/qcom-ipcc.h> +#include <dt-bindings/media/qcom,glymur-iris.h> #include <dt-bindings/phy/phy-qcom-qmp.h> #include <dt-bindings/power/qcom,rpmhpd.h> #include <dt-bindings/power/qcom-rpmpd.h>@@ -4163,6 +4164,123 @@ usb_mp: usb@a400000 { status = "disabled"; }; + iris: video-codec@aa00000 { + compatible = "qcom,glymur-iris"; + reg = <0x0 0xaa00000 0x0 0xf0000>; + + clocks = <&gcc GCC_VIDEO_AXI0_CLK>, + <&videocc VIDEO_CC_MVS0C_CLK>, + <&videocc VIDEO_CC_MVS0_CLK>,
arch/arm64/boot/dts/qcom/glymur.dtsi usb_mp: usb@a400000 { · line 4183
Quoted 10 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +10
-0+ <&gcc GCC_VIDEO_AXI0C_CLK>, + <&videocc VIDEO_CC_MVS0C_FREERUN_CLK>, + <&videocc VIDEO_CC_MVS0_FREERUN_CLK>, + <&gcc GCC_VIDEO_AXI1_CLK>, + <&videocc VIDEO_CC_MVS1_CLK>, + <&videocc VIDEO_CC_MVS1_FREERUN_CLK>; + clock-names = "iface", + "core", + "vcodec0_core", + "iface1",
I first wrote the comment regarding resets. But the clocks seem to have the same pattern. It's not just "iface1" clock. It's the clock for one of the cores. And there is another clock for another core. Please make that nicely named.
Quoted 37 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +37
-0+ "core_freerun", + "vcodec0_core_freerun", + "iface2", + "vcodec1_core", + "vcodec1_core_freerun"; + + dma-coherent; + + interconnects = <&hsc_noc MASTER_APPSS_PROC QCOM_ICC_TAG_ACTIVE_ONLY + &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, + <&mmss_noc MASTER_VIDEO QCOM_ICC_TAG_ALWAYS + &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>; + interconnect-names = "cpu-cfg", + "video-mem"; + + interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; + + iommus = <&apps_smmu 0x1940 0x0>, + <&apps_smmu 0x1943 0x0>, + <&apps_smmu 0x1944 0x0>, + <&apps_smmu 0x19e0 0x0>; + + iommu-map = <IOMMU_FID_IRIS_FIRMWARE &apps_smmu 0x19e2 0x1>; + + memory-region = <&video_mem>; + + operating-points-v2 = <&iris_opp_table>; + + power-domains = <&videocc VIDEO_CC_MVS0C_GDSC>, + <&videocc VIDEO_CC_MVS0_GDSC>, + <&rpmhpd RPMHPD_MXC>, + <&rpmhpd RPMHPD_MMCX>, + <&videocc VIDEO_CC_MVS1_GDSC>; + power-domain-names = "venus", + "vcodec0", + "mxc", + "mmcx",
arch/arm64/boot/dts/qcom/glymur.dtsi usb_mp: usb@a400000 { · line 4230
Quoted 10 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +10
-0+ "vcodec1"; + + resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>, + <&gcc GCC_VIDEO_AXI0C_CLK_ARES>, + <&videocc VIDEO_CC_MVS0C_FREERUN_CLK_ARES>, + <&videocc VIDEO_CC_MVS0_FREERUN_CLK_ARES>, + <&gcc GCC_VIDEO_AXI1_CLK_ARES>, + <&videocc VIDEO_CC_MVS1_FREERUN_CLK_ARES>; + reset-names = "bus0", + "bus1",
The names of the resets suggest that there is single "common" reset and then one reset per each core.
arch/arm64/boot/dts/qcom/glymur.dtsi usb_mp: usb@a400000 { · line 4234
Quoted 4 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +4
-0+ "core", + "vcodec0_core", + "bus2", + "vcodec1_core";
Are there two codecs? Or are there two cores? Your naming suggests the former case.
Quoted 56 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +49
-0+ + /* + * IRIS firmware is signed by vendors, only + * enable on boards where the proper signed firmware + * is available. + */ + status = "disabled"; + + iris_opp_table: opp-table { + compatible = "operating-points-v2"; + + opp-240000000 { + opp-hz = /bits/ 64 <240000000 240000000 360000000>; + required-opps = <&rpmhpd_opp_svs>, + <&rpmhpd_opp_low_svs>; + }; + + opp-338000000 { + opp-hz = /bits/ 64 <338000000 338000000 507000000>; + required-opps = <&rpmhpd_opp_svs>, + <&rpmhpd_opp_svs>; + }; + + opp-366000000 { + opp-hz = /bits/ 64 <366000000 366000000 549000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_svs_l1>; + }; + + opp-444000000 { + opp-hz = /bits/ 64 <444000000 444000000 666000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_nom>; + }; + + opp-533333334 { + opp-hz = /bits/ 64 <533333334 533333334 800000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_turbo>; + }; + + opp-655000000 { + opp-hz = /bits/ 64 <655000000 655000000 982000000>; + required-opps = <&rpmhpd_opp_nom>, + <&rpmhpd_opp_turbo_l1>; + }; + }; + }; + mdss: display-subsystem@ae00000 { compatible = "qcom,glymur-mdss"; reg = <0x0 0x0ae00000 0x0 0x1000>;Signature · 2 lines
-- 2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 13/14] arm64: dts: qcom: glymur: Add iris video node
Quoted 40 lines · Dmitry Baryshkov
Quoted 39 lines · Vishnu Reddy
Add iris video codec to glymur SoC, which comes with significantly different powering up sequence than previous platforms, thus different clocks and resets.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- arch/arm64/boot/dts/qcom/glymur.dtsi | 118 +++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+)arch/arm64/boot/dts/qcom/glymur.dtsi +14
-0@@ -13,6 +13,7 @@ #include <dt-bindings/interconnect/qcom,glymur-rpmh.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/mailbox/qcom-ipcc.h> +#include <dt-bindings/media/qcom,glymur-iris.h> #include <dt-bindings/phy/phy-qcom-qmp.h> #include <dt-bindings/power/qcom,rpmhpd.h> #include <dt-bindings/power/qcom-rpmpd.h>@@ -4163,6 +4164,123 @@ usb_mp: usb@a400000 { status = "disabled"; }; + iris: video-codec@aa00000 { + compatible = "qcom,glymur-iris"; + reg = <0x0 0xaa00000 0x0 0xf0000>; + + clocks = <&gcc GCC_VIDEO_AXI0_CLK>, + <&videocc VIDEO_CC_MVS0C_CLK>, + <&videocc VIDEO_CC_MVS0_CLK>, + <&gcc GCC_VIDEO_AXI0C_CLK>, + <&videocc VIDEO_CC_MVS0C_FREERUN_CLK>, + <&videocc VIDEO_CC_MVS0_FREERUN_CLK>, + <&gcc GCC_VIDEO_AXI1_CLK>, + <&videocc VIDEO_CC_MVS1_CLK>, + <&videocc VIDEO_CC_MVS1_FREERUN_CLK>;
Quoted 8 lines
arch/arm64/boot/dts/qcom/glymur.dtsi usb_mp: usb@a400000 { · line 4183
Quoted 4 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +4
-0+ clock-names = "iface", + "core", + "vcodec0_core", + "iface1",I first wrote the comment regarding resets. But the clocks seem to have the same pattern. It's not just "iface1" clock. It's the clock for one of the cores. And there is another clock for another core. Please make that nicely named.
In v1, I used iface_ctrl to reflect the clock purpose, but received the feedback [1] to align with the iface1 naming convention used on earlier platforms.
[1] https://lore.kernel.org/all/20260414-lush-reindeer-of-storm-bbe918@quoll/
Quoted 41 lines
Quoted 41 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +41
-0+ "core_freerun", + "vcodec0_core_freerun", + "iface2", + "vcodec1_core", + "vcodec1_core_freerun"; + + dma-coherent; + + interconnects = <&hsc_noc MASTER_APPSS_PROC QCOM_ICC_TAG_ACTIVE_ONLY + &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, + <&mmss_noc MASTER_VIDEO QCOM_ICC_TAG_ALWAYS + &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>; + interconnect-names = "cpu-cfg", + "video-mem"; + + interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; + + iommus = <&apps_smmu 0x1940 0x0>, + <&apps_smmu 0x1943 0x0>, + <&apps_smmu 0x1944 0x0>, + <&apps_smmu 0x19e0 0x0>; + + iommu-map = <IOMMU_FID_IRIS_FIRMWARE &apps_smmu 0x19e2 0x1>; + + memory-region = <&video_mem>; + + operating-points-v2 = <&iris_opp_table>; + + power-domains = <&videocc VIDEO_CC_MVS0C_GDSC>, + <&videocc VIDEO_CC_MVS0_GDSC>, + <&rpmhpd RPMHPD_MXC>, + <&rpmhpd RPMHPD_MMCX>, + <&videocc VIDEO_CC_MVS1_GDSC>; + power-domain-names = "venus", + "vcodec0", + "mxc", + "mmcx", + "vcodec1"; + + resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>, + <&gcc GCC_VIDEO_AXI0C_CLK_ARES>,
Quoted 8 lines
arch/arm64/boot/dts/qcom/glymur.dtsi usb_mp: usb@a400000 { · line 4230
Quoted 6 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +6
-0+ <&videocc VIDEO_CC_MVS0C_FREERUN_CLK_ARES>, + <&videocc VIDEO_CC_MVS0_FREERUN_CLK_ARES>, + <&gcc GCC_VIDEO_AXI1_CLK_ARES>, + <&videocc VIDEO_CC_MVS1_FREERUN_CLK_ARES>; + reset-names = "bus0", + "bus1",The names of the resets suggest that there is single "common" reset and then one reset per each core.
Two resets for controller and two resets for each per vcodec core.
Quoted 6 lines
arch/arm64/boot/dts/qcom/glymur.dtsi usb_mp: usb@a400000 { · line 4234
Quoted 4 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +4
-0+ "core", + "vcodec0_core", + "bus2", + "vcodec1_core";Are there two codecs? Or are there two cores? Your naming suggests the former case.
Two vcodec cores.
Quoted 56 lines
Quoted 56 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +49
-0+ + /* + * IRIS firmware is signed by vendors, only + * enable on boards where the proper signed firmware + * is available. + */ + status = "disabled"; + + iris_opp_table: opp-table { + compatible = "operating-points-v2"; + + opp-240000000 { + opp-hz = /bits/ 64 <240000000 240000000 360000000>; + required-opps = <&rpmhpd_opp_svs>, + <&rpmhpd_opp_low_svs>; + }; + + opp-338000000 { + opp-hz = /bits/ 64 <338000000 338000000 507000000>; + required-opps = <&rpmhpd_opp_svs>, + <&rpmhpd_opp_svs>; + }; + + opp-366000000 { + opp-hz = /bits/ 64 <366000000 366000000 549000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_svs_l1>; + }; + + opp-444000000 { + opp-hz = /bits/ 64 <444000000 444000000 666000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_nom>; + }; + + opp-533333334 { + opp-hz = /bits/ 64 <533333334 533333334 800000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_turbo>; + }; + + opp-655000000 { + opp-hz = /bits/ 64 <655000000 655000000 982000000>; + required-opps = <&rpmhpd_opp_nom>, + <&rpmhpd_opp_turbo_l1>; + }; + }; + }; + mdss: display-subsystem@ae00000 { compatible = "qcom,glymur-mdss"; reg = <0x0 0x0ae00000 0x0 0x1000>;Signature · 2 lines
-- 2.34.1
Re: [PATCH v5 13/14] arm64: dts: qcom: glymur: Add iris video node
Quoted 51 lines · Vishnu Reddy
Quoted 40 lines · Dmitry Baryshkov
Quoted 39 lines · Vishnu Reddy
Add iris video codec to glymur SoC, which comes with significantly different powering up sequence than previous platforms, thus different clocks and resets.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- arch/arm64/boot/dts/qcom/glymur.dtsi | 118 +++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+)arch/arm64/boot/dts/qcom/glymur.dtsi +14
-0@@ -13,6 +13,7 @@ #include <dt-bindings/interconnect/qcom,glymur-rpmh.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/mailbox/qcom-ipcc.h> +#include <dt-bindings/media/qcom,glymur-iris.h> #include <dt-bindings/phy/phy-qcom-qmp.h> #include <dt-bindings/power/qcom,rpmhpd.h> #include <dt-bindings/power/qcom-rpmpd.h>@@ -4163,6 +4164,123 @@ usb_mp: usb@a400000 { status = "disabled"; }; + iris: video-codec@aa00000 { + compatible = "qcom,glymur-iris"; + reg = <0x0 0xaa00000 0x0 0xf0000>; + + clocks = <&gcc GCC_VIDEO_AXI0_CLK>, + <&videocc VIDEO_CC_MVS0C_CLK>, + <&videocc VIDEO_CC_MVS0_CLK>, + <&gcc GCC_VIDEO_AXI0C_CLK>, + <&videocc VIDEO_CC_MVS0C_FREERUN_CLK>, + <&videocc VIDEO_CC_MVS0_FREERUN_CLK>, + <&gcc GCC_VIDEO_AXI1_CLK>, + <&videocc VIDEO_CC_MVS1_CLK>, + <&videocc VIDEO_CC_MVS1_FREERUN_CLK>;Quoted 8 lines
arch/arm64/boot/dts/qcom/glymur.dtsi usb_mp: usb@a400000 { · line 4183
Quoted 4 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +4
-0+ clock-names = "iface", + "core", + "vcodec0_core", + "iface1",I first wrote the comment regarding resets. But the clocks seem to have the same pattern. It's not just "iface1" clock. It's the clock for one of the cores. And there is another clock for another core. Please make that nicely named.
Quoted 5 lines
In v1, I used
iface_ctrlto reflect the clock purpose, but received the feedback [1] to align with the iface1 naming convention used on earlier platforms.[1] https://lore.kernel.org/all/20260414-lush-reindeer-of-storm-bbe918@quoll/
I'd also dislike the iface_ctrl, it doesn't say anything.
I'd suggest having vcodec0_iface / vcodec1_iface for vcodecs and just iface for the core AXI clock.
Quoted 51 lines
Quoted 42 lines
Quoted 42 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +41
-0+ "core_freerun", + "vcodec0_core_freerun", + "iface2", + "vcodec1_core", + "vcodec1_core_freerun"; + + dma-coherent; + + interconnects = <&hsc_noc MASTER_APPSS_PROC QCOM_ICC_TAG_ACTIVE_ONLY + &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, + <&mmss_noc MASTER_VIDEO QCOM_ICC_TAG_ALWAYS + &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>; + interconnect-names = "cpu-cfg", + "video-mem"; + + interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; + + iommus = <&apps_smmu 0x1940 0x0>, + <&apps_smmu 0x1943 0x0>, + <&apps_smmu 0x1944 0x0>, + <&apps_smmu 0x19e0 0x0>; + + iommu-map = <IOMMU_FID_IRIS_FIRMWARE &apps_smmu 0x19e2 0x1>; + + memory-region = <&video_mem>; + + operating-points-v2 = <&iris_opp_table>; + + power-domains = <&videocc VIDEO_CC_MVS0C_GDSC>, + <&videocc VIDEO_CC_MVS0_GDSC>, + <&rpmhpd RPMHPD_MXC>, + <&rpmhpd RPMHPD_MMCX>, + <&videocc VIDEO_CC_MVS1_GDSC>; + power-domain-names = "venus", + "vcodec0", + "mxc", + "mmcx", + "vcodec1"; + + resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>, + <&gcc GCC_VIDEO_AXI0C_CLK_ARES>,Quoted 8 lines
arch/arm64/boot/dts/qcom/glymur.dtsi usb_mp: usb@a400000 { · line 4230
Quoted 6 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +6
-0+ <&videocc VIDEO_CC_MVS0C_FREERUN_CLK_ARES>, + <&videocc VIDEO_CC_MVS0_FREERUN_CLK_ARES>, + <&gcc GCC_VIDEO_AXI1_CLK_ARES>, + <&videocc VIDEO_CC_MVS1_FREERUN_CLK_ARES>; + reset-names = "bus0", + "bus1",The names of the resets suggest that there is single "common" reset and then one reset per each core.
Quoted 1 line
Two resets for controller and two resets for each per vcodec core.
The same, vcodec0_bus, vcodec1_bus, please.
Quoted 66 lines
Quoted 7 lines
arch/arm64/boot/dts/qcom/glymur.dtsi usb_mp: usb@a400000 { · line 4234
Quoted 5 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +4
-0+ "core", + "vcodec0_core", + "bus2", + "vcodec1_core";Are there two codecs? Or are there two cores? Your naming suggests the former case.
Two vcodec cores.
Quoted 56 lines
Quoted 56 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +49
-0+ + /* + * IRIS firmware is signed by vendors, only + * enable on boards where the proper signed firmware + * is available. + */ + status = "disabled"; + + iris_opp_table: opp-table { + compatible = "operating-points-v2"; + + opp-240000000 { + opp-hz = /bits/ 64 <240000000 240000000 360000000>; + required-opps = <&rpmhpd_opp_svs>, + <&rpmhpd_opp_low_svs>; + }; + + opp-338000000 { + opp-hz = /bits/ 64 <338000000 338000000 507000000>; + required-opps = <&rpmhpd_opp_svs>, + <&rpmhpd_opp_svs>; + }; + + opp-366000000 { + opp-hz = /bits/ 64 <366000000 366000000 549000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_svs_l1>; + }; + + opp-444000000 { + opp-hz = /bits/ 64 <444000000 444000000 666000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_nom>; + }; + + opp-533333334 { + opp-hz = /bits/ 64 <533333334 533333334 800000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_turbo>; + }; + + opp-655000000 { + opp-hz = /bits/ 64 <655000000 655000000 982000000>; + required-opps = <&rpmhpd_opp_nom>, + <&rpmhpd_opp_turbo_l1>; + }; + }; + }; + mdss: display-subsystem@ae00000 { compatible = "qcom,glymur-mdss"; reg = <0x0 0x0ae00000 0x0 0x1000>;Signature · 2 lines
-- 2.34.1
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v5 13/14] arm64: dts: qcom: glymur: Add iris video node
Quoted 54 lines · Dmitry Baryshkov
Quoted 53 lines · Vishnu Reddy
Quoted 40 lines · Dmitry Baryshkov
Quoted 39 lines · Vishnu Reddy
Add iris video codec to glymur SoC, which comes with significantly different powering up sequence than previous platforms, thus different clocks and resets.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- arch/arm64/boot/dts/qcom/glymur.dtsi | 118 +++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+)arch/arm64/boot/dts/qcom/glymur.dtsi +14
-0@@ -13,6 +13,7 @@ #include <dt-bindings/interconnect/qcom,glymur-rpmh.h> #include <dt-bindings/interrupt-controller/arm-gic.h> #include <dt-bindings/mailbox/qcom-ipcc.h> +#include <dt-bindings/media/qcom,glymur-iris.h> #include <dt-bindings/phy/phy-qcom-qmp.h> #include <dt-bindings/power/qcom,rpmhpd.h> #include <dt-bindings/power/qcom-rpmpd.h>@@ -4163,6 +4164,123 @@ usb_mp: usb@a400000 { status = "disabled"; }; + iris: video-codec@aa00000 { + compatible = "qcom,glymur-iris"; + reg = <0x0 0xaa00000 0x0 0xf0000>; + + clocks = <&gcc GCC_VIDEO_AXI0_CLK>, + <&videocc VIDEO_CC_MVS0C_CLK>, + <&videocc VIDEO_CC_MVS0_CLK>, + <&gcc GCC_VIDEO_AXI0C_CLK>, + <&videocc VIDEO_CC_MVS0C_FREERUN_CLK>, + <&videocc VIDEO_CC_MVS0_FREERUN_CLK>, + <&gcc GCC_VIDEO_AXI1_CLK>, + <&videocc VIDEO_CC_MVS1_CLK>, + <&videocc VIDEO_CC_MVS1_FREERUN_CLK>;Quoted 8 lines
arch/arm64/boot/dts/qcom/glymur.dtsi usb_mp: usb@a400000 { · line 4183
Quoted 4 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +4
-0+ clock-names = "iface", + "core", + "vcodec0_core", + "iface1",I first wrote the comment regarding resets. But the clocks seem to have the same pattern. It's not just "iface1" clock. It's the clock for one of the cores. And there is another clock for another core. Please make that nicely named.
In v1, I used
iface_ctrlto reflect the clock purpose, but received the feedback [1] to align with the iface1 naming convention used on earlier platforms.
Quoted 5 lines
I'd also dislike the
iface_ctrl, it doesn't say anything.I'd suggest having
vcodec0_iface/vcodec1_ifacefor vcodecs and just iface for the core AXI clock.
These changes would also need to be reflected in the DT binding document. The current names are carried over from earlier platform targets as legacy names, and in v1 Krzysztof suggested [1] using an earlier series as a base and building on top of it — so I followed the same approach.
[1] https://lore.kernel.org/all/20260414-lush-reindeer-of-storm-bbe918@quoll/
Krzysztof, do you have any input on renaming these names?
Quoted 116 lines
Quoted 49 lines
Quoted 41 lines
Quoted 41 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +41
-0+ "core_freerun", + "vcodec0_core_freerun", + "iface2", + "vcodec1_core", + "vcodec1_core_freerun"; + + dma-coherent; + + interconnects = <&hsc_noc MASTER_APPSS_PROC QCOM_ICC_TAG_ACTIVE_ONLY + &config_noc SLAVE_VENUS_CFG QCOM_ICC_TAG_ACTIVE_ONLY>, + <&mmss_noc MASTER_VIDEO QCOM_ICC_TAG_ALWAYS + &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>; + interconnect-names = "cpu-cfg", + "video-mem"; + + interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>; + + iommus = <&apps_smmu 0x1940 0x0>, + <&apps_smmu 0x1943 0x0>, + <&apps_smmu 0x1944 0x0>, + <&apps_smmu 0x19e0 0x0>; + + iommu-map = <IOMMU_FID_IRIS_FIRMWARE &apps_smmu 0x19e2 0x1>; + + memory-region = <&video_mem>; + + operating-points-v2 = <&iris_opp_table>; + + power-domains = <&videocc VIDEO_CC_MVS0C_GDSC>, + <&videocc VIDEO_CC_MVS0_GDSC>, + <&rpmhpd RPMHPD_MXC>, + <&rpmhpd RPMHPD_MMCX>, + <&videocc VIDEO_CC_MVS1_GDSC>; + power-domain-names = "venus", + "vcodec0", + "mxc", + "mmcx", + "vcodec1"; + + resets = <&gcc GCC_VIDEO_AXI0_CLK_ARES>, + <&gcc GCC_VIDEO_AXI0C_CLK_ARES>,Quoted 8 lines
arch/arm64/boot/dts/qcom/glymur.dtsi usb_mp: usb@a400000 { · line 4230
Quoted 6 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +6
-0+ <&videocc VIDEO_CC_MVS0C_FREERUN_CLK_ARES>, + <&videocc VIDEO_CC_MVS0_FREERUN_CLK_ARES>, + <&gcc GCC_VIDEO_AXI1_CLK_ARES>, + <&videocc VIDEO_CC_MVS1_FREERUN_CLK_ARES>; + reset-names = "bus0", + "bus1",The names of the resets suggest that there is single "common" reset and then one reset per each core.
Quoted 1 line
Two resets for controller and two resets for each per vcodec core.
The same,
vcodec0_bus,vcodec1_bus, please.Quoted 64 lines
Quoted 6 lines
arch/arm64/boot/dts/qcom/glymur.dtsi usb_mp: usb@a400000 { · line 4234
Quoted 4 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +4
-0+ "core", + "vcodec0_core", + "bus2", + "vcodec1_core";Are there two codecs? Or are there two cores? Your naming suggests the former case.
Two vcodec cores.
Quoted 56 lines
Quoted 56 lines
arch/arm64/boot/dts/qcom/glymur.dtsi +49
-0+ + /* + * IRIS firmware is signed by vendors, only + * enable on boards where the proper signed firmware + * is available. + */ + status = "disabled"; + + iris_opp_table: opp-table { + compatible = "operating-points-v2"; + + opp-240000000 { + opp-hz = /bits/ 64 <240000000 240000000 360000000>; + required-opps = <&rpmhpd_opp_svs>, + <&rpmhpd_opp_low_svs>; + }; + + opp-338000000 { + opp-hz = /bits/ 64 <338000000 338000000 507000000>; + required-opps = <&rpmhpd_opp_svs>, + <&rpmhpd_opp_svs>; + }; + + opp-366000000 { + opp-hz = /bits/ 64 <366000000 366000000 549000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_svs_l1>; + }; + + opp-444000000 { + opp-hz = /bits/ 64 <444000000 444000000 666000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_nom>; + }; + + opp-533333334 { + opp-hz = /bits/ 64 <533333334 533333334 800000000>; + required-opps = <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_turbo>; + }; + + opp-655000000 { + opp-hz = /bits/ 64 <655000000 655000000 982000000>; + required-opps = <&rpmhpd_opp_nom>, + <&rpmhpd_opp_turbo_l1>; + }; + }; + }; + mdss: display-subsystem@ae00000 { compatible = "qcom,glymur-mdss"; reg = <0x0 0x0ae00000 0x0 0x1000>;Signature · 2 lines
-- 2.34.1
PATCH v5 14/14 arm64: dts: qcom: glymur-crd: Enable iris video codec node
In reply to Vishnu ReddyThe iris hardware block is described in the glymur SoC DTSI, and enabling it here allows the media iris driver to probe and use the video codec functionality.
--- arch/arm64/boot/dts/qcom/glymur-crd.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/qcom/glymur-crd.dts +4 -0
@@ -198,6 +198,10 @@ ptn3222_1: redriver@47 { }; }; +&iris { + status = "okay"; +}; + &mdss { status = "okay"; };
Signature · 1 line
2.34.1
Re: [PATCH v5 14/14] arm64: dts: qcom: glymur-crd: Enable iris video codec node
Quoted 10 lines · Vishnu Reddy
The iris hardware block is described in the glymur SoC DTSI, and enabling it here allows the media iris driver to probe and use the video codec functionality.
Reviewed-by Vikash Garodia <[email protected]>Signed-off-by Vishnu Reddy <[email protected]>--- arch/arm64/boot/dts/qcom/glymur-crd.dts | 4 ++++ 1 file changed, 4 insertions(+)
Signature · 2 lines
With best wishes Dmitry