msm: ipc_logging: add client version support
If clients use custom serialization functions, then they may need to define a version for deserialization support for log extraction. Add client version support. Change-Id: Id135f06d4142de39275b5d0caab88708d5496b5e Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
This commit is contained in:
parent
4bdf019b2e
commit
9f4800553d
|
@ -149,6 +149,7 @@ Kernel-Space Interface APIs
|
|||
*
|
||||
* @max_num_pages: Number of pages of logging space required (max. 10)
|
||||
* @mod_name : Name of the directory entry under DEBUGFS
|
||||
* @user_version : Version number of user-defined message formats
|
||||
*
|
||||
* returns reference to context on success, NULL on failure
|
||||
*/
|
||||
|
|
|
@ -1702,7 +1702,7 @@ static int __init pcie_init(void)
|
|||
for (i = 0; i < MAX_RC_NUM; i++) {
|
||||
snprintf(rc_name, MAX_RC_NAME_LEN, "pcie%d", i);
|
||||
msm_pcie_dev[i].ipc_log =
|
||||
ipc_log_context_create(PCIE_LOG_PAGES, rc_name);
|
||||
ipc_log_context_create(PCIE_LOG_PAGES, rc_name, 0);
|
||||
if (msm_pcie_dev[i].ipc_log == NULL)
|
||||
pr_err("%s: unable to create IPC log context for %s\n",
|
||||
__func__, rc_name);
|
||||
|
|
|
@ -1583,7 +1583,7 @@ static int __init smd_pkt_init(void)
|
|||
msecs_to_jiffies(SMD_PKT_PROBE_WAIT_TIMEOUT));
|
||||
|
||||
smd_pkt_ilctxt = ipc_log_context_create(SMD_PKT_IPC_LOG_PAGE_CNT,
|
||||
"smd_pkt");
|
||||
"smd_pkt", 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1293,7 +1293,7 @@ static int ngd_slim_probe(struct platform_device *pdev)
|
|||
|
||||
/* Create IPC log context */
|
||||
dev->ipc_slimbus_log = ipc_log_context_create(IPC_SLIMBUS_LOG_PAGES,
|
||||
dev_name(dev->dev));
|
||||
dev_name(dev->dev), 0);
|
||||
if (!dev->ipc_slimbus_log)
|
||||
dev_err(&pdev->dev, "error creating ipc_logging context\n");
|
||||
else {
|
||||
|
|
|
@ -2768,7 +2768,8 @@ static int __init bam_dmux_init(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
bam_ipc_log_txt = ipc_log_context_create(BAM_IPC_LOG_PAGES, "bam_dmux");
|
||||
bam_ipc_log_txt = ipc_log_context_create(BAM_IPC_LOG_PAGES, "bam_dmux",
|
||||
0);
|
||||
if (!bam_ipc_log_txt) {
|
||||
pr_err("%s : unable to create IPC Logging Context", __func__);
|
||||
}
|
||||
|
|
|
@ -3287,13 +3287,13 @@ int __init msm_smd_init(void)
|
|||
if (registered)
|
||||
return 0;
|
||||
|
||||
smd_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smd");
|
||||
smd_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smd", 0);
|
||||
if (!smd_log_ctx) {
|
||||
pr_err("%s: unable to create SMD logging context\n", __func__);
|
||||
msm_smd_debug_mask = 0;
|
||||
}
|
||||
|
||||
smsm_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smsm");
|
||||
smsm_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smsm", 0);
|
||||
if (!smsm_log_ctx) {
|
||||
pr_err("%s: unable to create SMSM logging context\n", __func__);
|
||||
msm_smd_debug_mask = 0;
|
||||
|
|
|
@ -1462,7 +1462,7 @@ int __init msm_smem_init(void)
|
|||
|
||||
registered = true;
|
||||
|
||||
smem_ipc_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smem");
|
||||
smem_ipc_log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smem", 0);
|
||||
if (!smem_ipc_log_ctx) {
|
||||
pr_err("%s: unable to create logging context\n", __func__);
|
||||
msm_smem_debug_mask = 0;
|
||||
|
|
|
@ -1917,7 +1917,7 @@ static int __init msm_smp2p_init(void)
|
|||
in_list[i].smem_edge_in = NULL;
|
||||
}
|
||||
|
||||
log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smp2p");
|
||||
log_ctx = ipc_log_context_create(NUM_LOG_PAGES, "smp2p", 0);
|
||||
if (!log_ctx)
|
||||
SMP2P_ERR("%s: unable to create log context\n", __func__);
|
||||
|
||||
|
|
|
@ -3905,7 +3905,7 @@ static int __init smux_init(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
log_ctx = ipc_log_context_create(1, "smux");
|
||||
log_ctx = ipc_log_context_create(1, "smux", 0);
|
||||
if (!log_ctx) {
|
||||
SMUX_ERR("%s: unable to create log context\n", __func__);
|
||||
disable_ipc_logging = 1;
|
||||
|
|
|
@ -3329,7 +3329,7 @@ static int __init msm_serial_hs_init(void)
|
|||
int ret;
|
||||
|
||||
ipc_msm_hs_log_ctxt = ipc_log_context_create(IPC_MSM_HS_LOG_PAGES,
|
||||
"msm_serial_hs");
|
||||
"msm_serial_hs", 0);
|
||||
if (!ipc_msm_hs_log_ctxt)
|
||||
MSM_HS_WARN("%s: error creating logging context", __func__);
|
||||
|
||||
|
|
|
@ -878,7 +878,7 @@ static struct notifier_block smd_tty_pm_nb = {
|
|||
static void smd_tty_log_init(void)
|
||||
{
|
||||
smd_tty_log_ctx = ipc_log_context_create(SMD_TTY_LOG_PAGES,
|
||||
"smd_tty");
|
||||
"smd_tty", 0);
|
||||
if (!smd_tty_log_ctx)
|
||||
pr_err("%s: Unable to create IPC log", __func__);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -48,10 +48,12 @@ struct decode_context {
|
|||
*
|
||||
* @max_num_pages: Number of pages of logging space required (max. 10)
|
||||
* @mod_name : Name of the directory entry under DEBUGFS
|
||||
* @user_version : Version number of user-defined message formats
|
||||
*
|
||||
* returns context id on success, NULL on failure
|
||||
*/
|
||||
void *ipc_log_context_create(int max_num_pages, const char *modname);
|
||||
void *ipc_log_context_create(int max_num_pages, const char *modname,
|
||||
uint16_t user_version);
|
||||
|
||||
/*
|
||||
* msg_encode_start: Start encoding a log message
|
||||
|
@ -208,7 +210,7 @@ int ipc_log_context_destroy(void *ctxt);
|
|||
#else
|
||||
|
||||
static inline void *ipc_log_context_create(int max_num_pages,
|
||||
const char *modname)
|
||||
const char *modname, uint16_t user_version)
|
||||
{ return NULL; }
|
||||
|
||||
static inline void msg_encode_start(struct encode_context *ectxt,
|
||||
|
|
|
@ -567,8 +567,18 @@ static void *get_deserialization_func(struct ipc_log_context *ilctxt,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* ipc_log_context_create: Create a debug log context
|
||||
* Should not be called from atomic context
|
||||
*
|
||||
* @max_num_pages: Number of pages of logging space required (max. 10)
|
||||
* @mod_name : Name of the directory entry under DEBUGFS
|
||||
* @user_version : Version number of user-defined message formats
|
||||
*
|
||||
* returns context id on success, NULL on failure
|
||||
*/
|
||||
void *ipc_log_context_create(int max_num_pages,
|
||||
const char *mod_name)
|
||||
const char *mod_name, uint16_t user_version)
|
||||
{
|
||||
struct ipc_log_context *ctxt;
|
||||
struct ipc_log_page *pg = NULL;
|
||||
|
@ -602,6 +612,7 @@ void *ipc_log_context_create(int max_num_pages,
|
|||
list_add_tail(&pg->hdr.list, &ctxt->page_list);
|
||||
spin_unlock_irqrestore(&ctxt->ipc_log_context_lock, flags);
|
||||
}
|
||||
ctxt->user_version = user_version;
|
||||
ctxt->first_page = get_first_page(ctxt);
|
||||
ctxt->last_page = pg;
|
||||
ctxt->write_page = ctxt->first_page;
|
||||
|
|
|
@ -30,7 +30,26 @@ struct ipc_log_page {
|
|||
char data[PAGE_SIZE - sizeof(struct ipc_log_page_header)];
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ipc_log_context - main logging context
|
||||
*
|
||||
* @user_version: Version number for user-defined messages
|
||||
* @list: List of log contexts (struct ipc_log_context)
|
||||
* @page_list: List of log pages (struct ipc_log_page)
|
||||
* @first_page: First page in list of logging pages
|
||||
* @last_page: Last page in list of logging pages
|
||||
* @write_page: Current write page
|
||||
* @read_page: Current read page (for internal reads)
|
||||
* @write_avail: Number of bytes available to write in all pages
|
||||
* @dent: Debugfs node for run-time log extraction
|
||||
* @dfunc_info_list: List of deserialization functions
|
||||
* @ipc_log_context_lock: Lock for entire structure
|
||||
* @read_avail: Completed when new data is added to the log
|
||||
*/
|
||||
struct ipc_log_context {
|
||||
uint16_t user_version;
|
||||
|
||||
/* add local data structures after this point */
|
||||
struct list_head list;
|
||||
struct list_head page_list;
|
||||
struct ipc_log_page *first_page;
|
||||
|
|
|
@ -3414,7 +3414,7 @@ static int __init msm_ipc_router_init(void)
|
|||
|
||||
msm_ipc_router_debug_mask |= SMEM_LOG;
|
||||
ipc_rtr_log_ctxt = ipc_log_context_create(IPC_RTR_LOG_PAGES,
|
||||
"ipc_router");
|
||||
"ipc_router", 0);
|
||||
if (!ipc_rtr_log_ctxt)
|
||||
IPC_RTR_ERR("%s: Unable to create IPC logging for IPC RTR",
|
||||
__func__);
|
||||
|
|
|
@ -634,13 +634,13 @@ void msm_ipc_router_ipc_log_init(void)
|
|||
{
|
||||
ipc_req_resp_log_txt =
|
||||
ipc_log_context_create(REQ_RESP_IPC_LOG_PAGES,
|
||||
"ipc_rtr_req_resp");
|
||||
"ipc_rtr_req_resp", 0);
|
||||
if (!ipc_req_resp_log_txt) {
|
||||
IPC_RTR_ERR("%s: Unable to create IPC logging for Req/Resp",
|
||||
__func__);
|
||||
}
|
||||
ipc_ind_log_txt =
|
||||
ipc_log_context_create(IND_IPC_LOG_PAGES, "ipc_rtr_ind");
|
||||
ipc_log_context_create(IND_IPC_LOG_PAGES, "ipc_rtr_ind", 0);
|
||||
if (!ipc_ind_log_txt) {
|
||||
IPC_RTR_ERR("%s: Unable to create IPC logging for Indications",
|
||||
__func__);
|
||||
|
|
Loading…
Reference in New Issue