From adffac8a9b8ed3ae440e2db4f4981500f060ee51 Mon Sep 17 00:00:00 2001 From: Eric Holmberg Date: Mon, 13 Oct 2014 10:10:30 -0600 Subject: [PATCH] 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 --- Documentation/arm/msm/msm_ipc_logging.txt | 1 + arch/arm/mach-msm/bam_dmux.c | 5 +++-- .../mach-msm/include/mach/msm_ipc_logging.h | 8 +++++--- arch/arm/mach-msm/ipc_logging.c | 13 ++++++++++++- arch/arm/mach-msm/ipc_logging.h | 19 +++++++++++++++++++ arch/arm/mach-msm/ipc_router.c | 4 ++-- arch/arm/mach-msm/ipc_socket.c | 6 +++--- arch/arm/mach-msm/smd.c | 6 +++--- arch/arm/mach-msm/smd_pkt.c | 4 ++-- arch/arm/mach-msm/smd_tty.c | 4 ++-- arch/arm/mach-msm/smem.c | 4 ++-- arch/arm/mach-msm/smp2p.c | 4 ++-- drivers/slimbus/slim-msm-ngd.c | 2 +- drivers/tty/n_smux.c | 4 ++-- drivers/tty/serial/msm_serial_hs.c | 2 +- 15 files changed, 60 insertions(+), 26 deletions(-) diff --git a/Documentation/arm/msm/msm_ipc_logging.txt b/Documentation/arm/msm/msm_ipc_logging.txt index cb330b0e0cf..14229dc08ed 100644 --- a/Documentation/arm/msm/msm_ipc_logging.txt +++ b/Documentation/arm/msm/msm_ipc_logging.txt @@ -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 */ diff --git a/arch/arm/mach-msm/bam_dmux.c b/arch/arm/mach-msm/bam_dmux.c index b618cd44230..89df8ed9bf0 100644 --- a/arch/arm/mach-msm/bam_dmux.c +++ b/arch/arm/mach-msm/bam_dmux.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-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 @@ -2578,7 +2578,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__); } diff --git a/arch/arm/mach-msm/include/mach/msm_ipc_logging.h b/arch/arm/mach-msm/include/mach/msm_ipc_logging.h index b3bf07c8ae7..82d77850a56 100644 --- a/arch/arm/mach-msm/include/mach/msm_ipc_logging.h +++ b/arch/arm/mach-msm/include/mach/msm_ipc_logging.h @@ -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, diff --git a/arch/arm/mach-msm/ipc_logging.c b/arch/arm/mach-msm/ipc_logging.c index 425eede0a10..64816f261ef 100644 --- a/arch/arm/mach-msm/ipc_logging.c +++ b/arch/arm/mach-msm/ipc_logging.c @@ -568,8 +568,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; @@ -603,6 +613,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; diff --git a/arch/arm/mach-msm/ipc_logging.h b/arch/arm/mach-msm/ipc_logging.h index e1d3fcb7225..34ad5fb3ae0 100644 --- a/arch/arm/mach-msm/ipc_logging.h +++ b/arch/arm/mach-msm/ipc_logging.h @@ -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; diff --git a/arch/arm/mach-msm/ipc_router.c b/arch/arm/mach-msm/ipc_router.c index 6bb4011820f..fa9546984c3 100644 --- a/arch/arm/mach-msm/ipc_router.c +++ b/arch/arm/mach-msm/ipc_router.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-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 @@ -3330,7 +3330,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) pr_err("%s: Unable to create IPC logging for IPC RTR", __func__); diff --git a/arch/arm/mach-msm/ipc_socket.c b/arch/arm/mach-msm/ipc_socket.c index 5aa6c93afdf..77943e3727d 100644 --- a/arch/arm/mach-msm/ipc_socket.c +++ b/arch/arm/mach-msm/ipc_socket.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-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 @@ -626,13 +626,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) { pr_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) { pr_err("%s: Unable to create IPC logging for Indications", __func__); diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c index 32f9b3b8f0a..33fae19bb34 100644 --- a/arch/arm/mach-msm/smd.c +++ b/arch/arm/mach-msm/smd.c @@ -1,7 +1,7 @@ /* arch/arm/mach-msm/smd.c * * Copyright (C) 2007 Google, Inc. - * Copyright (c) 2008-2013, The Linux Foundation. All rights reserved. + * Copyright (c) 2008-2014, The Linux Foundation. All rights reserved. * Author: Brian Swetland * * This software is licensed under the terms of the GNU General Public @@ -3340,13 +3340,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; diff --git a/arch/arm/mach-msm/smd_pkt.c b/arch/arm/mach-msm/smd_pkt.c index 1c44f9ac0f7..90b630d2cda 100644 --- a/arch/arm/mach-msm/smd_pkt.c +++ b/arch/arm/mach-msm/smd_pkt.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2008-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 @@ -1123,7 +1123,7 @@ static int __init smd_pkt_init(void) INIT_DELAYED_WORK(&loopback_work, loopback_probe_worker); smd_pkt_ilctxt = ipc_log_context_create(SMD_PKT_IPC_LOG_PAGE_CNT, - "smd_pkt"); + "smd_pkt", 0); D_STATUS("SMD Packet Port Driver Initialized.\n"); return 0; diff --git a/arch/arm/mach-msm/smd_tty.c b/arch/arm/mach-msm/smd_tty.c index e1c51624d4e..6c3232c8f25 100644 --- a/arch/arm/mach-msm/smd_tty.c +++ b/arch/arm/mach-msm/smd_tty.c @@ -1,7 +1,7 @@ /* arch/arm/mach-msm/smd_tty.c * * Copyright (C) 2007 Google, Inc. - * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. + * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved. * Author: Brian Swetland * * This software is licensed under the terms of the GNU General Public @@ -740,7 +740,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__); } diff --git a/arch/arm/mach-msm/smem.c b/arch/arm/mach-msm/smem.c index 3c7cbebc795..032f8b1c9cd 100644 --- a/arch/arm/mach-msm/smem.c +++ b/arch/arm/mach-msm/smem.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2013-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 @@ -1370,7 +1370,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; diff --git a/arch/arm/mach-msm/smp2p.c b/arch/arm/mach-msm/smp2p.c index 5574eae8597..22eb7991fb1 100644 --- a/arch/arm/mach-msm/smp2p.c +++ b/arch/arm/mach-msm/smp2p.c @@ -1,6 +1,6 @@ /* arch/arm/mach-msm/smp2p.c * - * Copyright (c) 2013, The Linux Foundation. All rights reserved. + * Copyright (c) 2013-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 @@ -1829,7 +1829,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__); diff --git a/drivers/slimbus/slim-msm-ngd.c b/drivers/slimbus/slim-msm-ngd.c index b4c88cdf4c4..85e88422155 100644 --- a/drivers/slimbus/slim-msm-ngd.c +++ b/drivers/slimbus/slim-msm-ngd.c @@ -1293,7 +1293,7 @@ static int __devinit 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 { diff --git a/drivers/tty/n_smux.c b/drivers/tty/n_smux.c index e36806fba0c..ffcfe528373 100644 --- a/drivers/tty/n_smux.c +++ b/drivers/tty/n_smux.c @@ -1,6 +1,6 @@ /* drivers/tty/n_smux.c * - * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -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; diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c index ad1ecff6ef1..8545ce9d987 100644 --- a/drivers/tty/serial/msm_serial_hs.c +++ b/drivers/tty/serial/msm_serial_hs.c @@ -3095,7 +3095,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__);