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

Commit 0f7bc6af authored by Ravikishore Pampana's avatar Ravikishore Pampana
Browse files

msm: camera: common: secure camera fixes



Isp bus port secure mode not coming properly. Added proper
logic to get the bus port secure mode correctly.
Use secure iommu handle to get secure buffer for ope.
Add spin lock for tfe irq handler.
Use proper bw structure to copy the user send blob
data.

CRs-Fixed: 2545590
Change-Id: Icb8ecf869681c370efa084991505036f90a35065
Signed-off-by: default avatarRavikishore Pampana <rpampana@codeaurora.org>
parent 21c88c4b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5200,7 +5200,7 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
		memset(&prepare_hw_data->bw_config_v2[bw_config->usage_type],
			0, sizeof(
			prepare_hw_data->bw_config_v2[bw_config->usage_type]));
		bw_config_size = sizeof(struct cam_isp_bw_config_internal_v2) +
		bw_config_size = sizeof(struct cam_isp_bw_config_v2) +
			((bw_config->num_paths - 1) *
			sizeof(struct cam_axi_per_path_bw_vote));
		memcpy(&prepare_hw_data->bw_config_v2[bw_config->usage_type],
+2 −2
Original line number Diff line number Diff line
@@ -2354,7 +2354,7 @@ static int cam_tfe_mgr_config_hw(void *hw_mgr_priv,
		if (hw_update_data->bw_config_valid[i] == true) {

			CAM_DBG(CAM_ISP, "idx=%d, bw_config_version=%d",
				ctx, ctx->ctx_index, i,
				ctx->ctx_index, i,
				hw_update_data->bw_config_version);
			if (hw_update_data->bw_config_version ==
				CAM_ISP_BW_CONFIG_V2) {
@@ -3486,7 +3486,7 @@ static int cam_isp_tfe_packet_generic_blob_handler(void *user_data,
		memset(&prepare_hw_data->bw_config_v2[bw_config->usage_type],
			0, sizeof(
			prepare_hw_data->bw_config_v2[bw_config->usage_type]));
		bw_config_size = sizeof(struct cam_isp_bw_config_internal_v2) +
		bw_config_size = sizeof(struct cam_isp_tfe_bw_config_v2) +
			((bw_config->num_paths - 1) *
			sizeof(struct cam_axi_per_path_bw_vote));
		memcpy(&prepare_hw_data->bw_config_v2[bw_config->usage_type],
+17 −3
Original line number Diff line number Diff line
@@ -475,6 +475,7 @@ int cam_isp_add_io_buffers(
	struct cam_isp_hw_get_wm_update     bus_rd_update;
	struct cam_hw_fence_map_entry      *out_map_entries;
	struct cam_hw_fence_map_entry      *in_map_entries;
	struct cam_isp_hw_get_cmd_update    secure_mode;
	uint32_t                            kmd_buf_remain_size;
	uint32_t                            i, j, num_out_buf, num_in_buf;
	uint32_t                            res_id_out, res_id_in, plane_id;
@@ -482,7 +483,8 @@ int cam_isp_add_io_buffers(
	size_t                              size;
	int32_t                             hdl;
	int                                 mmu_hdl;
	bool                                mode, is_buf_secure;
	bool                                is_buf_secure;
	uint32_t                            mode;

	io_cfg = (struct cam_buf_io_cfg *) ((uint8_t *)
			&prepare->packet->payload +
@@ -611,10 +613,16 @@ int cam_isp_add_io_buffers(
					break;

				hdl = io_cfg[i].mem_handle[plane_id];
				secure_mode.cmd_type =
					CAM_ISP_HW_CMD_GET_SECURE_MODE;
				secure_mode.res = res;
				secure_mode.data = (void *)&mode;
				rc = res->hw_intf->hw_ops.process_cmd(
					res->hw_intf->hw_priv,
					CAM_ISP_HW_CMD_GET_SECURE_MODE,
					&mode, sizeof(bool));
					&secure_mode,
					sizeof(
					struct cam_isp_hw_get_cmd_update));
				if (rc)
					return -EINVAL;

@@ -722,10 +730,16 @@ int cam_isp_add_io_buffers(
					break;

				hdl = io_cfg[i].mem_handle[plane_id];
				secure_mode.cmd_type =
					CAM_ISP_HW_CMD_GET_SECURE_MODE;
				secure_mode.res = res;
				secure_mode.data = (void *)&mode;
				rc = res->hw_intf->hw_ops.process_cmd(
					res->hw_intf->hw_priv,
					CAM_ISP_HW_CMD_GET_SECURE_MODE,
					&mode, sizeof(bool));
					&secure_mode,
					sizeof(
					struct cam_isp_hw_get_cmd_update));
				if (rc)
					return -EINVAL;

+9 −8
Original line number Diff line number Diff line
@@ -1043,12 +1043,13 @@ static int cam_tfe_bus_deinit_comp_grp(
static int cam_tfe_bus_get_secure_mode(void *priv, void *cmd_args,
	uint32_t arg_size)
{
	bool *mode = cmd_args;
	struct cam_isp_resource_node *res =
		(struct cam_isp_resource_node *) priv;
	struct cam_tfe_bus_tfe_out_data *rsrc_data =
		(struct cam_tfe_bus_tfe_out_data *)res->res_priv;
	struct cam_isp_hw_get_cmd_update    *secure_mode = cmd_args;
	struct cam_tfe_bus_tfe_out_data     *rsrc_data;
	uint32_t                            *mode;

	rsrc_data = (struct cam_tfe_bus_tfe_out_data *)
		secure_mode->res->res_priv;
	mode = (uint32_t *)secure_mode->data;
	*mode = (rsrc_data->secure_mode == CAM_SECURE_MODE_SECURE) ?
		true : false;

@@ -1657,7 +1658,7 @@ static int cam_tfe_bus_update_wm(void *priv, void *cmd_args,
			wm_data->index, reg_val_pair[j-1]);

		val = io_cfg->planes[i].plane_stride;
		CAM_DBG(CAM_ISP, "before stride %d", val);
		CAM_DBG(CAM_ISP, "before stride 0x%x", val);
		val = ALIGNUP(val, 16);
		if (val != io_cfg->planes[i].plane_stride &&
			val != wm_data->stride)
@@ -1674,7 +1675,7 @@ static int cam_tfe_bus_update_wm(void *priv, void *cmd_args,
			CAM_TFE_ADD_REG_VAL_PAIR(reg_val_pair, j,
				wm_data->hw_regs->image_cfg_2,
				io_cfg->planes[i].plane_stride);
			wm_data->stride = val;
			wm_data->stride = io_cfg->planes[i].plane_stride;
			CAM_DBG(CAM_ISP, "WM %d image stride 0x%x",
				wm_data->index, reg_val_pair[j-1]);
		}
@@ -1833,7 +1834,7 @@ static int cam_tfe_bus_update_stripe_cfg(void *priv, void *cmd_args,
		wm_data = tfe_out_data->wm_res[i]->res_priv;
		wm_data->width = stripe_config->width;
		wm_data->offset = stripe_config->offset;
		CAM_DBG(CAM_ISP, "id:%x WM:%d width:0x%x offset:%x",
		CAM_DBG(CAM_ISP, "id:%x WM:%d width:0x%x offset:0x%x",
			stripe_args->res->res_id, wm_data->index,
			wm_data->width, wm_data->offset);
	}
+2 −0
Original line number Diff line number Diff line
@@ -702,6 +702,7 @@ irqreturn_t cam_tfe_irq(int irq_num, void *data)
		return IRQ_HANDLED;
	}

	spin_lock(&core_info->spin_lock);
	for (i = 0; i < CAM_TFE_TOP_IRQ_REG_NUM; i++)
		top_irq_status[i] = cam_io_r(mem_base  +
		core_info->tfe_hw_info->top_irq_status[i]);
@@ -740,6 +741,7 @@ irqreturn_t cam_tfe_irq(int irq_num, void *data)
			core_info->core_index, bus_irq_status[0],
			bus_irq_status[1]);
	}
	spin_unlock(&core_info->spin_lock);

	/* check reset */
	if ((top_irq_status[0] & core_info->tfe_hw_info->reset_irq_mask[0]) ||
Loading