diff options
| -rw-r--r-- | drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c | 32 | ||||
| -rw-r--r-- | drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c | 16 |
2 files changed, 41 insertions, 7 deletions
diff --git a/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c b/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c index 1c0a10e2fbef..a0f1d5148c94 100644 --- a/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c +++ b/drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c @@ -878,6 +878,8 @@ static int cam_smmu_detach_device(int idx) static int cam_smmu_attach_sec_cpp(int idx) { + int32_t rc = 0; + /* * When switching to secure, detach CPP NS, do scm call * with CPP SID and no need of attach again, because @@ -889,8 +891,12 @@ static int cam_smmu_attach_sec_cpp(int idx) return -EINVAL; } - msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_SECURE, + rc = msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_SECURE, MSM_CAMERA_TZ_HW_BLOCK_CPP); + if (rc != 0) { + pr_err("fail to set secure mode for cpp, rc %d", rc); + return rc; + } iommu_cb_set.cb_info[idx].state = CAM_SMMU_ATTACH; @@ -899,8 +905,14 @@ static int cam_smmu_attach_sec_cpp(int idx) static int cam_smmu_detach_sec_cpp(int idx) { - msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_NON_SECURE, + int32_t rc = 0; + + rc = msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_NON_SECURE, MSM_CAMERA_TZ_HW_BLOCK_CPP); + if (rc != 0) { + pr_err("fail to switch to non secure mode for cpp, rc %d", rc); + return rc; + } iommu_cb_set.cb_info[idx].state = CAM_SMMU_DETACH; @@ -917,6 +929,8 @@ static int cam_smmu_detach_sec_cpp(int idx) static int cam_smmu_attach_sec_vfe_ns_stats(int idx) { + int32_t rc = 0; + /* *When switching to secure, for secure pixel and non-secure stats *localizing scm/attach of non-secure SID's in attach secure @@ -933,16 +947,26 @@ static int cam_smmu_attach_sec_vfe_ns_stats(int idx) } } - msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_SECURE, + rc = msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_SECURE, MSM_CAMERA_TZ_HW_BLOCK_ISP); + if (rc != 0) { + pr_err("fail to set secure mode for vfe, rc %d", rc); + return rc; + } return 0; } static int cam_smmu_detach_sec_vfe_ns_stats(int idx) { - msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_NON_SECURE, + int32_t rc = 0; + + rc = msm_camera_tz_set_mode(MSM_CAMERA_TZ_MODE_NON_SECURE, MSM_CAMERA_TZ_HW_BLOCK_ISP); + if (rc != 0) { + pr_err("fail to switch to non secure mode for vfe, rc %d", rc); + return rc; + } /* *While exiting from secure mode for secure pixel and non-secure stats, diff --git a/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c b/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c index 7885149440f9..da31dcd84b11 100644 --- a/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c +++ b/drivers/media/platform/msm/camera_v2/pproc/cpp/msm_cpp.c @@ -834,8 +834,10 @@ static int cpp_init_mem(struct cpp_device *cpp_dev) else rc = cam_smmu_get_handle("cpp", &iommu_hdl); - if (rc < 0) + if (rc < 0) { + pr_err("smmu get handle failed\n"); return -ENODEV; + } cpp_dev->iommu_hdl = iommu_hdl; cam_smmu_reg_client_page_fault_handler( @@ -1466,10 +1468,16 @@ static int cpp_close_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) msm_cpp_clear_timer(cpp_dev); cpp_release_hardware(cpp_dev); if (cpp_dev->iommu_state == CPP_IOMMU_STATE_ATTACHED) { - cpp_dev->iommu_state = CPP_IOMMU_STATE_DETACHED; - rc = cam_smmu_ops(cpp_dev->iommu_hdl, CAM_SMMU_DETACH); + if (cpp_dev->security_mode == SECURE_MODE) + rc = cam_smmu_ops(cpp_dev->iommu_hdl, + CAM_SMMU_DETACH_SEC_CPP); + else + rc = cam_smmu_ops(cpp_dev->iommu_hdl, + CAM_SMMU_DETACH); + if (rc < 0) pr_err("Error: Detach fail in release\n"); + cpp_dev->iommu_state = CPP_IOMMU_STATE_DETACHED; } cam_smmu_destroy_handle(cpp_dev->iommu_hdl); msm_cpp_empty_list(processing_q, list_frame); @@ -3450,6 +3458,7 @@ STREAM_BUFF_END: rc = msm_cpp_copy_from_ioctl_ptr(&cpp_attach_info, ioctl_ptr); if (rc < 0) { + pr_err("CPP_IOMMU_ATTACH copy from user fail"); ERR_COPY_FROM_USER(); return -EINVAL; } @@ -3487,6 +3496,7 @@ STREAM_BUFF_END: rc = msm_cpp_copy_from_ioctl_ptr(&cpp_attach_info, ioctl_ptr); if (rc < 0) { + pr_err("CPP_IOMMU_DETTACH copy from user fail"); ERR_COPY_FROM_USER(); return -EINVAL; } |
