From 0b3a1409c1208ed52d30e25a9c30faedc57d56ae Mon Sep 17 00:00:00 2001 From: 0ctobot Date: Thu, 4 Apr 2019 23:16:44 -0400 Subject: [PATCH] Revert "treewide: make every ipc_loggings a no-op" This is at best overkill, and at worst completely useless as ipc_logging functions are inherently no-op'ed when CONFIG_IPC_LOGGING is unset and optimized out by the compiler. This reverts commit 008e9854e641d98a22fb97ec9d4dcb905766a50b. Signed-off-by: Adam W. Willis --- drivers/char/msm_smd_pkt.c | 6 +- drivers/devfreq/devfreq_spdm.c | 6 +- drivers/dma/qcom/gpi.c | 26 +++ drivers/net/wireless/cnss2/debug.h | 5 +- drivers/pci/host/pci-msm.c | 28 +++- drivers/platform/msm/ep_pcie/ep_pcie_com.h | 21 +++ drivers/platform/msm/gsi/gsi.h | 7 +- drivers/platform/msm/ipa/ipa_common_i.h | 7 +- drivers/platform/msm/mhi_dev/mhi.h | 4 + drivers/platform/msm/mhi_dev/mhi_dev_net.c | 8 +- drivers/platform/msm/mhi_dev/mhi_uci.c | 4 + drivers/platform/msm/sps/spsi.h | 45 +++++- drivers/slimbus/slim-msm.h | 13 ++ drivers/soc/qcom/bam_dmux.c | 19 ++- drivers/soc/qcom/glink_loopback_server.c | 6 +- drivers/soc/qcom/glink_private.h | 178 ++++++++++++++++++--- drivers/soc/qcom/glink_smem_native_xprt.c | 12 +- drivers/soc/qcom/glink_ssr.c | 6 +- drivers/soc/qcom/icnss.c | 26 ++- drivers/soc/qcom/msm_glink_pkt.c | 8 +- drivers/soc/qcom/msm_smd.c | 40 ++++- drivers/soc/qcom/msm_smem.c | 19 ++- drivers/soc/qcom/qmi_interface.c | 15 +- drivers/soc/qcom/qsee_ipc_irq_bridge.c | 7 +- drivers/soc/qcom/smd_init_dt.c | 16 +- drivers/soc/qcom/smp2p_private.h | 22 ++- drivers/soc/qcom/system_health_monitor.c | 12 +- drivers/soc/qcom/wcnss/wcnss_wlan.c | 5 +- drivers/tty/serial/msm_serial_hs.c | 27 +++- drivers/tty/serial/msm_smd_tty.c | 16 +- drivers/usb/gadget/function/f_fs.c | 2 + drivers/usb/pd/policy_engine.c | 8 + net/ipc_router/ipc_router_core.c | 3 + techpack/audio/ipc/apr.c | 7 +- 34 files changed, 560 insertions(+), 74 deletions(-) diff --git a/drivers/char/msm_smd_pkt.c b/drivers/char/msm_smd_pkt.c index 643ddfbf6560..c93c1dae97b4 100644 --- a/drivers/char/msm_smd_pkt.c +++ b/drivers/char/msm_smd_pkt.c @@ -119,7 +119,11 @@ enum { #ifdef DEBUG -#define SMD_PKT_LOG_STRING(x...) ((void)0) +#define SMD_PKT_LOG_STRING(x...) \ +do { \ + if (smd_pkt_ilctxt) \ + ipc_log_string(smd_pkt_ilctxt, ": "x); \ +} while (0) #define D_STATUS(x...) \ do { \ diff --git a/drivers/devfreq/devfreq_spdm.c b/drivers/devfreq/devfreq_spdm.c index eb3028761212..3290a2a9929f 100644 --- a/drivers/devfreq/devfreq_spdm.c +++ b/drivers/devfreq/devfreq_spdm.c @@ -30,7 +30,11 @@ static void *spdm_ipc_log_ctxt; #define DEVFREQ_SPDM_DEFAULT_WINDOW_MS 100 #define SPDM_IPC_LOG_PAGES 5 -#define SPDM_IPC_LOG(x...) ((void)0) +#define SPDM_IPC_LOG(x...) do { \ + pr_debug(x); \ + if (spdm_ipc_log_ctxt) \ + ipc_log_string(spdm_ipc_log_ctxt, x); \ +} while (0) #define COPY_SIZE(x, y) ((x) <= (y) ? (x) : (y)) diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c index 4d5593a5345b..de735758216f 100644 --- a/drivers/dma/qcom/gpi.c +++ b/drivers/dma/qcom/gpi.c @@ -43,10 +43,16 @@ #define GPI_LOG(gpi_dev, fmt, ...) do { \ if (gpi_dev->klog_lvl != LOG_LVL_MASK_ALL) \ dev_dbg(gpi_dev->dev, "%s: " fmt, __func__, ##__VA_ARGS__); \ + if (gpi_dev->ilctxt && gpi_dev->ipc_log_lvl != LOG_LVL_MASK_ALL) \ + ipc_log_string(gpi_dev->ilctxt, \ + "%s: " fmt, __func__, ##__VA_ARGS__); \ } while (0) #define GPI_ERR(gpi_dev, fmt, ...) do { \ if (gpi_dev->klog_lvl >= LOG_LVL_ERROR) \ dev_err(gpi_dev->dev, "%s: " fmt, __func__, ##__VA_ARGS__); \ + if (gpi_dev->ilctxt && gpi_dev->ipc_log_lvl >= LOG_LVL_ERROR) \ + ipc_log_string(gpi_dev->ilctxt, \ + "%s: " fmt, __func__, ##__VA_ARGS__); \ } while (0) /* gpii specific logging macros */ @@ -54,16 +60,28 @@ if (gpii->klog_lvl >= LOG_LVL_INFO) \ pr_info("%s:%u:%s: " fmt, gpii->label, ch, \ __func__, ##__VA_ARGS__); \ + if (gpii->ilctxt && gpii->ipc_log_lvl >= LOG_LVL_INFO) \ + ipc_log_string(gpii->ilctxt, \ + "ch:%u %s: " fmt, ch, \ + __func__, ##__VA_ARGS__); \ } while (0) #define GPII_ERR(gpii, ch, fmt, ...) do { \ if (gpii->klog_lvl >= LOG_LVL_ERROR) \ pr_err("%s:%u:%s: " fmt, gpii->label, ch, \ __func__, ##__VA_ARGS__); \ + if (gpii->ilctxt && gpii->ipc_log_lvl >= LOG_LVL_ERROR) \ + ipc_log_string(gpii->ilctxt, \ + "ch:%u %s: " fmt, ch, \ + __func__, ##__VA_ARGS__); \ } while (0) #define GPII_CRITIC(gpii, ch, fmt, ...) do { \ if (gpii->klog_lvl >= LOG_LVL_CRITICAL) \ pr_err("%s:%u:%s: " fmt, gpii->label, ch, \ __func__, ##__VA_ARGS__); \ + if (gpii->ilctxt && gpii->ipc_log_lvl >= LOG_LVL_CRITICAL) \ + ipc_log_string(gpii->ilctxt, \ + "ch:%u %s: " fmt, ch, \ + __func__, ##__VA_ARGS__); \ } while (0) enum DEBUG_LOG_LVL { @@ -91,11 +109,19 @@ enum EV_PRIORITY { if (gpii->klog_lvl >= LOG_LVL_REG_ACCESS) \ pr_info("%s:%u:%s: " fmt, gpii->label, \ ch, __func__, ##__VA_ARGS__); \ + if (gpii->ilctxt && gpii->ipc_log_lvl >= LOG_LVL_REG_ACCESS) \ + ipc_log_string(gpii->ilctxt, \ + "ch:%u %s: " fmt, ch, \ + __func__, ##__VA_ARGS__); \ } while (0) #define GPII_VERB(gpii, ch, fmt, ...) do { \ if (gpii->klog_lvl >= LOG_LVL_VERBOSE) \ pr_info("%s:%u:%s: " fmt, gpii->label, \ ch, __func__, ##__VA_ARGS__); \ + if (gpii->ilctxt && gpii->ipc_log_lvl >= LOG_LVL_VERBOSE) \ + ipc_log_string(gpii->ilctxt, \ + "ch:%u %s: " fmt, ch, \ + __func__, ##__VA_ARGS__); \ } while (0) #else diff --git a/drivers/net/wireless/cnss2/debug.h b/drivers/net/wireless/cnss2/debug.h index 9ffa472658e2..bf2e755f8ee0 100644 --- a/drivers/net/wireless/cnss2/debug.h +++ b/drivers/net/wireless/cnss2/debug.h @@ -20,7 +20,10 @@ extern void *cnss_ipc_log_context; -#define cnss_ipc_log_string(_x...) ((void)0) +#define cnss_ipc_log_string(_x...) do { \ + if (cnss_ipc_log_context) \ + ipc_log_string(cnss_ipc_log_context, _x); \ + } while (0) #define cnss_pr_err(_fmt, ...) do { \ printk("%scnss: " _fmt, KERN_ERR, ##__VA_ARGS__); \ diff --git a/drivers/pci/host/pci-msm.c b/drivers/pci/host/pci-msm.c index 9eb46962b20d..a3cba5f92f72 100644 --- a/drivers/pci/host/pci-msm.c +++ b/drivers/pci/host/pci-msm.c @@ -235,31 +235,57 @@ } while (0) #define PCIE_DBG(dev, fmt, arg...) do { \ + if ((dev) && (dev)->ipc_log_long) \ + ipc_log_string((dev)->ipc_log_long, \ + "DBG1:%s: " fmt, __func__, arg); \ + if ((dev) && (dev)->ipc_log) \ + ipc_log_string((dev)->ipc_log, "%s: " fmt, __func__, arg); \ if (msm_pcie_debug_mask) \ pr_alert("%s: " fmt, __func__, arg); \ } while (0) #define PCIE_DBG2(dev, fmt, arg...) do { \ + if ((dev) && (dev)->ipc_log) \ + ipc_log_string((dev)->ipc_log, "DBG2:%s: " fmt, __func__, arg);\ if (msm_pcie_debug_mask) \ pr_alert("%s: " fmt, __func__, arg); \ } while (0) #define PCIE_DBG3(dev, fmt, arg...) do { \ + if ((dev) && (dev)->ipc_log) \ + ipc_log_string((dev)->ipc_log, "DBG3:%s: " fmt, __func__, arg);\ if (msm_pcie_debug_mask) \ pr_alert("%s: " fmt, __func__, arg); \ } while (0) -#define PCIE_DUMP(dev, fmt, arg...) ((void)0) +#define PCIE_DUMP(dev, fmt, arg...) do { \ + if ((dev) && (dev)->ipc_log_dump) \ + ipc_log_string((dev)->ipc_log_dump, \ + "DUMP:%s: " fmt, __func__, arg); \ + } while (0) #define PCIE_DBG_FS(dev, fmt, arg...) do { \ + if ((dev) && (dev)->ipc_log_dump) \ + ipc_log_string((dev)->ipc_log_dump, \ + "DBG_FS:%s: " fmt, __func__, arg); \ pr_alert("%s: " fmt, __func__, arg); \ } while (0) #define PCIE_INFO(dev, fmt, arg...) do { \ + if ((dev) && (dev)->ipc_log_long) \ + ipc_log_string((dev)->ipc_log_long, \ + "INFO:%s: " fmt, __func__, arg); \ + if ((dev) && (dev)->ipc_log) \ + ipc_log_string((dev)->ipc_log, "%s: " fmt, __func__, arg); \ pr_info("%s: " fmt, __func__, arg); \ } while (0) #define PCIE_ERR(dev, fmt, arg...) do { \ + if ((dev) && (dev)->ipc_log_long) \ + ipc_log_string((dev)->ipc_log_long, \ + "ERR:%s: " fmt, __func__, arg); \ + if ((dev) && (dev)->ipc_log) \ + ipc_log_string((dev)->ipc_log, "%s: " fmt, __func__, arg); \ pr_err("%s: " fmt, __func__, arg); \ } while (0) diff --git a/drivers/platform/msm/ep_pcie/ep_pcie_com.h b/drivers/platform/msm/ep_pcie/ep_pcie_com.h index 1a75fe3efa66..a3ff69ad05d7 100644 --- a/drivers/platform/msm/ep_pcie/ep_pcie_com.h +++ b/drivers/platform/msm/ep_pcie/ep_pcie_com.h @@ -181,11 +181,19 @@ } while (0) #define EP_PCIE_DBG(dev, fmt, arg...) do { \ + if ((dev)->ipc_log_ful) \ + ipc_log_string((dev)->ipc_log_ful, "%s: " fmt, __func__, arg); \ if (ep_pcie_get_debug_mask()) \ pr_alert("%s: " fmt, __func__, arg); \ } while (0) #define EP_PCIE_DBG2(dev, fmt, arg...) do { \ + if ((dev)->ipc_log_sel) \ + ipc_log_string((dev)->ipc_log_sel, \ + "DBG1:%s: " fmt, __func__, arg); \ + if ((dev)->ipc_log_ful) \ + ipc_log_string((dev)->ipc_log_ful, \ + "DBG2:%s: " fmt, __func__, arg); \ if (ep_pcie_get_debug_mask()) \ pr_alert("%s: " fmt, __func__, arg); \ } while (0) @@ -193,15 +201,28 @@ #define EP_PCIE_DBG_FS(fmt, arg...) pr_alert("%s: " fmt, __func__, arg) #define EP_PCIE_DUMP(dev, fmt, arg...) do { \ + if ((dev)->ipc_log_dump) \ + ipc_log_string((dev)->ipc_log_dump, \ + "DUMP:%s: " fmt, __func__, arg); \ if (ep_pcie_get_debug_mask()) \ pr_alert("%s: " fmt, __func__, arg); \ } while (0) #define EP_PCIE_INFO(dev, fmt, arg...) do { \ + if ((dev)->ipc_log_sel) \ + ipc_log_string((dev)->ipc_log_sel, \ + "INFO:%s: " fmt, __func__, arg); \ + if ((dev)->ipc_log_ful) \ + ipc_log_string((dev)->ipc_log_ful, "%s: " fmt, __func__, arg); \ pr_info("%s: " fmt, __func__, arg); \ } while (0) #define EP_PCIE_ERR(dev, fmt, arg...) do { \ + if ((dev)->ipc_log_sel) \ + ipc_log_string((dev)->ipc_log_sel, \ + "ERR:%s: " fmt, __func__, arg); \ + if ((dev)->ipc_log_ful) \ + ipc_log_string((dev)->ipc_log_ful, "%s: " fmt, __func__, arg); \ pr_err("%s: " fmt, __func__, arg); \ } while (0) diff --git a/drivers/platform/msm/gsi/gsi.h b/drivers/platform/msm/gsi/gsi.h index b4489609eb46..4a3f4ec82032 100644 --- a/drivers/platform/msm/gsi/gsi.h +++ b/drivers/platform/msm/gsi/gsi.h @@ -35,7 +35,12 @@ #define gsi_readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; }) #define gsi_writel(v, c) ({ __iowmb(); writel_relaxed((v), (c)); }) -#define GSI_IPC_LOGGING(buf, fmt, args...) ((void)0) +#define GSI_IPC_LOGGING(buf, fmt, args...) \ + do { \ + if (buf) \ + ipc_log_string((buf), fmt, __func__, __LINE__, \ + ## args); \ + } while (0) #define GSIDBG(fmt, args...) \ do { \ diff --git a/drivers/platform/msm/ipa/ipa_common_i.h b/drivers/platform/msm/ipa/ipa_common_i.h index 4ef77a96d991..530aa545a328 100644 --- a/drivers/platform/msm/ipa/ipa_common_i.h +++ b/drivers/platform/msm/ipa/ipa_common_i.h @@ -345,7 +345,12 @@ struct ipa_hdr_offset_entry { extern const char *ipa_clients_strings[]; -#define IPA_IPC_LOGGING(buf, fmt, args...) ((void)0) +#define IPA_IPC_LOGGING(buf, fmt, args...) \ + do { \ + if (buf) \ + ipc_log_string((buf), fmt, __func__, __LINE__, \ + ## args); \ + } while (0) void ipa_inc_client_enable_clks(struct ipa_active_client_logging_info *id); void ipa_dec_client_disable_clks(struct ipa_active_client_logging_info *id); diff --git a/drivers/platform/msm/mhi_dev/mhi.h b/drivers/platform/msm/mhi_dev/mhi.h index eb992af4d845..5c03fb5b4588 100644 --- a/drivers/platform/msm/mhi_dev/mhi.h +++ b/drivers/platform/msm/mhi_dev/mhi.h @@ -599,6 +599,10 @@ extern void *mhi_ipc_log; if (_msg_lvl >= mhi_msg_lvl) { \ pr_err("[%s] "_msg, __func__, ##__VA_ARGS__); \ } \ + if (mhi_ipc_log && (_msg_lvl >= mhi_ipc_msg_lvl)) { \ + ipc_log_string(mhi_ipc_log, \ + "[0x%x %s] " _msg, bhi_imgtxdb, __func__, ##__VA_ARGS__); \ + } \ } while (0) diff --git a/drivers/platform/msm/mhi_dev/mhi_dev_net.c b/drivers/platform/msm/mhi_dev/mhi_dev_net.c index 396470a243f5..d1f86a476f46 100644 --- a/drivers/platform/msm/mhi_dev/mhi_dev_net.c +++ b/drivers/platform/msm/mhi_dev/mhi_dev_net.c @@ -73,6 +73,10 @@ struct mhi_dev_net_chan_attr { if (_msg_lvl >= mhi_net_msg_lvl) { \ pr_err("[%s] "_msg, __func__, ##__VA_ARGS__); \ } \ + if (mhi_net_ipc_log && (_msg_lvl >= mhi_net_ipc_log_lvl)) { \ + ipc_log_string(mhi_net_ipc_log, \ + "[%s] " _msg, __func__, ##__VA_ARGS__); \ + } \ } while (0) module_param(mhi_net_msg_lvl, uint, 0644); @@ -580,9 +584,7 @@ static int mhi_dev_net_close(void) } /* freeing mhi client and IPC context */ kfree(client); - if (mhi_net_ipc_log) - kfree(mhi_net_ipc_log); - + kfree(mhi_net_ipc_log); return 0; } diff --git a/drivers/platform/msm/mhi_dev/mhi_uci.c b/drivers/platform/msm/mhi_dev/mhi_uci.c index cb8032309889..1876bdb57389 100644 --- a/drivers/platform/msm/mhi_dev/mhi_uci.c +++ b/drivers/platform/msm/mhi_dev/mhi_uci.c @@ -338,6 +338,10 @@ struct mhi_uci_ctxt_t { if (_msg_lvl >= mhi_uci_msg_lvl) { \ pr_err("[%s] "_msg, __func__, ##__VA_ARGS__); \ } \ + if (mhi_uci_ipc_log && (_msg_lvl >= mhi_uci_ipc_log_lvl)) { \ + ipc_log_string(mhi_uci_ipc_log, \ + "[%s] " _msg, __func__, ##__VA_ARGS__); \ + } \ } while (0) diff --git a/drivers/platform/msm/sps/spsi.h b/drivers/platform/msm/sps/spsi.h index 75dd89fcaa8c..0c1b8ea1a60e 100644 --- a/drivers/platform/msm/sps/spsi.h +++ b/drivers/platform/msm/sps/spsi.h @@ -117,8 +117,33 @@ extern u8 logging_option; extern u8 debug_level_option; extern u8 print_limit_option; +#define SPS_IPC(idx, dev, msg, args...) do { \ + if (dev) { \ + if ((idx == 0) && (dev)->ipc_log0) \ + ipc_log_string((dev)->ipc_log0, \ + "%s: " msg, __func__, args); \ + else if ((idx == 1) && (dev)->ipc_log1) \ + ipc_log_string((dev)->ipc_log1, \ + "%s: " msg, __func__, args); \ + else if ((idx == 2) && (dev)->ipc_log2) \ + ipc_log_string((dev)->ipc_log2, \ + "%s: " msg, __func__, args); \ + else if ((idx == 3) && (dev)->ipc_log3) \ + ipc_log_string((dev)->ipc_log3, \ + "%s: " msg, __func__, args); \ + else if ((idx == 4) && (dev)->ipc_log4) \ + ipc_log_string((dev)->ipc_log4, \ + "%s: " msg, __func__, args); \ + else \ + pr_debug("sps: no such IPC logging index!\n"); \ + } \ + } while (0) #define SPS_DUMP(msg, args...) do { \ - pr_info(msg, ##args); \ + SPS_IPC(4, sps, msg, args); \ + if (sps) { \ + if (sps->ipc_log4 == NULL) \ + pr_info(msg, ##args); \ + } \ } while (0) #define SPS_ERR(dev, msg, args...) do { \ if (logging_option != 1) { \ @@ -127,6 +152,7 @@ extern u8 print_limit_option; else \ pr_err(msg, ##args); \ } \ + SPS_IPC(3, dev, msg, args); \ } while (0) #define SPS_INFO(dev, msg, args...) do { \ if (logging_option != 1) { \ @@ -135,6 +161,7 @@ extern u8 print_limit_option; else \ pr_info(msg, ##args); \ } \ + SPS_IPC(3, dev, msg, args); \ } while (0) #define SPS_DBG(dev, msg, args...) do { \ if ((unlikely(logging_option > 1)) \ @@ -145,6 +172,10 @@ extern u8 print_limit_option; pr_info(msg, ##args); \ } else \ pr_debug(msg, ##args); \ + if (dev) { \ + if ((dev)->ipc_loglevel <= 0) \ + SPS_IPC(0, dev, msg, args); \ + } \ } while (0) #define SPS_DBG1(dev, msg, args...) do { \ if ((unlikely(logging_option > 1)) \ @@ -155,6 +186,10 @@ extern u8 print_limit_option; pr_info(msg, ##args); \ } else \ pr_debug(msg, ##args); \ + if (dev) { \ + if ((dev)->ipc_loglevel <= 1) \ + SPS_IPC(1, dev, msg, args); \ + } \ } while (0) #define SPS_DBG2(dev, msg, args...) do { \ if ((unlikely(logging_option > 1)) \ @@ -165,6 +200,10 @@ extern u8 print_limit_option; pr_info(msg, ##args); \ } else \ pr_debug(msg, ##args); \ + if (dev) { \ + if ((dev)->ipc_loglevel <= 2) \ + SPS_IPC(2, dev, msg, args); \ + } \ } while (0) #define SPS_DBG3(dev, msg, args...) do { \ if ((unlikely(logging_option > 1)) \ @@ -175,6 +214,10 @@ extern u8 print_limit_option; pr_info(msg, ##args); \ } else \ pr_debug(msg, ##args); \ + if (dev) { \ + if ((dev)->ipc_loglevel <= 3) \ + SPS_IPC(3, dev, msg, args); \ + } \ } while (0) #else #define SPS_DBG3(x...) pr_debug(x) diff --git a/drivers/slimbus/slim-msm.h b/drivers/slimbus/slim-msm.h index 97521aeda29a..edebfd935483 100644 --- a/drivers/slimbus/slim-msm.h +++ b/drivers/slimbus/slim-msm.h @@ -374,15 +374,23 @@ enum { /* Default IPC log level INFO */ #define SLIM_DBG(dev, x...) do { \ pr_debug(x); \ + if (dev->ipc_slimbus_log && dev->ipc_log_mask >= DBG_LEV) { \ + ipc_log_string(dev->ipc_slimbus_log, x); \ + } \ } while (0) #define SLIM_INFO(dev, x...) do { \ pr_debug(x); \ + if (dev->ipc_slimbus_log && dev->ipc_log_mask >= INFO_LEV) {\ + ipc_log_string(dev->ipc_slimbus_log, x); \ + } \ } while (0) /* warnings and errors show up on console always */ #define SLIM_WARN(dev, x...) do { \ pr_warn(x); \ + if (dev->ipc_slimbus_log && dev->ipc_log_mask >= WARN_LEV) \ + ipc_log_string(dev->ipc_slimbus_log, x); \ } while (0) /* ERROR condition in the driver sets the hs_serial_debug_mask @@ -391,6 +399,11 @@ enum { */ #define SLIM_ERR(dev, x...) do { \ pr_err(x); \ + if (dev->ipc_slimbus_log && dev->ipc_log_mask >= ERR_LEV) { \ + ipc_log_string(dev->ipc_slimbus_log, x); \ + dev->default_ipc_log_mask = dev->ipc_log_mask; \ + dev->ipc_log_mask = FATAL_LEV; \ + } \ } while (0) #define SLIM_RST_LOGLVL(dev) { \ diff --git a/drivers/soc/qcom/bam_dmux.c b/drivers/soc/qcom/bam_dmux.c index 6ce83895bc26..84e51931cbac 100644 --- a/drivers/soc/qcom/bam_dmux.c +++ b/drivers/soc/qcom/bam_dmux.c @@ -323,10 +323,27 @@ static void *bam_ipc_log_txt; * D: 1 = Disconnect ACK active */ -#define BAM_DMUX_LOG(fmt, args...) ((void)0) +#define BAM_DMUX_LOG(fmt, args...) \ +do { \ + if (bam_ipc_log_txt) { \ + ipc_log_string(bam_ipc_log_txt, \ + " %c%c%c%c %c%c%c%c%d " fmt, \ + a2_pc_disabled ? 'D' : 'd', \ + in_global_reset ? 'R' : 'r', \ + bam_dmux_power_state ? 'P' : 'p', \ + bam_connection_is_active ? 'A' : 'a', \ + bam_dmux_uplink_vote ? 'V' : 'v', \ + bam_is_connected ? 'U' : 'u', \ + wait_for_ack ? 'W' : 'w', \ + ul_wakeup_ack_completion.done ? 'A' : 'a', \ + atomic_read(&ul_ondemand_vote), \ + args); \ + } \ +} while (0) #define DMUX_LOG_KERR(fmt, args...) \ do { \ + BAM_DMUX_LOG(fmt, args); \ pr_err(fmt, args); \ } while (0) diff --git a/drivers/soc/qcom/glink_loopback_server.c b/drivers/soc/qcom/glink_loopback_server.c index 6d883c289a8e..abd140ec302a 100644 --- a/drivers/soc/qcom/glink_loopback_server.c +++ b/drivers/soc/qcom/glink_loopback_server.c @@ -20,12 +20,16 @@ #include #include "glink_loopback_commands.h" + /* Number of internal IPC Logging log pages */ #define GLINK_LBSRV_NUM_LOG_PAGES 3 static void *glink_lbsrv_log_ctx; -#define GLINK_LBSRV_IPC_LOG_STR(x...) ((void)0) +#define GLINK_LBSRV_IPC_LOG_STR(x...) do { \ + if (glink_lbsrv_log_ctx) \ + ipc_log_string(glink_lbsrv_log_ctx, x); \ +} while (0) #define LBSRV_INFO(x...) GLINK_LBSRV_IPC_LOG_STR(" " x) diff --git a/drivers/soc/qcom/glink_private.h b/drivers/soc/qcom/glink_private.h index 824c2b397649..c982cbdd8fd2 100644 --- a/drivers/soc/qcom/glink_private.h +++ b/drivers/soc/qcom/glink_private.h @@ -140,70 +140,198 @@ const char *glink_get_xprt_state_string(enum transport_state_e enum_id); */ const char *glink_get_ch_state_string(enum local_channel_state_e enum_id); -#define GLINK_IPC_LOG_STR(x...) ((void)0) +#define GLINK_IPC_LOG_STR(x...) do { \ + if (glink_get_log_ctx()) \ + ipc_log_string(glink_get_log_ctx(), x); \ +} while (0) -#define GLINK_DBG(x...) ((void)0) +#define GLINK_DBG(x...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_DEBUG) \ + GLINK_IPC_LOG_STR(x); \ +} while (0) -#define GLINK_INFO(x...) ((void)0) +#define GLINK_INFO(x...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_INFO) \ + GLINK_IPC_LOG_STR(x); \ +} while (0) -#define GLINK_INFO_PERF(x...) ((void)0) +#define GLINK_INFO_PERF(x...) do { \ + if (glink_get_debug_mask() & (QCOM_GLINK_INFO | QCOM_GLINK_PERF)) \ + GLINK_IPC_LOG_STR(x); \ +} while (0) -#define GLINK_PERF(x...) ((void)0) +#define GLINK_PERF(x...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_PERF) \ + GLINK_IPC_LOG_STR(" " x); \ +} while (0) #define GLINK_UT_ERR(x...) do { \ if (!(glink_get_debug_mask() & QCOM_GLINK_PERF)) \ pr_err(" " x); \ + GLINK_IPC_LOG_STR(" " x); \ } while (0) -#define GLINK_UT_DBG(x...) ((void)0) +#define GLINK_UT_DBG(x...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_DEBUG) \ + GLINK_IPC_LOG_STR(" " x); \ +} while (0) -#define GLINK_UT_INFO(x...) ((void)0) +#define GLINK_UT_INFO(x...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_INFO) \ + GLINK_IPC_LOG_STR(" " x); \ +} while (0) -#define GLINK_UT_INFO_PERF(x...) ((void)0) +#define GLINK_UT_INFO_PERF(x...) do { \ + if (glink_get_debug_mask() & (QCOM_GLINK_INFO | QCOM_GLINK_PERF)) \ + GLINK_IPC_LOG_STR(" " x); \ +} while (0) -#define GLINK_UT_PERF(x...) ((void)0) +#define GLINK_UT_PERF(x...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_PERF) \ + GLINK_IPC_LOG_STR(" " x); \ +} while (0) -#define GLINK_XPRT_IPC_LOG_STR(xprt, x...) ((void)0) +#define GLINK_XPRT_IPC_LOG_STR(xprt, x...) do { \ + if (glink_get_xprt_log_ctx(xprt)) \ + ipc_log_string(glink_get_xprt_log_ctx(xprt), x); \ +} while (0) -#define GLINK_XPRT_IF_INFO(xprt_if, x...) ((void)0) +#define GLINK_XPRT_IF_INFO(xprt_if, x...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_INFO) \ + GLINK_XPRT_IPC_LOG_STR(xprt_if.glink_core_priv, " " x); \ +} while (0) -#define GLINK_XPRT_IF_DBG(xprt_if, x...) ((void)0) +#define GLINK_XPRT_IF_DBG(xprt_if, x...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_DEBUG) \ + GLINK_XPRT_IPC_LOG_STR(xprt_if.glink_core_priv, " " x); \ +} while (0) #define GLINK_XPRT_IF_ERR(xprt_if, x...) do { \ pr_err(" " x); \ + GLINK_XPRT_IPC_LOG_STR(xprt_if.glink_core_priv, " " x); \ } while (0) -#define GLINK_PERF_XPRT(xprt, fmt, args...) ((void)0) +#define GLINK_PERF_XPRT(xprt, fmt, args...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_PERF) \ + GLINK_XPRT_IPC_LOG_STR(xprt, " %s:%s " fmt, \ + xprt->name, xprt->edge, args); \ +} while (0) -#define GLINK_PERF_CH(ctx, fmt, args...) ((void)0) +#define GLINK_PERF_CH(ctx, fmt, args...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_PERF) \ + GLINK_XPRT_IPC_LOG_STR(ctx->transport_ptr, \ + " %s:%s:%s[%u:%u] " fmt, \ + ctx->transport_ptr->name, \ + ctx->transport_ptr->edge, \ + ctx->name, \ + ctx->lcid, \ + ctx->rcid, args); \ +} while (0) -#define GLINK_PERF_CH_XPRT(ctx, xprt, fmt, args...) ((void)0) +#define GLINK_PERF_CH_XPRT(ctx, xprt, fmt, args...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_PERF) \ + GLINK_XPRT_IPC_LOG_STR(xprt, \ + " %s:%s:%s[%u:%u] " fmt, \ + xprt->name, \ + xprt->edge, \ + ctx->name, \ + ctx->lcid, \ + ctx->rcid, args); \ +} while (0) -#define GLINK_INFO_PERF_XPRT(xprt, fmt, args...) ((void)0) +#define GLINK_INFO_PERF_XPRT(xprt, fmt, args...) do { \ + if (glink_get_debug_mask() & (QCOM_GLINK_INFO | QCOM_GLINK_PERF)) \ + GLINK_XPRT_IPC_LOG_STR(xprt, " %s:%s " fmt, \ + xprt->name, xprt->edge, args); \ +} while (0) -#define GLINK_INFO_PERF_CH(ctx, fmt, args...) ((void)0) +#define GLINK_INFO_PERF_CH(ctx, fmt, args...) do { \ + if (glink_get_debug_mask() & (QCOM_GLINK_INFO | QCOM_GLINK_PERF)) \ + GLINK_XPRT_IPC_LOG_STR(ctx->transport_ptr, \ + " %s:%s:%s[%u:%u] " fmt, \ + ctx->transport_ptr->name, \ + ctx->transport_ptr->edge, \ + ctx->name, \ + ctx->lcid, \ + ctx->rcid, args); \ +} while (0) -#define GLINK_INFO_PERF_CH_XPRT(ctx, xprt, fmt, args...) ((void)0) +#define GLINK_INFO_PERF_CH_XPRT(ctx, xprt, fmt, args...) do { \ + if (glink_get_debug_mask() & (QCOM_GLINK_INFO | QCOM_GLINK_PERF)) \ + GLINK_XPRT_IPC_LOG_STR(xprt,\ + " %s:%s:%s[%u:%u] " fmt, \ + xprt->name, \ + xprt->edge, \ + ctx->name, \ + ctx->lcid, \ + ctx->rcid, args); \ +} while (0) -#define GLINK_INFO_XPRT(xprt, fmt, args...) ((void)0) +#define GLINK_INFO_XPRT(xprt, fmt, args...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_INFO) \ + GLINK_XPRT_IPC_LOG_STR(xprt, " %s:%s " fmt, \ + xprt->name, xprt->edge, args); \ +} while (0) -#define GLINK_INFO_CH(ctx, fmt, args...) ((void)0) +#define GLINK_INFO_CH(ctx, fmt, args...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_INFO) \ + GLINK_XPRT_IPC_LOG_STR(ctx->transport_ptr, \ + " %s:%s:%s[%u:%u] " fmt, \ + ctx->transport_ptr->name, \ + ctx->transport_ptr->edge, \ + ctx->name, \ + ctx->lcid, \ + ctx->rcid, args); \ +} while (0) -#define GLINK_INFO_CH_XPRT(ctx, xprt, fmt, args...) ((void)0) +#define GLINK_INFO_CH_XPRT(ctx, xprt, fmt, args...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_INFO) \ + GLINK_XPRT_IPC_LOG_STR(xprt, \ + " %s:%s:%s[%u:%u] " fmt, \ + xprt->name, \ + xprt->edge, \ + ctx->name, \ + ctx->lcid, \ + ctx->rcid, args); \ +} while (0) -#define GLINK_DBG_XPRT(xprt, fmt, args...) ((void)0) +#define GLINK_DBG_XPRT(xprt, fmt, args...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_DEBUG) \ + GLINK_XPRT_IPC_LOG_STR(xprt, " %s:%s " fmt, \ + xprt->name, xprt->edge, args); \ +} while (0) -#define GLINK_DBG_CH(ctx, fmt, args...) ((void)0) +#define GLINK_DBG_CH(ctx, fmt, args...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_DEBUG) \ + GLINK_XPRT_IPC_LOG_STR(ctx->transport_ptr, \ + " %s:%s:%s[%u:%u] " fmt, \ + ctx->transport_ptr->name, \ + ctx->transport_ptr->edge, \ + ctx->name, \ + ctx->lcid, \ + ctx->rcid, args); \ +} while (0) -#define GLINK_DBG_CH_XPRT(ctx, xprt, fmt, args...) ((void)0) +#define GLINK_DBG_CH_XPRT(ctx, xprt, fmt, args...) do { \ + if (glink_get_debug_mask() & QCOM_GLINK_DEBUG) \ + GLINK_XPRT_IPC_LOG_STR(xprt, \ + " %s:%s:%s[%u:%u] " fmt, \ + xprt->name, \ + xprt->edge, \ + ctx->name, \ + ctx->lcid, \ + ctx->rcid, args); \ +} while (0) #define GLINK_ERR(x...) do { \ pr_err_ratelimited(" " x); \ + GLINK_IPC_LOG_STR(" " x); \ } while (0) #define GLINK_ERR_XPRT(xprt, fmt, args...) do { \ pr_err_ratelimited(" %s:%s " fmt, \ xprt->name, xprt->edge, args); \ + GLINK_INFO_XPRT(xprt, fmt, args); \ } while (0) #define GLINK_ERR_CH(ctx, fmt, args...) do { \ @@ -213,6 +341,7 @@ const char *glink_get_ch_state_string(enum local_channel_state_e enum_id); ctx->name, \ ctx->lcid, \ ctx->rcid, args); \ + GLINK_INFO_CH(ctx, fmt, args); \ } while (0) #define GLINK_ERR_CH_XPRT(ctx, xprt, fmt, args...) do { \ @@ -222,6 +351,7 @@ const char *glink_get_ch_state_string(enum local_channel_state_e enum_id); ctx->name, \ ctx->lcid, \ ctx->rcid, args); \ + GLINK_INFO_CH_XPRT(ctx, xprt, fmt, args); \ } while (0) /** diff --git a/drivers/soc/qcom/glink_smem_native_xprt.c b/drivers/soc/qcom/glink_smem_native_xprt.c index b85d63f50808..8b5a46d05398 100644 --- a/drivers/soc/qcom/glink_smem_native_xprt.c +++ b/drivers/soc/qcom/glink_smem_native_xprt.c @@ -264,7 +264,17 @@ static struct glink_core_version versions[] = { {1, TRACER_PKT_FEATURE, negotiate_features_v1}, }; -#define SMEM_IPC_LOG(einfo, str, id, param1, param2) ((void)0) +#define SMEM_IPC_LOG(einfo, str, id, param1, param2) do { \ + if ((glink_xprt_debug_mask & QCOM_GLINK_DEBUG_ENABLE) \ + && (einfo->debug_mask & QCOM_GLINK_DEBUG_ENABLE)) \ + ipc_log_string(einfo->log_ctx, \ + "%s: Rx:%x:%x Tx:%x:%x Cmd:%x P1:%x P2:%x\n", \ + str, einfo->rx_ch_desc->read_index, \ + einfo->rx_ch_desc->write_index, \ + einfo->tx_ch_desc->read_index, \ + einfo->tx_ch_desc->write_index, \ + id, param1, param2); \ +} while (0) \ enum { QCOM_GLINK_DEBUG_ENABLE = 1U << 0, diff --git a/drivers/soc/qcom/glink_ssr.c b/drivers/soc/qcom/glink_ssr.c index c3d4a5b1309f..c16621a8655d 100644 --- a/drivers/soc/qcom/glink_ssr.c +++ b/drivers/soc/qcom/glink_ssr.c @@ -30,10 +30,14 @@ #define NUM_LOG_PAGES 3 #define GLINK_SSR_PRIORITY 1 -#define GLINK_SSR_LOG(x...) ((void)0) +#define GLINK_SSR_LOG(x...) do { \ + if (glink_ssr_log_ctx) \ + ipc_log_string(glink_ssr_log_ctx, x); \ +} while (0) #define GLINK_SSR_ERR(x...) do { \ pr_err(x); \ + GLINK_SSR_LOG(x); \ } while (0) static void *glink_ssr_log_ctx; diff --git a/drivers/soc/qcom/icnss.c b/drivers/soc/qcom/icnss.c index 4b744f0f659e..9c57f08525e6 100644 --- a/drivers/soc/qcom/icnss.c +++ b/drivers/soc/qcom/icnss.c @@ -78,45 +78,67 @@ module_param(qmi_timeout, ulong, 0600); #define PROBE_TIMEOUT 5000 -#define icnss_ipc_log_string(_x...) ((void)0) +#define icnss_ipc_log_string(_x...) do { \ + if (icnss_ipc_log_context) \ + ipc_log_string(icnss_ipc_log_context, _x); \ + } while (0) -#define icnss_ipc_log_long_string(_x...) ((void)0) +#define icnss_ipc_log_long_string(_x...) do { \ + if (icnss_ipc_log_long_context) \ + ipc_log_string(icnss_ipc_log_long_context, _x); \ + } while (0) #define icnss_pr_err(_fmt, ...) do { \ printk("%s" pr_fmt(_fmt), KERN_ERR, ##__VA_ARGS__); \ + icnss_ipc_log_string("%s" pr_fmt(_fmt), "", \ + ##__VA_ARGS__); \ } while (0) #define icnss_pr_warn(_fmt, ...) do { \ printk("%s" pr_fmt(_fmt), KERN_WARNING, ##__VA_ARGS__); \ + icnss_ipc_log_string("%s" pr_fmt(_fmt), "", \ + ##__VA_ARGS__); \ } while (0) #define icnss_pr_info(_fmt, ...) do { \ printk("%s" pr_fmt(_fmt), KERN_INFO, ##__VA_ARGS__); \ + icnss_ipc_log_string("%s" pr_fmt(_fmt), "", \ + ##__VA_ARGS__); \ } while (0) #if defined(CONFIG_DYNAMIC_DEBUG) #define icnss_pr_dbg(_fmt, ...) do { \ pr_debug(_fmt, ##__VA_ARGS__); \ + icnss_ipc_log_string(pr_fmt(_fmt), ##__VA_ARGS__); \ } while (0) #define icnss_pr_vdbg(_fmt, ...) do { \ pr_debug(_fmt, ##__VA_ARGS__); \ + icnss_ipc_log_long_string(pr_fmt(_fmt), ##__VA_ARGS__); \ } while (0) #elif defined(DEBUG) #define icnss_pr_dbg(_fmt, ...) do { \ printk("%s" pr_fmt(_fmt), KERN_DEBUG, ##__VA_ARGS__); \ + icnss_ipc_log_string("%s" pr_fmt(_fmt), "", \ + ##__VA_ARGS__); \ } while (0) #define icnss_pr_vdbg(_fmt, ...) do { \ printk("%s" pr_fmt(_fmt), KERN_DEBUG, ##__VA_ARGS__); \ + icnss_ipc_log_long_string("%s" pr_fmt(_fmt), "", \ + ##__VA_ARGS__); \ } while (0) #else #define icnss_pr_dbg(_fmt, ...) do { \ no_printk("%s" pr_fmt(_fmt), KERN_DEBUG, ##__VA_ARGS__); \ + icnss_ipc_log_string("%s" pr_fmt(_fmt), "", \ + ##__VA_ARGS__); \ } while (0) #define icnss_pr_vdbg(_fmt, ...) do { \ no_printk("%s" pr_fmt(_fmt), KERN_DEBUG, ##__VA_ARGS__); \ + icnss_ipc_log_long_string("%s" pr_fmt(_fmt), "", \ + ##__VA_ARGS__); \ } while (0) #endif diff --git a/drivers/soc/qcom/msm_glink_pkt.c b/drivers/soc/qcom/msm_glink_pkt.c index 8f0f36355512..4559f11b7d52 100644 --- a/drivers/soc/qcom/msm_glink_pkt.c +++ b/drivers/soc/qcom/msm_glink_pkt.c @@ -210,17 +210,23 @@ static bool glink_pkt_read_avail(struct glink_pkt_dev *devp); #ifdef DEBUG -#define GLINK_PKT_LOG_STRING(x...) ((void)0) +#define GLINK_PKT_LOG_STRING(x...) \ +do { \ + if (glink_pkt_ilctxt) \ + ipc_log_string(glink_pkt_ilctxt, ": "x); \ +} while (0) #define GLINK_PKT_INFO(x...) \ do { \ if (msm_glink_pkt_debug_mask & GLINK_PKT_STATUS) \ pr_info("Status: "x); \ + GLINK_PKT_LOG_STRING(x); \ } while (0) #define GLINK_PKT_ERR(x...) \ do { \ pr_err_ratelimited(" err: "x); \ + GLINK_PKT_LOG_STRING(x); \ } while (0) #else diff --git a/drivers/soc/qcom/msm_smd.c b/drivers/soc/qcom/msm_smd.c index bef4f3807b7e..15ca3aa34128 100644 --- a/drivers/soc/qcom/msm_smd.c +++ b/drivers/soc/qcom/msm_smd.c @@ -143,25 +143,49 @@ void *smsm_log_ctx; #define NUM_LOG_PAGES 4 #define IPC_LOG_SMD(level, x...) do { \ - printk(level x); \ + if (smd_log_ctx) \ + ipc_log_string(smd_log_ctx, x); \ + else \ + printk(level x); \ } while (0) #define IPC_LOG_SMSM(level, x...) do { \ - printk(level x); \ + if (smsm_log_ctx) \ + ipc_log_string(smsm_log_ctx, x); \ + else \ + printk(level x); \ } while (0) #if defined(CONFIG_MSM_SMD_DEBUG) -#define SMD_DBG(x...) ((void)0) +#define SMD_DBG(x...) do { \ + if (msm_smd_debug_mask & MSM_SMD_DEBUG) \ + IPC_LOG_SMD(KERN_DEBUG, x); \ + } while (0) -#define SMSM_DBG(x...) ((void)0) +#define SMSM_DBG(x...) do { \ + if (msm_smd_debug_mask & MSM_SMSM_DEBUG) \ + IPC_LOG_SMSM(KERN_DEBUG, x); \ + } while (0) -#define SMD_INFO(x...) ((void)0) +#define SMD_INFO(x...) do { \ + if (msm_smd_debug_mask & MSM_SMD_INFO) \ + IPC_LOG_SMD(KERN_INFO, x); \ + } while (0) -#define SMSM_INFO(x...) ((void)0) +#define SMSM_INFO(x...) do { \ + if (msm_smd_debug_mask & MSM_SMSM_INFO) \ + IPC_LOG_SMSM(KERN_INFO, x); \ + } while (0) -#define SMD_POWER_INFO(x...) ((void)0) +#define SMD_POWER_INFO(x...) do { \ + if (msm_smd_debug_mask & MSM_SMD_POWER_INFO) \ + IPC_LOG_SMD(KERN_INFO, x); \ + } while (0) -#define SMSM_POWER_INFO(x...) ((void)0) +#define SMSM_POWER_INFO(x...) do { \ + if (msm_smd_debug_mask & MSM_SMSM_POWER_INFO) \ + IPC_LOG_SMSM(KERN_INFO, x); \ + } while (0) #else #define SMD_DBG(x...) do { } while (0) #define SMSM_DBG(x...) do { } while (0) diff --git a/drivers/soc/qcom/msm_smem.c b/drivers/soc/qcom/msm_smem.c index 983870ff7668..dd4978474f6b 100644 --- a/drivers/soc/qcom/msm_smem.c +++ b/drivers/soc/qcom/msm_smem.c @@ -48,15 +48,24 @@ module_param_named(debug_mask, msm_smem_debug_mask, static void *smem_ipc_log_ctx; #define NUM_LOG_PAGES 4 -#define IPC_LOG(x...) ((void)0) +#define IPC_LOG(x...) do { \ + if (smem_ipc_log_ctx) \ + ipc_log_string(smem_ipc_log_ctx, x); \ + } while (0) + #define LOG_ERR(x...) do { \ pr_err(x); \ + IPC_LOG(x); \ + } while (0) +#define SMEM_DBG(x...) do { \ + if (msm_smem_debug_mask & MSM_SMEM_DEBUG) \ + IPC_LOG(x); \ + } while (0) +#define SMEM_INFO(x...) do { \ + if (msm_smem_debug_mask & MSM_SMEM_INFO) \ + IPC_LOG(x); \ } while (0) - -#define SMEM_DBG(x...) ((void)0) - -#define SMEM_INFO(x...) ((void)0) #define SMEM_SPINLOCK_SMEM_ALLOC "S:3" diff --git a/drivers/soc/qcom/qmi_interface.c b/drivers/soc/qcom/qmi_interface.c index 44980645aa6f..0b952a48a33e 100644 --- a/drivers/soc/qcom/qmi_interface.c +++ b/drivers/soc/qcom/qmi_interface.c @@ -40,8 +40,19 @@ #define MAX_WQ_NAME_LEN 20 #define QMI_REQ_RESP_LOG_PAGES 3 #define QMI_IND_LOG_PAGES 2 -#define QMI_REQ_RESP_LOG(buf...) ((void)0) -#define QMI_IND_LOG(buf...) ((void)0) +#define QMI_REQ_RESP_LOG(buf...) \ +do { \ + if (qmi_req_resp_log_ctx) { \ + ipc_log_string(qmi_req_resp_log_ctx, buf); \ + } \ +} while (0) \ + +#define QMI_IND_LOG(buf...) \ +do { \ + if (qmi_ind_log_ctx) { \ + ipc_log_string(qmi_ind_log_ctx, buf); \ + } \ +} while (0) \ static LIST_HEAD(svc_event_nb_list); static DEFINE_MUTEX(svc_event_nb_list_lock); diff --git a/drivers/soc/qcom/qsee_ipc_irq_bridge.c b/drivers/soc/qcom/qsee_ipc_irq_bridge.c index 9333f9e099d4..ac3dcc35892d 100644 --- a/drivers/soc/qcom/qsee_ipc_irq_bridge.c +++ b/drivers/soc/qcom/qsee_ipc_irq_bridge.c @@ -27,11 +27,16 @@ #define NUM_LOG_PAGES 4 #define QIIB_DBG(x...) do { \ - pr_debug(x); \ + if (qiib_info->log_ctx) \ + ipc_log_string(qiib_info->log_ctx, x); \ + else \ + pr_debug(x); \ } while (0) #define QIIB_ERR(x...) do { \ pr_err(x); \ + if (qiib_info->log_ctx) \ + ipc_log_string(qiib_info->log_ctx, x); \ } while (0) static void qiib_cleanup(void); diff --git a/drivers/soc/qcom/smd_init_dt.c b/drivers/soc/qcom/smd_init_dt.c index 0f2b2e52d4db..f14461f55433 100644 --- a/drivers/soc/qcom/smd_init_dt.c +++ b/drivers/soc/qcom/smd_init_dt.c @@ -24,12 +24,22 @@ #define MODULE_NAME "msm_smd" #define IPC_LOG(level, x...) do { \ - printk(level x); \ + if (smd_log_ctx) \ + ipc_log_string(smd_log_ctx, x); \ + else \ + printk(level x); \ } while (0) #if defined(CONFIG_MSM_SMD_DEBUG) -#define SMD_DBG(x...) ((void)0) -#define SMSM_DBG(x...) ((void)0) +#define SMD_DBG(x...) do { \ + if (msm_smd_debug_mask & MSM_SMD_DEBUG) \ + IPC_LOG(KERN_DEBUG, x); \ + } while (0) + +#define SMSM_DBG(x...) do { \ + if (msm_smd_debug_mask & MSM_SMSM_DEBUG) \ + IPC_LOG(KERN_DEBUG, x); \ + } while (0) #else #define SMD_DBG(x...) do { } while (0) #define SMSM_DBG(x...) do { } while (0) diff --git a/drivers/soc/qcom/smp2p_private.h b/drivers/soc/qcom/smp2p_private.h index fd2edf4d987e..b332f7bc9080 100644 --- a/drivers/soc/qcom/smp2p_private.h +++ b/drivers/soc/qcom/smp2p_private.h @@ -147,17 +147,31 @@ enum { MSM_SMP2P_GPIO = 1U << 2, }; -#define SMP2P_IPC_LOG_STR(x...) ((void)0) +#define SMP2P_IPC_LOG_STR(x...) do { \ + if (smp2p_get_log_ctx()) \ + ipc_log_string(smp2p_get_log_ctx(), x); \ +} while (0) -#define SMP2P_DBG(x...) ((void)0) +#define SMP2P_DBG(x...) do { \ + if (smp2p_get_debug_mask() & MSM_SMP2P_DEBUG) \ + SMP2P_IPC_LOG_STR(x); \ +} while (0) -#define SMP2P_INFO(x...) ((void)0) +#define SMP2P_INFO(x...) do { \ + if (smp2p_get_debug_mask() & MSM_SMP2P_INFO) \ + SMP2P_IPC_LOG_STR(x); \ +} while (0) #define SMP2P_ERR(x...) do { \ pr_err(x); \ + SMP2P_IPC_LOG_STR(x); \ +} while (0) + +#define SMP2P_GPIO(x...) do { \ + if (smp2p_get_debug_mask() & MSM_SMP2P_GPIO) \ + SMP2P_IPC_LOG_STR(x); \ } while (0) -#define SMP2P_GPIO(x...) ((void)0) enum msm_smp2p_edge_state { SMP2P_EDGE_STATE_CLOSED, diff --git a/drivers/soc/qcom/system_health_monitor.c b/drivers/soc/qcom/system_health_monitor.c index 722138a3d74a..fcffa519c535 100644 --- a/drivers/soc/qcom/system_health_monitor.c +++ b/drivers/soc/qcom/system_health_monitor.c @@ -54,11 +54,19 @@ module_param_named(default_timeout_ms, shm_default_timeout_ms, #define SHM_ILCTXT_NUM_PAGES 2 static void *shm_ilctxt; -#define SHM_INFO_LOG(x...) ((void)0) +#define SHM_INFO_LOG(x...) do { \ + if ((shm_debug_mask & SHM_INFO_FLAG) && shm_ilctxt) \ + ipc_log_string(shm_ilctxt, x); \ +} while (0) -#define SHM_DEBUG(x...) ((void)0) +#define SHM_DEBUG(x...) do { \ + if ((shm_debug_mask & SHM_DEBUG_FLAG) && shm_ilctxt) \ + ipc_log_string(shm_ilctxt, x); \ +} while (0) #define SHM_ERR(x...) do { \ + if (shm_ilctxt) \ + ipc_log_string(shm_ilctxt, x); \ pr_err(x); \ } while (0) diff --git a/drivers/soc/qcom/wcnss/wcnss_wlan.c b/drivers/soc/qcom/wcnss/wcnss_wlan.c index c0404a20e97e..08bd78b55364 100644 --- a/drivers/soc/qcom/wcnss/wcnss_wlan.c +++ b/drivers/soc/qcom/wcnss/wcnss_wlan.c @@ -456,7 +456,10 @@ static struct { static void *wcnss_ipc_log; #define IPC_NUM_LOG_PAGES 12 -#define wcnss_ipc_log_string(_x...) ((void)0) +#define wcnss_ipc_log_string(_x...) do { \ + if (wcnss_ipc_log) \ + ipc_log_string(wcnss_ipc_log, _x); \ + } while (0) void wcnss_log(enum wcnss_log_type type, const char *_fmt, ...) { diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c index 1d496e45a0b4..b48c7ed2f68f 100644 --- a/drivers/tty/serial/msm_serial_hs.c +++ b/drivers/tty/serial/msm_serial_hs.c @@ -88,13 +88,26 @@ enum { DBG_LEV = 4U, }; -#define MSM_HS_DBG(x...) ((void)0) +#define MSM_HS_DBG(x...) do { \ + if (msm_uport->ipc_debug_mask >= DBG_LEV) { \ + if (msm_uport->ipc_msm_hs_log_ctxt) \ + ipc_log_string(msm_uport->ipc_msm_hs_log_ctxt, x); \ + } \ +} while (0) -#define MSM_HS_INFO(x...) ((void)0) +#define MSM_HS_INFO(x...) do { \ + if (msm_uport->ipc_debug_mask >= INFO_LEV) {\ + if (msm_uport->ipc_msm_hs_log_ctxt) \ + ipc_log_string(msm_uport->ipc_msm_hs_log_ctxt, x); \ + } \ +} while (0) /* warnings and errors show up on console always */ #define MSM_HS_WARN(x...) do { \ pr_warn(x); \ + if (msm_uport->ipc_msm_hs_log_ctxt && \ + msm_uport->ipc_debug_mask >= WARN_LEV) \ + ipc_log_string(msm_uport->ipc_msm_hs_log_ctxt, x); \ } while (0) /* ERROR condition in the driver sets the hs_serial_debug_mask @@ -103,9 +116,17 @@ enum { */ #define MSM_HS_ERR(x...) do { \ pr_err(x); \ + if (msm_uport->ipc_msm_hs_log_ctxt && \ + msm_uport->ipc_debug_mask >= ERR_LEV) { \ + ipc_log_string(msm_uport->ipc_msm_hs_log_ctxt, x); \ + msm_uport->ipc_debug_mask = FATAL_LEV; \ + } \ } while (0) -#define LOG_USR_MSG(ctx, x...) ((void)0) +#define LOG_USR_MSG(ctx, x...) do { \ + if (ctx) \ + ipc_log_string(ctx, x); \ +} while (0) /* * There are 3 different kind of UART Core available on MSM. diff --git a/drivers/tty/serial/msm_smd_tty.c b/drivers/tty/serial/msm_smd_tty.c index a86db1c66371..84ee1dd5f50a 100644 --- a/drivers/tty/serial/msm_smd_tty.c +++ b/drivers/tty/serial/msm_smd_tty.c @@ -42,9 +42,19 @@ #define MAX_RA_WAKE_LOCK_NAME_LEN 32 #define SMD_TTY_LOG_PAGES 2 -#define SMD_TTY_INFO(buf...) ((void)0) - -#define SMD_TTY_ERR(buf...) ((void)0) +#define SMD_TTY_INFO(buf...) \ +do { \ + if (smd_tty_log_ctx) { \ + ipc_log_string(smd_tty_log_ctx, buf); \ + } \ +} while (0) + +#define SMD_TTY_ERR(buf...) \ +do { \ + if (smd_tty_log_ctx) \ + ipc_log_string(smd_tty_log_ctx, buf); \ + pr_err(buf); \ +} while (0) static void *smd_tty_log_ctx; static bool smd_tty_in_suspend; diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index f504ac12c020..ce6c5133928c 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -57,6 +57,8 @@ static bool ffs_op_flg = true; static void *ffs_ipc_log; #define ffs_log(fmt, ...) do { \ + ipc_log_string(ffs_ipc_log, "%s: " fmt, __func__, \ + ##__VA_ARGS__); \ pr_debug("%s: " fmt, __func__, ##__VA_ARGS__); \ } while (0) diff --git a/drivers/usb/pd/policy_engine.c b/drivers/usb/pd/policy_engine.c index 635642c980ca..e2a636fa8731 100644 --- a/drivers/usb/pd/policy_engine.c +++ b/drivers/usb/pd/policy_engine.c @@ -213,18 +213,26 @@ enum vdm_state { static void *usbpd_ipc_log; #define usbpd_dbg(dev, fmt, ...) do { \ + ipc_log_string(usbpd_ipc_log, "%s: %s: " fmt, dev_name(dev), __func__, \ + ##__VA_ARGS__); \ dev_dbg(dev, fmt, ##__VA_ARGS__); \ } while (0) #define usbpd_info(dev, fmt, ...) do { \ + ipc_log_string(usbpd_ipc_log, "%s: %s: " fmt, dev_name(dev), __func__, \ + ##__VA_ARGS__); \ dev_info(dev, fmt, ##__VA_ARGS__); \ } while (0) #define usbpd_warn(dev, fmt, ...) do { \ + ipc_log_string(usbpd_ipc_log, "%s: %s: " fmt, dev_name(dev), __func__, \ + ##__VA_ARGS__); \ dev_warn(dev, fmt, ##__VA_ARGS__); \ } while (0) #define usbpd_err(dev, fmt, ...) do { \ + ipc_log_string(usbpd_ipc_log, "%s: %s: " fmt, dev_name(dev), __func__, \ + ##__VA_ARGS__); \ dev_err(dev, fmt, ##__VA_ARGS__); \ } while (0) diff --git a/net/ipc_router/ipc_router_core.c b/net/ipc_router/ipc_router_core.c index f02cc7238860..d62b58250aff 100644 --- a/net/ipc_router/ipc_router_core.c +++ b/net/ipc_router/ipc_router_core.c @@ -53,6 +53,9 @@ module_param_named(debug_mask, msm_ipc_router_debug_mask, #define IPC_RTR_INFO_PAGES 6 #define IPC_RTR_INFO(log_ctx, x...) do { \ +typeof(log_ctx) _log_ctx = (log_ctx); \ +if (_log_ctx) \ + ipc_log_string(_log_ctx, x); \ if (msm_ipc_router_debug_mask & RTR_DBG) \ pr_info("[IPCRTR] "x); \ } while (0) diff --git a/techpack/audio/ipc/apr.c b/techpack/audio/ipc/apr.c index 02c8287d4934..c1d007c41874 100644 --- a/techpack/audio/ipc/apr.c +++ b/techpack/audio/ipc/apr.c @@ -89,7 +89,12 @@ static const struct file_operations apr_debug_ops = { }; #endif -#define APR_PKT_INFO(x...) ((void)0) +#define APR_PKT_INFO(x...) \ +do { \ + if (apr_pkt_ctx) \ + ipc_log_string(apr_pkt_ctx, ": "x); \ +} while (0) + struct apr_svc_table { char name[64];