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:
parent
994ee60d4a
commit
b1136eebcd
6 changed files with 95 additions and 24 deletions
|
@ -2503,6 +2503,32 @@ int ipa_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ipa_set_required_perf_profile);
|
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 = {
|
static const struct dev_pm_ops ipa_pm_ops = {
|
||||||
.suspend_noirq = ipa_ap_suspend,
|
.suspend_noirq = ipa_ap_suspend,
|
||||||
.resume_noirq = ipa_ap_resume,
|
.resume_noirq = ipa_ap_resume,
|
||||||
|
|
|
@ -303,6 +303,10 @@ struct ipa_api_controller {
|
||||||
int (*ipa_set_required_perf_profile)(
|
int (*ipa_set_required_perf_profile)(
|
||||||
enum ipa_voltage_level floor_voltage, u32 bandwidth_mbps);
|
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
|
#ifdef CONFIG_IPA
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#ifndef _IPA_COMMON_I_H_
|
#ifndef _IPA_COMMON_I_H_
|
||||||
#define _IPA_COMMON_I_H_
|
#define _IPA_COMMON_I_H_
|
||||||
|
#include <linux/ipc_logging.h>
|
||||||
|
|
||||||
#define __FILENAME__ \
|
#define __FILENAME__ \
|
||||||
(strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
(strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||||
|
@ -114,6 +115,13 @@ struct ipa_active_client_logging_info {
|
||||||
|
|
||||||
extern const char *ipa_clients_strings[];
|
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_inc_client_enable_clks(struct ipa_active_client_logging_info *id);
|
||||||
void ipa_dec_client_disable_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(
|
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_suspend_resource_sync(enum ipa_rm_resource_name resource);
|
||||||
int ipa_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
|
int ipa_set_required_perf_profile(enum ipa_voltage_level floor_voltage,
|
||||||
u32 bandwidth_mbps);
|
u32 bandwidth_mbps);
|
||||||
|
void *ipa_get_ipc_logbuf(void);
|
||||||
|
void *ipa_get_ipc_logbuf_low(void);
|
||||||
|
|
||||||
|
|
||||||
#endif /* _IPA_COMMON_I_H_ */
|
#endif /* _IPA_COMMON_I_H_ */
|
||||||
|
|
|
@ -67,8 +67,6 @@
|
||||||
|
|
||||||
#define IPA_TRANSPORT_PROD_TIMEOUT_MSEC 100
|
#define IPA_TRANSPORT_PROD_TIMEOUT_MSEC 100
|
||||||
|
|
||||||
#define IPA_IPC_LOG_PAGES 50
|
|
||||||
|
|
||||||
#define IPA3_ACTIVE_CLIENTS_TABLE_BUF_SIZE 2048
|
#define IPA3_ACTIVE_CLIENTS_TABLE_BUF_SIZE 2048
|
||||||
|
|
||||||
#define IPA3_ACTIVE_CLIENT_LOG_TYPE_EP 0
|
#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;
|
result = -ENOMEM;
|
||||||
goto fail_logbuf;
|
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->pdev = ipa_dev;
|
||||||
ipa3_ctx->uc_pdev = ipa_dev;
|
ipa3_ctx->uc_pdev = ipa_dev;
|
||||||
|
@ -4460,8 +4451,6 @@ fail_bus_reg:
|
||||||
fail_bind:
|
fail_bind:
|
||||||
kfree(ipa3_ctx->ctrl);
|
kfree(ipa3_ctx->ctrl);
|
||||||
fail_mem_ctrl:
|
fail_mem_ctrl:
|
||||||
ipc_log_context_destroy(ipa3_ctx->logbuf_low);
|
|
||||||
fail_logbuf_low:
|
|
||||||
ipc_log_context_destroy(ipa3_ctx->logbuf);
|
ipc_log_context_destroy(ipa3_ctx->logbuf);
|
||||||
fail_logbuf:
|
fail_logbuf:
|
||||||
kfree(ipa3_ctx);
|
kfree(ipa3_ctx);
|
||||||
|
|
|
@ -1587,6 +1587,43 @@ static ssize_t ipa3_clear_active_clients_log(struct file *file,
|
||||||
return count;
|
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 = {
|
const struct file_operations ipa3_gen_reg_ops = {
|
||||||
.read = ipa3_read_gen_reg,
|
.read = ipa3_read_gen_reg,
|
||||||
};
|
};
|
||||||
|
@ -1671,6 +1708,10 @@ const struct file_operations ipa3_active_clients = {
|
||||||
.write = ipa3_clear_active_clients_log,
|
.write = ipa3_clear_active_clients_log,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const struct file_operations ipa3_ipc_low_ops = {
|
||||||
|
.write = ipa3_enable_ipc_low,
|
||||||
|
};
|
||||||
|
|
||||||
void ipa3_debugfs_init(void)
|
void ipa3_debugfs_init(void)
|
||||||
{
|
{
|
||||||
const mode_t read_only_mode = S_IRUSR | S_IRGRP | S_IROTH;
|
const mode_t read_only_mode = S_IRUSR | S_IRGRP | S_IROTH;
|
||||||
|
@ -1883,8 +1924,8 @@ void ipa3_debugfs_init(void)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = debugfs_create_u32("enable_low_prio_print", read_write_mode,
|
file = debugfs_create_file("enable_low_prio_print", write_only_mode,
|
||||||
dent, &ipa3_ctx->enable_low_prio_print);
|
dent, 0, &ipa3_ipc_low_ops);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
IPAERR("could not create enable_low_prio_print file\n");
|
IPAERR("could not create enable_low_prio_print file\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
@ -56,32 +56,35 @@
|
||||||
|
|
||||||
#define IPA_MAX_STATUS_STAT_NUM 30
|
#define IPA_MAX_STATUS_STAT_NUM 30
|
||||||
|
|
||||||
#define IPA_IPC_LOGGING(buf, fmt, args...) \
|
#define IPA_IPC_LOG_PAGES 50
|
||||||
ipc_log_string((buf), \
|
|
||||||
DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args)
|
|
||||||
|
|
||||||
#define IPADBG(fmt, args...) \
|
#define IPADBG(fmt, args...) \
|
||||||
do { \
|
do { \
|
||||||
pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
|
pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
|
||||||
if (ipa3_ctx) { \
|
if (ipa3_ctx) { \
|
||||||
IPA_IPC_LOGGING(ipa3_ctx->logbuf, fmt, ## args); \
|
IPA_IPC_LOGGING(ipa3_ctx->logbuf, \
|
||||||
IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, fmt, ## args); \
|
DRV_NAME " %s:%d " fmt, ## args); \
|
||||||
|
IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, \
|
||||||
|
DRV_NAME " %s:%d " fmt, ## args); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define IPADBG_LOW(fmt, args...) \
|
#define IPADBG_LOW(fmt, args...) \
|
||||||
do { \
|
do { \
|
||||||
pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
|
pr_debug(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
|
||||||
if (ipa3_ctx && ipa3_ctx->enable_low_prio_print) \
|
if (ipa3_ctx) \
|
||||||
IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, fmt, ## args); \
|
IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, \
|
||||||
|
DRV_NAME " %s:%d " fmt, ## args); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define IPAERR(fmt, args...) \
|
#define IPAERR(fmt, args...) \
|
||||||
do { \
|
do { \
|
||||||
pr_err(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
|
pr_err(DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args);\
|
||||||
if (ipa3_ctx) { \
|
if (ipa3_ctx) { \
|
||||||
IPA_IPC_LOGGING(ipa3_ctx->logbuf, fmt, ## args); \
|
IPA_IPC_LOGGING(ipa3_ctx->logbuf, \
|
||||||
IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, fmt, ## args); \
|
DRV_NAME " %s:%d " fmt, ## args); \
|
||||||
|
IPA_IPC_LOGGING(ipa3_ctx->logbuf_low, \
|
||||||
|
DRV_NAME " %s:%d " fmt, ## args); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
@ -1432,7 +1435,6 @@ struct ipa3_ready_cb_info {
|
||||||
* @ctrl: holds the core specific operations based on
|
* @ctrl: holds the core specific operations based on
|
||||||
* core version (vtable like)
|
* core version (vtable like)
|
||||||
* @enable_clock_scaling: clock scaling is enabled ?
|
* @enable_clock_scaling: clock scaling is enabled ?
|
||||||
* @enable_low_prio_print: enable low priority prints
|
|
||||||
* @curr_ipa_clk_rate: ipa3_clk current rate
|
* @curr_ipa_clk_rate: ipa3_clk current rate
|
||||||
* @wcstats: wlan common buffer stats
|
* @wcstats: wlan common buffer stats
|
||||||
* @uc_ctx: uC interface context
|
* @uc_ctx: uC interface context
|
||||||
|
@ -1537,7 +1539,6 @@ struct ipa3_context {
|
||||||
struct device *uc_pdev;
|
struct device *uc_pdev;
|
||||||
spinlock_t idr_lock;
|
spinlock_t idr_lock;
|
||||||
u32 enable_clock_scaling;
|
u32 enable_clock_scaling;
|
||||||
u32 enable_low_prio_print;
|
|
||||||
u32 curr_ipa_clk_rate;
|
u32 curr_ipa_clk_rate;
|
||||||
bool q6_proxy_clk_vote_valid;
|
bool q6_proxy_clk_vote_valid;
|
||||||
u32 ipa_num_pipes;
|
u32 ipa_num_pipes;
|
||||||
|
|
Loading…
Add table
Reference in a new issue