浏览代码

msm: camera: smmu: add new flag to indicate Hw, CDM access

When set, buffers will be mapped within 32-bit region
address space and in patching, if Shared or CmdBUffer is
not set for such buffers - patch the value with right shift
by 8. kmd does as below.

Map:
  Shared or CmdBuffer : Mapped within 32bit.
  HwAndCDMOrShared    : Mapped within 32bit
  others(HwAccess)    : Mapped within 40bit
Patching:
  Shared or CmdBuffer : as is
  HwAndCDMOrShared    : iova >> 8
  others (HwAccess)   : iova >> 8

Shared/CmdBuffer takes precedence over HwAndCDMOrShared.

CRs-Fixed: 3128094
Change-Id: Ifd9f5beaf2659f77544cd0722ef7f60d6c0684a7
Signed-off-by: Pavan Kumar Chilamkurthi <[email protected]>
Pavan Kumar Chilamkurthi 3 年之前
父节点
当前提交
3ea1c2ad59
共有 3 个文件被更改,包括 13 次插入5 次删除
  1. 2 1
      drivers/cam_req_mgr/cam_mem_mgr.c
  2. 10 4
      drivers/cam_utils/cam_packet_util.c
  3. 1 0
      include/uapi/camera/media/cam_req_mgr.h

+ 2 - 1
drivers/cam_req_mgr/cam_mem_mgr.c

@@ -884,7 +884,8 @@ static int cam_mem_util_map_hw_va(uint32_t flags,
 		/* If 36-bit enabled, check for ICP cmd buffers and map them within the shared region */
 		if (cam_smmu_is_expanded_memory() &&
 			cam_smmu_supports_shared_region(mmu_hdls[i]) &&
-			(flags & CAM_MEM_FLAG_CMD_BUF_TYPE))
+			((flags & CAM_MEM_FLAG_CMD_BUF_TYPE) ||
+			(flags & CAM_MEM_FLAG_HW_AND_CDM_OR_SHARED)))
 			region = CAM_SMMU_REGION_SHARED;
 
 		if (flags & CAM_MEM_FLAG_PROTECTED_MODE)

+ 10 - 4
drivers/cam_utils/cam_packet_util.c

@@ -360,6 +360,11 @@ int cam_packet_util_process_patches(struct cam_packet *packet,
 				(flags & CAM_MEM_FLAG_CMD_BUF_TYPE)) {
 				*dst_cpu_addr = temp;
 			} else {
+				if (CAM_36BIT_INTF_GET_IOVA_OFFSET(temp))
+					CAM_ERR(CAM_UTIL,
+						"Buffer address 0x%lx not aligned to 256bytes",
+						temp);
+
 				*dst_cpu_addr = CAM_36BIT_INTF_GET_IOVA_BASE(temp);
 			}
 		} else {
@@ -367,10 +372,11 @@ int cam_packet_util_process_patches(struct cam_packet *packet,
 		}
 
 		CAM_DBG(CAM_UTIL,
-			"patch is done for dst %pK with iova 0x%lx patched value 0x%x, shared=%d, cmd=%d",
-			dst_cpu_addr, iova_addr, *dst_cpu_addr,
-			(flags & CAM_MEM_FLAG_HW_SHARED_ACCESS),
-			(flags & CAM_MEM_FLAG_CMD_BUF_TYPE));
+			"patch is done for dst %pK with base iova 0x%lx final iova 0x%lx patched value 0x%x, shared=%s, cmd=%s, HwAndCDM %s",
+			dst_cpu_addr, iova_addr, temp, *dst_cpu_addr,
+			CAM_BOOL_TO_YESNO(flags & CAM_MEM_FLAG_HW_SHARED_ACCESS),
+			CAM_BOOL_TO_YESNO(flags & CAM_MEM_FLAG_CMD_BUF_TYPE),
+			CAM_BOOL_TO_YESNO(flags & CAM_MEM_FLAG_HW_AND_CDM_OR_SHARED));
 	}
 
 	return rc;

+ 1 - 0
include/uapi/camera/media/cam_req_mgr.h

@@ -292,6 +292,7 @@ struct cam_req_mgr_link_control {
 #define CAM_MEM_FLAG_DISABLE_DELAYED_UNMAP      (1<<13)
 #define CAM_MEM_FLAG_KMD_DEBUG_FLAG             (1<<14)
 #define CAM_MEM_FLAG_EVA_NOPIXEL                (1<<15)
+#define CAM_MEM_FLAG_HW_AND_CDM_OR_SHARED       (1<<16)
 
 
 #define CAM_MEM_MMU_MAX_HANDLE                  16