]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: iris: Add support for multiple TZ content protection(CP) configs
authorVikash Garodia <vikash.garodia@oss.qualcomm.com>
Wed, 10 Dec 2025 12:36:00 +0000 (18:06 +0530)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 20 Jan 2026 15:22:24 +0000 (16:22 +0100)
vpu4 needs an additional configuration with respect to CP regions. Make
the CP configuration as array such that the multiple configuration can be
managed per platform.

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Co-developed-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
Signed-off-by: Vishnu Reddy <busanna.reddy@oss.qualcomm.com>
Signed-off-by: Vikash Garodia <vikash.garodia@oss.qualcomm.com>
Reviewed-by: Dikshita Agarwal <dikshita.agarwal@oss.qualcomm.com>
Signed-off-by: Bryan O'Donoghue <bod@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/qcom/iris/iris_firmware.c
drivers/media/platform/qcom/iris/iris_platform_common.h
drivers/media/platform/qcom/iris/iris_platform_gen1.c
drivers/media/platform/qcom/iris/iris_platform_gen2.c

index 679444327ed73a40c5cacd36f4156fc94c9ca45f..5f408024e967fd21ade66cc3fa377d8507f9002e 100644 (file)
@@ -64,9 +64,9 @@ err_release_fw:
 
 int iris_fw_load(struct iris_core *core)
 {
-       struct tz_cp_config *cp_config = core->iris_platform_data->tz_cp_config_data;
+       const struct tz_cp_config *cp_config;
        const char *fwpath = NULL;
-       int ret;
+       int i, ret;
 
        ret = of_property_read_string_index(core->dev->of_node, "firmware-name", 0,
                                            &fwpath);
@@ -85,14 +85,17 @@ int iris_fw_load(struct iris_core *core)
                return ret;
        }
 
