msm: camera: icp: Multiple ICPs Log Enhancement

Modifying the info/error/dbg logs in hw mgr, context and hfi
layers to spit out relevant info to determine which ICP device
is running the execution.

Change type defination of hw_dev_type to enum in local instances in
functions and the field of hw ctx struct.

CRs-Fixed: 3361905
Change-Id: Ib50208eaf243c50678d07845461c750b36d19bf9
Signed-off-by: Petar Ivanov <quic_pivanov@quicinc.com>
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
This commit is contained in:
Petar Ivanov
2022-10-17 09:29:10 -07:00
committed by Camera Software Integration
parent 92e59f3c6a
commit 5614df0d47
8 changed files with 1040 additions and 734 deletions

View File

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/debugfs.h>
@@ -37,18 +37,18 @@ static int cam_icp_context_dump_active_request(void *data, void *args)
return -EINVAL;
}
CAM_INFO(CAM_ICP, "iommu fault for icp ctx %d state %d",
ctx->ctx_id, ctx->state);
CAM_INFO(CAM_ICP, "[%s] iommu fault for icp ctx %d state %d",
ctx->dev_name, ctx->ctx_id, ctx->state);
list_for_each_entry_safe(req, req_temp,
&ctx->active_req_list, list) {
CAM_INFO(CAM_ICP, "Active req_id: %llu ctx_id: %u",
req->request_id, ctx->ctx_id);
CAM_INFO(CAM_ICP, "[%s] ctx[%u]: Active req_id: %llu",
ctx->dev_name, ctx->ctx_id, req->request_id);
rc = cam_context_dump_pf_info_to_hw(ctx, pf_args, &req->pf_data);
if (rc)
CAM_ERR(CAM_ICP, "Failed to dump pf info ctx_id: %u state: %d",
ctx->ctx_id, ctx->state);
CAM_ERR(CAM_ICP, "[%s] ctx[%u]: Failed to dump pf info.ctx->state: %d",
ctx->dev_name, ctx->ctx_id, ctx->state);
}
/*
@@ -61,7 +61,8 @@ static int cam_icp_context_dump_active_request(void *data, void *args)
rc = cam_context_send_pf_evt(ctx, pf_args);
if (rc)
CAM_ERR(CAM_ICP,
"Failed to notify PF event to userspace rc: %d", rc);
"[%s] ctx[%u]: Failed to notify PF event to userspace rc: %d",
ctx->dev_name, ctx->ctx_id, rc);
}
return rc;
@@ -80,8 +81,8 @@ static int cam_icp_context_mini_dump(void *priv, void *args)
ctx = (struct cam_context *)priv;
rc = cam_context_mini_dump(ctx, args);
if (rc)
CAM_ERR(CAM_ICP, "ctx [id: %u name: %s] Mini Dump failed rc %d", ctx->dev_name,
ctx->ctx_id, rc);
CAM_ERR(CAM_ICP, "[%s] ctx[%u]: Mini Dump failed rc %d",
ctx->dev_name, ctx->ctx_id, rc);
return rc;
}
@@ -94,7 +95,7 @@ static int __cam_icp_acquire_dev_in_available(struct cam_context *ctx,
rc = cam_context_acquire_dev_to_hw(ctx, cmd);
if (!rc) {
ctx->state = CAM_CTX_ACQUIRED;
trace_cam_context_state("ICP", ctx);
trace_cam_context_state(ctx->dev_name, ctx);
}
return rc;
@@ -109,10 +110,11 @@ static int __cam_icp_release_dev_in_acquired(struct cam_context *ctx,
rc = cam_context_release_dev_to_hw(ctx, cmd);
if (rc)
CAM_ERR(CAM_ICP, "Unable to release device");
CAM_ERR(CAM_ICP, "[%s] ctx[%u]: Unable to release device",
ctx->dev_name, ctx->ctx_id);
ctx->state = CAM_CTX_AVAILABLE;
trace_cam_context_state("ICP", ctx);
trace_cam_context_state(ctx->dev_name, ctx);
return rc;
}
@@ -124,7 +126,7 @@ static int __cam_icp_start_dev_in_acquired(struct cam_context *ctx,
rc = cam_context_start_dev_to_hw(ctx, cmd);
if (!rc) {
ctx->state = CAM_CTX_READY;
trace_cam_context_state("ICP", ctx);
trace_cam_context_state(ctx->dev_name, ctx);
}
return rc;
@@ -138,7 +140,8 @@ static int __cam_icp_dump_dev_in_ready(
rc = cam_context_dump_dev_to_hw(ctx, cmd);
if (rc)
CAM_ERR(CAM_ICP, "Failed to dump device");
CAM_ERR(CAM_ICP, "[%s] ctx[%u]: Failed to dump device",
ctx->dev_name, ctx->ctx_id);
return rc;
}
@@ -150,7 +153,8 @@ static int __cam_icp_flush_dev_in_ready(struct cam_context *ctx,
rc = cam_context_flush_dev_to_hw(ctx, cmd);
if (rc)
CAM_ERR(CAM_ICP, "Failed to flush device");
CAM_ERR(CAM_ICP, "[%s] ctx[%u]: Failed to flush device",
ctx->dev_name, ctx->ctx_id);
return rc;
}
@@ -177,7 +181,8 @@ static int __cam_icp_config_dev_in_ready(struct cam_context *ctx,
if ((len < sizeof(struct cam_packet)) ||
(cmd->offset >= (len - sizeof(struct cam_packet)))) {
CAM_ERR(CAM_CTXT,
"Invalid offset, len: %zu cmd offset: %llu sizeof packet: %zu",
"[%s] ctx[%u]: Invalid offset, len: %zu cmd offset: %llu sizeof packet: %zu",
ctx->dev_name, ctx->ctx_id,
len, cmd->offset, sizeof(struct cam_packet));
return -EINVAL;
}
@@ -188,7 +193,8 @@ static int __cam_icp_config_dev_in_ready(struct cam_context *ctx,
rc = cam_packet_util_validate_packet(packet, remain_len);
if (rc) {
CAM_ERR(CAM_CTXT, "Invalid packet params, remain length: %zu",
CAM_ERR(CAM_CTXT, "[%s] ctx[%u]: Invalid packet params, remain length: %zu",
ctx->dev_name, ctx->ctx_id,
remain_len);
return rc;
}
@@ -204,7 +210,8 @@ static int __cam_icp_config_dev_in_ready(struct cam_context *ctx,
rc = cam_context_prepare_dev_to_hw(ctx, cmd);
if (rc)
CAM_ERR(CAM_ICP, "Failed to prepare device");
CAM_ERR(CAM_ICP, "[%s] ctx[%u]:Failed to prepare device",
ctx->dev_name, ctx->ctx_id);
return rc;
}
@@ -216,10 +223,11 @@ static int __cam_icp_stop_dev_in_ready(struct cam_context *ctx,
rc = cam_context_stop_dev_to_hw(ctx);
if (rc)
CAM_ERR(CAM_ICP, "Failed to stop device");
CAM_ERR(CAM_ICP, "[%s] ctx[%u]: Failed to stop device",
ctx->dev_name, ctx->ctx_id);
ctx->state = CAM_CTX_ACQUIRED;
trace_cam_context_state("ICP", ctx);
trace_cam_context_state(ctx->dev_name, ctx);
return rc;
}
@@ -230,7 +238,8 @@ static int __cam_icp_release_dev_in_ready(struct cam_context *ctx,
rc = __cam_icp_stop_dev_in_ready(ctx, NULL);
if (rc)
CAM_ERR(CAM_ICP, "Failed to stop device");
CAM_ERR(CAM_ICP, "[%s] ctx[%u]: Failed to stop device",
ctx->dev_name, ctx->ctx_id);
rc = __cam_icp_release_dev_in_acquired(ctx, cmd);
if (rc)
@@ -239,7 +248,7 @@ static int __cam_icp_release_dev_in_ready(struct cam_context *ctx,
return rc;
}
static uint32_t get_error_code(uint32_t err_type)
static uint32_t cam_icp_context_get_error_code(uint32_t err_type)
{
switch (err_type) {
case CAM_ICP_HW_ERROR_NO_MEM:
@@ -269,12 +278,11 @@ static int __cam_icp_notify_v4l2_err_evt(struct cam_context *ctx,
V4L_EVENT_CAM_REQ_MGR_EVENT);
if (rc)
CAM_ERR(CAM_ICP,
"Error in notifying the error time for req id:%lld ctx %u",
request_id,
ctx->ctx_id);
"[%s] ctx[%u]: Error in notifying the error time for req id:%lld",
ctx->dev_name, ctx->ctx_id, request_id);
CAM_INFO(CAM_ICP,
"CTX: [%s][%d] notifying error to userspace err type: %d, err code: %u, req id: %llu",
"[%s] ctx[%u]: notifying error to userspace err type: %d, err code: %u, req id: %llu",
ctx->dev_name, ctx->ctx_id, err_type, err_code, request_id);
return rc;
@@ -287,7 +295,7 @@ static int cam_icp_ctx_handle_fatal_error(void *ctx, void *err_evt_data)
int rc;
err_evt = (struct cam_icp_hw_error_evt_data *)err_evt_data;
err_code = get_error_code(err_evt->err_type);
err_code = cam_icp_context_get_error_code(err_evt->err_type);
rc = __cam_icp_notify_v4l2_err_evt(ctx, CAM_REQ_MGR_ERROR_TYPE_RECOVERY,
err_code, err_evt->req_id);
@@ -358,16 +366,16 @@ static int cam_icp_context_validate_event_notify_injection(struct cam_context *c
break;
default:
CAM_ERR(CAM_ICP,
"Invalid error type: %u for error event injection err code: %u req id: %llu ctx id: %u dev hdl: %d",
err_evt_params->err_type, err_evt_params->err_code,
req_id, ctx->ctx_id, ctx->dev_hdl);
"[%s] ctx[%u]: Invalid error type: %u for error event injection err code: %u req id: %llu dev hdl: %d",
ctx->dev_name, ctx->ctx_id, err_evt_params->err_type,
err_evt_params->err_code, ctx->dev_hdl);
return -EINVAL;
}
CAM_INFO(CAM_ICP,
"Inject ERR evt: err code: %u err type: %u req id: %llu ctx id: %u dev hdl: %d",
err_evt_params->err_code, err_evt_params->err_type,
req_id, ctx->ctx_id, ctx->dev_hdl);
"[%s] ctx[%u]: Inject ERR evt: err code: %u err type: %u req id: %llu dev hdl: %d",
ctx->dev_name, ctx->ctx_id, err_evt_params->err_code,
err_evt_params->err_type, req_id, ctx->dev_hdl);
break;
}
case V4L_EVENT_CAM_REQ_MGR_PF_ERROR: {
@@ -378,24 +386,27 @@ static int cam_icp_context_validate_event_notify_injection(struct cam_context *c
rc = cam_smmu_is_cb_non_fatal_fault_en(ctx->img_iommu_hdl, &non_fatal_en);
if (rc) {
CAM_ERR(CAM_ICP,
"Fail to query whether device's cb has non-fatal enabled rc: %d",
rc);
"[%s] ctx[%u]: Fail to query whether device's cb has non-fatal enabled rc: %d",
ctx->dev_name, ctx->ctx_id, rc);
return rc;
}
if (!non_fatal_en) {
CAM_ERR(CAM_ICP,
"Fail to inject page fault event notification. Page fault is fatal for ICP");
"[%s] ctx[%u]: Fail to inject page fault event notification. Page fault is fatal for ICP",
ctx->dev_name, ctx->ctx_id);
return -EINVAL;
}
CAM_INFO(CAM_ICP,
"Inject PF evt: req_id: %llu ctx id: %u dev hdl: %d ctx found: %hhu",
req_id, ctx->ctx_id, ctx->dev_hdl, pf_evt_params->ctx_found);
"[%s] ctx[%u]: Inject PF evt: req_id: %llu dev hdl: %d ctx found: %hhu",
ctx->dev_name, ctx->ctx_id,
req_id, ctx->dev_hdl, pf_evt_params->ctx_found);
break;
}
default:
CAM_ERR(CAM_ICP, "Event notification type not supported: %u", evt_type);
CAM_ERR(CAM_ICP, "[%s] ctx[%u]: Event notification type not supported: %u",
ctx->dev_name, ctx->ctx_id, evt_type);
rc = -EINVAL;
}
@@ -422,18 +433,21 @@ static int cam_icp_context_inject_evt(void *context, void *evt_args)
buf_err_params = &evt_params->u.buf_err_evt;
if (buf_err_params->sync_error > CAM_SYNC_ICP_EVENT_START ||
buf_err_params->sync_error < CAM_SYNC_ICP_EVENT_END) {
CAM_INFO(CAM_ICP, "Inject buffer sync error %u ctx id: %u req id %llu",
buf_err_params->sync_error, ctx->ctx_id, evt_params->req_id);
CAM_INFO(CAM_ICP, "[%s] ctx[%u]: Inject buffer sync error %u req id %llu",
ctx->dev_name, ctx->ctx_id, buf_err_params->sync_error,
evt_params->req_id);
} else {
CAM_ERR(CAM_ICP, "Invalid buffer sync error %u ctx id: %u req id %llu",
buf_err_params->sync_error, ctx->ctx_id, evt_params->req_id);
CAM_ERR(CAM_ICP, "[%s] ctx[%u]: Invalid buffer sync error %u req id %llu",
ctx->dev_name, ctx->ctx_id, buf_err_params->sync_error,
evt_params->req_id);
return -EINVAL;
}
} else {
rc = cam_icp_context_validate_event_notify_injection(ctx, evt_params);
if (rc) {
CAM_ERR(CAM_ICP,
"Event notification injection failed validation rc: %d", rc);
"[%s] ctx[%u]: Event notification injection failed validation rc: %d",
ctx->dev_name, ctx->ctx_id, rc);
return -EINVAL;
}
}
@@ -523,7 +537,7 @@ int cam_icp_context_init(struct cam_icp_context *ctx, struct cam_hw_mgr_intf *hw
rc = cam_context_init(ctx->base, icp_dev_name, CAM_ICP, ctx_id,
NULL, hw_intf, ctx->req_base, CAM_CTX_ICP_REQ_MAX, img_iommu_hdl);
if (rc) {
CAM_ERR(CAM_ICP, "Camera Context Base init failed");
CAM_ERR(CAM_ICP, "[%s] Camera Context Base init failed", icp_dev_name);
goto err;
}

View File

@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef _HFI_INTF_H_
@@ -15,6 +15,8 @@
#define HFI_NUM_MAX 2
#define HFI_HANDLE_INIT_VALUE HFI_NUM_MAX
#define HFI_CLIENT_NAME_LEN 32
/**
* struct hfi_mem
* @len: length of memory
@@ -122,10 +124,11 @@ int cam_hfi_init(int client_handle, struct hfi_mem_info *hfi_mem,
/**
* cam_hfi_register() - function to register user as hfi client and retrieve handle
* @client_handle: client handle to be retrieved
* @client_name: Name of the client to be registered
*
* Returns success(zero)/failure(non zero)
*/
int cam_hfi_register(int *client_handle);
int cam_hfi_register(int *client_handle, const char *client_name);
/**
* cam_hfi_unregister() - function to unregister hfi client

View File

@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef _CAM_HFI_REG_H_
@@ -283,6 +283,7 @@ struct hfi_qtbl {
* @msg_q_state: State of message queue
* @priv: device private data
* @dbg_lvl: debug level set to FW
* @client_name: hfi client's name
*/
struct hfi_info {
struct hfi_mem_info map;
@@ -297,6 +298,7 @@ struct hfi_info {
bool msg_q_state;
void *priv;
u64 dbg_lvl;
char client_name[HFI_CLIENT_NAME_LEN];
};
#endif /* _CAM_HFI_REG_H_ */

View File

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/io.h>
@@ -87,8 +87,8 @@ static inline int hfi_get_client_info(int client_handle, struct hfi_info **hfi)
*hfi = g_hfi.hfi[idx];
if (!g_hfi.hfi[idx]) {
CAM_ERR(CAM_HFI, "HFI interface not setup for client hdl: %d",
client_handle);
CAM_ERR(CAM_HFI, "[%s] HFI interface not setup for client hdl: %d",
g_hfi.hfi[idx]->client_name, client_handle);
return -ENODEV;
}
@@ -137,8 +137,8 @@ void cam_hfi_mini_dump(int client_handle, struct hfi_mini_dump_info *dst)
hfi_mem = &hfi->map;
if (!hfi_mem) {
CAM_ERR(CAM_HFI, "hfi mem info NULL... unable to dump queues for hdl: %d",
client_handle);
CAM_ERR(CAM_HFI, "[%s] hfi mem info NULL... unable to dump queues for hdl: %d",
hfi->client_name, client_handle);
return;
}
@@ -165,25 +165,23 @@ void cam_hfi_queue_dump(int client_handle, bool dump_queue_data)
rc = hfi_get_client_info(client_handle, &hfi);
if (rc) {
CAM_ERR(CAM_HFI, "Failed to get hfi info rc: %d for hdl: %d",
CAM_ERR(CAM_HFI, "Failed to get hfi info rc:%d for hdl:%d",
rc, client_handle);
return;
}
hfi_mem = &hfi->map;
if (!hfi_mem) {
CAM_ERR(CAM_HFI, "mem info NULL... unable to dump queues for hdl: %d",
client_handle);
CAM_ERR(CAM_HFI, "[%s] mem info NULL... unable to dump queues for hdl: %d",
hfi->client_name, client_handle);
return;
}
qtbl = (struct hfi_qtbl *)hfi_mem->qtbl.kva;
CAM_INFO(CAM_HFI,
"hfi hdl: %u qtbl header: version=0x%08x tbl_size=%u numq=%u qhdr_size=%u",
client_handle,
qtbl->q_tbl_hdr.qtbl_version,
qtbl->q_tbl_hdr.qtbl_size,
qtbl->q_tbl_hdr.qtbl_num_q,
"[%s] hfi hdl: %u qtbl header: version=0x%08x tbl_size=%u numq=%u qhdr_size=%u",
hfi->client_name, client_handle, qtbl->q_tbl_hdr.qtbl_version,
qtbl->q_tbl_hdr.qtbl_size, qtbl->q_tbl_hdr.qtbl_num_q,
qtbl->q_tbl_hdr.qtbl_qhdr_size);
q_hdr = &qtbl->q_hdr[Q_CMD];
@@ -233,16 +231,17 @@ int hfi_write_cmd(int client_handle, void *cmd_ptr)
}
if (!cmd_ptr) {
CAM_ERR(CAM_HFI, "command is null for hfi hdl: %d",
client_handle);
CAM_ERR(CAM_HFI, "[%s] command is null for hfi hdl: %d",
hfi->client_name, client_handle);
return -EINVAL;
}
mutex_lock(&hfi->cmd_q_lock);
if (hfi->hfi_state != HFI_READY ||
!hfi->cmd_q_state) {
CAM_ERR(CAM_HFI, "Invalid hfi state: %u cmd q state: %u hfi hdl: %d",
hfi->hfi_state, hfi->cmd_q_state, client_handle);
CAM_ERR(CAM_HFI, "[%s] Invalid hfi state: %u cmd q state: %u hfi hdl: %d",
hfi->client_name, hfi->hfi_state,
hfi->cmd_q_state, client_handle);
rc = -ENODEV;
goto err;
}
@@ -254,7 +253,8 @@ int hfi_write_cmd(int client_handle, void *cmd_ptr)
size_in_words = (*(uint32_t *)cmd_ptr) >> BYTE_WORD_SHIFT;
if (!size_in_words) {
CAM_DBG(CAM_HFI, "hfi hdl: %u word size is NULL");
CAM_DBG(CAM_HFI, "[%s] hfi hdl: %u word size is NULL",
hfi->client_name, client_handle);
rc = -EINVAL;
goto err;
}
@@ -264,8 +264,8 @@ int hfi_write_cmd(int client_handle, void *cmd_ptr)
(q->qhdr_q_size - (q->qhdr_write_idx - read_idx)) :
(read_idx - q->qhdr_write_idx);
if (empty_space <= size_in_words) {
CAM_ERR(CAM_HFI, "hfi hdl: %u failed: empty space %u, size_in_words %u",
empty_space, size_in_words);
CAM_ERR(CAM_HFI, "[%s] hfi hdl: %u failed: empty space %u, size_in_words %u",
hfi->client_name, client_handle, empty_space, size_in_words);
rc = -EIO;
goto err;
}
@@ -325,20 +325,23 @@ int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
}
if (!pmsg) {
CAM_ERR(CAM_HFI, "client hdl: %d Invalid msg", client_handle);
CAM_ERR(CAM_HFI, "[%s] client hdl: %d Invalid msg",
hfi->client_name, client_handle);
return -EINVAL;
}
if (!((q_id == Q_MSG) || (q_id == Q_DBG))) {
CAM_ERR(CAM_HFI, "Invalid q :%u", q_id);
CAM_ERR(CAM_HFI, "[%s] Invalid q :%u",
hfi->client_name, q_id);
return -EINVAL;
}
mutex_lock(&hfi->msg_q_lock);
if (hfi->hfi_state != HFI_READY ||
!hfi->msg_q_state) {
CAM_ERR(CAM_HFI, "Invalid hfi state:%u msg q state: %u hfi hdl: %d",
hfi->hfi_state, hfi->msg_q_state, client_handle);
CAM_ERR(CAM_HFI, "[%s] Invalid hfi state:%u msg q state: %u hfi hdl: %d",
hfi->client_name, hfi->hfi_state, hfi->msg_q_state,
client_handle);
rc = -ENODEV;
goto err;
}
@@ -347,8 +350,9 @@ int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
q = &q_tbl_ptr->q_hdr[q_id];
if (q->qhdr_read_idx == q->qhdr_write_idx) {
CAM_DBG(CAM_HFI, "hfi hdl: %d Q not ready, state:%u, r idx:%u, w idx:%u",
client_handle, hfi->hfi_state, q->qhdr_read_idx, q->qhdr_write_idx);
CAM_DBG(CAM_HFI, "[%s] hfi hdl: %d Q not ready, state:%u, r idx:%u, w idx:%u",
hfi->client_name, client_handle, hfi->hfi_state,
q->qhdr_read_idx, q->qhdr_write_idx);
rc = -EIO;
goto err;
}
@@ -371,8 +375,9 @@ int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
if ((size_in_words == 0) ||
(size_in_words > size_upper_bound)) {
CAM_ERR(CAM_HFI, "Invalid HFI message packet size - 0x%08x hfi hdl:%d",
size_in_words << BYTE_WORD_SHIFT, client_handle);
CAM_ERR(CAM_HFI, "[%s] Invalid HFI message packet size - 0x%08x hfi hdl:%d",
hfi->client_name, size_in_words << BYTE_WORD_SHIFT,
client_handle);
q->qhdr_read_idx = q->qhdr_write_idx;
rc = -EIO;
goto err;
@@ -406,14 +411,23 @@ int hfi_cmd_ubwc_config(int client_handle, uint32_t *ubwc_cfg)
{
uint8_t *prop;
struct hfi_cmd_prop *dbg_prop;
struct hfi_info *hfi;
uint32_t size = 0;
int rc;
size = sizeof(struct hfi_cmd_prop) +
sizeof(struct hfi_cmd_ubwc_cfg);
rc = hfi_get_client_info(client_handle, &hfi);
if (rc) {
CAM_ERR(CAM_HFI, "Failed to get hfi info rc: %d for hdl:%d",
rc, client_handle);
return rc;
}
CAM_DBG(CAM_HFI,
"hfi hdl: %d size of ubwc %u, ubwc_cfg [rd-0x%x,wr-0x%x]",
client_handle, size, ubwc_cfg[0], ubwc_cfg[1]);
"[%s] hfi hdl: %d size of ubwc %u, ubwc_cfg [rd-0x%x,wr-0x%x]",
hfi->client_name, client_handle, size, ubwc_cfg[0], ubwc_cfg[1]);
prop = kzalloc(size, GFP_KERNEL);
if (!prop)
@@ -438,14 +452,24 @@ int hfi_cmd_ubwc_config_ext(int client_handle, uint32_t *ubwc_ipe_cfg,
{
uint8_t *prop;
struct hfi_cmd_prop *dbg_prop;
struct hfi_info *hfi;
uint32_t size = 0;
int rc;
rc = hfi_get_client_info(client_handle, &hfi);
if (rc) {
CAM_ERR(CAM_HFI, "Failed to get hfi info rc: %d for hdl:%d",
rc, client_handle);
return rc;
}
size = sizeof(struct hfi_cmd_prop) +
sizeof(struct hfi_cmd_ubwc_cfg_ext);
CAM_DBG(CAM_HFI,
"hfi hdl: %d size of ubwc %u, ubwc_ipe_cfg[rd-0x%x,wr-0x%x] ubwc_bps_cfg[rd-0x%x,wr-0x%x] ubwc_ofe_cfg[rd-0x%x,wr-0x%x]",
client_handle, size, ubwc_ipe_cfg[0], ubwc_ipe_cfg[1], ubwc_bps_cfg[0],
"[%s] hfi hdl: %d size of ubwc %u, ubwc_ipe_cfg[rd-0x%x,wr-0x%x] ubwc_bps_cfg[rd-0x%x,wr-0x%x] ubwc_ofe_cfg[rd-0x%x,wr-0x%x]",
hfi->client_name, client_handle, size,
ubwc_ipe_cfg[0], ubwc_ipe_cfg[1], ubwc_bps_cfg[0],
ubwc_bps_cfg[1], ubwc_ofe_cfg[0], ubwc_ofe_cfg[1]);
prop = kzalloc(size, GFP_KERNEL);
@@ -536,8 +560,8 @@ int hfi_set_fw_dump_levels(int client_handle, uint32_t hang_dump_lvl,
return rc;
}
CAM_DBG(CAM_HFI, "hfi hdl: %d fw dump ENTER",
client_handle);
CAM_DBG(CAM_HFI, "[%s] hfi hdl: %d fw dump ENTER",
hfi->client_name, client_handle);
size = sizeof(struct hfi_cmd_prop) + sizeof(uint32_t);
prop = kzalloc(size, GFP_KERNEL);
@@ -560,11 +584,9 @@ int hfi_set_fw_dump_levels(int client_handle, uint32_t hang_dump_lvl,
hfi_write_cmd(client_handle, prop);
CAM_DBG(CAM_HFI,
"hfi hdl: %d prop->size = %d prop->pkt_type = %d prop->num_prop = %d hang_dump_lvl = %u ram_dump_lvl = %u",
client_handle,
fw_dump_level_switch_prop->size,
fw_dump_level_switch_prop->pkt_type,
fw_dump_level_switch_prop->num_prop,
"[%s] hfi hdl: %d prop->size = %d prop->pkt_type = %d prop->num_prop = %d hang_dump_lvl = %u ram_dump_lvl = %u",
hfi->client_name, client_handle, fw_dump_level_switch_prop->size,
fw_dump_level_switch_prop->pkt_type, fw_dump_level_switch_prop->num_prop,
hang_dump_lvl, ram_dump_lvl);
kfree(prop);
@@ -602,13 +624,14 @@ int hfi_send_freq_info(int client_handle, int32_t freq)
dbg_prop->prop_data[1] = freq;
CAM_DBG(CAM_HFI,
"hfi hdl: %d\n"
"[%s] hfi hdl: %d\n"
"prop->size = %d\n"
"prop->pkt_type = %d\n"
"prop->num_prop = %d\n"
"prop->prop_data[0] = %d\n"
"prop->prop_data[1] = %d\n"
"dbg_lvl = 0x%x\n",
hfi->client_name,
client_handle,
dbg_prop->size,
dbg_prop->pkt_type,
@@ -625,10 +648,13 @@ int hfi_send_freq_info(int client_handle, int32_t freq)
int hfi_send_system_cmd(int client_handle, uint32_t type, uint64_t data, uint32_t size)
{
int rc = 0;
struct hfi_info *hfi;
if (!IS_VALID_HFI_INDEX(client_handle)) {
CAM_ERR(CAM_HFI, "Invalid client handle: %d", client_handle);
return -EINVAL;
rc = hfi_get_client_info(client_handle, &hfi);
if (rc) {
CAM_ERR(CAM_HFI, "Failed to get hfi info rc: %d for hdl: %d",
rc, client_handle);
return rc;
}
switch (type) {
@@ -693,8 +719,8 @@ int hfi_send_system_cmd(int client_handle, uint32_t type, uint64_t data, uint32_
case HFI_CMD_IPEBPS_ASYNC_COMMAND_INDIRECT:
break;
default:
CAM_ERR(CAM_HFI, "command not supported: %u client handle: %d",
type, client_handle);
CAM_ERR(CAM_HFI, "[%s] command not supported: %u client handle: %d",
hfi->client_name, type, client_handle);
break;
}
@@ -751,8 +777,8 @@ int cam_hfi_resume(int client_handle)
icp_base = hfi_iface_addr(hfi);
if (!icp_base) {
CAM_ERR(CAM_HFI, "invalid HFI interface address for hdl:%d",
client_handle);
CAM_ERR(CAM_HFI, "[%s] Invalid HFI interface address for hdl:%d",
hfi->client_name, client_handle);
return -EINVAL;
}
@@ -760,15 +786,16 @@ int cam_hfi_resume(int client_handle)
HFI_REG_ICP_HOST_INIT_RESPONSE,
HFI_POLL_DELAY_US, HFI_POLL_TIMEOUT_US,
(uint32_t)UINT_MAX, ICP_INIT_RESP_SUCCESS, &status)) {
CAM_ERR(CAM_HFI, "response poll timed out: status=0x%08x hfi hdl: %d",
status, client_handle);
CAM_ERR(CAM_HFI, "[%s] response poll timed out: status=0x%08x hfi hdl: %d",
hfi->client_name, status, client_handle);
return -ETIMEDOUT;
}
hfi_irq_enable(hfi);
fw_version = cam_io_r(icp_base + HFI_REG_FW_VERSION);
CAM_DBG(CAM_HFI, "hfi hdl: %d fw version : [%x]", client_handle, fw_version);
CAM_DBG(CAM_HFI, "[%s] hfi hdl: %d fw version : [%x]",
hfi->client_name, client_handle, fw_version);
hfi_mem = &hfi->map;
cam_io_w_mb((uint32_t)hfi_mem->qtbl.iova, icp_base + HFI_REG_QTBL_PTR);
@@ -856,8 +883,8 @@ int cam_hfi_init(int client_handle, struct hfi_mem_info *hfi_mem,
if (!hfi_mem || !hfi_ops || !priv) {
CAM_ERR(CAM_HFI,
"invalid arg: hfi_mem=%pK hfi_ops=%pK priv=%pK hfi hdl:%d",
hfi_mem, hfi_ops, priv, client_handle);
"[%s] Invalid arg: hfi_mem=%pK hfi_ops=%pK priv=%pK hfi hdl:%d",
hfi->client_name, hfi_mem, hfi_ops, priv, client_handle);
return -EINVAL;
}
@@ -976,8 +1003,8 @@ int cam_hfi_init(int client_handle, struct hfi_mem_info *hfi_mem,
break;
default:
CAM_ERR(CAM_HFI, "Invalid event driven mode :%u for hdl:%d",
event_driven_mode, client_handle);
CAM_ERR(CAM_HFI, "[%s] Invalid event driven mode :%u for hdl:%d",
hfi->client_name, event_driven_mode, client_handle);
break;
}
@@ -986,8 +1013,8 @@ int cam_hfi_init(int client_handle, struct hfi_mem_info *hfi_mem,
icp_base = hfi_iface_addr(hfi);
if (!icp_base) {
CAM_ERR(CAM_HFI, "invalid HFI interface address for hdl: %d",
client_handle);
CAM_ERR(CAM_HFI, "[%s] Invalid HFI interface address for hdl: %d",
hfi->client_name, client_handle);
rc = -EINVAL;
goto regions_fail;
}
@@ -1029,7 +1056,8 @@ int cam_hfi_init(int client_handle, struct hfi_mem_info *hfi_mem,
cam_io_w_mb((uint32_t)hfi_mem->hwmutex.len,
icp_base + HFI_REG_DEVICE_HWMUTEX_SIZE);
CAM_DBG(CAM_HFI, "HFI handle: %d", client_handle);
CAM_DBG(CAM_HFI, "[%s] HFI handle: %d",
hfi->client_name, client_handle);
CAM_DBG(CAM_HFI, "IO1 : [0x%x 0x%x] IO2 [0x%x 0x%x]",
hfi_mem->io_mem.iova, hfi_mem->io_mem.len,
@@ -1064,8 +1092,8 @@ int cam_hfi_init(int client_handle, struct hfi_mem_info *hfi_mem,
HFI_REG_ICP_HOST_INIT_RESPONSE,
HFI_POLL_DELAY_US, HFI_POLL_TIMEOUT_US,
(uint32_t)UINT_MAX, ICP_INIT_RESP_SUCCESS, &status)) {
CAM_ERR(CAM_HFI, "response poll timed out: status=0x%08x",
status);
CAM_ERR(CAM_HFI, "[%s] hfi hdl:%u response poll timed out: status=0x%08x",
hfi->client_name, client_handle, status);
rc = -ETIMEDOUT;
goto regions_fail;
}
@@ -1104,8 +1132,8 @@ void cam_hfi_deinit(int client_handle)
if (cam_presil_mode_enabled()) {
CAM_DBG(CAM_HFI,
"HFI hdl: %d SYS_RESET Needed in presil for back to back hfi_init success",
client_handle);
"[%s] HFI hdl: %d SYS_RESET Needed in presil for back to back hfi_init success",
hfi->client_name, client_handle);
hfi_send_system_cmd(client_handle, HFI_CMD_SYS_RESET, 0, 0);
}
@@ -1142,11 +1170,10 @@ static int hfi_get_free_index(uint32_t *free_index)
return -EUSERS;
}
int cam_hfi_register(int *client_handle)
int cam_hfi_register(int *client_handle, const char *client_name)
{
struct hfi_info *hfi = NULL;
uint32_t hfi_index;
int rc = 0;
int hfi_index, rc = 0;
if (!client_handle) {
CAM_ERR(CAM_HFI, "Client handle is NULL");
@@ -1162,8 +1189,9 @@ int cam_hfi_register(int *client_handle)
rc = -EINVAL;
goto failed_hfi_register;
}
CAM_ERR(CAM_HFI, "HFI client handle:%d is already established",
*client_handle);
CAM_ERR(CAM_HFI, "[%s] HFI client handle:%d is already established",
hfi->client_name, *client_handle);
rc = -EINVAL;
goto failed_hfi_register;
}
@@ -1190,6 +1218,7 @@ int cam_hfi_register(int *client_handle)
g_hfi.hfi[hfi_index] = hfi;
g_hfi.num_hfi++;
*client_handle = HFI_GET_CLIENT_HANDLE(hfi_index);
memcpy(hfi->client_name, client_name, HFI_CLIENT_NAME_LEN);
mutex_unlock(&g_hfi_lock);
mutex_init(&hfi->cmd_q_lock);
@@ -1275,7 +1304,8 @@ int hfi_write_cmd(int client_handle, void *cmd_ptr)
}
if (!cmd_ptr) {
CAM_ERR(CAM_HFI, "command is null for hfi hdl:%d", client_handle);
CAM_ERR(CAM_HFI, "[%s] command is null for hfi hdl:%d",
hfi->client_name, client_handle);
return -EINVAL;
}
@@ -1285,12 +1315,12 @@ int hfi_write_cmd(int client_handle, void *cmd_ptr)
CAM_PRESIL_CLIENT_ID_CAMERA);
if ((presil_rc != CAM_PRESIL_SUCCESS) && (presil_rc != CAM_PRESIL_BLOCKED)) {
CAM_ERR(CAM_HFI, "hfi hdl: %d failed presil rc %d",
client_handle, presil_rc);
CAM_ERR(CAM_HFI, "[%s] hfi hdl: %d failed presil rc %d",
hfi->client_name, client_handle, presil_rc);
rc = -EINVAL;
} else {
CAM_DBG(CAM_HFI, "hfi hdl: %d presil rc %d",
client_handle, presil_rc);
CAM_DBG(CAM_HFI, "[%s] hfi hdl: %d presil rc %d",
hfi->client_name, client_handle, presil_rc);
}
mutex_unlock(&hfi->cmd_q_lock);
@@ -1312,13 +1342,14 @@ int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
}
if (!pmsg) {
CAM_ERR(CAM_HFI, "Invalid msg for hdl: %d", client_handle);
CAM_ERR(CAM_HFI, "[%s] Invalid msg for hdl: %d",
hfi->client_name, client_handle);
return -EINVAL;
}
if (q_id > Q_DBG) {
CAM_ERR(CAM_HFI, "Invalid q :%u hdl: %d",
q_id, client_handle);
CAM_ERR(CAM_HFI, "[%s] Invalid q :%u hdl: %d",
hfi->client_name, q_id, client_handle);
return -EINVAL;
}
mutex_lock(&hfi->msg_q_lock);
@@ -1330,10 +1361,12 @@ int hfi_read_message(int client_handle, uint32_t *pmsg, uint8_t q_id,
CAM_PRESIL_CLIENT_ID_CAMERA);
if ((presil_rc != CAM_PRESIL_SUCCESS) && (presil_rc != CAM_PRESIL_BLOCKED)) {
CAM_ERR(CAM_HFI, "hfi hdl: %d failed presil rc %d", client_handle, presil_rc);
CAM_ERR(CAM_HFI, "[%s] hfi hdl: %d failed presil rc %d",
hfi->client_name, client_handle, presil_rc);
rc = -EINVAL;
} else {
CAM_DBG(CAM_HFI, "hfi hdl: %d presil rc %d", client_handle, presil_rc);
CAM_DBG(CAM_HFI, "[%s] hfi hdl: %d presil rc %d",
hfi->client_name, client_handle, presil_rc);
}
mutex_unlock(&hfi->msg_q_lock);

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef CAM_ICP_HW_MGR_H
@@ -88,6 +88,11 @@
(hw_cap_mask) & BIT((hw_dev_type)); \
})
#define CAM_ICP_IS_VALID_HW_DEV_TYPE(type) \
({ \
((type) >= CAM_ICP_HW_ICP_V1) && ((type) < CAM_ICP_HW_MAX); \
})
struct hfi_mini_dump_info;
/**
@@ -346,7 +351,7 @@ struct cam_icp_hw_ctx_data {
char ctx_id_string[128];
struct cam_icp_ctx_perf_stats perf_stats;
struct cam_hw_inject_evt_param evt_inject_params;
uint32_t hw_dev_type;
enum cam_icp_hw_type hw_dev_type;
uint32_t hw_clk_type;
bool abort_timed_out;
};
@@ -557,6 +562,7 @@ struct cam_icp_hw_ctx_mini_dump {
/**
* struct cam_icp_hw_mini_dump_info
*
* @hw_mgr_name: name of the hw mgr that is dumped
* @ctx: Context for minidump
* @hfi_info: hfi info
* @hfi_mem_info: hfi mem info
@@ -571,6 +577,7 @@ struct cam_icp_hw_ctx_mini_dump {
* @icp_use_pil: Is PIL used
*/
struct cam_icp_hw_mini_dump_info {
char hw_mgr_name[CAM_ICP_HW_MGR_NAME_SIZE];
struct cam_icp_hw_ctx_mini_dump *ctx[CAM_ICP_CTX_MAX];
struct hfi_mini_dump_info hfi_info;
struct icp_hfi_mem_info hfi_mem_info;

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include "cam_debug_util.h"
@@ -8,7 +8,7 @@
uint32_t icp_request_cnt[CAM_ICP_MAX_ICP_HW_TYPE];
static int cam_icp_get_device_num(uint32_t dev_type, uint32_t *num_dev)
static int cam_icp_get_device_num(enum cam_icp_hw_type dev_type, uint32_t *num_dev)
{
int rc = 0;
@@ -27,7 +27,7 @@ static int cam_icp_get_device_num(uint32_t dev_type, uint32_t *num_dev)
return rc;
}
int cam_icp_alloc_processor_devs(struct device_node *np, int *icp_hw_type,
int cam_icp_alloc_processor_devs(struct device_node *np, enum cam_icp_hw_type *icp_hw_type,
struct cam_hw_intf ***devices, uint32_t *hw_dev_cnt, uint32_t *dev_cap_cnt)
{
uint32_t num_icp_found = 0, num_icp_listed;

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include "cam_icp_v1_core.h"
@@ -14,7 +14,7 @@
/**
* @brief : Get ICP device type (ICP_V1/ICP_V2/...)
*/
int cam_icp_alloc_processor_devs(struct device_node *np, int *icp_hw_type,
int cam_icp_alloc_processor_devs(struct device_node *np, enum cam_icp_hw_type *icp_hw_type,
struct cam_hw_intf ***devices, uint32_t *hw_dev_cnt, uint32_t *dev_cap_cnt);
/**