Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f75f78d0 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: isp: Add ref count to attach to smmu only once"

parents 8cbf0cff 7eafa4d1
Loading
Loading
Loading
Loading
+28 −16
Original line number Diff line number Diff line
@@ -1085,27 +1085,39 @@ int msm_isp_smmu_attach(struct msm_isp_buf_mgr *buf_mgr,
		 * Call hypervisor thru scm call to notify secure or
		 * non-secure mode
		 */

		rc = cam_smmu_ops(buf_mgr->img_iommu_hdl, CAM_SMMU_ATTACH);
		if (buf_mgr->attach_ref_cnt == 0) {
			rc = cam_smmu_ops(buf_mgr->img_iommu_hdl,
				CAM_SMMU_ATTACH);
			if (rc < 0) {
				pr_err("%s: img smmu attach error, rc :%d\n",
					__func__, rc);
			goto err1;
			}
		rc = cam_smmu_ops(buf_mgr->stats_iommu_hdl, CAM_SMMU_ATTACH);
			rc = cam_smmu_ops(buf_mgr->stats_iommu_hdl,
				CAM_SMMU_ATTACH);
			if (rc < 0) {
				pr_err("%s: stats smmu attach error, rc :%d\n",
					__func__, rc);
				goto err2;
			}
		}
		buf_mgr->attach_ref_cnt++;
	} else {
		rc = cam_smmu_ops(buf_mgr->img_iommu_hdl, CAM_SMMU_DETACH);
		rc |= cam_smmu_ops(buf_mgr->stats_iommu_hdl, CAM_SMMU_DETACH);
		if (buf_mgr->attach_ref_cnt == 1) {
			rc = cam_smmu_ops(buf_mgr->img_iommu_hdl,
				CAM_SMMU_DETACH);
			rc |= cam_smmu_ops(buf_mgr->stats_iommu_hdl,
				CAM_SMMU_DETACH);
			if (rc < 0) {
				pr_err("%s: img/stats smmu detach error, rc :%d\n",
					__func__, rc);
			}
		}
		if (buf_mgr->attach_ref_cnt > 0)
			buf_mgr->attach_ref_cnt--;
		else
			pr_err("%s: Error! Invalid ref_cnt\n", __func__);
	}
	mutex_unlock(&buf_mgr->lock);
	return rc;

+1 −1
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ struct msm_isp_buf_mgr {
	int num_iommu_ctx;
	struct list_head buffer_q;
	int num_iommu_secure_ctx;
	int attach_ref_cnt[MAX_PROTECTION_MODE][MAX_IOMMU_CTX];
	int attach_ref_cnt;
	enum msm_isp_buf_mgr_state attach_state;
	struct device *isp_dev;
	struct mutex lock;