فهرست منبع

msm: camera: csiphy: Fix misc seccam integration issues

The current secure camera implementation suffers with a few
issues in terms of typecasting, error handling and in
populating the information in the right data structures when
the new SCM API is used on the targets without domain ID support.
In addition, we needed to be explicit in failing to acquire
if dual IFE is required in secure camera use cases as it is
not a supported feature as of now.

CRs-Fixed: 3317248
Change-Id: Idb762158b0ff0e0a0d6d51de4770fc3d9d9072c8
Signed-off-by: Vijay Kumar Tumati <[email protected]>
Vijay Kumar Tumati 2 سال پیش
والد
کامیت
bae0381f76

+ 7 - 0
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

@@ -5350,6 +5350,13 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)
 			}
 		}
 
+		if (in_port[i].usage_type && in_port[i].secure_mode) {
+			CAM_ERR(CAM_ISP,
+				"Dual IFE mode is not supported in secure camera usecases");
+			rc = -EINVAL;
+			goto free_mem;
+		}
+
 		cam_ife_hw_mgr_preprocess_port(ife_ctx, &in_port[i]);
 		total_pix_port += in_port[i].ipp_count +
 					in_port[i].ife_rd_count +

+ 2 - 4
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c

@@ -26,6 +26,7 @@
 #include "cam_cdm_util.h"
 #include "cam_common_util.h"
 #include "cam_subdev.h"
+#include "cam_compat.h"
 
 /* CSIPHY TPG VC/DT values */
 #define CAM_IFE_CPHY_TPG_VC_VAL                         0x0
@@ -4720,9 +4721,6 @@ static void cam_ife_csid_ver2_send_secure_info(
 	secure_info.vc_mask = 0;
 	secure_info.csid_hw_idx_mask = BIT(csid_hw->hw_intf->hw_idx);
 
-	if (csid_hw->sync_mode == CAM_ISP_HW_SYNC_MASTER)
-		secure_info.csid_hw_idx_mask |= BIT(csid_hw->dual_core_idx);
-
 	CAM_DBG(CAM_ISP,
 		"PHY secure info for CSID[%u], lane_cfg: 0x%x, ife: 0x%x, cdm: 0x%x, vc_mask: 0x%llx",
 		csid_hw->hw_intf->hw_idx,
@@ -4877,7 +4875,7 @@ int cam_ife_csid_ver2_start(void *hw_priv, void *args,
 	 */
 	if ((csid_hw->sync_mode != CAM_ISP_HW_SYNC_SLAVE) &&
 		start_args->is_secure &&
-		csid_hw->flags.domain_id_security)
+		cam_is_mink_api_available())
 		cam_ife_csid_ver2_send_secure_info(start_args, csid_hw);
 
 	/*

+ 1 - 1
drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.h

@@ -552,7 +552,7 @@ struct cam_ife_csid_ver2_common_reg_info {
 struct cam_ife_csid_secure_info {
 	uint32_t phy_sel;
 	uint32_t lane_cfg;
-	uint32_t vc_mask;
+	uint64_t vc_mask;
 	uint32_t csid_hw_idx_mask;
 	uint32_t cdm_hw_idx_mask;
 };

+ 4 - 4
drivers/cam_sensor_module/cam_csiphy/cam_csiphy_core.c

@@ -482,8 +482,8 @@ static int cam_csiphy_update_secure_info(struct csiphy_device *csiphy_dev, int32
 	uint32_t cpas_version;
 	int rc;
 
-	if (csiphy_dev->domain_id_security) {
-		CAM_DBG(CAM_CSIPHY, "Domain ID scheme for CSIPHY [%u], skipping legacy update",
+	if (cam_is_mink_api_available()) {
+		CAM_DBG(CAM_CSIPHY, "Using MINK API for CSIPHY [%u], skipping legacy update",
 			csiphy_dev->soc_info.index);
 
 		return 0;
@@ -2502,7 +2502,7 @@ int32_t cam_csiphy_core_cfg(void *phy_dev,
 
 				rc = cam_csiphy_program_secure_mode(csiphy_dev,
 					CAM_SECURE_MODE_SECURE, offset);
-				if (rc < 0) {
+				if (rc) {
 					csiphy_dev->csiphy_info[offset]
 						.secure_mode =
 						CAM_SECURE_MODE_NON_SECURE;
@@ -2570,7 +2570,7 @@ int32_t cam_csiphy_core_cfg(void *phy_dev,
 			rc = cam_csiphy_program_secure_mode(
 				csiphy_dev,
 				CAM_SECURE_MODE_SECURE, offset);
-			if (rc < 0) {
+			if (rc) {
 				csiphy_dev->csiphy_info[offset].secure_mode =
 					CAM_SECURE_MODE_NON_SECURE;
 				goto cpas_stop;

+ 1 - 1
drivers/cam_sensor_module/cam_csiphy/cam_csiphy_dev.h

@@ -118,7 +118,7 @@ enum cam_csiphy_common_reg_program {
 struct cam_csiphy_secure_info {
 	uint32_t phy_lane_sel_mask;
 	uint32_t lane_assign;
-	uint32_t vc_mask;
+	uint64_t vc_mask;
 	uint32_t csid_hw_idx_mask;
 	uint32_t cdm_hw_idx_mask;
 };

+ 8 - 0
drivers/cam_utils/cam_compat.c

@@ -272,6 +272,14 @@ void cam_free_clear(const void * ptr)
 }
 #endif
 
+bool cam_is_mink_api_available(void)
+{
+#if KERNEL_VERSION(6, 0, 0) <= LINUX_VERSION_CODE
+	return true;
+#else
+	return false;
+#endif
+}
 #if KERNEL_VERSION(6, 0, 0) <= LINUX_VERSION_CODE
 int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev,
 	bool protect, int32_t offset)

+ 1 - 0
drivers/cam_utils/cam_compat.h

@@ -60,6 +60,7 @@ int camera_component_match_add_drivers(struct device *master_dev,
 	struct component_match **match_list);
 int cam_csiphy_notify_secure_mode(struct csiphy_device *csiphy_dev,
 	bool protect, int32_t offset);
+bool cam_is_mink_api_available(void);
 void cam_free_clear(const void *);
 void cam_check_iommu_faults(struct iommu_domain *domain,
 	struct cam_smmu_pf_info *pf_info);