Browse Source

msm: camera: isp: Fix logic to get correct mid on page fault

This commit add change to get correct port id or resource outport
for page fault if mid value is same for two or more ports.

CRs-Fixed: 3593650
Change-Id: If09a515ea37c5b89787945c9d0d8f1e3903bca55
Signed-off-by: Ayush Kumar <[email protected]>
(cherry picked from commit 8f675ac9d2534e09b7f0a4b8d82dbb1dc2df6feb)
Ayush Kumar 1 năm trước cách đây
mục cha
commit
fc6c82e618

+ 1 - 0
drivers/cam_isp/isp_hw_mgr/cam_tfe_hw_mgr.c

@@ -5334,6 +5334,7 @@ static void cam_tfe_mgr_dump_pf_data(
 	}
 
 	get_res.mid = pf_cmd_args->pf_args->pf_smmu_info->mid;
+	get_res.pid = pf_cmd_args->pf_args->pf_smmu_info->pid;
 	cmd_update.res = hw_mgr_res->hw_res[0];
 	cmd_update.cmd_type = CAM_ISP_HW_CMD_GET_RES_FOR_MID;
 	cmd_update.data = (void *) &get_res;

+ 0 - 1
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_csid_hw/cam_tfe_csid_core.c

@@ -546,7 +546,6 @@ static int cam_tfe_csid_global_reset(struct cam_tfe_csid_hw *csid_hw)
 	} else
 		rc = 0;
 
-	usleep_range(3000, 3010);
 	val = cam_io_r_mb(soc_info->reg_map[0].mem_base +
 		csid_reg->csi2_reg->csid_csi2_rx_irq_mask_addr);
 	if (val != 0)

+ 34 - 16
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe770.h

@@ -1225,7 +1225,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = -1,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_5,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_1,
-			.mid[0]              = 16,
+			.mid[0]           = 16,
+			.pid_mask         = 0x700,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_RDI1,
@@ -1233,7 +1234,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = -1,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_6,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_2,
-			.mid[0]              = 17,
+			.mid[0]           = 17,
+			.pid_mask         = 0x700,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_RDI2,
@@ -1241,7 +1243,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = -1,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_7,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_3,
-			.mid[0]              = 18,
+			.mid[0]           = 18,
+			.pid_mask         = 0x700,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_FULL,
@@ -1249,7 +1252,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = 4096,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_0,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_0,
-			.mid[0]              = 16,
+			.mid[0]           = 16,
+			.pid_mask         = 0x70,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_RAW_DUMP,
@@ -1257,7 +1261,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = 4096,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_1,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_0,
-			.mid[0]              = 19,
+			.mid[0]           = 19,
+			.pid_mask         = 0x700,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_PDAF,
@@ -1265,7 +1270,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = 4096,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_8,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_0,
-			.mid[0]              = 26,
+			.mid[0]           = 26,
+			.pid_mask         = 0x700,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_STATS_HDR_BE,
@@ -1273,7 +1279,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = -1,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_3,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_0,
-			.mid[0]              = 20,
+			.mid[0]           = 20,
+			.pid_mask         = 0x70,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_STATS_HDR_BHIST,
@@ -1281,7 +1288,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = -1,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_2,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_0,
-			.mid[0]              = 18,
+			.mid[0]           = 18,
+			.pid_mask         = 0x70,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_STATS_TL_BG,
@@ -1289,7 +1297,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = -1,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_2,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_0,
-			.mid[0]              = 17,
+			.mid[0]           = 17,
+			.pid_mask         = 0x70,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_STATS_AWB_BG,
@@ -1297,7 +1306,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = -1,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_3,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_0,
-			.mid[0]              = 19,
+			.mid[0]           = 19,
+			.pid_mask         = 0x70,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_STATS_BF,
@@ -1305,7 +1315,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = -1,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_4,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_0,
-			.mid[0]              = 21,
+			.mid[0]           = 21,
+			.pid_mask         = 0x70,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_STATS_RS,
@@ -1313,7 +1324,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = -1,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_10,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_0,
-			.mid[0]              = 27,
+			.mid[0]           = 27,
+			.pid_mask         = 0x70,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_DS4,
@@ -1321,7 +1333,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = -1,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_0,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_0,
-			.mid[0]              = 22,
+			.mid[0]           = 22,
+			.pid_mask         = 0x70,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_DS16,
@@ -1329,7 +1342,8 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = -1,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_0,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_0,
-			.mid[0]              = 23,
+			.mid[0]           = 23,
+			.pid_mask         = 0x70,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_AI,
@@ -1337,8 +1351,9 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.max_height       = 1920,
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_9,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_0,
-			.mid[0]              = 24,
-			.mid[1]              = 25,
+			.mid[0]           = 24,
+			.mid[1]           = 25,
+			.pid_mask         = 0x70,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_PD_LCR_STATS,
@@ -1347,6 +1362,7 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_11,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_4,
 			.mid[0]           = 21,
+			.pid_mask         = 0x70,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_PD_PREPROCESSED,
@@ -1355,6 +1371,7 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_11,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_4,
 			.mid[0]           = 20,
