Browse Source

Revert "msm: camera: icp: Debug queue updates"

This reverts commit f9da163e99ef761fde283d72b0080f140cc3bebc.

Change-Id: I5f3a819658bc9e140f159211d63bfabdfeb3aa70
Signed-off-by: Karthik Anantha Ram <[email protected]>
Karthik Anantha Ram 2 years ago
parent
commit
1c6ec7a3fa

+ 3 - 6
drivers/cam_icp/fw_inc/hfi_intf.h

@@ -79,14 +79,12 @@ struct hfi_ops {
  * @msg_q: msg queue
  * @msg_q_state: msg queue state
  * @cmd_q_state: cmd queue state
- * @dbg_q_state: dbg queue state
  */
 struct hfi_mini_dump_info {
 	uint32_t       cmd_q[HFI_CMD_Q_MINI_DUMP_SIZE_IN_BYTES];
 	uint32_t       msg_q[HFI_MSG_Q_MINI_DUMP_SIZE_IN_BYTES];
 	bool           msg_q_state;
 	bool           cmd_q_state;
-	bool           dbg_q_state;
 };
 /**
  * hfi_write_cmd() - function for hfi write
@@ -101,15 +99,13 @@ int hfi_write_cmd(int client_handle, void *cmd_ptr);
  * hfi_read_message() - function for hfi read
  * @client_handle: client handle
  * @pmsg: buffer to place read message for hfi queue
- * @q_id: Queue to read from
- * @buf_words_size: size in words of the input buffer
+ * @q_id: queue id
  * @words_read: total number of words read from the queue
  *              returned as output to the caller
  *
  * Returns success(zero)/failure(non zero)
  */
-int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
-	size_t buf_words_size, uint32_t *words_read);
+int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id, uint32_t *words_read);
 
 /**
  * hfi_init() - function initialize hfi after firmware download
@@ -247,4 +243,5 @@ void cam_hfi_queue_dump(int client_handle, bool dump_queue_data);
  * @dst: memory destination
  */
 void cam_hfi_mini_dump(int client_handle, struct hfi_mini_dump_info *dst);
+
 #endif /* _HFI_INTF_H_ */

+ 7 - 11
drivers/cam_icp/fw_inc/hfi_reg.h

@@ -276,17 +276,15 @@ struct hfi_qtbl {
  * @smem_size: Shared memory size
  * @uncachedheap_size: uncached heap size
  * @msgpacket_buf: message buffer
- * @cmd_q_lock: Lock for command queue
- * @msg_q_lock: Lock for message queue
- * @dbg_q_lock: Lock for debug queue
  * @hfi_state: State machine for hfi
+ * @cmd_q_lock: Lock for command queue
+ * @cmd_q_state: State of command queue
+ * @mutex msg_q_lock: Lock for message queue
+ * @msg_q_state: State of message queue
  * @priv: device private data
  * @dbg_lvl: debug level set to FW
  * @fw_version: firmware version
  * @client_name: hfi client's name
- * @cmd_q_state: State of command queue
- * @msg_q_state: State of message queue
- * @dbg_q_state: State of debug queue
  */
 struct hfi_info {
 	struct hfi_mem_info map;
@@ -294,17 +292,15 @@ struct hfi_info {
 	uint32_t smem_size;
 	uint32_t uncachedheap_size;
 	uint32_t msgpacket_buf[ICP_HFI_MAX_MSG_SIZE_IN_WORDS];
+	uint8_t hfi_state;
 	struct mutex cmd_q_lock;
+	bool cmd_q_state;
 	struct mutex msg_q_lock;
-	struct mutex dbg_q_lock;
-	uint8_t hfi_state;
+	bool msg_q_state;
 	void *priv;
 	u64 dbg_lvl;
 	uint32_t fw_version;
 	char client_name[HFI_CLIENT_NAME_LEN];
-	bool cmd_q_state;
-	bool msg_q_state;
-	bool dbg_q_state;
 };
 
 #endif /* _CAM_HFI_REG_H_ */

+ 14 - 48
drivers/cam_icp/hfi.c

@@ -147,7 +147,6 @@ void cam_hfi_mini_dump(int client_handle, struct hfi_mini_dump_info *dst)
 	memcpy(dst->msg_q, dwords, ICP_CMD_Q_SIZE_IN_BYTES);
 	dst->msg_q_state = hfi->msg_q_state;
 	dst->cmd_q_state = hfi->cmd_q_state;
-	dst->dbg_q_state = hfi->dbg_q_state;
 }
 
 void cam_hfi_queue_dump(int client_handle, bool dump_queue_data)
@@ -303,7 +302,7 @@ err:
 }
 
 int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
