msm: ipa3: allocate ipa_low IPC only when needed

for data path and other frequent log prints, IPA driver is
using a debugfs trigger to enable those.
This change is an optimization to allocate IPC resources only
when needed instead of on boot up.

CRs-Fixed: 1005492
Change-Id: I6e7ac15ea7256c18e4174de56adb532ab6c6b0d0
Acked-by: Ady Abraham <adya@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
This commit is contained in:
Skylar Chang 2016-04-19 11:58:17 -07:00 committed by Kyle Yan
parent 994ee60d4a
commit b1136eebcd
6 changed files with 95 additions and 24 deletions

View file

@ -2503,6 +2503,32 @@ int ipa_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
}
EXPORT_SYMBOL(ipa_set_required_perf_profile);
/**
* ipa_get_ipc_logbuf() - return a pointer to IPA driver IPC log
*/
void *ipa_get_ipc_logbuf(void)
{
void *ret;
IPA_API_DISPATCH_RETURN_PTR(ipa_get_ipc_logbuf);
return ret;
}
EXPORT_SYMBOL(ipa_get_ipc_logbuf);
/**
* ipa_get_ipc_logbuf_low() - return a pointer to IPA driver IPC low prio log
*/
void *ipa_get_ipc_logbuf_low(void)
{
void *ret;
IPA_API_DISPATCH_RETURN_PTR(ipa_get_ipc_logbuf_low);
return ret;
}
EXPORT_SYMBOL(ipa_get_ipc_logbuf_low);
static const struct dev_pm_ops ipa_pm_ops = {
.suspend_noirq = ipa_ap_suspend,
.resume_noirq = ipa_ap_resume,

View file

@ -303,6 +303,10 @@ struct ipa_api_controller {
int (*ipa_set_required_perf_profile)(
enum ipa_voltage_level floor_voltage, u32 bandwidth_mbps);
void *(*ipa_get_ipc_logbuf)(void);
void *(*ipa_get_ipc_logbuf_low)(void);
};
#ifdef CONFIG_IPA

View file

@ -12,6 +12,7 @@
#ifndef _IPA_COMMON_I_H_
#define _IPA_COMMON_I_H_
#include <linux/ipc_logging.h>
#define __FILENAME__ \
(strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
@ -114,6 +115,13 @@ struct ipa_active_client_logging_info {
extern const char *ipa_clients_strings[];
#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);
int ipa_inc_client_enable_clks_no_block(
@ -123,6 +131,8 @@ int ipa_resume_resource(enum ipa_rm_resource_name name);
int ipa_suspend_resource_sync(enum ipa_rm_resource_name resource);
int ipa_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
u32 bandwidth_mbps);
void *ipa_get_ipc_logbuf(void);
void *ipa_get_ipc_logbuf_low(void);
#endif /* _IPA_COMMON_I_H_ */

View file

@ -67,8 +67,6 @@
#define IPA_TRANSPORT_PROD_TIMEOUT_MSEC 100
#define IPA_IPC_LOG_PAGES 50
#define IPA3_ACTIVE_CLIENTS_TABLE_BUF_SIZE 2048
#define IPA3_ACTIVE_CLIENT_LOG_TYPE_EP 0
@ -3958,13 +3956,6 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
result = -ENOMEM;
goto fail_logbuf;
}
ipa3_ctx->logbuf_low =
ipc_log_context_create(IPA_IPC_LOG_PAGES, "ipa_low", 0);
if (ipa3_ctx->logbuf_low == NULL) {
IPAERR("failed to get logbuf_low\n");
result = -ENOMEM;
goto fail_logbuf_low;
}
ipa3_ctx->pdev = ipa_dev;
ipa3_ctx->uc_pdev = ipa_dev;
@ -4460,8 +4451,6 @@ fail_bus_reg:
fail_bind:
kfree(ipa3_ctx->ctrl);
fail_mem_ctrl:
ipc_log_context_destroy(ipa3_ctx->logbuf_low);
fail_logbuf_low:
ipc_log_context_destroy(ipa3_ctx->logbuf);
fail_logbuf:
kfree(ipa3_ctx);

View file

@ -1587,6 +1587,43 @@ static ssize_t ipa3_clear_active_clients_log(struct file *file,
return count;
}
static ssize_t ipa3_enable_ipc_low(struct file *file,
const char __user *ubuf, size_t count, loff_t *ppos)
{
unsigned long missing;
s8 option = 0;
if (sizeof(dbg_buff) < count + 1)
return -EFAULT;
missing = copy_from_user(dbg_buff, ubuf, count);
if (missing)
return -EFAULT;
dbg_buff[count] = '\0';
if (kstrtos8(dbg_buff, 0, &option))
return -EFAULT;
if (option) {
if (!ipa3_ctx->logbuf_low) {
ipa3_ctx->logbuf_low =
ipc_log_context_create(IPA_IPC_LOG_PAGES,
"ipa_low", 0);
}
if (ipa3_ctx->logbuf_low == NULL) {
IPAERR("failed to get logbuf_low\n");
return -EFAULT;
}
} else {
if (ipa3_ctx->logbuf_low)
ipc_log_context_destroy(ipa3_ctx->logbuf_low);
ipa3_ctx->logbuf_low = NULL;
}
return count;
}
const struct file_operations ipa3_gen_reg_ops = {
.read = ipa3_read_gen_reg,
};
@ -1671,6 +1708,10 @@ const struct file_operations ipa3_active_clients = {
.write = ipa3_clear_active_clients_log,
};
const struct file_operations ipa3_ipc_low_ops = {
.write = ipa3_enable_ipc_low,
};
void ipa3_debugfs_init(void)
{
const mode_t read_only_mode = S_IRUSR | S_IRGRP | S_IROTH;
@ -1883,8 +1924,8 @@ void ipa3_debugfs_init(void)
goto fail;
}
file = debugfs_create_u32("enable_low_prio_print", read_write_mode,
dent, &ipa3_ctx->enable_low_prio_print);
file = debugfs_create_file("enable_low_prio_print", write_only_mode,
dent, 0, &ipa3_ipc_low_ops);
if (!file) {
IPAERR("could not create enable_low_prio_print file\n");
goto fail;

View file

@ -56,32 +56,35 @@
#define IPA_MAX_STATUS_STAT_NUM 30
#define IPA_IPC_LOGGING(buf, fmt, args...) \
ipc_log_string((buf), \
DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args)
#define IPA_IPC_LOG_PAGES 50
#define IPADBG(fmt, args...) \
do { \
pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
if (ipa3_ctx) { \
IPA_IPC_LOGGING(ipa3_ctx->logbuf, fmt, ## args); \
IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, fmt, ## args); \
IPA_IPC_LOGGING(ipa3_ctx->logbuf, \
DRV_NAME " %s:%d " fmt, ## args); \
IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, \
DRV_NAME " %s:%d " fmt, ## args); \
} \
} while (0)
#define IPADBG_LOW(fmt, args...) \
do { \
pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
if (ipa3_ctx && ipa3_ctx->enable_low_prio_print) \
IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, fmt, ## args); \
if (ipa3_ctx) \
IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, \
DRV_NAME " %s:%d " fmt, ## args); \
} while (0)
#define IPAERR(fmt, args...) \
do { \
pr_err(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
if (ipa3_ctx) { \
IPA_IPC_LOGGING(ipa3_ctx->logbuf, fmt, ## args); \
IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, fmt, ## args); \
IPA_IPC_LOGGING(ipa3_ctx->logbuf, \
DRV_NAME " %s:%d " fmt, ## args); \
IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, \
DRV_NAME " %s:%d " fmt, ## args); \
} \
} while (0)
@ -1432,7 +1435,6 @@ struct ipa3_ready_cb_info {
* @ctrl: holds the core specific operations based on
* core version (vtable like)
* @enable_clock_scaling: clock scaling is enabled ?
* @enable_low_prio_print: enable low priority prints
* @curr_ipa_clk_rate: ipa3_clk current rate
* @wcstats: wlan common buffer stats
* @uc_ctx: uC interface context
@ -1537,7 +1539,6 @@ struct ipa3_context {
struct device *uc_pdev;
spinlock_t idr_lock;
u32 enable_clock_scaling;
u32 enable_low_prio_print;
u32 curr_ipa_clk_rate;
bool q6_proxy_clk_vote_valid;
u32 ipa_num_pipes;