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

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

Merge "msm: gsi: add ipc logging"

parents 14f1ffdd 9b0f9335
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -568,7 +568,7 @@ static void gsi_handle_irq(void)
		if (!type)
			break;

		GSIDBG("type %x\n", type);
		GSIDBG_LOW("type %x\n", type);

		if (type & GSI_EE_n_CNTXT_TYPE_IRQ_CH_CTRL_BMSK)
			gsi_handle_ch_ctrl(ee);
@@ -2837,6 +2837,13 @@ static int msm_gsi_probe(struct platform_device *pdev)
		return -ENOMEM;
	}

	gsi_ctx->ipc_logbuf = ipc_log_context_create(GSI_IPC_LOG_PAGES,
		"gsi", 0);
	if (gsi_ctx->ipc_logbuf == NULL) {
		GSIERR("failed to get ipc_logbuf\n");
		return -ENOMEM;
	}

	gsi_ctx->dev = dev;
	init_completion(&gsi_ctx->gen_ee_cmd_compl);
	gsi_debugfs_init();
+44 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/msm_gsi.h>
#include <linux/ipc_logging.h>

#define GSI_CHAN_MAX      31
#define GSI_EVT_RING_MAX  23
@@ -26,10 +27,48 @@
#define gsi_readl(c)	({ u32 __v = readl_relaxed(c); __iormb(); __v; })
#define gsi_writel(v, c)	({ __iowmb(); writel_relaxed((v), (c)); })

#define GSIERR(fmt, args...) \
		dev_err(gsi_ctx->dev, "%s:%d " fmt, __func__, __LINE__, ## args)
#define GSI_IPC_LOGGING(buf, fmt, args...) \
	do { \
		if (buf) \
			ipc_log_string((buf), fmt, __func__, __LINE__, \
				## args); \
	} while (0)

#define GSIDBG(fmt, args...) \
		dev_dbg(gsi_ctx->dev, "%s:%d " fmt, __func__, __LINE__, ## args)
	do { \
		dev_dbg(gsi_ctx->dev, "%s:%d " fmt, __func__, __LINE__, \
		## args);\
		if (gsi_ctx) { \
			GSI_IPC_LOGGING(gsi_ctx->ipc_logbuf, \
				"%s:%d " fmt, ## args); \
			GSI_IPC_LOGGING(gsi_ctx->ipc_logbuf_low, \
				"%s:%d " fmt, ## args); \
		} \
	} while (0)

#define GSIDBG_LOW(fmt, args...) \
	do { \
		dev_dbg(gsi_ctx->dev, "%s:%d " fmt, __func__, __LINE__, \
		## args);\
		if (gsi_ctx) { \
			GSI_IPC_LOGGING(gsi_ctx->ipc_logbuf_low, \
				"%s:%d " fmt, ## args); \
		} \
	} while (0)

#define GSIERR(fmt, args...) \
	do { \
		dev_err(gsi_ctx->dev, "%s:%d " fmt, __func__, __LINE__, \
		## args);\
		if (gsi_ctx) { \
			GSI_IPC_LOGGING(gsi_ctx->ipc_logbuf, \
				"%s:%d " fmt, ## args); \
			GSI_IPC_LOGGING(gsi_ctx->ipc_logbuf_low, \
				"%s:%d " fmt, ## args); \
		} \
	} while (0)

#define GSI_IPC_LOG_PAGES 50

enum gsi_evt_ring_state {
	GSI_EVT_RING_STATE_NOT_ALLOCATED = 0x0,
@@ -163,6 +202,8 @@ struct gsi_ctx {
	u32 max_ch;
	u32 max_ev;
	struct completion gen_ee_cmd_compl;
	void *ipc_logbuf;
	void *ipc_logbuf_low;
};

enum gsi_re_type {
+51 −1
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -747,6 +747,45 @@ error:
	return -EFAULT;
}

static ssize_t gsi_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 (!gsi_ctx->ipc_logbuf_low) {
			gsi_ctx->ipc_logbuf_low =
				ipc_log_context_create(GSI_IPC_LOG_PAGES,
					"gsi_low", 0);
		}

		if (gsi_ctx->ipc_logbuf_low == NULL) {
			TERR("failed to get ipc_logbuf_low\n");
			return -EFAULT;
		}
	} else {
		if (gsi_ctx->ipc_logbuf_low)
			ipc_log_context_destroy(gsi_ctx->ipc_logbuf_low);
		gsi_ctx->ipc_logbuf_low = NULL;
	}

	return count;
}



const struct file_operations gsi_ev_dump_ops = {
	.write = gsi_dump_evt,
};
@@ -783,6 +822,10 @@ const struct file_operations gsi_print_dp_stats_ops = {
	.write = gsi_print_dp_stats,
};

const struct file_operations gsi_ipc_low_ops = {
	.write = gsi_enable_ipc_low,
};

void gsi_debugfs_init(void)
{
	static struct dentry *dfile;
@@ -858,6 +901,13 @@ void gsi_debugfs_init(void)
		goto fail;
	}

	dfile = debugfs_create_file("ipc_low", write_only_mode,
		dent, 0, &gsi_ipc_low_ops);
	if (!dfile || IS_ERR(dfile)) {
		TERR("could not create ipc_low\n");
		goto fail;
	}

	return;
fail:
	debugfs_remove_recursive(dent);