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

Commit 5cbba714 authored by Ayush Kumar's avatar Ayush Kumar
Browse files

msm: camera: isp: Dump buffer address on page fault



This is debug change to dump last consumer address and
current consume buffer address on page fault.

CRs-Fixed: 2797725
Change-Id: I0b5120982e474962568c98d897d2e1739b8e4b9b
Signed-off-by: default avatarAyush Kumar <ayushkr@codeaurora.org>
parent 3f3685b0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -70,11 +70,13 @@ struct cam_hw_update_entry {
 *
 * @resrouce_handle:       Resource port id for the buffer
 * @sync_id:               Sync id
 * @image_buf_addr:        Image buffer address array
 *
 */
struct cam_hw_fence_map_entry {
	uint32_t           resource_handle;
	int32_t            sync_id;
	int32_t            image_buf_addr[CAM_PACKET_MAX_PLANES];
};

/**
+48 −3
Original line number Diff line number Diff line
@@ -39,6 +39,9 @@
#define CAM_ISP_GENERIC_BLOB_TYPE_MAX               \
	(CAM_ISP_GENERIC_BLOB_TYPE_CSID_QCFA_CONFIG + 1)

static int cam_ife_hw_mgr_handle_hw_dump_bus_info(
	void *ctx, void *evt_info);

static uint32_t blob_type_hw_cmd_map[CAM_ISP_GENERIC_BLOB_TYPE_MAX] = {
	CAM_ISP_HW_CMD_GET_HFR_UPDATE,
	CAM_ISP_HW_CMD_CLOCK_UPDATE,
@@ -6386,13 +6389,14 @@ static void cam_ife_mgr_print_io_bufs(struct cam_packet *packet,

static int cam_ife_mgr_cmd(void *hw_mgr_priv, void *cmd_args)
{
	int rc = 0;
	int i, rc = 0;
	struct cam_hw_cmd_args *hw_cmd_args = cmd_args;
	struct cam_ife_hw_mgr  *hw_mgr = hw_mgr_priv;
	struct cam_ife_hw_mgr_ctx *ctx = (struct cam_ife_hw_mgr_ctx *)
		hw_cmd_args->ctxt_to_hw_map;
	struct cam_isp_hw_cmd_args      *isp_hw_cmd_args = NULL;
	struct cam_packet               *packet;
	struct cam_isp_hw_event_info     event_info;
	unsigned long rem_jiffies = 0;

	if (!hw_mgr_priv || !cmd_args) {
@@ -6462,6 +6466,15 @@ static int cam_ife_mgr_cmd(void *hw_mgr_priv, void *cmd_args)
			hw_mgr->mgr_common.img_iommu_hdl_secure,
			hw_cmd_args->u.pf_args.buf_info,
			hw_cmd_args->u.pf_args.mem_found);
		event_info.err_type = CAM_ISP_HW_ERROR_BUSIF_OVERFLOW;
		event_info.res_type = CAM_ISP_RESOURCE_VFE_OUT;
		event_info.hw_idx = 0;
		for (i = 0; i < CAM_IFE_HW_OUT_RES_MAX; i++) {
			event_info.res_id =
				CAM_ISP_IFE_OUT_RES_BASE + (i & 0xFF);
			cam_ife_hw_mgr_handle_hw_dump_bus_info(ctx,
				&event_info);
		}
		break;
	case CAM_HW_MGR_CMD_REG_DUMP_ON_FLUSH:
		if (ctx->last_dump_flush_req_id == ctx->applied_req_id)
@@ -7010,6 +7023,38 @@ static int cam_ife_hw_mgr_handle_csid_event(
	return 0;
}

static int cam_ife_hw_mgr_handle_hw_dump_bus_info(
	void                                 *ctx,
	void                                 *evt_info)
{
	struct cam_ife_hw_mgr_ctx     *ife_hw_mgr_ctx =
		(struct cam_ife_hw_mgr_ctx *)ctx;
	struct cam_isp_hw_event_info  *event_info =
		(struct cam_isp_hw_event_info *)evt_info;
	struct cam_ife_hw_mgr_res     *hw_mgr_res = NULL;
	struct cam_hw_intf            *hw_intf;
	uint32_t i, out_port_id;
	int rc = 0;

	out_port_id = event_info->res_id & 0xFF;
	hw_mgr_res =
		&ife_hw_mgr_ctx->res_list_ife_out[out_port_id];
	for (i = 0; i < CAM_ISP_HW_SPLIT_MAX; i++) {
		if (!hw_mgr_res->hw_res[i])
			continue;
		hw_intf = hw_mgr_res->hw_res[i]->hw_intf;
		if (hw_intf->hw_ops.process_cmd) {
			rc = hw_intf->hw_ops.process_cmd(
				hw_intf->hw_priv,
				CAM_ISP_HW_CMD_DUMP_BUS_INFO,
				(void *)event_info,
				sizeof(struct cam_isp_hw_event_info));
		}
	}

	return rc;
}

static int cam_ife_hw_mgr_handle_hw_dump_info(
	void                                 *ctx,
	void                                 *evt_info)
+18 −0
Original line number Diff line number Diff line
@@ -480,6 +480,8 @@ int cam_isp_add_io_buffers(
	uint32_t                            i, j, num_out_buf, num_in_buf;
	uint32_t                            res_id_out, res_id_in, plane_id;
	uint32_t                            io_cfg_used_bytes, num_ent;
	uint32_t                           *image_buf_addr;
	uint32_t                           *image_buf_offset;
	uint64_t                            iova_addr;
	size_t                              size;
	int32_t                             hdl;
@@ -682,6 +684,10 @@ int cam_isp_add_io_buffers(
			wm_update.num_buf   = plane_id;
			wm_update.io_cfg    = &io_cfg[i];
			wm_update.frame_header = 0;
			for (plane_id = 0; plane_id < CAM_PACKET_MAX_PLANES;
				plane_id++)
				wm_update.image_buf_offset[plane_id] = 0;

			iova_addr = frame_header_info->frame_header_iova_addr;
			if ((frame_header_info->frame_header_enable) &&
				!(frame_header_info->frame_header_res_id)) {
@@ -714,6 +720,18 @@ int cam_isp_add_io_buffers(
				return rc;
			}
			io_cfg_used_bytes += update_buf.cmd.used_bytes;
			image_buf_addr =
				out_map_entries->image_buf_addr;
			image_buf_offset =
				wm_update.image_buf_offset;
			if (j == CAM_ISP_HW_SPLIT_LEFT) {
				for (plane_id = 0;
					plane_id < CAM_PACKET_MAX_PLANES;
					plane_id++)
					image_buf_addr[plane_id] =
						io_addr[plane_id] +
						image_buf_offset[plane_id];
			}
		}
		for (j = 0; j < CAM_ISP_HW_SPLIT_MAX &&
			io_cfg[i].direction == CAM_BUF_INPUT; j++) {
+2 −0
Original line number Diff line number Diff line
@@ -220,6 +220,7 @@ struct cam_isp_hw_cmd_buf_update {
 * @Brief:         Get cmd buffer for WM updates.
 *
 * @ image_buf:    image buffer address array
 * @ image_buf_offset: image buffer address offset array
 * @ num_buf:      Number of buffers in the image_buf array
 * @ frame_header: frame header iova
 * @ local_id:     local id for the wm
@@ -228,6 +229,7 @@ struct cam_isp_hw_cmd_buf_update {
 */
struct cam_isp_hw_get_wm_update {
	dma_addr_t                     *image_buf;
	uint32_t                        image_buf_offset[CAM_PACKET_MAX_PLANES];
	uint32_t                        num_buf;
	uint64_t                        frame_header;
	uint32_t                        local_id;
+26 −2
Original line number Diff line number Diff line
@@ -3161,17 +3161,22 @@ static int cam_vfe_bus_update_wm(void *priv, void *cmd_args,

		/* WM Image address */
		for (k = 0; k < loop_size; k++) {
			if (wm_data->en_ubwc)
			if (wm_data->en_ubwc) {
				CAM_VFE_ADD_REG_VAL_PAIR(reg_val_pair, j,
					wm_data->hw_regs->image_addr,
					update_buf->wm_update->image_buf[i] +
					io_cfg->planes[i].meta_size +
					k * frame_inc);
			else
				update_buf->wm_update->image_buf_offset[i] =
					io_cfg->planes[i].meta_size;
			} else {
				CAM_VFE_ADD_REG_VAL_PAIR(reg_val_pair, j,
					wm_data->hw_regs->image_addr,
					update_buf->wm_update->image_buf[i] +
					wm_data->offset + k * frame_inc);
				update_buf->wm_update->image_buf_offset[i] =
					wm_data->offset;
			}
			CAM_DBG(CAM_ISP, "WM %d image address 0x%x",
				wm_data->index, reg_val_pair[j-1]);
		}
@@ -3754,11 +3759,19 @@ int cam_vfe_bus_dump_wm_data(void *priv, void *cmd_args, uint32_t arg_size)
	struct cam_isp_resource_node              *rsrc_node = NULL;
	struct cam_vfe_bus_ver2_vfe_out_data      *rsrc_data = NULL;
	struct cam_vfe_bus_ver2_wm_resource_data  *wm_data   = NULL;
	struct cam_vfe_bus_ver2_common_data       *common_data = NULL;
	int                                        i, wm_idx;
	enum cam_vfe_bus_ver2_vfe_out_type         vfe_out_res_id;
	uint32_t                                   addr_status0, addr_status1;

	vfe_out_res_id = cam_vfe_bus_get_out_res_id(event_info->res_id);
	rsrc_node = &bus_priv->vfe_out[vfe_out_res_id];
	if (!rsrc_node) {
		CAM_DBG(CAM_ISP,
			"Resource with res id %d is null",
			vfe_out_res_id);
		return -EINVAL;
	}
	rsrc_data = rsrc_node->res_priv;
	for (i = 0; i < rsrc_data->num_wm; i++) {
		wm_idx = cam_vfe_bus_get_wm_idx(vfe_out_res_id, i);
@@ -3768,6 +3781,11 @@ int cam_vfe_bus_dump_wm_data(void *priv, void *cmd_args, uint32_t arg_size)
			return -EINVAL;
		}
		wm_data = bus_priv->bus_client[wm_idx].res_priv;
		common_data = rsrc_data->common_data;
		addr_status0 = cam_io_r_mb(common_data->mem_base +
			wm_data->hw_regs->status0);
		addr_status1 = cam_io_r_mb(common_data->mem_base +
			wm_data->hw_regs->status1);
		CAM_INFO(CAM_ISP,
			"VFE:%d WM:%d width:%u height:%u stride:%u x_init:%u en_cfg:%u acquired width:%u height:%u",
			wm_data->common_data->core_index, wm_idx,
@@ -3777,6 +3795,12 @@ int cam_vfe_bus_dump_wm_data(void *priv, void *cmd_args, uint32_t arg_size)
			wm_data->en_cfg,
			wm_data->acquired_width,
			wm_data->acquired_height);
		CAM_INFO(CAM_ISP,
			"hw:%d WM:%d current client address:0x%x current frame header addr:0x%x",
			common_data->hw_intf->hw_idx,
			wm_data->index,
			addr_status0,
			addr_status1);
	}
	return 0;
}
Loading