Skip to content

Commit

Permalink
acpm: support dynamic ctrl of ipc retry logging
Browse files Browse the repository at this point in the history
Also configure retry log dump as default off

Bug: 243085956
Change-Id: Ib51d8d6ca3c45415691c313c53f19699cc102376
Signed-off-by: Redick_Lin <[email protected]>
  • Loading branch information
Redick_Lin authored and TreeHugger Robot committed Nov 17, 2022
1 parent 4cf7a9f commit 1bca209
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
17 changes: 17 additions & 0 deletions drivers/soc/google/acpm/acpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ static int debug_log_level_set(void *data, unsigned long long val)
return 0;
}

static int debug_retry_log_ctrl_get(void *data, unsigned long long *val)
{
*val = acpm_fw_get_retry_log_ctrl();
return 0;
}

static int debug_retry_log_ctrl_set(void *data, unsigned long long val)
{
acpm_fw_set_retry_log_ctrl(val);

return 0;
}

static int debug_ipc_loopback_test_get(void *data, unsigned long long *val)
{
struct acpm_info *acpm = (struct acpm_info *) data;
Expand Down Expand Up @@ -206,6 +219,8 @@ static int debug_acpm_framework_cmd_set(void *data, u64 val)

DEFINE_SIMPLE_ATTRIBUTE(debug_log_level_fops,
debug_log_level_get, debug_log_level_set, "0%llu\n");
DEFINE_SIMPLE_ATTRIBUTE(debug_retry_log_ctrl_fops,
debug_retry_log_ctrl_get, debug_retry_log_ctrl_set, "0%llu\n");
DEFINE_SIMPLE_ATTRIBUTE(debug_ipc_loopback_test_fops,
debug_ipc_loopback_test_get, NULL, "%llu\n");
DEFINE_SIMPLE_ATTRIBUTE(debug_uart_gprio_level_fops,
Expand All @@ -229,6 +244,8 @@ static void acpm_debugfs_init(struct acpm_info *acpm)
&debug_ipc_loopback_test_fops);
debugfs_create_file("log_level", 0644, den, acpm,
&debug_log_level_fops);
debugfs_create_file("retry_log_ctrl", 0644, den, acpm,
&debug_retry_log_ctrl_fops);
debugfs_create_file("uart_gprio_level", 0644, den, acpm,
&debug_uart_gprio_level_fops);
debugfs_create_file("logb_gprio_level", 0644, den, acpm,
Expand Down
23 changes: 18 additions & 5 deletions drivers/soc/google/acpm/acpm_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ unsigned int acpm_fw_get_log_level(void)
return acpm_debug->debug_log_level;
}

void acpm_fw_set_retry_log_ctrl(bool enable)
{
acpm_debug->retry_log = enable;
}

unsigned int acpm_fw_get_retry_log_ctrl(void)
{
return acpm_debug->retry_log;
}

void acpm_ramdump(void)
{
if (acpm_debug->dump_size)
Expand Down Expand Up @@ -731,6 +741,7 @@ int __acpm_ipc_send_data(unsigned int channel_id, struct ipc_config *cfg, bool w
spin_unlock_irqrestore(&channel->tx_lock, flags);

if (channel->polling && cfg->response) {
unsigned int saved_debug_log_level = acpm_debug->debug_log_level;
retry:
timeout = sched_clock() + IPC_TIMEOUT;
timeout_flag = false;
Expand Down Expand Up @@ -764,16 +775,18 @@ int __acpm_ipc_send_data(unsigned int channel_id, struct ipc_config *cfg, bool w
__raw_readl(acpm_ipc->intr + INTMSR1));

cpu_irq_info_dump(retry_cnt);
if (retry_cnt == 1) {
acpm_debug->debug_log_level =
acpm_debug->retry_log ?
2 : saved_debug_log_level;
acpm_log_print();
acpm_debug->debug_log_level = saved_debug_log_level;
}
++retry_cnt;

goto retry;
} else {
unsigned int saved_debug_log_level =
acpm_debug->debug_log_level;
++retry_cnt;
acpm_debug->debug_log_level = 2;
acpm_log_print();
acpm_debug->debug_log_level = saved_debug_log_level;
continue;
}
cnt_10us = 0;
Expand Down
3 changes: 3 additions & 0 deletions drivers/soc/google/acpm/acpm_ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct acpm_debug_info {
unsigned int dump_size;
void __iomem *dump_dram_base;
unsigned int debug_log_level;
unsigned int retry_log;
struct delayed_work acpm_log_work;
unsigned int async_id; /* ACPM IPC_AP_ERR_LOG_ASYNC channel id */
unsigned int async_size; /* ACPM IPC_AP_ERR_LOG_ASYNC channel queue sizes */
Expand Down Expand Up @@ -142,6 +143,8 @@ extern void timestamp_write(void);
extern void acpm_ramdump(void);
extern void acpm_fw_set_log_level(unsigned int on);
extern unsigned int acpm_fw_get_log_level(void);
extern void acpm_fw_set_retry_log_ctrl(bool enable);
extern unsigned int acpm_fw_get_retry_log_ctrl(void);
extern void acpm_ipc_set_waiting_mode(bool mode);

extern int acpm_ipc_remove(struct platform_device *pdev);
Expand Down

0 comments on commit 1bca209

Please sign in to comment.