Browse Source

Merge "video: driver: Update ssr type specific to target"

qctecmdr 1 năm trước cách đây
mục cha
commit
6acdf52427

+ 12 - 1
driver/platform/kalama/src/msm_vidc_kalama.c

@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <dt-bindings/clock/qcom,gcc-kalama.h>
@@ -2696,6 +2696,13 @@ static const u32 kalama_vdec_output_properties_av1[] = {
 	HFI_PROP_FENCE,
 };
 
+static const u32 kalama_msm_vidc_ssr_type[] = {
+	HFI_SSR_TYPE_SW_ERR_FATAL,
+	HFI_SSR_TYPE_SW_DIV_BY_ZERO,
+	HFI_SSR_TYPE_CPU_WDOG_IRQ,
+	HFI_SSR_TYPE_NOC_ERROR,
+};
+
 static const struct msm_vidc_platform_data kalama_data = {
 	/* resources dependent on other module */
 	.bw_tbl = kalama_bw_table,
@@ -2760,6 +2767,10 @@ static const struct msm_vidc_platform_data kalama_data = {
 	.dec_output_prop_size_hevc = ARRAY_SIZE(kalama_vdec_output_properties_hevc),
 	.dec_output_prop_size_vp9 = ARRAY_SIZE(kalama_vdec_output_properties_vp9),
 	.dec_output_prop_size_av1 = ARRAY_SIZE(kalama_vdec_output_properties_av1),
+
+	.msm_vidc_ssr_type = kalama_msm_vidc_ssr_type,
+	.msm_vidc_ssr_type_size = ARRAY_SIZE(kalama_msm_vidc_ssr_type),
+
 };
 
 static const struct msm_vidc_platform_data kalama_data_v2 = {

+ 11 - 1
driver/platform/waipio/src/waipio.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/of.h>
@@ -1744,6 +1744,13 @@ static const u32 waipio_vdec_output_properties_vp9[] = {
 	HFI_PROP_FENCE,
 };
 
+static const u32 waipio_msm_vidc_ssr_type[] = {
+	HFI_SSR_TYPE_SW_ERR_FATAL,
+	HFI_SSR_TYPE_SW_DIV_BY_ZERO,
+	HFI_SSR_TYPE_CPU_WDOG_IRQ,
+	HFI_SSR_TYPE_NOC_ERROR,
+};
+
 static const struct msm_vidc_platform_data waipio_data = {
 	/* resources dependent on other module */
 	.bw_tbl = waipio_bw_table,
@@ -1806,6 +1813,9 @@ static const struct msm_vidc_platform_data waipio_data = {
 	.dec_output_prop_size_avc = ARRAY_SIZE(waipio_vdec_output_properties_avc),
 	.dec_output_prop_size_hevc = ARRAY_SIZE(waipio_vdec_output_properties_hevc),
 	.dec_output_prop_size_vp9 = ARRAY_SIZE(waipio_vdec_output_properties_vp9),
+
+	.msm_vidc_ssr_type = waipio_msm_vidc_ssr_type,
+	.msm_vidc_ssr_type_size = ARRAY_SIZE(waipio_msm_vidc_ssr_type),
 };
 
 static int msm_vidc_init_data(struct msm_vidc_core *core)

+ 2 - 1
driver/vidc/inc/msm_vidc_driver.h

@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #ifndef _MSM_VIDC_DRIVER_H_
@@ -617,6 +617,7 @@ int msm_vidc_get_frame_rate(struct msm_vidc_inst *inst);
 int msm_vidc_get_operating_rate(struct msm_vidc_inst *inst);
 int msm_vidc_alloc_and_queue_input_internal_buffers(struct msm_vidc_inst *inst);
 int vb2_buffer_to_driver(struct vb2_buffer *vb2, struct msm_vidc_buffer *buf);
+bool is_ssr_type_allowed(struct msm_vidc_core *core, u32 type);
 struct msm_vidc_buffer *msm_vidc_fetch_buffer(struct msm_vidc_inst *inst,
 					      struct vb2_buffer *vb2);
 struct context_bank_info

+ 1 - 2
driver/vidc/inc/venus_hfi.h

@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #ifndef _VENUS_HFI_H_
@@ -65,7 +65,6 @@ int venus_hfi_core_init(struct msm_vidc_core *core);
 int venus_hfi_core_deinit(struct msm_vidc_core *core, bool force);
 int venus_hfi_noc_error_info(struct msm_vidc_core *core);
 int venus_hfi_suspend(struct msm_vidc_core *core);
-bool is_ssr_type_allowed(struct msm_vidc_core *core, u32 type);
 int venus_hfi_trigger_ssr(struct msm_vidc_core *core, u32 type,
 			  u32 client_id, u32 addr);
 int venus_hfi_trigger_stability(struct msm_vidc_inst *inst, u32 type,

+ 19 - 0
driver/vidc/src/msm_vidc_driver.c

@@ -4054,6 +4054,19 @@ int msm_vidc_smmu_fault_handler(struct iommu_domain *domain,
 	return -ENOSYS;
 }
 
+bool is_ssr_type_allowed(struct msm_vidc_core *core, u32 type)
+{
+	u32 i;
+	const u32 *ssr_type = core->platform->data.msm_vidc_ssr_type;
+	u32 ssr_type_size = core->platform->data.msm_vidc_ssr_type_size;
+
+	for (i = 0; i < ssr_type_size; i++) {
+		if (type == ssr_type[i])
+			return true;
+	}
+	return false;
+}
+
 int msm_vidc_trigger_ssr(struct msm_vidc_core *core,
 		u64 trigger_ssr_val)
 {
@@ -4069,6 +4082,12 @@ int msm_vidc_trigger_ssr(struct msm_vidc_core *core,
 	 */
 	d_vpr_e("%s: trigger ssr is called. trigger ssr val: %#llx\n",
 		__func__, trigger_ssr_val);
+
+	if (!is_ssr_type_allowed(core, trigger_ssr_val)) {
+		d_vpr_h("SSR Type %#llx is not allowed\n", trigger_ssr_val);
+		return 0;
+	}
+
 	ssr->ssr_type = (trigger_ssr_val &
 			(unsigned long)SSR_TYPE) >> SSR_TYPE_SHIFT;
 	ssr->sub_client_id = (trigger_ssr_val &

+ 1 - 19
driver/vidc/src/venus_hfi.c

@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/iommu.h>
@@ -922,30 +922,12 @@ int venus_hfi_suspend(struct msm_vidc_core *core)
 	return rc;
 }
 
-bool is_ssr_type_allowed(struct msm_vidc_core *core, u32 type)
-{
-	u32 i;
-	const u32 *ssr_type = core->platform->data.msm_vidc_ssr_type;
-	u32 ssr_type_size = core->platform->data.msm_vidc_ssr_type_size;
-
-	for (i = 0; i < ssr_type_size; i++) {
-		if (type == ssr_type[i])
-			return true;
-	}
-	return false;
-}
-
 int venus_hfi_trigger_ssr(struct msm_vidc_core *core, u32 type,
 	u32 client_id, u32 addr)
 {
 	int rc = 0;
 	u32 payload[2];
 
-	if (!is_ssr_type_allowed(core, type)) {
-		d_vpr_h("SSR Type %d is not allowed\n", type);
-		return rc;
-	}
-
 	/*
 	 * call resume before preparing ssr hfi packet in core->packet
 	 * otherwise ssr hfi packet in core->packet will be overwritten