-       ret = qcom_scm_mem_protect_video_var(cp_config->cp_start,
-                                            cp_config->cp_size,
-                                            cp_config->cp_nonpixel_start,
-                                            cp_config->cp_nonpixel_size);
-       if (ret) {
-               dev_err(core->dev, "protect memory failed\n");
-               qcom_scm_pas_shutdown(core->iris_platform_data->pas_id);
-               return ret;
+       for (i = 0; i < core->iris_platform_data->tz_cp_config_data_size; i++) {
+               cp_config = &core->iris_platform_data->tz_cp_config_data[i];
+               ret = qcom_scm_mem_protect_video_var(cp_config->cp_start,
+                                                    cp_config->cp_size,
+                                                    cp_config->cp_nonpixel_start,
+                                                    cp_config->cp_nonpixel_size);
+               if (ret) {
+                       dev_err(core->dev, "qcom_scm_mem_protect_video_var failed: %d\n", ret);
+                       qcom_scm_pas_shutdown(core->iris_platform_data->pas_id);
+                       return ret;
+               }
        }
 
        return ret;
index 222bd7d629ce9e1c02e4180e5876347275f8f4af..f215abcd36ebca59b800ba52c733c2087bcc97f2 100644 (file)
@@ -237,7 +237,8 @@ struct iris_platform_data {
        u32 inst_fw_caps_dec_size;
        const struct platform_inst_fw_cap *inst_fw_caps_enc;
        u32 inst_fw_caps_enc_size;
-       struct tz_cp_config *tz_cp_config_data;
+       const struct tz_cp_config *tz_cp_config_data;
+       u32 tz_cp_config_data_size;
        u32 core_arch;
        u32 hw_response_timeout;
        struct ubwc_config_data *ubwc_config;
index 7abd18be3549fe10d96e9caf4dd00c5b22cffa81..df8e6bf9430ed2a070e092edae9ef998d092cb5e 100644 (file)
@@ -294,11 +294,13 @@ static const char * const sm8250_opp_clk_table[] = {
        NULL,
 };
 
-static struct tz_cp_config tz_cp_config_sm8250 = {
-       .cp_start = 0,
-       .cp_size = 0x25800000,
-       .cp_nonpixel_start = 0x01000000,
-       .cp_nonpixel_size = 0x24800000,
+static const struct tz_cp_config tz_cp_config_sm8250[] = {
+       {
+               .cp_start = 0,
+               .cp_size = 0x25800000,
+               .cp_nonpixel_start = 0x01000000,
+               .cp_nonpixel_size = 0x24800000,
+       },
 };
 
 static const u32 sm8250_vdec_input_config_param_default[] = {
@@ -366,7 +368,8 @@ const struct iris_platform_data sm8250_data = {
        .inst_fw_caps_dec_size = ARRAY_SIZE(inst_fw_cap_sm8250_dec),
        .inst_fw_caps_enc = inst_fw_cap_sm8250_enc,
        .inst_fw_caps_enc_size = ARRAY_SIZE(inst_fw_cap_sm8250_enc),
-       .tz_cp_config_data = &tz_cp_config_sm8250,
+       .tz_cp_config_data = tz_cp_config_sm8250,
+       .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_sm8250),
        .hw_response_timeout = HW_RESPONSE_TIMEOUT_VALUE,
        .num_vpp_pipe = 4,
        .max_session_count = 16,
@@ -418,7 +421,8 @@ const struct iris_platform_data sc7280_data = {
        .inst_fw_caps_dec_size = ARRAY_SIZE(inst_fw_cap_sm8250_dec),
        .inst_fw_caps_enc = inst_fw_cap_sm8250_enc,
        .inst_fw_caps_enc_size = ARRAY_SIZE(inst_fw_cap_sm8250_enc),
-       .tz_cp_config_data = &tz_cp_config_sm8250,
+       .tz_cp_config_data = tz_cp_config_sm8250,
+       .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_sm8250),
        .hw_response_timeout = HW_RESPONSE_TIMEOUT_VALUE,
        .num_vpp_pipe = 1,
        .no_aon = true,
index cc242e56de7f1cfb237b9847bc52a6a1aa5aa819..5da90d47f9c6eab4a7e6b17841fdc0e599397bf7 100644 (file)
@@ -800,11 +800,13 @@ static struct ubwc_config_data ubwc_config_sm8550 = {
        .bank_spreading = 1,
 };
 
-static struct tz_cp_config tz_cp_config_sm8550 = {
-       .cp_start = 0,
-       .cp_size = 0x25800000,
-       .cp_nonpixel_start = 0x01000000,
-       .cp_nonpixel_size = 0x24800000,
+static const struct tz_cp_config tz_cp_config_sm8550[] = {
+       {
+               .cp_start = 0,
+               .cp_size = 0x25800000,
+               .cp_nonpixel_start = 0x01000000,
+               .cp_nonpixel_size = 0x24800000,
+       },
 };
 
 static const u32 sm8550_vdec_input_config_params_default[] = {
@@ -950,7 +952,8 @@ const struct iris_platform_data sm8550_data = {
        .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 = &tz_cp_config_sm8550,
+       .tz_cp_config_data = tz_cp_config_sm8550,
+       .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_sm8550),
        .core_arch = VIDEO_ARCH_LX,
        .hw_response_timeout = HW_RESPONSE_TIMEOUT_VALUE,
        .ubwc_config = &ubwc_config_sm8550,
@@ -1054,7 +1057,8 @@ const struct iris_platform_data sm8650_data = {
        .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 = &tz_cp_config_sm8550,
+       .tz_cp_config_data = tz_cp_config_sm8550,
+       .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_sm8550),
        .core_arch = VIDEO_ARCH_LX,
        .hw_response_timeout = HW_RESPONSE_TIMEOUT_VALUE,
        .ubwc_config = &ubwc_config_sm8550,
@@ -1149,7 +1153,8 @@ const struct iris_platform_data sm8750_data = {
        .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 = &tz_cp_config_sm8550,
+       .tz_cp_config_data = tz_cp_config_sm8550,
+       .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_sm8550),
        .core_arch = VIDEO_ARCH_LX,
        .hw_response_timeout = HW_RESPONSE_TIMEOUT_VALUE,
        .ubwc_config = &ubwc_config_sm8550,
@@ -1248,7 +1253,8 @@ const struct iris_platform_data qcs8300_data = {
        .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 = &tz_cp_config_sm8550,
+       .tz_cp_config_data = tz_cp_config_sm8550,
+       .tz_cp_config_data_size = ARRAY_SIZE(tz_cp_config_sm8550),
        .core_arch = VIDEO_ARCH_LX,
        .hw_response_timeout = HW_RESPONSE_TIMEOUT_VALUE,
        .ubwc_config = &ubwc_config_sm8550,