[Freedreno] [DPU PATCH 15/19] drm/msm: dpu: Remove arbitrary register dumps

Sean Paul seanpaul at chromium.org
Wed Jun 20 20:48:37 UTC 2018


This can be achieved via /dev/mem.

Signed-off-by: Sean Paul <seanpaul at chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c    |   3 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c    |   3 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c   |   3 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c     |   3 -
 .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c   |   3 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c   |  14 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c    |   3 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c       |  22 -
 drivers/gpu/drm/msm/dpu_dbg.c                 | 716 +-----------------
 drivers/gpu/drm/msm/dpu_dbg.h                 |  59 --
 10 files changed, 7 insertions(+), 822 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c
index 24b0dbc76f3a..da6f0609be5f 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cdm.c
@@ -301,9 +301,6 @@ struct dpu_hw_cdm *dpu_hw_cdm_init(enum dpu_cdm idx,
 		goto blk_init_error;
 	}
 
-	dpu_dbg_reg_register_dump_range(DPU_DBG_NAME, cfg->name, c->hw.blk_off,
-			c->hw.blk_off + c->hw.length, c->hw.xin_id);
-
 	/*
 	 * Perform any default initialization for the chroma down module
 	 * @setup default csc coefficients
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
index ad02316fafce..06be7cf7ce50 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
@@ -524,9 +524,6 @@ struct dpu_hw_ctl *dpu_hw_ctl_init(enum dpu_ctl idx,
 		goto blk_init_error;
 	}
 
-	dpu_dbg_reg_register_dump_range(DPU_DBG_NAME, cfg->name, c->hw.blk_off,
-			c->hw.blk_off + c->hw.length, c->hw.xin_id);
-
 	return c;
 
 blk_init_error:
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
index 7386d4643115..d280df5613c9 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c
@@ -332,9 +332,6 @@ struct dpu_hw_intf *dpu_hw_intf_init(enum dpu_intf idx,
 		goto blk_init_error;
 	}
 
-	dpu_dbg_reg_register_dump_range(DPU_DBG_NAME, cfg->name, c->hw.blk_off,
-			c->hw.blk_off + c->hw.length, c->hw.xin_id);
-
 	return c;
 
 blk_init_error:
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
index 5b4d529a1a89..4ab72b0f07a5 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c
@@ -245,9 +245,6 @@ struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx,
 		goto blk_init_error;
 	}
 
-	dpu_dbg_reg_register_dump_range(DPU_DBG_NAME, cfg->name, c->hw.blk_off,
-			c->hw.blk_off + c->hw.length, c->hw.xin_id);
-
 	return c;
 
 blk_init_error:
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c
index 12e90b8e5466..cc3a623903f4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c
@@ -234,9 +234,6 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx,
 		goto blk_init_error;
 	}
 
-	dpu_dbg_reg_register_dump_range(DPU_DBG_NAME, cfg->name, c->hw.blk_off,
-			c->hw.blk_off + c->hw.length, c->hw.xin_id);
-
 	return c;
 
 blk_init_error:
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
index 6640906e4f03..2b3f5e88af98 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
@@ -734,20 +734,6 @@ struct dpu_hw_pipe *dpu_hw_sspp_init(enum dpu_sspp idx,
 		goto blk_init_error;
 	}
 
-	if (!is_virtual_pipe)
-		dpu_dbg_reg_register_dump_range(DPU_DBG_NAME, cfg->name,
-			hw_pipe->hw.blk_off,
-			hw_pipe->hw.blk_off + hw_pipe->hw.length,
-			hw_pipe->hw.xin_id);
-
-	if (cfg->sblk->scaler_blk.len && !is_virtual_pipe)
-		dpu_dbg_reg_register_dump_range(DPU_DBG_NAME,
-			cfg->sblk->scaler_blk.name,
-			hw_pipe->hw.blk_off + cfg->sblk->scaler_blk.base,
-			hw_pipe->hw.blk_off + cfg->sblk->scaler_blk.base +
-				cfg->sblk->scaler_blk.len,
-			hw_pipe->hw.xin_id);
-
 	return hw_pipe;
 
 blk_init_error:
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c
index 115eeedd90e8..42fc72cf48dd 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c
@@ -379,9 +379,6 @@ struct dpu_hw_mdp *dpu_hw_mdptop_init(enum dpu_mdp idx,
 		goto blk_init_error;
 	}
 
-	dpu_dbg_reg_register_dump_range(DPU_DBG_NAME, cfg->name,
-			mdp->hw.blk_off, mdp->hw.blk_off + mdp->hw.length,
-			mdp->hw.xin_id);
 	dpu_dbg_set_dpu_top_offset(mdp->hw.blk_off);
 
 	return mdp;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 4fd5e1d7261e..3003176e731d 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1417,11 +1417,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 	DRM_DEBUG("mapped dpu address space @%pK\n", dpu_kms->mmio);
 	dpu_kms->mmio_len = msm_iomap_size(dpu_kms->pdev, "mdp_phys");
 
-	rc = dpu_dbg_reg_register_base(DPU_DBG_NAME, dpu_kms->mmio,
-			dpu_kms->mmio_len);
-	if (rc)
-		DPU_ERROR("dbg base register kms failed: %d\n", rc);
-
 	dpu_kms->vbif[VBIF_RT] = msm_ioremap(dpu_kms->pdev, "vbif_phys",
 								"vbif_phys");
 	if (IS_ERR(dpu_kms->vbif[VBIF_RT])) {
@@ -1432,11 +1427,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 	}
 	dpu_kms->vbif_len[VBIF_RT] = msm_iomap_size(dpu_kms->pdev,
 								"vbif_phys");
-	rc = dpu_dbg_reg_register_base("vbif_rt", dpu_kms->vbif[VBIF_RT],
-				dpu_kms->vbif_len[VBIF_RT]);
-	if (rc)
-		DPU_ERROR("dbg base register vbif_rt failed: %d\n", rc);
-
 	dpu_kms->vbif[VBIF_NRT] = msm_ioremap(dpu_kms->pdev, "vbif_nrt_phys",
 								"vbif_nrt_phys");
 	if (IS_ERR(dpu_kms->vbif[VBIF_NRT])) {
@@ -1445,12 +1435,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 	} else {
 		dpu_kms->vbif_len[VBIF_NRT] = msm_iomap_size(dpu_kms->pdev,
 							"vbif_nrt_phys");
-		rc = dpu_dbg_reg_register_base("vbif_nrt",
-				dpu_kms->vbif[VBIF_NRT],
-				dpu_kms->vbif_len[VBIF_NRT]);
-		if (rc)
-			DPU_ERROR("dbg base register vbif_nrt failed: %d\n",
-					rc);
 	}
 
 	dpu_kms->reg_dma = msm_ioremap(dpu_kms->pdev, "regdma_phys",
@@ -1461,12 +1445,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
 	} else {
 		dpu_kms->reg_dma_len = msm_iomap_size(dpu_kms->pdev,
 								"regdma_phys");
-		rc =  dpu_dbg_reg_register_base("reg_dma",
-				dpu_kms->reg_dma,
-				dpu_kms->reg_dma_len);
-		if (rc)
-			DPU_ERROR("dbg base register reg_dma failed: %d\n",
-					rc);
 	}
 
 	dpu_kms->core_client = dpu_power_client_create(&dpu_kms->phandle,
diff --git a/drivers/gpu/drm/msm/dpu_dbg.c b/drivers/gpu/drm/msm/dpu_dbg.c
index 813f6f3ff773..3572e3cbec6c 100644
--- a/drivers/gpu/drm/msm/dpu_dbg.c
+++ b/drivers/gpu/drm/msm/dpu_dbg.c
@@ -25,16 +25,10 @@
 #include "dpu_dbg.h"
 #include "disp/dpu1/dpu_hw_catalog.h"
 
-#define DPU_DBG_BASE_MAX		10
 
 #define DEFAULT_PANIC		1
-#define DEFAULT_REGDUMP		DPU_DBG_DUMP_IN_MEM
 #define DEFAULT_DBGBUS_DPU	DPU_DBG_DUMP_IN_MEM
 #define DEFAULT_DBGBUS_VBIFRT	DPU_DBG_DUMP_IN_MEM
-#define DEFAULT_BASE_REG_CNT	0x100
-#define GROUP_BYTES		4
-#define ROW_BYTES		16
-#define RANGE_NAME_LEN		40
 #define REG_BASE_NAME_LEN	80
 
 #define DBGBUS_FLAGS_DSPP	BIT(0)
@@ -65,41 +59,11 @@
 #define MMSS_VBIF_ERR_INFO_1		0x1a4
 #define MMSS_VBIF_CLIENT_NUM		14
 
-/* print debug ranges in groups of 4 u32s */
-#define REG_DUMP_ALIGN		16
-
-/**
- * struct dpu_dbg_reg_offset - tracking for start and end of region
- * @start: start offset
- * @start: end offset
- */
-struct dpu_dbg_reg_offset {
-	u32 start;
-	u32 end;
-};
-
-/**
- * struct dpu_dbg_reg_range - register dumping named sub-range
- * @head: head of this node
- * @reg_dump: address for the mem dump
- * @range_name: name of this range
- * @offset: offsets for range to dump
- * @xin_id: client xin id
- */
-struct dpu_dbg_reg_range {
-	struct list_head head;
-	u32 *reg_dump;
-	char range_name[RANGE_NAME_LEN];
-	struct dpu_dbg_reg_offset offset;
-	uint32_t xin_id;
-};
-
 /**
  * struct dpu_dbg_reg_base - register region base.
  *	may sub-ranges: sub-ranges are used for dumping
  *	or may not have sub-ranges: dumping is base -> max_offset
  * @reg_base_head: head of this node
- * @sub_range_list: head to the list with dump ranges
  * @name: register base name
  * @base: base pointer
  * @off: cached offset of region for manual register dumping
@@ -107,13 +71,11 @@ struct dpu_dbg_reg_range {
  * @max_offset: length of region
  * @buf: buffer used for manual register dumping
  * @buf_len:  buffer length used for manual register dumping
- * @reg_dump: address for the mem dump if no ranges used
  * @cb: callback for external dump function, null if not defined
  * @cb_ptr: private pointer to callback function
  */
 struct dpu_dbg_reg_base {
 	struct list_head reg_base_head;
-	struct list_head sub_range_list;
 	char name[REG_BASE_NAME_LEN];
 	void __iomem *base;
 	size_t off;
@@ -121,7 +83,6 @@ struct dpu_dbg_reg_base {
 	size_t max_offset;
 	char *buf;
 	size_t buf_len;
-	u32 *reg_dump;
 	void (*cb)(void *ptr);
 	void *cb_ptr;
 };
@@ -167,11 +128,9 @@ struct dpu_dbg_vbif_debug_bus {
  * struct dpu_dbg_base - global dpu debug base structure
  * @reg_base_list: list of register dumping regions
  * @dev: device pointer
- * @req_dump_blks: list of blocks requested for dumping
  * @panic_on_err: whether to kernel panic after triggering dump via debugfs
  * @dump_work: work struct for deferring register dump work to separate thread
  * @work_panic: panic after dump if internal user passed "panic" special region
- * @enable_reg_dump: whether to dump registers into memory, kernel log, or both
  * @dbgbus_dpu: debug bus structure for the dpu
  * @dbgbus_vbif_rt: debug bus structure for the realtime vbif
  * @dsi_dbg_bus: dump dsi debug bus register
@@ -180,12 +139,9 @@ static struct dpu_dbg_base {
 	struct list_head reg_base_list;
 	struct device *dev;
 
-	struct dpu_dbg_reg_base *req_dump_blks[DPU_DBG_BASE_MAX];
-
 	u32 panic_on_err;
 	struct work_struct dump_work;
 	bool work_panic;
-	u32 enable_reg_dump;
 
 	struct dpu_dbg_dpu_debug_bus dbgbus_dpu;
 	struct dpu_dbg_vbif_debug_bus dbgbus_vbif_rt;
@@ -2006,222 +1962,6 @@ static inline void _dpu_dbg_enable_power(int enable)
 		pm_runtime_put_sync(dpu_dbg_base.dev);
 }
 
-/**
- * _dpu_dump_reg - helper function for dumping rotator register set content
- * @dump_name: register set name
- * @reg_dump_flag: dumping flag controlling in-log/memory dump location
- * @base_addr: starting address of io region for calculating offsets to print
- * @addr: starting address offset for dumping
- * @len_bytes: range of the register set
- * @dump_mem: output buffer for memory dump location option
- * @from_isr: whether being called from isr context
- */
-static void _dpu_dump_reg(const char *dump_name, u32 reg_dump_flag,
-		char *base_addr, char *addr, size_t len_bytes, u32 **dump_mem,
-		bool from_isr)
-{
-	u32 in_log, in_mem, len_align, len_padded;
-	u32 *dump_addr = NULL;
-	char *end_addr;
-	int i;
-
-	if (!len_bytes)
-		return;
-
-	in_log = (reg_dump_flag & DPU_DBG_DUMP_IN_LOG);
-	in_mem = (reg_dump_flag & DPU_DBG_DUMP_IN_MEM);
-
-	pr_debug("%s: reg_dump_flag=%d in_log=%d in_mem=%d\n",
-		dump_name, reg_dump_flag, in_log, in_mem);
-
-	if (!in_log && !in_mem)
-		return;
-
-	if (in_log)
-		dev_info(dpu_dbg_base.dev, "%s: start_offset %p len 0x%zx\n",
-				dump_name, (void*)(addr - base_addr),
-				len_bytes);
-
-	len_align = (len_bytes + REG_DUMP_ALIGN - 1) / REG_DUMP_ALIGN;
-	len_padded = len_align * REG_DUMP_ALIGN;
-	end_addr = addr + len_bytes;
-
-	if (in_mem) {
-		if (dump_mem && !(*dump_mem)) {
-			phys_addr_t phys = 0;
-			*dump_mem = dma_alloc_coherent(dpu_dbg_base.dev,
-					len_padded, &phys, GFP_KERNEL);
-		}
-
-		if (dump_mem && *dump_mem) {
-			dump_addr = *dump_mem;
-			dev_info(dpu_dbg_base.dev,
-				"%s: start_addr:0x%pK len:0x%x reg_offset=%p\n",
-				dump_name, dump_addr, len_padded,
-				(void*)(addr - base_addr));
-		} else {
-			in_mem = 0;
-			pr_err("dump_mem: kzalloc fails!\n");
-		}
-	}
-
-	if (!from_isr)
-		_dpu_dbg_enable_power(true);
-
-	for (i = 0; i < len_align; i++) {
-		u32 x0, x4, x8, xc;
-
-		x0 = (addr < end_addr) ? readl_relaxed(addr + 0x0) : 0;
-		x4 = (addr + 0x4 < end_addr) ? readl_relaxed(addr + 0x4) : 0;
-		x8 = (addr + 0x8 < end_addr) ? readl_relaxed(addr + 0x8) : 0;
-		xc = (addr + 0xc < end_addr) ? readl_relaxed(addr + 0xc) : 0;
-
-		if (in_log)
-			dev_info(dpu_dbg_base.dev,
-					"%p : %08x %08x %08x %08x\n",
-					(void*)(addr - base_addr), x0, x4, x8,
-					xc);
-
-		if (dump_addr) {
-			dump_addr[i * 4] = x0;
-			dump_addr[i * 4 + 1] = x4;
-			dump_addr[i * 4 + 2] = x8;
-			dump_addr[i * 4 + 3] = xc;
-		}
-
-		addr += REG_DUMP_ALIGN;
-	}
-
-	if (!from_isr)
-		_dpu_dbg_enable_power(false);
-}
-
-/**
- * _dpu_dbg_get_dump_range - helper to retrieve dump length for a range node
- * @range_node: range node to dump
- * @max_offset: max offset of the register base
- * @Return: length
- */
-static u32 _dpu_dbg_get_dump_range(struct dpu_dbg_reg_offset *range_node,
-		size_t max_offset)
-{
-	u32 length = 0;
-
-	if ((range_node->start > range_node->end) ||
-		(range_node->end > max_offset) || (range_node->start == 0
-		&& range_node->end == 0)) {
-		length = max_offset;
-	} else {
-		length = range_node->end - range_node->start;
-	}
-
-	return length;
-}
-
-static int _dpu_dump_reg_range_cmp(void *priv, struct list_head *a,
-		struct list_head *b)
-{
-	struct dpu_dbg_reg_range *ar, *br;
-
-	if (!a || !b)
-		return 0;
-
-	ar = container_of(a, struct dpu_dbg_reg_range, head);
-	br = container_of(b, struct dpu_dbg_reg_range, head);
-
-	return ar->offset.start - br->offset.start;
-}
-
-/**
- * _dpu_dump_reg_by_ranges - dump ranges or full range of the register blk base
- * @dbg: register blk base structure
- * @reg_dump_flag: dump target, memory, kernel log, or both
- */
-static void _dpu_dump_reg_by_ranges(struct dpu_dbg_reg_base *dbg,
-	u32 reg_dump_flag)
-{
-	char *addr;
-	size_t len;
-	struct dpu_dbg_reg_range *range_node;
-
-	if (!dbg || !(dbg->base || dbg->cb)) {
-		pr_err("dbg base is null!\n");
-		return;
-	}
-
-	dev_info(dpu_dbg_base.dev, "%s:=========%s DUMP=========\n", __func__,
-			dbg->name);
-	if (dbg->cb) {
-		dbg->cb(dbg->cb_ptr);
-	/* If there is a list to dump the registers by ranges, use the ranges */
-	} else if (!list_empty(&dbg->sub_range_list)) {
-		/* sort the list by start address first */
-		list_sort(NULL, &dbg->sub_range_list, _dpu_dump_reg_range_cmp);
-		list_for_each_entry(range_node, &dbg->sub_range_list, head) {
-			len = _dpu_dbg_get_dump_range(&range_node->offset,
-				dbg->max_offset);
-			addr = dbg->base + range_node->offset.start;
-			pr_debug("%s: range_base=0x%pK start=0x%x end=0x%x\n",
-				range_node->range_name,
-				addr, range_node->offset.start,
-				range_node->offset.end);
-
-			_dpu_dump_reg(range_node->range_name, reg_dump_flag,
-					dbg->base, addr, len,
-					&range_node->reg_dump, false);
-		}
-	} else {
-		/* If there is no list to dump ranges, dump all registers */
-		dev_info(dpu_dbg_base.dev,
-				"Ranges not found, will dump full registers\n");
-		dev_info(dpu_dbg_base.dev, "base:0x%pK len:0x%zx\n", dbg->base,
-				dbg->max_offset);
-		addr = dbg->base;
-		len = dbg->max_offset;
-		_dpu_dump_reg(dbg->name, reg_dump_flag, dbg->base, addr, len,
-				&dbg->reg_dump, false);
-	}
-}
-
-/**
- * _dpu_dump_reg_by_blk - dump a named register base region
- * @blk_name: register blk name
- */
-static void _dpu_dump_reg_by_blk(const char *blk_name)
-{
-	struct dpu_dbg_base *dbg_base = &dpu_dbg_base;
-	struct dpu_dbg_reg_base *blk_base;
-
-	if (!dbg_base)
-		return;
-
-	list_for_each_entry(blk_base, &dbg_base->reg_base_list, reg_base_head) {
-		if (strlen(blk_base->name) &&
-			!strcmp(blk_base->name, blk_name)) {
-			_dpu_dump_reg_by_ranges(blk_base,
-				dbg_base->enable_reg_dump);
-			break;
-		}
-	}
-}
-
-/**
- * _dpu_dump_get_blk_addr - retrieve register block address by name
- * @blk_name: register blk name
- * @Return: register blk base, or NULL
- */
-static struct dpu_dbg_reg_base *_dpu_dump_get_blk_addr(const char *blk_name)
-{
-	struct dpu_dbg_base *dbg_base = &dpu_dbg_base;
-	struct dpu_dbg_reg_base *blk_base;
-
-	list_for_each_entry(blk_base, &dbg_base->reg_base_list, reg_base_head)
-		if (strlen(blk_base->name) && !strcmp(blk_base->name, blk_name))
-			return blk_base;
-
-	return NULL;
-}
-
 static void _dpu_dbg_dump_dpu_dbg_bus(struct dpu_dbg_dpu_debug_bus *bus)
 {
 	bool in_log, in_mem;
@@ -2490,27 +2230,14 @@ static void _dpu_dbg_dump_vbif_dbg_bus(struct dpu_dbg_vbif_debug_bus *bus)
 
 /**
  * _dpu_dump_array - dump array of register bases
- * @blk_arr: array of register base pointers
- * @len: length of blk_arr
  * @do_panic: whether to trigger a panic after dumping
  * @name: string indicating origin of dump
  * @dump_dbgbus_dpu: whether to dump the dpu debug bus
  * @dump_dbgbus_vbif_rt: whether to dump the vbif rt debug bus
  */
-static void _dpu_dump_array(struct dpu_dbg_reg_base *blk_arr[],
-	u32 len, bool do_panic, const char *name, bool dump_dbgbus_dpu,
-	bool dump_dbgbus_vbif_rt)
+static void _dpu_dump_array(bool do_panic, const char *name,
+			    bool dump_dbgbus_dpu, bool dump_dbgbus_vbif_rt)
 {
-	int i;
-
-	if (!blk_arr || !len) {
-		for (i = 0; i < len; i++) {
-			if (blk_arr[i] != NULL)
-				_dpu_dump_reg_by_ranges(blk_arr[i],
-					dpu_dbg_base.enable_reg_dump);
-		}
-	}
-
 	if (dump_dbgbus_dpu)
 		_dpu_dbg_dump_dpu_dbg_bus(&dpu_dbg_base.dbgbus_dpu);
 
@@ -2527,50 +2254,27 @@ static void _dpu_dump_array(struct dpu_dbg_reg_base *blk_arr[],
  */
 static void _dpu_dump_work(struct work_struct *work)
 {
-	_dpu_dump_array(dpu_dbg_base.req_dump_blks,
-		ARRAY_SIZE(dpu_dbg_base.req_dump_blks),
-		dpu_dbg_base.work_panic, "dpudump_workitem",
+	_dpu_dump_array(dpu_dbg_base.work_panic, "dpudump_workitem",
 		dpu_dbg_base.dbgbus_dpu.cmn.include_in_deferred_work,
 		dpu_dbg_base.dbgbus_vbif_rt.cmn.include_in_deferred_work);
 }
 
 void dpu_dbg_dump(bool queue_work, const char *name, ...)
 {
-	int index = 0;
 	bool do_panic = false;
 	bool dump_dbgbus_dpu = false;
 	bool dump_dbgbus_vbif_rt = false;
 	va_list args;
 	char *blk_name = NULL;
-	struct dpu_dbg_reg_base *blk_base = NULL;
-	struct dpu_dbg_reg_base **blk_arr;
-	u32 blk_len;
 
 	if (queue_work && work_pending(&dpu_dbg_base.dump_work))
 		return;
 
-	blk_arr = &dpu_dbg_base.req_dump_blks[0];
-	blk_len = ARRAY_SIZE(dpu_dbg_base.req_dump_blks);
-
-	memset(dpu_dbg_base.req_dump_blks, 0,
-			sizeof(dpu_dbg_base.req_dump_blks));
-
 	va_start(args, name);
 	while ((blk_name = va_arg(args, char*))) {
 		if (IS_ERR_OR_NULL(blk_name))
 			break;
 
-		blk_base = _dpu_dump_get_blk_addr(blk_name);
-		if (blk_base) {
-			if (index < blk_len) {
-				blk_arr[index] = blk_base;
-				index++;
-			} else {
-				pr_err("insufficient space to to dump %s\n",
-						blk_name);
-			}
-		}
-
 		if (!strcmp(blk_name, "dbg_bus"))
 			dump_dbgbus_dpu = true;
 
@@ -2594,8 +2298,8 @@ void dpu_dbg_dump(bool queue_work, const char *name, ...)
 				dump_dbgbus_vbif_rt;
 		schedule_work(&dpu_dbg_base.dump_work);
 	} else {
-		_dpu_dump_array(blk_arr, blk_len, do_panic, name,
-				dump_dbgbus_dpu, dump_dbgbus_vbif_rt);
+		_dpu_dump_array(do_panic, name, dump_dbgbus_dpu,
+				dump_dbgbus_vbif_rt);
 	}
 }
 
@@ -2622,9 +2326,7 @@ static int dpu_dbg_debugfs_open(struct inode *inode, struct file *file)
 static ssize_t dpu_dbg_dump_write(struct file *file,
 	const char __user *user_buf, size_t count, loff_t *ppos)
 {
-	_dpu_dump_array(NULL, 0, dpu_dbg_base.panic_on_err, "dump_debugfs",
-		true, true, true);
-
+	_dpu_dump_array(dpu_dbg_base.panic_on_err, "dump_debugfs", true, true);
 	return count;
 }
 
@@ -2633,245 +2335,9 @@ static const struct file_operations dpu_dbg_dump_fops = {
 	.write = dpu_dbg_dump_write,
 };
 
-/**
- * dpu_dbg_reg_base_release - release allocated reg dump file private data
- * @inode: debugfs inode
- * @file: file handle
- * @Return: 0 on success
- */
-static int dpu_dbg_reg_base_release(struct inode *inode, struct file *file)
-{
-	struct dpu_dbg_reg_base *dbg = file->private_data;
-
-	if (dbg && dbg->buf) {
-		kfree(dbg->buf);
-		dbg->buf_len = 0;
-		dbg->buf = NULL;
-	}
-	return 0;
-}
-
-
-/**
- * dpu_dbg_reg_base_offset_write - set new offset and len to debugfs reg base
- * @file: file handler
- * @user_buf: user buffer content from debugfs
- * @count: size of user buffer
- * @ppos: position offset of user buffer
- */
-static ssize_t dpu_dbg_reg_base_offset_write(struct file *file,
-		const char __user *user_buf, size_t count, loff_t *ppos)
-{
-	struct dpu_dbg_reg_base *dbg = file->private_data;
-	u32 off = 0;
-	u32 cnt = DEFAULT_BASE_REG_CNT;
-	char buf[24];
-
-	if (!dbg)
-		return -ENODEV;
-
-	if (count >= sizeof(buf))
-		return -EFAULT;
-
-	if (copy_from_user(buf, user_buf, count))
-		return -EFAULT;
-
-	buf[count] = 0;	/* end of string */
-
-	if (sscanf(buf, "%5x %x", &off, &cnt) != 2)
-		return -EFAULT;
-
-	if (off > dbg->max_offset)
-		return -EINVAL;
-
-	if (off % sizeof(u32))
-		return -EINVAL;
-
-	if (cnt > (dbg->max_offset - off))
-		cnt = dbg->max_offset - off;
-
-	dbg->off = off;
-	dbg->cnt = cnt;
-
-	pr_debug("offset=%x cnt=%x\n", off, cnt);
-
-	return count;
-}
-
-/**
- * dpu_dbg_reg_base_offset_read - read current offset and len of register base
- * @file: file handler
- * @user_buf: user buffer content from debugfs
- * @count: size of user buffer
- * @ppos: position offset of user buffer
- */
-static ssize_t dpu_dbg_reg_base_offset_read(struct file *file,
-			char __user *buff, size_t count, loff_t *ppos)
-{
-	struct dpu_dbg_reg_base *dbg = file->private_data;
-	int len = 0;
-	char buf[24] = {'\0'};
-
-	if (!dbg)
-		return -ENODEV;
-
-	if (*ppos)
-		return 0;	/* the end */
-
-	if (dbg->off % sizeof(u32))
-		return -EFAULT;
-
-	len = snprintf(buf, sizeof(buf), "0x%08zx %zx\n", dbg->off, dbg->cnt);
-	if (len < 0 || len >= sizeof(buf))
-		return 0;
-
-	if ((count < sizeof(buf)) || copy_to_user(buff, buf, len))
-		return -EFAULT;
-
-	*ppos += len;	/* increase offset */
-
-	return len;
-}
-
-/**
- * dpu_dbg_reg_base_reg_write - write to reg base hw at offset a given value
- * @file: file handler
- * @user_buf: user buffer content from debugfs
- * @count: size of user buffer
- * @ppos: position offset of user buffer
- */
-static ssize_t dpu_dbg_reg_base_reg_write(struct file *file,
-		const char __user *user_buf, size_t count, loff_t *ppos)
-{
-	struct dpu_dbg_reg_base *dbg = file->private_data;
-	size_t off;
-	u32 data, cnt;
-	char buf[24];
-
-	if (!dbg)
-		return -ENODEV;
-
-	if (count >= sizeof(buf))
-		return -EFAULT;
-
-	if (copy_from_user(buf, user_buf, count))
-		return -EFAULT;
-
-	buf[count] = 0;	/* end of string */
-
-	cnt = sscanf(buf, "%zx %x", &off, &data);
-
-	if (cnt < 2)
-		return -EFAULT;
-
-	if (off % sizeof(u32))
-		return -EFAULT;
-
-	if (off >= dbg->max_offset)
-		return -EFAULT;
-
-	_dpu_dbg_enable_power(true);
-
-	writel_relaxed(data, dbg->base + off);
-
-	_dpu_dbg_enable_power(false);
-
-	pr_debug("addr=%zx data=%x\n", off, data);
-
-	return count;
-}
-
-/**
- * dpu_dbg_reg_base_reg_read - read len from reg base hw at current offset
- * @file: file handler
- * @user_buf: user buffer content from debugfs
- * @count: size of user buffer
- * @ppos: position offset of user buffer
- */
-static ssize_t dpu_dbg_reg_base_reg_read(struct file *file,
-			char __user *user_buf, size_t count, loff_t *ppos)
-{
-	struct dpu_dbg_reg_base *dbg = file->private_data;
-	size_t len;
-
-	if (!dbg) {
-		pr_err("invalid handle\n");
-		return -ENODEV;
-	}
-
-	if (!dbg->buf) {
-		char dump_buf[64];
-		char *ptr;
-		int cnt, tot;
-
-		dbg->buf_len = sizeof(dump_buf) *
-			DIV_ROUND_UP(dbg->cnt, ROW_BYTES);
-		dbg->buf = kzalloc(dbg->buf_len, GFP_KERNEL);
-
-		if (!dbg->buf)
-			return -ENOMEM;
-
-		if (dbg->off % sizeof(u32))
-			return -EFAULT;
-
-		ptr = dbg->base + dbg->off;
-		tot = 0;
-
-		_dpu_dbg_enable_power(true);
-
-		for (cnt = dbg->cnt; cnt > 0; cnt -= ROW_BYTES) {
-			hex_dump_to_buffer(ptr, min(cnt, ROW_BYTES),
-					   ROW_BYTES, GROUP_BYTES, dump_buf,
-					   sizeof(dump_buf), false);
-			len = scnprintf(dbg->buf + tot, dbg->buf_len - tot,
-					"0x%08x: %s\n",
-					((int) (unsigned long) ptr) -
-					((int) (unsigned long) dbg->base),
-					dump_buf);
-
-			ptr += ROW_BYTES;
-			tot += len;
-			if (tot >= dbg->buf_len)
-				break;
-		}
-
-		_dpu_dbg_enable_power(false);
-
-		dbg->buf_len = tot;
-	}
-
-	if (*ppos >= dbg->buf_len)
-		return 0; /* done reading */
-
-	len = min(count, dbg->buf_len - (size_t) *ppos);
-	if (copy_to_user(user_buf, dbg->buf + *ppos, len)) {
-		pr_err("failed to copy to user\n");
-		return -EFAULT;
-	}
-
-	*ppos += len; /* increase offset */
-
-	return len;
-}
-
-static const struct file_operations dpu_off_fops = {
-	.open = dpu_dbg_debugfs_open,
-	.release = dpu_dbg_reg_base_release,
-	.read = dpu_dbg_reg_base_offset_read,
-	.write = dpu_dbg_reg_base_offset_write,
-};
-
-static const struct file_operations dpu_reg_fops = {
-	.open = dpu_dbg_debugfs_open,
-	.release = dpu_dbg_reg_base_release,
-	.read = dpu_dbg_reg_base_reg_read,
-	.write = dpu_dbg_reg_base_reg_write,
-};
-
 int dpu_dbg_debugfs_register(struct dentry *debugfs_root)
 {
 	static struct dpu_dbg_base *dbg = &dpu_dbg_base;
-	struct dpu_dbg_reg_base *blk_base;
 	char debug_name[80] = "";
 
 	if (!debugfs_root)
@@ -2881,8 +2347,6 @@ int dpu_dbg_debugfs_register(struct dentry *debugfs_root)
 			&dpu_dbg_dump_fops);
 	debugfs_create_u32("panic", 0600, debugfs_root,
 			&dpu_dbg_base.panic_on_err);
-	debugfs_create_u32("reg_dump", 0600, debugfs_root,
-			&dpu_dbg_base.enable_reg_dump);
 
 	if (dbg->dbgbus_dpu.entries) {
 		dbg->dbgbus_dpu.cmn.name = DBGBUS_NAME_DPU;
@@ -2902,18 +2366,6 @@ int dpu_dbg_debugfs_register(struct dentry *debugfs_root)
 				&dbg->dbgbus_vbif_rt.cmn.enable_mask);
 	}
 
-	list_for_each_entry(blk_base, &dbg->reg_base_list, reg_base_head) {
-		snprintf(debug_name, sizeof(debug_name), "%s_off",
-				blk_base->name);
-		debugfs_create_file(debug_name, 0600, debugfs_root, blk_base,
-				&dpu_off_fops);
-
-		snprintf(debug_name, sizeof(debug_name), "%s_reg",
-				blk_base->name);
-		debugfs_create_file(debug_name, 0600, debugfs_root, blk_base,
-				&dpu_reg_fops);
-	}
-
 	return 0;
 }
 
@@ -2964,172 +2416,18 @@ int dpu_dbg_init(struct device *dev)
 	INIT_WORK(&dpu_dbg_base.dump_work, _dpu_dump_work);
 	dpu_dbg_base.work_panic = false;
 	dpu_dbg_base.panic_on_err = DEFAULT_PANIC;
-	dpu_dbg_base.enable_reg_dump = DEFAULT_REGDUMP;
 
-	pr_info("debug_status: panic:%d, dump:%d\n", dpu_dbg_base.panic_on_err,
-		dpu_dbg_base.enable_reg_dump);
+	pr_info("debug_status: panic:%d\n", dpu_dbg_base.panic_on_err);
 
 	return 0;
 }
 
-static void dpu_dbg_reg_base_destroy(void)
-{
-	struct dpu_dbg_reg_range *range_node, *range_tmp;
-	struct dpu_dbg_reg_base *blk_base, *blk_tmp;
-	struct dpu_dbg_base *dbg_base = &dpu_dbg_base;
-
-	if (!dbg_base)
-		return;
-
-	list_for_each_entry_safe(blk_base, blk_tmp, &dbg_base->reg_base_list,
-							reg_base_head) {
-		list_for_each_entry_safe(range_node, range_tmp,
-				&blk_base->sub_range_list, head) {
-			list_del(&range_node->head);
-			kfree(range_node);
-		}
-		list_del(&blk_base->reg_base_head);
-		kfree(blk_base);
-	}
-}
 /**
  * dpu_dbg_destroy - destroy dpu debug facilities
  */
 void dpu_dbg_destroy(void)
 {
 	_dpu_dbg_debugfs_destroy();
-	dpu_dbg_reg_base_destroy();
-}
-
-int dpu_dbg_reg_register_base(const char *name, void __iomem *base,
-		size_t max_offset)
-{
-	struct dpu_dbg_base *dbg_base = &dpu_dbg_base;
-	struct dpu_dbg_reg_base *reg_base;
-
-	if (!name || !strlen(name)) {
-		pr_err("no debug name provided\n");
-		return -EINVAL;
-	}
-
-	reg_base = kzalloc(sizeof(*reg_base), GFP_KERNEL);
-	if (!reg_base)
-		return -ENOMEM;
-
-	strlcpy(reg_base->name, name, sizeof(reg_base->name));
-	reg_base->base = base;
-	reg_base->max_offset = max_offset;
-	reg_base->off = 0;
-	reg_base->cnt = DEFAULT_BASE_REG_CNT;
-	reg_base->reg_dump = NULL;
-
-	/* Initialize list to make sure check for null list will be valid */
-	INIT_LIST_HEAD(&reg_base->sub_range_list);
-
-	pr_debug("%s base: %pK max_offset 0x%zX\n", reg_base->name,
-			reg_base->base, reg_base->max_offset);
-
-	list_add(&reg_base->reg_base_head, &dbg_base->reg_base_list);
-
-	return 0;
-}
-
-int dpu_dbg_reg_register_cb(const char *name, void (*cb)(void *), void *ptr)
-{
-	struct dpu_dbg_base *dbg_base = &dpu_dbg_base;
-	struct dpu_dbg_reg_base *reg_base;
-
-	if (!name || !strlen(name)) {
-		pr_err("no debug name provided\n");
-		return -EINVAL;
-	}
-
-	reg_base = kzalloc(sizeof(*reg_base), GFP_KERNEL);
-	if (!reg_base)
-		return -ENOMEM;
-
-	strlcpy(reg_base->name, name, sizeof(reg_base->name));
-	reg_base->base = NULL;
-	reg_base->max_offset = 0;
-	reg_base->off = 0;
-	reg_base->cnt = DEFAULT_BASE_REG_CNT;
-	reg_base->reg_dump = NULL;
-	reg_base->cb = cb;
-	reg_base->cb_ptr = ptr;
-
-	/* Initialize list to make sure check for null list will be valid */
-	INIT_LIST_HEAD(&reg_base->sub_range_list);
-
-	pr_debug("%s cb: %pK cb_ptr: %pK\n", reg_base->name,
-			reg_base->cb, reg_base->cb_ptr);
-
-	list_add(&reg_base->reg_base_head, &dbg_base->reg_base_list);
-
-	return 0;
-}
-
-void dpu_dbg_reg_unregister_cb(const char *name, void (*cb)(void *), void *ptr)
-{
-	struct dpu_dbg_base *dbg_base = &dpu_dbg_base;
-	struct dpu_dbg_reg_base *reg_base;
-
-	if (!dbg_base)
-		return;
-
-	list_for_each_entry(reg_base, &dbg_base->reg_base_list, reg_base_head) {
-		if (strlen(reg_base->name) &&
-			!strcmp(reg_base->name, name)) {
-			pr_debug("%s cb: %pK cb_ptr: %pK\n", reg_base->name,
-					reg_base->cb, reg_base->cb_ptr);
-			list_del(&reg_base->reg_base_head);
-			kfree(reg_base);
-			break;
-		}
-	}
-}
-
-void dpu_dbg_reg_register_dump_range(const char *base_name,
-		const char *range_name, u32 offset_start, u32 offset_end,
-		uint32_t xin_id)
-{
-	struct dpu_dbg_reg_base *reg_base;
-	struct dpu_dbg_reg_range *range;
-
-	reg_base = _dpu_dump_get_blk_addr(base_name);
-	if (!reg_base) {
-		pr_err("error: for range %s unable to locate base %s\n",
-				range_name, base_name);
-		return;
-	}
-
-	if (!range_name || strlen(range_name) == 0) {
-		pr_err("%pS: bad range name, base_name %s, offset_start 0x%X, end 0x%X\n",
-				__builtin_return_address(0), base_name,
-				offset_start, offset_end);
-		return;
-	}
-
-	if (offset_end - offset_start < REG_DUMP_ALIGN ||
-			offset_start > offset_end) {
-		pr_err("%pS: bad range, base_name %s, range_name %s, offset_start 0x%X, end 0x%X\n",
-				__builtin_return_address(0), base_name,
-				range_name, offset_start, offset_end);
-		return;
-	}
-
-	range = kzalloc(sizeof(*range), GFP_KERNEL);
-	if (!range)
-		return;
-
-	strlcpy(range->range_name, range_name, sizeof(range->range_name));
-	range->offset.start = offset_start;
-	range->offset.end = offset_end;
-	range->xin_id = xin_id;
-	list_add_tail(&range->head, &reg_base->sub_range_list);
-
-	pr_debug("base %s, range %s, start 0x%X, end 0x%X\n",
-			base_name, range->range_name,
-			range->offset.start, range->offset.end);
 }
 
 void dpu_dbg_set_dpu_top_offset(u32 blk_off)
diff --git a/drivers/gpu/drm/msm/dpu_dbg.h b/drivers/gpu/drm/msm/dpu_dbg.h
index 052c78d5b4f5..dd36c30cf7c0 100644
--- a/drivers/gpu/drm/msm/dpu_dbg.h
+++ b/drivers/gpu/drm/msm/dpu_dbg.h
@@ -73,53 +73,6 @@ void dpu_dbg_destroy(void);
  */
 void dpu_dbg_dump(bool queue_work, const char *name, ...);
 
-/**
- * dpu_dbg_reg_register_base - register a hw register address section for later
- *	dumping. call this before calling dpu_dbg_reg_register_dump_range
- *	to be able to specify sub-ranges within the base hw range.
- * @name:	name of base region
- * @base:	base pointer of region
- * @max_offset:	length of region
- * Returns:	0 or -ERROR
- */
-int dpu_dbg_reg_register_base(const char *name, void __iomem *base,
-		size_t max_offset);
-
-/**
- * dpu_dbg_reg_register_cb - register a hw register callback for later
- *	dumping.
- * @name:	name of base region
- * @cb:		callback of external region
- * @cb_ptr:	private pointer of external region
- * Returns:	0 or -ERROR
- */
-int dpu_dbg_reg_register_cb(const char *name, void (*cb)(void *), void *ptr);
-
-/**
- * dpu_dbg_reg_unregister_cb - register a hw unregister callback for later
- *	dumping.
- * @name:	name of base region
- * @cb:		callback of external region
- * @cb_ptr:	private pointer of external region
- * Returns:	None
- */
-void dpu_dbg_reg_unregister_cb(const char *name, void (*cb)(void *), void *ptr);
-
-/**
- * dpu_dbg_reg_register_dump_range - register a hw register sub-region for
- *	later register dumping associated with base specified by
- *	dpu_dbg_reg_register_base
- * @base_name:		name of base region
- * @range_name:		name of sub-range within base region
- * @offset_start:	sub-range's start offset from base's base pointer
- * @offset_end:		sub-range's end offset from base's base pointer
- * @xin_id:		xin id
- * Returns:		none
- */
-void dpu_dbg_reg_register_dump_range(const char *base_name,
-		const char *range_name, u32 offset_start, u32 offset_end,
-		uint32_t xin_id);
-
 /**
  * dpu_dbg_set_dpu_top_offset - set the target specific offset from mdss base
  *	address of the top registers. Used for accessing debug bus controls.
@@ -160,18 +113,6 @@ static inline void dpu_dbg_dump(bool queue_work, const char *name, ...)
 {
 }
 
-static inline int dpu_dbg_reg_register_base(const char *name,
-		void __iomem *base, size_t max_offset)
-{
-	return 0;
-}
-
-static inline void dpu_dbg_reg_register_dump_range(const char *base_name,
-		const char *range_name, u32 offset_start, u32 offset_end,
-		uint32_t xin_id)
-{
-}
-
 void dpu_dbg_set_dpu_top_offset(u32 blk_off)
 {
 }
-- 
Sean Paul, Software Engineer, Google / Chromium OS



More information about the Freedreno mailing list