-	size_t buf_words_size, uint32_t *words_read)
+	uint32_t *words_read)
 {
 	struct hfi_info *hfi;
 	struct hfi_qtbl *q_tbl_ptr;
@@ -311,7 +310,6 @@ int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
 	uint32_t new_read_idx, size_in_words, word_diff, temp;
 	uint32_t *read_q, *read_ptr, *write_ptr;
 	uint32_t size_upper_bound = 0;
-	struct mutex *q_lock;
 	int rc = 0;
 
 	rc = hfi_get_client_info(client_handle, &hfi);
@@ -327,19 +325,13 @@ int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
 		return -EINVAL;
 	}
 
-	switch (q_id) {
-	case Q_MSG:
-		q_lock = &hfi->msg_q_lock;
-		break;
-	case Q_DBG:
-		q_lock = &hfi->dbg_q_lock;
-		break;
-	default:
-		CAM_ERR(CAM_HFI, "Invalid q_id: %u for read", q_id);
+	if (!((q_id == Q_MSG) || (q_id == Q_DBG))) {
+		CAM_ERR(CAM_HFI, "[%s] Invalid q :%u",
+			hfi->client_name, q_id);
 		return -EINVAL;
 	}
 
-	mutex_lock(q_lock);
+	mutex_lock(&hfi->msg_q_lock);
 	if (hfi->hfi_state != HFI_READY ||
 		!hfi->msg_q_state) {
 		CAM_ERR(CAM_HFI, "[%s] Invalid hfi state:%u msg q state: %u hfi hdl: %d",
@@ -386,14 +378,6 @@ int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
 		goto err;
 	}
 
-	if (size_in_words > buf_words_size) {
-		CAM_ERR(CAM_HFI,
-			"[%s] hdl: %d Size of buffer: %u is smaller than size to read from queue: %u",
-			hfi->client_name, client_handle, buf_words_size, size_in_words);
-		rc = -EIO;
-		goto err;
-	}
-
 	new_read_idx = q->qhdr_read_idx + size_in_words;
 
 	if (new_read_idx < q->qhdr_q_size) {
@@ -413,10 +397,9 @@ int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
 	 */
 	wmb();
 err:
-	mutex_unlock(q_lock);
+	mutex_unlock(&hfi->msg_q_lock);
 	return rc;
 }
-
 #endif /* #ifndef CONFIG_CAM_PRESIL */
 
 int hfi_cmd_ubwc_config(int client_handle, uint32_t *ubwc_cfg)
@@ -919,7 +902,6 @@ int cam_hfi_init(int client_handle, struct hfi_mem_info *hfi_mem,
 
 	mutex_lock(&hfi->cmd_q_lock);
 	mutex_lock(&hfi->msg_q_lock);
-	mutex_lock(&hfi->dbg_q_lock);
 
 	hfi->hfi_state = HFI_INIT;
 	memcpy(&hfi->map, hfi_mem, sizeof(hfi->map));
@@ -1127,21 +1109,18 @@ int cam_hfi_init(int client_handle, struct hfi_mem_info *hfi_mem,
 
 	hfi->cmd_q_state = true;
 	hfi->msg_q_state = true;
-	hfi->dbg_q_state = true;
 	hfi->hfi_state = HFI_READY;
 
 	hfi_irq_enable(hfi);
 
-	mutex_unlock(&hfi->dbg_q_lock);
-	mutex_unlock(&hfi->msg_q_lock);
 	mutex_unlock(&hfi->cmd_q_lock);
+	mutex_unlock(&hfi->msg_q_lock);
 
 	return rc;
 
 regions_fail:
-	mutex_unlock(&hfi->dbg_q_lock);
-	mutex_unlock(&hfi->msg_q_lock);
 	mutex_unlock(&hfi->cmd_q_lock);
+	mutex_unlock(&hfi->msg_q_lock);
 	return rc;
 }
 
@@ -1166,14 +1145,11 @@ void cam_hfi_deinit(int client_handle)
 
 	mutex_lock(&hfi->cmd_q_lock);
 	mutex_lock(&hfi->msg_q_lock);
-	mutex_lock(&hfi->dbg_q_lock);
 
 	hfi->hfi_state = HFI_DEINIT;
 	hfi->cmd_q_state = false;
 	hfi->msg_q_state = false;
-	hfi->dbg_q_state = false;
 
-	mutex_unlock(&hfi->dbg_q_lock);
 	mutex_unlock(&hfi->cmd_q_lock);
 	mutex_unlock(&hfi->msg_q_lock);
 
@@ -1253,7 +1229,6 @@ int cam_hfi_register(int *client_handle, const char *client_name)
 
 	mutex_init(&hfi->cmd_q_lock);
 	mutex_init(&hfi->msg_q_lock);
-	mutex_init(&hfi->dbg_q_lock);
 
 	return rc;
 
@@ -1278,7 +1253,6 @@ int cam_hfi_unregister(int *client_handle)
 	}
 
 	mutex_lock(&g_hfi_lock);
-	mutex_destroy(&hfi->dbg_q_lock);
 	mutex_destroy(&hfi->msg_q_lock);
 	mutex_destroy(&hfi->cmd_q_lock);
 	cam_free_clear((void *)hfi);
@@ -1360,11 +1334,10 @@ int hfi_write_cmd(int client_handle, void *cmd_ptr)
 }
 
 int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
-	size_t buf_words_size, uint32_t *words_read)
+	uint32_t *words_read)
 {
 	struct hfi_info *hfi;
 	int presil_rc = CAM_PRESIL_BLOCKED;
-	struct mutex *q_lock = NULL;
 	int rc = 0;
 
 	rc = hfi_get_client_info(client_handle, &hfi);
@@ -1380,19 +1353,12 @@ int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
 		return -EINVAL;
 	}
 
