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

Commit a3cfbff0 authored by Huaibin Yang's avatar Huaibin Yang Committed by Ingrid Gallardo
Browse files

msm: mdss: debugfs: xlog: add iommu xlog



Add iommu xlog flags and handlers. MDSS_XLOG_IOMMU is dedicated to
iommu issues. The fault handler, if installed, dumps mdp registers to
ram, dump xlog entries to kernel log and panic the system.

Change-Id: I7d703c5958104fb3dc2c30a7fc1e59508c8d0ca3
Signed-off-by: default avatarHuaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: default avatarIngrid Gallardo <ingridg@codeaurora.org>
parent db7b7b0b
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -38,7 +38,8 @@ enum mdss_dbg_reg_dump_flag {

enum mdss_dbg_xlog_flag {
	MDSS_XLOG_DEFAULT = BIT(0),
	MDSS_XLOG_ALL = BIT(7),
	MDSS_XLOG_IOMMU = BIT(1),
	MDSS_XLOG_ALL = BIT(7)
};

#define MDSS_XLOG(...) mdss_xlog(__func__, __LINE__, MDSS_XLOG_DEFAULT, \
@@ -51,6 +52,8 @@ enum mdss_dbg_xlog_flag {
#define MDSS_XLOG_ALL(...) mdss_xlog(__func__, __LINE__, MDSS_XLOG_ALL,	\
		##__VA_ARGS__, DATA_LIMITER)

#define MDSS_XLOG_IOMMU(...) mdss_xlog(__func__, __LINE__, MDSS_XLOG_IOMMU, \
		##__VA_ARGS__, DATA_LIMITER)

#define ATRACE_END(name) trace_tracing_mark_write(current->tgid, name, 0)
#define ATRACE_BEGIN(name) trace_tracing_mark_write(current->tgid, name, 1)
@@ -106,6 +109,8 @@ int mdss_create_xlog_debug(struct mdss_debug_data *mdd);
void mdss_xlog(const char *name, int line, int flag, ...);
void mdss_dump_reg(struct mdss_debug_base *dbg, u32 reg_dump_flag);
void mdss_xlog_tout_handler_default(const char *name, ...);
int mdss_xlog_tout_handler_iommu(struct iommu_domain *domain,
	struct device *dev, unsigned long iova, int flags, void *token);
#else
static inline int mdss_debugfs_init(struct mdss_data_type *mdata) { return 0; }
static inline int mdss_debugfs_remove(struct mdss_data_type *mdata)
@@ -132,6 +137,8 @@ static inline void mdss_dump_reg(struct mdss_debug_base *dbg,
static inline void mdss_xlog(const char *name, int line, int flag...) { }
static inline void mdss_dsi_debug_check_te(struct mdss_panel_data *pdata) { }
static inline void mdss_xlog_tout_handler_default(const char *name, ...) { }
static inline int  mdss_xlog_tout_handler_iommu(struct iommu_domain *domain,
	struct device *dev, unsigned long iova, int flags, void *token) { }
#endif

static inline int mdss_debug_register_io(const char *name,
+15 −1
Original line number Diff line number Diff line
@@ -235,6 +235,21 @@ void mdss_xlog_tout_handler_default(const char *name, ...)
	if (dead && mdss_dbg_xlog.panic_on_err)
		panic(name);
}

int mdss_xlog_tout_handler_iommu(struct iommu_domain *domain,
	struct device *dev, unsigned long iova, int flags, void *token)
{
	if (!mdss_xlog_is_enabled(MDSS_XLOG_IOMMU))
		return 0;

	mdss_dump_reg_by_blk("mdp");
	mdss_dump_reg_by_blk("vbif");
	mdss_xlog_dump_all();
	panic("mdp iommu");

	return 0;
}

static int mdss_xlog_dump_open(struct inode *inode, struct file *file)
{
	/* non-seekable */
@@ -299,4 +314,3 @@ int mdss_create_xlog_debug(struct mdss_debug_data *mdd)
			    &mdss_dbg_xlog.enable_reg_dump);
	return 0;
}
+4 −1
Original line number Diff line number Diff line
/*
 * MDSS MDP Interface (used by framebuffer core)
 *
 * Copyright (c) 2007-2014, The Linux Foundation. All rights reserved.
 * Copyright (c) 2007-2015, The Linux Foundation. All rights reserved.
 * Copyright (C) 2007 Google Incorporated
 *
 * This software is licensed under the terms of the GNU General Public
@@ -1045,6 +1045,9 @@ int mdss_iommu_init(struct mdss_data_type *mdata)
			return -EINVAL;
		}

		iommu_set_fault_handler(domain, mdss_xlog_tout_handler_iommu,
			NULL);

		iomap->ctx = msm_iommu_get_ctx(iomap->ctx_name);
		if (!iomap->ctx) {
			pr_warn("unable to get iommu ctx(%s)\n",