فهرست منبع

msm: camera: common: Update logging for better debugging

Fix incorrect logging format strings. Update log string to
better indicate about the parameters.

CRs-Fixed: 3128094
Change-Id: I265d9233769f152ae0cbdf1f13b4499b03cf1593
Signed-off-by: Pavan Kumar Chilamkurthi <[email protected]>
Pavan Kumar Chilamkurthi 3 سال پیش
والد
کامیت
cd2c6d0ab8

+ 7 - 7
drivers/cam_isp/isp_hw_mgr/isp_hw/sfe_hw/sfe_top/cam_sfe_top.c

@@ -814,26 +814,26 @@ static int cam_sfe_top_handle_overflow(
 {
 	struct cam_sfe_top_common_data      *common_data;
 	struct cam_hw_soc_info              *soc_info;
-	uint32_t                             overflow_status, violation_status, tmp;
+	uint32_t                             bus_overflow_status, violation_status, tmp;
 	uint32_t                             i = 0;
 
 	common_data = &top_priv->common_data;
 	soc_info = common_data->soc_info;
 
-	overflow_status = cam_io_r(soc_info->reg_map[SFE_CORE_BASE_IDX].mem_base +
+	bus_overflow_status = cam_io_r(soc_info->reg_map[SFE_CORE_BASE_IDX].mem_base +
 		top_priv->common_data.common_reg->bus_overflow_status);
 	violation_status = cam_io_r(soc_info->reg_map[SFE_CORE_BASE_IDX].mem_base +
 		top_priv->common_data.common_reg->ipp_violation_status);
 
 	CAM_ERR(CAM_ISP,
-		"SFE%d src_clk_rate:%luHz overflow:%s violation: %s",
+		"SFE%d src_clk_rate:%luHz bus_overflow_status:%s violation: %s",
 		soc_info->index, soc_info->applied_src_clk_rate,
-		CAM_BOOL_TO_YESNO(overflow_status), CAM_BOOL_TO_YESNO(violation_status));
+		CAM_BOOL_TO_YESNO(bus_overflow_status), CAM_BOOL_TO_YESNO(violation_status));
 
-	tmp = overflow_status;
+	tmp = bus_overflow_status;
 	while (tmp) {
 		if (tmp & 0x1)
-			CAM_ERR(CAM_ISP, "SFE Overflow %s ",
+			CAM_ERR(CAM_ISP, "SFE Bus Overflow %s ",
 				top_priv->wr_client_desc[i].desc);
 		tmp = tmp >> 1;
 		i++;
@@ -843,7 +843,7 @@ static int cam_sfe_top_handle_overflow(
 		cam_sfe_top_print_ipp_violation_info(top_priv, violation_status);
 	cam_sfe_top_print_debug_reg_info(top_priv);
 
-	if (overflow_status)
+	if (bus_overflow_status)
 		cam_cpas_log_votes();
 
 	return 0;

+ 3 - 2
drivers/cam_req_mgr/cam_mem_mgr.c

@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/module.h>
@@ -334,8 +335,8 @@ int cam_mem_get_io_buf(int32_t buf_handle, int32_t mmu_handle,
 		*flags = tbl.bufq[idx].flags;
 
 	CAM_DBG(CAM_MEM,
-		"handle:0x%x fd:%d i_ino:%lu iova_ptr:0x%llx len_ptr:%llu",
-		mmu_handle, tbl.bufq[idx].fd, tbl.bufq[idx].i_ino, iova_ptr, *len_ptr);
+		"handle:0x%x fd:%d i_ino:%lu iova_ptr:0x%lx len_ptr:%lu",
+		mmu_handle, tbl.bufq[idx].fd, tbl.bufq[idx].i_ino, *iova_ptr, *len_ptr);
 handle_mismatch:
 	mutex_unlock(&tbl.bufq[idx].q_lock);
 	return rc;

+ 23 - 30
drivers/cam_smmu/cam_smmu_api.c

@@ -610,11 +610,9 @@ static void cam_smmu_dump_cb_info(int idx)
 		"********** %llu:%llu:%llu:%llu Context bank dump for %s **********",
 		hrs, min, sec, ms, cb_info->name[0]);
 	CAM_ERR(CAM_SMMU,
-		"Usage: shared_usage=%u io_usage=%u shared_free=%u io_free=%u",
-		(unsigned int)cb_info->shared_mapping_size,
-		(unsigned int)cb_info->io_mapping_size,
-		(unsigned int)shared_free_len,
-		(unsigned int)io_free_len);
+		"Usage: shared_usage=%lu io_usage=%lu shared_free=%lu io_free=%lu",
+		cb_info->shared_mapping_size, cb_info->io_mapping_size,
+		shared_free_len, io_free_len);
 
 	if (iommu_cb_set.cb_dump_enable) {
 		list_for_each_entry_safe(mapping, mapping_temp,
@@ -622,13 +620,11 @@ static void cam_smmu_dump_cb_info(int idx)
 			i++;
 			CAM_CONVERT_TIMESTAMP_FORMAT(mapping->ts, hrs, min, sec, ms);
 			CAM_ERR(CAM_SMMU,
-				"%llu:%llu:%llu:%llu: %u ion_fd=%d i_ino=%lu start=0x%x end=0x%x len=%u region=%d",
+				"%llu:%llu:%llu:%llu: %u ion_fd=%d i_ino=%lu start=0x%lx end=0x%lx len=%lu region=%d",
 				hrs, min, sec, ms, i, mapping->ion_fd, mapping->i_ino,
-				(void *)mapping->paddr,
-				((uint64_t)mapping->paddr +
-				(uint64_t)mapping->len),
-				(unsigned int)mapping->len,
-				mapping->region_id);
+				mapping->paddr,
+				((uint64_t)mapping->paddr + (uint64_t)mapping->len),
+				mapping->len, mapping->region_id);
 		}
 
 		cam_smmu_dump_monitor_array(&iommu_cb_set.cb_info[idx]);
@@ -643,10 +639,9 @@ static void cam_smmu_print_user_list(int idx)
 	list_for_each_entry(mapping,
 		&iommu_cb_set.cb_info[idx].smmu_buf_list, list) {
 		CAM_ERR(CAM_SMMU,
-			"ion_fd = %d, i_ino=%lu, paddr= 0x%pK, len = %u, region = %d",
-			 mapping->ion_fd, mapping->i_ino, (void *)mapping->paddr,
-			 (unsigned int)mapping->len,
-			 mapping->region_id);
+			"ion_fd = %d, i_ino=%lu, paddr= 0x%lx, len = %lu, region = %d",
+			mapping->ion_fd, mapping->i_ino, mapping->paddr, mapping->len,
+			mapping->region_id);
 	}
 }
 
@@ -658,10 +653,9 @@ static void cam_smmu_print_kernel_list(int idx)
 	list_for_each_entry(mapping,
 		&iommu_cb_set.cb_info[idx].smmu_buf_kernel_list, list) {
 		CAM_ERR(CAM_SMMU,
-			"dma_buf = %pK, i_ino = %lu, paddr= 0x%pK, len = %u, region = %d",
-			 mapping->buf, mapping->i_ino, (void *)mapping->paddr,
-			 (unsigned int)mapping->len,
-			 mapping->region_id);
+			"dma_buf = %pK, i_ino = %lu, paddr= 0x%lx, len = %lu, region = %d",
+			mapping->buf, mapping->i_ino, mapping->paddr,
+			mapping->len, mapping->region_id);
 	}
 }
 
