summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2017-01-28 00:47:00 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-01-28 00:46:59 -0800
commit8ddeb3ad18e9c6ee7732d2ccb84e3b3ed7a58d3b (patch)
treebf4ca0f844c78e0aa60ae9a843ed328ca63bb5ea
parent7a05d2091651228059bd310c1a35ea2d4478f711 (diff)
parentd6f2fbcca5e1915f4862b41f84d08f019d70f72a (diff)
Merge "msm: camera: Find and return mapped fd's from the list"
-rw-r--r--drivers/media/platform/msm/camera_v2/common/cam_smmu_api.c24
1 files changed, 22 insertions, 2 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 54c0aa39cdd3..1c0a10e2fbef 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
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1212,6 +1212,25 @@ static enum cam_smmu_buf_state cam_smmu_check_fd_in_list(int idx,
return CAM_SMMU_BUFF_NOT_EXIST;
}
+static enum cam_smmu_buf_state cam_smmu_check_secure_fd_in_list(int idx,
+ int ion_fd, dma_addr_t *paddr_ptr,
+ size_t *len_ptr)
+{
+ struct cam_sec_buff_info *mapping;
+
+ list_for_each_entry(mapping,
+ &iommu_cb_set.cb_info[idx].smmu_buf_list,
+ list) {
+ if (mapping->ion_fd == ion_fd) {
+ mapping->ref_count++;
+ *paddr_ptr = mapping->paddr;
+ *len_ptr = mapping->len;
+ return CAM_SMMU_BUFF_EXIST;
+ }
+ }
+ return CAM_SMMU_BUFF_NOT_EXIST;
+}
+
int cam_smmu_get_handle(char *identifier, int *handle_ptr)
{
int ret = 0;
@@ -1935,7 +1954,8 @@ int cam_smmu_get_stage2_phy_addr(int handle,
goto get_addr_end;
}
- buf_state = cam_smmu_check_fd_in_list(idx, ion_fd, paddr_ptr, len_ptr);
+ buf_state = cam_smmu_check_secure_fd_in_list(idx, ion_fd, paddr_ptr,
+ len_ptr);
if (buf_state == CAM_SMMU_BUFF_EXIST) {
CDBG("ion_fd:%d already in the list, give same addr back",
ion_fd);