+			.pid_mask         = 0x70,
 		},
 		{
 			.tfe_out_id       = CAM_TFE_BUS_TFE_OUT_PD_PARSED,
@@ -1363,6 +1380,7 @@ static struct cam_tfe_bus_hw_info  tfe770_bus_hw_info = {
 			.composite_group  = CAM_TFE_BUS_COMP_GRP_11,
 			.rup_group_id     = CAM_TFE_BUS_RUP_GRP_4,
 			.mid[0]           = 22,
+			.pid_mask         = 0x70,
 		},
 	},
 	.num_comp_grp             = 12,

+ 21 - 5
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_bus.c

@@ -155,6 +155,7 @@ struct cam_tfe_bus_tfe_out_data {
 	void                            *priv;
 	cam_hw_mgr_event_cb_func         event_cb;
 	uint32_t                         mid[CAM_TFE_BUS_MAX_MID_PER_PORT];
+	uint64_t                         pid_mask;
 };
 
 struct cam_tfe_bus_priv {
@@ -1833,6 +1834,8 @@ static int cam_tfe_bus_init_tfe_out_resource(uint32_t  index,
 	for (i = 0; i < CAM_TFE_BUS_MAX_MID_PER_PORT; i++)
 		rsrc_data->mid[i] = hw_info->tfe_out_hw_info[index].mid[i];
 
+	rsrc_data->pid_mask = hw_info->tfe_out_hw_info[index].pid_mask;
+
 	tfe_out->hw_intf = bus_priv->common_data.hw_intf;
 
 	return 0;
@@ -2434,7 +2437,9 @@ static int cam_tfe_bus_get_res_id_for_mid(
 	struct cam_isp_hw_get_cmd_update   *cmd_update =
 		(struct cam_isp_hw_get_cmd_update   *)cmd_args;
 	struct cam_isp_hw_get_res_for_mid       *get_res = NULL;
+	uint32_t num_mid = 0, port_mid[CAM_TFE_BUS_TFE_OUT_MAX] = {0};
 	int i, j;
+	bool pid_found = false;
 
 	get_res = (struct cam_isp_hw_get_res_for_mid *)cmd_update->data;
 	if (!get_res) {
@@ -2452,11 +2457,23 @@ static int cam_tfe_bus_get_res_id_for_mid(
 
 		for (j = 0; j < CAM_TFE_BUS_MAX_MID_PER_PORT; j++) {
 			if (tfe_out_data->mid[j] == get_res->mid)
-				goto end;
+				port_mid[num_mid++] = i;
+
+		}
+	}
+
+	for (i = 0; i < num_mid; i++) {
+		tfe_out_data = (struct cam_tfe_bus_tfe_out_data  *)
+			bus_priv->tfe_out[port_mid[i]].res_priv;
+		get_res->out_res_id = bus_priv->tfe_out[port_mid[i]].res_id;
+		if (tfe_out_data->pid_mask & (1 << get_res->pid)) {
+			get_res->out_res_id = bus_priv->tfe_out[port_mid[i]].res_id;
+			pid_found = true;
+			goto end;
 		}
 	}
 
-	if (i == bus_priv->num_out) {
+	if (!num_mid) {
 		CAM_ERR(CAM_ISP,
 			"mid:%d does not match with any out resource",
 			get_res->mid);
@@ -2465,9 +2482,8 @@ static int cam_tfe_bus_get_res_id_for_mid(
 	}
 
 end:
-	CAM_INFO(CAM_ISP, "match mid :%d  out resource:%d found",
-		get_res->mid, bus_priv->tfe_out[i].res_id);
-	get_res->out_res_id = bus_priv->tfe_out[i].res_id;
+	CAM_INFO(CAM_ISP, "match mid :%d  out resource:%d found, is pid found %d",
+		get_res->mid, get_res->out_res_id, pid_found);
 	return 0;
 }
 

+ 7 - 5
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_bus.h

@@ -167,12 +167,13 @@ struct cam_tfe_bus_reg_offset_bus_client {
  * struct cam_tfe_bus_tfe_out_hw_info:
  *
  * @Brief:           HW capability of TFE Bus Client
- * tfe_out_id        Tfe out port id
- * max_width         Max width supported by the outport
- * max_height        Max height supported by outport
- * composite_group   Out port composite group id
- * rup_group_id      Reg update group of outport id
+ * tfe_out_id:       Tfe out port id
+ * max_width:        Max width supported by the outport
+ * max_height:       Max height supported by outport
+ * composite_group:  Out port composite group id
+ * rup_group_id:     Reg update group of outport id
  * mid:              ouport mid value
+ * pid:              pid associated with mid
  */
 struct cam_tfe_bus_tfe_out_hw_info {
 	enum cam_tfe_bus_tfe_out_id         tfe_out_id;
@@ -181,6 +182,7 @@ struct cam_tfe_bus_tfe_out_hw_info {
 	uint32_t                            composite_group;
 	uint32_t                            rup_group_id;
 	uint32_t                            mid[CAM_TFE_BUS_MAX_MID_PER_PORT];
+	uint64_t                            pid_mask;
 };
 
 /*