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

Commit 0f44e025 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa3: rmnet_ipa: add IPC logging to common buffer"

parents c1996781 56afc880
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
+16 −80
Original line number Diff line number Diff line
@@ -34,52 +34,42 @@

#define IPA_USB_DRV_NAME "ipa_usb"

#define IPA_USB_IPC_LOG_PAGES 10
#define IPA_USB_IPC_LOG(buf, fmt, args...) \
	ipc_log_string((buf), \
		DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args)
#define IPA_USB_DBG(fmt, args...) \
	do { \
		pr_debug(IPA_USB_DRV_NAME " %s:%d " fmt, \
			__func__, __LINE__, ## args); \
		if (ipa3_usb_ctx) { \
			IPA_USB_IPC_LOG(ipa3_usb_ctx->logbuf, fmt, ## args); \
			IPA_USB_IPC_LOG(ipa3_usb_ctx->logbuf_low, \
					fmt, ## args); \
		} \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \
			IPA_USB_DRV_NAME " %s:%d " fmt, ## args); \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
			IPA_USB_DRV_NAME " %s:%d " fmt, ## args); \
	} while (0)

#define IPA_USB_DBG_LOW(fmt, args...) \
	do { \
		pr_debug(IPA_USB_DRV_NAME " %s:%d " fmt, \
			__func__, __LINE__, ## args); \
		if (ipa3_usb_ctx && \
			ipa3_usb_ctx->enable_low_prio_print) { \
			IPA_USB_IPC_LOG(ipa3_usb_ctx->logbuf_low, \
			fmt, ## args); \
		} \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
			IPA_USB_DRV_NAME " %s:%d " fmt, ## args); \
	} while (0)

#define IPA_USB_ERR(fmt, args...) \
	do { \
		pr_err(IPA_USB_DRV_NAME " %s:%d " fmt, \
			__func__, __LINE__, ## args); \
		if (ipa3_usb_ctx) { \
			IPA_USB_IPC_LOG(ipa3_usb_ctx->logbuf, fmt, ## args); \
			IPA_USB_IPC_LOG(ipa3_usb_ctx->logbuf_low, \
					fmt, ## args); \
		} \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \
			IPA_USB_DRV_NAME " %s:%d " fmt, ## args); \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
			IPA_USB_DRV_NAME " %s:%d " fmt, ## args); \
	} while (0)

#define IPA_USB_INFO(fmt, args...) \
	do { \
		pr_info(IPA_USB_DRV_NAME " %s:%d " fmt, \
			__func__, __LINE__, ## args); \
		if (ipa3_usb_ctx) { \
			IPA_USB_IPC_LOG(ipa3_usb_ctx->logbuf, fmt, ## args); \
			IPA_USB_IPC_LOG(ipa3_usb_ctx->logbuf_low, \
					fmt, ## args); \
		} \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \
			IPA_USB_DRV_NAME " %s:%d " fmt, ## args); \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
			IPA_USB_DRV_NAME " %s:%d " fmt, ## args); \
	} while (0)

struct ipa_usb_xdci_connect_params_internal {
@@ -189,10 +179,6 @@ struct ipa3_usb_context {
		ttype_ctx[IPA_USB_TRANSPORT_MAX];
	struct dentry *dfile_state_info;
	struct dentry *dent;
	struct dentry *dfile_enable_low_prio;
	void *logbuf;
	void *logbuf_low;
	u32 enable_low_prio_print;
};

enum ipa3_usb_op {
@@ -492,7 +478,7 @@ static void ipa3_usb_notify_do(enum ipa3_usb_transport_type ttype,
	void *user_data;
	int res;

	IPA_USB_DBG_LOW("Trying to notify USB with %s\n",
	IPA_USB_DBG("Trying to notify USB with %s\n",
		ipa3_usb_notify_event_to_string(event));

	cb = ipa3_usb_ctx->ttype_ctx[ttype].ipa_usb_notify_cb;
@@ -500,7 +486,7 @@ static void ipa3_usb_notify_do(enum ipa3_usb_transport_type ttype,

	if (cb) {
		res = cb(event, user_data);
		IPA_USB_DBG_LOW("Notified USB with %s. is_dpl=%d result=%d\n",
		IPA_USB_DBG("Notified USB with %s. is_dpl=%d result=%d\n",
			ipa3_usb_notify_event_to_string(event),
			IPA3_USB_IS_TTYPE_DPL(ttype), res);
	}
@@ -1792,33 +1778,6 @@ connect_ul_fail:
	return result;
}

static int ipa_usb_ipc_logging_init(void)
{
	int result;

	ipa3_usb_ctx->logbuf = ipc_log_context_create(IPA_USB_IPC_LOG_PAGES,
							"ipa_usb", 0);
	if (ipa3_usb_ctx->logbuf == NULL) {
		/* we can't use ipa_usb print macros on failures */
		pr_err("ipa_usb: failed to get logbuf\n");
		return -ENOMEM;
	}

	ipa3_usb_ctx->logbuf_low = ipc_log_context_create(IPA_USB_IPC_LOG_PAGES,
							"ipa_usb_low", 0);
	if (ipa3_usb_ctx->logbuf_low == NULL) {
		pr_err("ipa_usb: failed to get logbuf_low\n");
		result = -ENOMEM;
		goto fail_logbuf_low;
	}

	return 0;

fail_logbuf_low:
	ipc_log_context_destroy(ipa3_usb_ctx->logbuf);
	return result;
}

#ifdef CONFIG_DEBUG_FS
static char dbg_buff[IPA_USB_MAX_MSG_LEN];

@@ -1983,8 +1942,6 @@ const struct file_operations ipa3_ipa_usb_ops = {
static void ipa_usb_debugfs_init(void)
{
	const mode_t read_only_mode = S_IRUSR | S_IRGRP | S_IROTH;
	const mode_t read_write_mode = S_IRUSR | S_IRGRP | S_IROTH |
			S_IWUSR | S_IWGRP;

	ipa3_usb_ctx->dent = debugfs_create_dir("ipa_usb", 0);
	if (IS_ERR(ipa3_usb_ctx->dent)) {
@@ -2001,16 +1958,6 @@ static void ipa_usb_debugfs_init(void)
		goto fail;
	}

	ipa3_usb_ctx->dfile_enable_low_prio =
			debugfs_create_u32("enable_low_prio_print",
		read_write_mode, ipa3_usb_ctx->dent,
		&ipa3_usb_ctx->enable_low_prio_print);
	if (!ipa3_usb_ctx->dfile_enable_low_prio ||
			IS_ERR(ipa3_usb_ctx->dfile_enable_low_prio)) {
		IPA_USB_ERR("could not create enable_low_prio_print file\n");
		goto fail;
	}

	return;

fail:
@@ -2623,14 +2570,6 @@ static int __init ipa3_usb_init(void)
	}
	memset(ipa3_usb_ctx, 0, sizeof(struct ipa3_usb_context));

	res = ipa_usb_ipc_logging_init();
	if (res) {
		/* IPA_USB_ERR will crash on NULL dereference if we use macro*/
		pr_err("ipa_usb: failed to initialize ipc logging\n");
		res = -EFAULT;
		goto ipa_usb_init_ipc_log_fail;
	}

	for (i = 0; i < IPA_USB_MAX_TETH_PROT_SIZE; i++)
		ipa3_usb_ctx->teth_prot_ctx[i].state =
			IPA_USB_TETH_PROT_INVALID;
@@ -2671,9 +2610,6 @@ static int __init ipa3_usb_init(void)

ipa_usb_workqueue_fail:
	IPA_USB_ERR(":init failed (%d)\n", -res);
	ipc_log_context_destroy(ipa3_usb_ctx->logbuf);
	ipc_log_context_destroy(ipa3_usb_ctx->logbuf_low);
ipa_usb_init_ipc_log_fail:
	kfree(ipa3_usb_ctx);
	return res;
}
+11 −72
Original line number Diff line number Diff line
@@ -23,49 +23,37 @@
#include <linux/types.h>
#include <linux/ipv6.h>
#include <net/addrconf.h>
#include <linux/ipc_logging.h>
#include <linux/ipa.h>
#include <linux/cdev.h>
#include <linux/ipa_odu_bridge.h>
#include "../ipa_common_i.h"

#define ODU_BRIDGE_DRV_NAME "odu_ipa_bridge"

#define ODU_IPC_LOG_PAGES 10
#define ODU_IPC_LOG(buf, fmt, args...) \
	ipc_log_string((buf), \
		ODU_BRIDGE_DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args)

#define ODU_BRIDGE_DBG(fmt, args...) \
	do { \
		pr_debug(ODU_BRIDGE_DRV_NAME " %s:%d " fmt, \
			__func__, __LINE__, ## args); \
		if (odu_bridge_ctx) { \
			ODU_IPC_LOG(odu_bridge_ctx->logbuf, \
			fmt, ## args); \
			ODU_IPC_LOG(odu_bridge_ctx->logbuf_low, \
					fmt, ## args); \
		} \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \
			ODU_BRIDGE_DRV_NAME " %s:%d " fmt, ## args); \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
			ODU_BRIDGE_DRV_NAME " %s:%d " fmt, ## args); \
	} while (0)
#define ODU_BRIDGE_DBG_LOW(fmt, args...) \
	do { \
		pr_debug(ODU_BRIDGE_DRV_NAME " %s:%d " fmt, \
			__func__, __LINE__, ## args); \
		if (odu_bridge_ctx && \
			odu_bridge_ctx->enable_low_prio_print) { \
			ODU_IPC_LOG(odu_bridge_ctx->logbuf_low, \
			fmt, ## args); \
		} \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
			ODU_BRIDGE_DRV_NAME " %s:%d " fmt, ## args); \
	} while (0)
#define ODU_BRIDGE_ERR(fmt, args...) \
	do { \
		pr_err(ODU_BRIDGE_DRV_NAME " %s:%d " fmt, \
			__func__, __LINE__, ## args); \
		if (odu_bridge_ctx) { \
			ODU_IPC_LOG(odu_bridge_ctx->logbuf, \
			fmt, ## args); \
			ODU_IPC_LOG(odu_bridge_ctx->logbuf_low, \
					fmt, ## args); \
		} \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \
			ODU_BRIDGE_DRV_NAME " %s:%d " fmt, ## args); \
		IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
			ODU_BRIDGE_DRV_NAME " %s:%d " fmt, ## args); \
	} while (0)

#define ODU_BRIDGE_FUNC_ENTRY() \
@@ -158,7 +146,6 @@ struct odu_bridge_ctx {
	u32 ipa_sys_desc_size;
	void *logbuf;
	void *logbuf_low;
	u32 enable_low_prio_print;
};
static struct odu_bridge_ctx *odu_bridge_ctx;

@@ -683,7 +670,6 @@ static long compat_odu_bridge_ioctl(struct file *file,
static struct dentry *dent;
static struct dentry *dfile_stats;
static struct dentry *dfile_mode;
static struct dentry *dfile_low_prio;

static ssize_t odu_debugfs_stats(struct file *file,
				  char __user *ubuf,
@@ -806,15 +792,6 @@ static void odu_debugfs_init(void)
		goto fail;
	}

	dfile_low_prio = debugfs_create_u32("enable_low_prio_print",
					read_write_mode,
		dent, &odu_bridge_ctx->enable_low_prio_print);
	if (!dfile_low_prio) {
		ODU_BRIDGE_ERR("could not create enable_low_prio_print file\n");
		goto fail;
	}

	return;
fail:
	debugfs_remove_recursive(dent);
}
@@ -1104,34 +1081,6 @@ static void odu_bridge_deregister_properties(void)
	ODU_BRIDGE_FUNC_EXIT();
}

static int odu_bridge_ipc_logging_init(void)
{
	int result;

	odu_bridge_ctx->logbuf = ipc_log_context_create(ODU_IPC_LOG_PAGES,
							"ipa_odu_bridge", 0);
	if (odu_bridge_ctx->logbuf == NULL) {
		/* we can't use odu_bridge print macros on failures */
		pr_err("odu_bridge: failed to get logbuf\n");
		return -ENOMEM;
	}

	odu_bridge_ctx->logbuf_low =
			ipc_log_context_create(ODU_IPC_LOG_PAGES,
						"ipa_odu_bridge_low", 0);
	if (odu_bridge_ctx->logbuf_low == NULL) {
		pr_err("odu_bridge: failed to get logbuf_low\n");
		result = -ENOMEM;
		goto fail_logbuf_low;
	}

	return 0;

fail_logbuf_low:
	ipc_log_context_destroy(odu_bridge_ctx->logbuf);
	return result;
}

/**
 * odu_bridge_init() - Initialize the ODU bridge driver
 * @params: initialization parameters
@@ -1183,13 +1132,6 @@ int odu_bridge_init(struct odu_bridge_params *params)
		return -ENOMEM;
	}

	res = odu_bridge_ipc_logging_init();
	if (res) {
		/* ODU_BRIDGE_ERR will crash on NULL if we use it here*/
		pr_err("odu_bridge: failed to initialize ipc logging\n");
		res = -EFAULT;
		goto fail_ipc_create;
	}
	odu_bridge_ctx->class = class_create(THIS_MODULE, ODU_BRIDGE_DRV_NAME);
	if (!odu_bridge_ctx->class) {
		ODU_BRIDGE_ERR("Class_create err.\n");
@@ -1264,9 +1206,6 @@ fail_device_create:
fail_alloc_chrdev_region:
	class_destroy(odu_bridge_ctx->class);
fail_class_create:
	ipc_log_context_destroy(odu_bridge_ctx->logbuf);
	ipc_log_context_destroy(odu_bridge_ctx->logbuf_low);
fail_ipc_create:
	kfree(odu_bridge_ctx);
	odu_bridge_ctx = NULL;
	return res;
+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_ */
Loading