-	switch (q_id) {
-	case Q_MSG:
-		q_lock = &hfi->msg_q_lock;
-		break;
-	case Q_DBG:
-		q_lock = &hfi->dbg_q_lock;
-		break;
-	default:
-		CAM_ERR(CAM_HFI, "Invalid q_id: %u for read", q_id);
+	if (q_id > Q_DBG) {
+		CAM_ERR(CAM_HFI, "[%s] Invalid q :%u hdl: %d",
+			hfi->client_name, q_id, client_handle);
 		return -EINVAL;
 	}
-
-	mutex_lock(q_lock);
+	mutex_lock(&hfi->msg_q_lock);
 
 	memset(pmsg, 0x0, sizeof(uint32_t) * 256 /* ICP_MSG_BUF_SIZE */);
 	*words_read = 0;
@@ -1409,7 +1375,7 @@ int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
 		hfi->client_name, client_handle, presil_rc);
 	}
 
-	mutex_unlock(q_lock);
+	mutex_unlock(&hfi->msg_q_lock);
 	return rc;
 }
 #else

+ 2 - 4
drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.c

@@ -2968,8 +2968,7 @@ static void cam_icp_mgr_process_dbg_buf(struct cam_icp_hw_mgr *hw_mgr)
 	char *dbg_buf;
 	int rc = 0;
 
-	rc = hfi_read_message(hw_mgr->hfi_handle, hw_mgr->dbg_buf, Q_DBG,
-		ICP_DBG_BUF_SIZE_IN_WORDS, &read_len);
+	rc = hfi_read_message(hw_mgr->hfi_handle, hw_mgr->dbg_buf, Q_DBG, &read_len);
 	if (rc)
 		return;
 
@@ -3094,8 +3093,7 @@ static int32_t cam_icp_mgr_process_msg(void *priv, void *data)
 	task_data = data;
 	hw_mgr = priv;
 
-	rc = hfi_read_message(hw_mgr->hfi_handle, hw_mgr->msg_buf, Q_MSG,
-		ICP_MSG_BUF_SIZE_IN_WORDS, &read_len);
+	rc = hfi_read_message(hw_mgr->hfi_handle, hw_mgr->msg_buf, Q_MSG, &read_len);
 	if (rc) {
 		CAM_DBG(CAM_ICP, "Unable to read msg q rc %d", rc);
 	} else {

+ 4 - 6
drivers/cam_icp/icp_hw/icp_hw_mgr/cam_icp_hw_mgr.h

@@ -41,10 +41,8 @@
 
 #define ICP_FRAME_PROCESS_SUCCESS 0
 #define ICP_FRAME_PROCESS_FAILURE 1
-
-/* size of buffer to drain from msg/dbq queue */
-#define ICP_MSG_BUF_SIZE_IN_WORDS 256
-#define ICP_DBG_BUF_SIZE_IN_WORDS 25600
+#define ICP_MSG_BUF_SIZE        256
+#define ICP_DBG_BUF_SIZE        102400
 
 #define ICP_OVER_CLK_THRESHOLD  5
 #define ICP_TWO_DEV_BW_SHARE_RATIO 2
@@ -481,8 +479,8 @@ struct cam_icp_hw_mgr {
 	struct cam_req_mgr_core_workq *cmd_work;
 	struct cam_req_mgr_core_workq *msg_work;
 	struct cam_req_mgr_core_workq *timer_work;
-	uint32_t msg_buf[ICP_MSG_BUF_SIZE_IN_WORDS];
-	uint32_t dbg_buf[ICP_DBG_BUF_SIZE_IN_WORDS];
+	uint32_t msg_buf[ICP_MSG_BUF_SIZE];
+	uint32_t dbg_buf[ICP_DBG_BUF_SIZE];
 	struct completion icp_complete;
 	struct hfi_cmd_work_data *cmd_work_data;
 	struct hfi_msg_work_data *msg_work_data;