@@ -854,7 +848,7 @@ static int cam_smmu_iommu_fault_handler(struct iommu_domain *domain,
 
 	if (!token) {
 		CAM_ERR(CAM_SMMU,
-			"token is NULL, domain = %pK, device = %pK,iova = %lX, flags = %d",
+			"token is NULL, domain = %pK, device = %pK,iova = 0x%lx, flags = 0x%x",
 			domain, dev, iova, flags);
 		return 0;
 	}
@@ -1301,8 +1295,8 @@ static void cam_smmu_clean_user_buffer_list(int idx)
 			CAM_ERR(CAM_SMMU, "Buffer delete failed: idx = %d",
 				idx);
 			CAM_ERR(CAM_SMMU,
-				"Buffer delete failed: addr = %lx, fd = %d, i_ino = %lu",
-				(unsigned long)mapping_info->paddr,
+				"Buffer delete failed: addr = 0x%lx, fd = %d, i_ino = %lu",
+				mapping_info->paddr,
 				mapping_info->ion_fd, mapping_info->i_ino);
 			/*
 			 * Ignore this error and continue to delete other
@@ -1335,9 +1329,8 @@ static void cam_smmu_clean_kernel_buffer_list(int idx)
 				"Buffer delete in kernel list failed: idx = %d",
 				idx);
 			CAM_ERR(CAM_SMMU,
-				"Buffer delete failed: addr = %lx, dma_buf = %pK",
-				(unsigned long)mapping_info->paddr,
-				mapping_info->buf);
+				"Buffer delete failed: addr = 0x%lx, dma_buf = %pK",
+				mapping_info->paddr, mapping_info->buf);
 			/*
 			 * Ignore this error and continue to delete other
 			 * buffers in the list
@@ -2202,8 +2195,8 @@ static int cam_smmu_map_buffer_validate(struct dma_buf *buf,
 		if (IS_ERR_OR_NULL(table)) {
 			rc = PTR_ERR(table);
 			CAM_ERR(CAM_SMMU,
-				"Error: dma map attachment failed, size=%zu",
-				buf->size);
+				"Error: dma map attachment failed, size=%zu, rc %d dma_dir %d",
+				buf->size, rc, dma_dir);
 			goto err_detach;
 		}
 
@@ -4131,9 +4124,9 @@ static int cam_smmu_get_memory_regions_info(struct device_node *of_node,
 
 		CAM_DBG(CAM_SMMU, "Found label -> %s", cb->name[0]);
 		CAM_DBG(CAM_SMMU, "Found region -> %s", region_name);
-		CAM_DBG(CAM_SMMU, "region_start -> %lx", region_start);
-		CAM_DBG(CAM_SMMU, "region_len -> %lx", region_len);
-		CAM_DBG(CAM_SMMU, "region_id -> %X", region_id);
+		CAM_DBG(CAM_SMMU, "region_start -> 0x%lx", region_start);
+		CAM_DBG(CAM_SMMU, "region_len -> 0x%lx", region_len);
+		CAM_DBG(CAM_SMMU, "region_id -> 0x%x", region_id);
 	}
 
 	if (cb->io_support) {

+ 7 - 5
drivers/cam_utils/cam_packet_util.c

@@ -178,7 +178,7 @@ void cam_packet_dump_patch_info(struct cam_packet *packet,
 	uintptr_t  cpu_addr = 0;
 	uint32_t  *dst_cpu_addr;
 	uint32_t   flags;
-	uint64_t   value = 0;
+	uint32_t   value = 0;
 
 	patch_desc = (struct cam_patch_desc *)
 			((uint32_t *) &packet->payload +
@@ -209,9 +209,9 @@ void cam_packet_dump_patch_info(struct cam_packet *packet,
 		dst_cpu_addr = (uint32_t *)cpu_addr;
 		dst_cpu_addr = (uint32_t *)((uint8_t *)dst_cpu_addr +
 			patch_desc[i].dst_offset);
-		value = *((uint64_t *)dst_cpu_addr);
+		value = *dst_cpu_addr;
 		CAM_INFO(CAM_UTIL,
-			"i = %d src_buf 0x%llx src_hdl 0x%x src_buf_with_offset 0x%llx src_size 0x%llx src_flags: %x dst %p dst_offset %u dst_hdl 0x%x value 0x%llx",
+			"i = %d src_buf 0x%llx src_hdl 0x%x src_buf_with_offset 0x%llx src_size 0x%llx src_flags: %x dst %p dst_offset %u dst_hdl 0x%x value 0x%x",
 			i, iova_addr, patch_desc[i].src_buf_hdl,
 			(iova_addr + patch_desc[i].src_offset),
 			src_buf_size, flags, dst_cpu_addr,
@@ -367,8 +367,10 @@ int cam_packet_util_process_patches(struct cam_packet *packet,
 		}
 
 		CAM_DBG(CAM_UTIL,
-			"patch is done for dst %pK with src 0x%llx value 0x%llx",
-			dst_cpu_addr, iova_addr, *((uint64_t *)dst_cpu_addr));
+			"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));
 	}
 
 	return rc;