Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94cde8db authored by Skylar Chang's avatar Skylar Chang Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarAdy Abraham <adya@qti.qualcomm.com>
Signed-off-by: default avatarSkylar Chang <chiaweic@codeaurora.org>
parent e80f64ee
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -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,
+4 −0
Original line number Diff line number Diff line
@@ -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
+10 −0
Original line number Diff line number Diff line
@@ -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_ */
+0 −11
Original line number Diff line number Diff line
@@ -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);
+43 −2
Original line number Diff line number Diff line
@@ -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;
Loading