Re: [DPU PATCH 13/19] drm/msm: dpu: Remove dpu evtlog

ryadav-sgV2jX0FEOL9JmXXK+q4OQ
2018-06-26T06:52:46Z

On 2018-06-21 02:18, Sean Paul wrote:
> Now that everything has been converted to tracepoints, remove the dpu
> evtlog.
>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Rajesh Yadav <ryadav@codeaurora.org>
> ---
> drivers/gpu/drm/msm/Makefile | 1 -
> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 5 -
> drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 33 ---
> drivers/gpu/drm/msm/dpu_dbg.c | 147 +----------
> drivers/gpu/drm/msm/dpu_dbg.h | 224 +---------------
> drivers/gpu/drm/msm/dpu_dbg_evtlog.c | 306 ----------------------
> 6 files changed, 11 insertions(+), 705 deletions(-)
> delete mode 100644 drivers/gpu/drm/msm/dpu_dbg_evtlog.c
>
> diff --git a/drivers/gpu/drm/msm/Makefile
> b/drivers/gpu/drm/msm/Makefile
> index dc56904367d8..9c182a9dab2b 100644
> --- a/drivers/gpu/drm/msm/Makefile
> +++ b/drivers/gpu/drm/msm/Makefile
> @@ -75,7 +75,6 @@ msm-y := \
> disp/dpu1/dpu_mdss.o \
> disp/dpu1/dpu_power_handle.o \
> dpu_dbg.o \
> - dpu_dbg_evtlog.o \
> msm_prop.o \
> msm_atomic.o \
> msm_debugfs.o \
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 6ae5bba21074..4fd5e1d7261e 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -43,11 +43,6 @@ static const char * const iommu_ports[] = {
> "mdp_0",
> };
>
> -/**
> - * Controls size of event log buffer. Specified as a power of 2.
> - */
> -#define DPU_EVTLOG_SIZE 1024
> -
> /*
> * To enable overall DRM driver logging
> * # echo 0x2 > /sys/module/drm/parameters/debug
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
> index d6f117bdad24..41fd6a227d8b 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h
> @@ -165,39 +165,6 @@ TRACE_EVENT(dpu_trace_counter,
> __get_str(counter_name), __entry->value)
> )
>
> -#define DPU_TRACE_EVTLOG_SIZE 15
> -TRACE_EVENT(dpu_evtlog,
> - TP_PROTO(const char *tag, u32 tag_id, u32 cnt, u32 data[]),
> - TP_ARGS(tag, tag_id, cnt, data),
> - TP_STRUCT__entry(
> - __field(int, pid)
> - __string(evtlog_tag, tag)
> - __field(u32, tag_id)
> - __array(u32, data, DPU_TRACE_EVTLOG_SIZE)
> - ),
> - TP_fast_assign(
> - __entry->pid = current->tgid;
> - __assign_str(evtlog_tag, tag);
> - __entry->tag_id = tag_id;
> - if (cnt > DPU_TRACE_EVTLOG_SIZE)
> - cnt = DPU_TRACE_EVTLOG_SIZE;
> - memcpy(__entry->data, data, cnt * sizeof(u32));
> - memset(&__entry->data[cnt], 0,
> - (DPU_TRACE_EVTLOG_SIZE - cnt) * sizeof(u32));
> - ),
> - TP_printk("%d|%s:%d|%x|%x|%x|%x|%x|%x|%x|%x|%x|%x|%x|%x|%x|%x|%x",
> - __entry->pid, __get_str(evtlog_tag),
> - __entry->tag_id,
> - __entry->data[0], __entry->data[1],
> - __entry->data[2], __entry->data[3],
> - __entry->data[4], __entry->data[5],
> - __entry->data[6], __entry->data[7],
> - __entry->data[8], __entry->data[9],
> - __entry->data[10], __entry->data[11],
> - __entry->data[12], __entry->data[13],
> - __entry->data[14])
> -)
> -
> TRACE_EVENT(dpu_perf_crtc_update,
> TP_PROTO(u32 crtc, u64 bw_ctl_mnoc, u64 bw_ctl_llcc,
> u64 bw_ctl_ebi, u32 core_clk_rate,
> diff --git a/drivers/gpu/drm/msm/dpu_dbg.c
> b/drivers/gpu/drm/msm/dpu_dbg.c
> index 27538bc6c290..9495a0f17f1b 100644
> --- a/drivers/gpu/drm/msm/dpu_dbg.c
> +++ b/drivers/gpu/drm/msm/dpu_dbg.c
> @@ -165,7 +165,6 @@ struct dpu_dbg_vbif_debug_bus {
>
> /**
> * struct dpu_dbg_base - global dpu debug base structure
> - * @evtlog: event log instance
> * @reg_base_list: list of register dumping regions
> * @dev: device pointer
> * @req_dump_blks: list of blocks requested for dumping
> @@ -179,7 +178,6 @@ struct dpu_dbg_vbif_debug_bus {
> * @dsi_dbg_bus: dump dsi debug bus register
> */
> static struct dpu_dbg_base {
> - struct dpu_dbg_evtlog *evtlog;
> struct list_head reg_base_list;
> struct device *dev;
>
> @@ -196,9 +194,6 @@ static struct dpu_dbg_base {
> bool dsi_dbg_bus;
> } dpu_dbg_base;
>
> -/* dpu_dbg_base_evtlog - global pointer to main dpu event log for
> macro use */
> -struct dpu_dbg_evtlog *dpu_dbg_base_evtlog;
> -
> static void _dpu_debug_bus_xbar_dump(void __iomem *mem_base,
> struct dpu_debug_bus_entry *entry, u32 val)
> {
> @@ -2526,8 +2521,6 @@ static void _dpu_dump_array(struct
> dpu_dbg_reg_base *blk_arr[],
> {
> int i;
>
> - dpu_evtlog_dump_all(dpu_dbg_base.evtlog);
> -
> if (dump_all || !blk_arr || !len) {
> _dpu_dump_reg_all();
> } else {
> @@ -2556,7 +2549,7 @@ 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, "evtlog_workitem",
> + 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,
> dpu_dbg_base.dump_all);
> @@ -2564,7 +2557,7 @@ static void _dpu_dump_work(struct work_struct
> *work)
>
> void dpu_dbg_dump(bool queue_work, const char *name, ...)
> {
> - int i, index = 0;
> + int index = 0;
> bool do_panic = false;
> bool dump_dbgbus_dpu = false;
> bool dump_dbgbus_vbif_rt = false;
> @@ -2575,9 +2568,6 @@ void dpu_dbg_dump(bool queue_work, const char
> *name, ...)
> struct dpu_dbg_reg_base **blk_arr;
> u32 blk_len;
>
> - if (!dpu_evtlog_is_enabled(dpu_dbg_base.evtlog, DPU_EVTLOG_ALWAYS))
> - return;
> -
> if (queue_work && work_pending(&dpu_dbg_base.dump_work))
> return;
>
> @@ -2589,12 +2579,7 @@ void dpu_dbg_dump(bool queue_work, const char
> *name, ...)
> dpu_dbg_base.dump_all = false;
>
> va_start(args, name);
> - i = 0;
> while ((blk_name = va_arg(args, char*))) {
> - if (i++ >= DPU_EVTLOG_MAX_DATA) {
> - pr_err("could not parse all dump arguments\n");
> - break;
> - }
> if (IS_ERR_OR_NULL(blk_name))
> break;
>
> @@ -2641,7 +2626,7 @@ void dpu_dbg_dump(bool queue_work, const char
> *name, ...)
> }
>
> /*
> - * dpu_dbg_debugfs_open - debugfs open handler for evtlog dump
> + * dpu_dbg_debugfs_open - debugfs open handler for debug dump
> * @inode: debugfs inode
> * @file: file handle
> */
> @@ -2654,35 +2639,13 @@ static int dpu_dbg_debugfs_open(struct inode
> *inode, struct file *file)
> }
>
> /**
> - * dpu_evtlog_dump_read - debugfs read handler for evtlog dump
> - * @file: file handler
> - * @buff: user buffer content for debugfs
> - * @count: size of user buffer
> - * @ppos: position offset of user buffer
> - */
> -static ssize_t dpu_evtlog_dump_read(struct file *file, char __user
> *buff,
> - size_t count, loff_t *ppos)
> -{
> - ssize_t len = 0;
> - char evtlog_buf[DPU_EVTLOG_BUF_MAX];
> -
> - len = dpu_evtlog_dump_to_buffer(dpu_dbg_base.evtlog, evtlog_buf,
> - DPU_EVTLOG_BUF_MAX);
> - if (copy_to_user(buff, evtlog_buf, len))
> - return -EFAULT;
> - *ppos += len;
> -
> - return len;
> -}
> -
> -/**
> - * dpu_evtlog_dump_write - debugfs write handler for evtlog dump
> + * dpu_dbg_dump_write - debugfs write handler for debug dump
> * @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_evtlog_dump_write(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",
> @@ -2691,86 +2654,9 @@ static ssize_t dpu_evtlog_dump_write(struct file
> *file,
> return count;
> }
>
> -static const struct file_operations dpu_evtlog_fops = {
> +static const struct file_operations dpu_dbg_dump_fops = {
> .open = dpu_dbg_debugfs_open,
> - .read = dpu_evtlog_dump_read,
> - .write = dpu_evtlog_dump_write,
> -};
> -
> -/*
> - * dpu_evtlog_filter_show - read callback for evtlog filter
> - * @s: pointer to seq_file object
> - * @data: pointer to private data
> - */
> -static int dpu_evtlog_filter_show(struct seq_file *s, void *data)
> -{
> - struct dpu_dbg_evtlog *evtlog;
> - char buffer[64];
> - int i;
> -
> - if (!s || !s->private)
> - return -EINVAL;
> -
> - evtlog = s->private;
> -
> - for (i = 0; !dpu_evtlog_get_filter(
> - evtlog, i, buffer, ARRAY_SIZE(buffer)); ++i)
> - seq_printf(s, "*%s*\n", buffer);
> - return 0;
> -}
> -
> -/*
> - * dpu_evtlog_filter_open - debugfs open handler for evtlog filter
> - * @inode: debugfs inode
> - * @file: file handle
> - * Returns: zero on success
> - */
> -static int dpu_evtlog_filter_open(struct inode *inode, struct file
> *file)
> -{
> - if (!file)
> - return -EINVAL;
> -
> - return single_open(file, dpu_evtlog_filter_show, inode->i_private);
> -}
> -
> -/*
> - * dpu_evtlog_filter_write - write callback for evtlog filter
> - * @file: pointer to file structure
> - * @user_buf: pointer to incoming user data
> - * @count: size of incoming user buffer
> - * @ppos: pointer to file offset
> - */
> -static ssize_t dpu_evtlog_filter_write(struct file *file,
> - const char __user *user_buf, size_t count, loff_t *ppos)
> -{
> - char *tmp_filter = NULL;
> - ssize_t rc = 0;
> -
> - if (count > 0) {
> - /* copy user provided string and null terminate it */
> - tmp_filter = kzalloc(count + 1, GFP_KERNEL);
> - if (!tmp_filter)
> - rc = -ENOMEM;
> - else if (copy_from_user(tmp_filter, user_buf, count))
> - rc = -EFAULT;
> - }
> -
> - /* update actual filter configuration on success */
> - if (!rc) {
> - dpu_evtlog_set_filter(dpu_dbg_base.evtlog, tmp_filter);
> - rc = count;
> - }
> - kfree(tmp_filter);
> -
> - return rc;
> -}
> -
> -static const struct file_operations dpu_evtlog_filter_fops = {
> - .open = dpu_evtlog_filter_open,
> - .write = dpu_evtlog_filter_write,
> - .read = seq_read,
> - .llseek = seq_lseek,
> - .release = seq_release
> + .write = dpu_dbg_dump_write,
> };
>
> /**
> @@ -3018,12 +2904,7 @@ int dpu_dbg_debugfs_register(struct dentry
> *debugfs_root)
> return -EINVAL;
>
> debugfs_create_file("dump", 0600, debugfs_root, NULL,
> - &dpu_evtlog_fops);
> - debugfs_create_u32("enable", 0600, debugfs_root,
> - &(dpu_dbg_base.evtlog->enable));
> - debugfs_create_file("filter", 0600, debugfs_root,
> - dpu_dbg_base.evtlog,
> - &dpu_evtlog_filter_fops);
> + &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,
> @@ -3106,19 +2987,12 @@ int dpu_dbg_init(struct device *dev)
> INIT_LIST_HEAD(&dpu_dbg_base.reg_base_list);
> dpu_dbg_base.dev = dev;
>
> - dpu_dbg_base.evtlog = dpu_evtlog_init();
> - if (IS_ERR_OR_NULL(dpu_dbg_base.evtlog))
> - return PTR_ERR(dpu_dbg_base.evtlog);
> -
> - dpu_dbg_base_evtlog = dpu_dbg_base.evtlog;
> -
> 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("evtlog_status: enable:%d, panic:%d, dump:%d\n",
> - dpu_dbg_base.evtlog->enable, dpu_dbg_base.panic_on_err,
> + pr_info("debug_status: panic:%d, dump:%d\n",
> dpu_dbg_base.panic_on_err,
> dpu_dbg_base.enable_reg_dump);
>
> return 0;
> @@ -3150,9 +3024,6 @@ static void dpu_dbg_reg_base_destroy(void)
> void dpu_dbg_destroy(void)
> {
> _dpu_dbg_debugfs_destroy();
> - dpu_dbg_base_evtlog = NULL;
> - dpu_evtlog_destroy(dpu_dbg_base.evtlog);
> - dpu_dbg_base.evtlog = NULL;
> dpu_dbg_reg_base_destroy();
> }
>
> diff --git a/drivers/gpu/drm/msm/dpu_dbg.h
> b/drivers/gpu/drm/msm/dpu_dbg.h
> index 283dbbc00690..052c78d5b4f5 100644
> --- a/drivers/gpu/drm/msm/dpu_dbg.h
> +++ b/drivers/gpu/drm/msm/dpu_dbg.h
> @@ -17,109 +17,11 @@
> #include <linux/debugfs.h>
> #include <linux/list.h>
>
> -#define DPU_EVTLOG_DATA_LIMITER (-1)
> -#define DPU_EVTLOG_FUNC_ENTRY 0x1111
> -#define DPU_EVTLOG_FUNC_EXIT 0x2222
> -#define DPU_EVTLOG_FUNC_CASE1 0x3333
> -#define DPU_EVTLOG_FUNC_CASE2 0x4444
> -#define DPU_EVTLOG_FUNC_CASE3 0x5555
> -#define DPU_EVTLOG_FUNC_CASE4 0x6666
> -#define DPU_EVTLOG_FUNC_CASE5 0x7777
> -#define DPU_EVTLOG_FUNC_CASE6 0x8888
> -#define DPU_EVTLOG_FUNC_CASE7 0x9999
> -#define DPU_EVTLOG_FUNC_CASE8 0xaaaa
> -#define DPU_EVTLOG_FUNC_CASE9 0xbbbb
> -#define DPU_EVTLOG_FUNC_CASE10 0xcccc
> -#define DPU_EVTLOG_PANIC 0xdead
> -#define DPU_EVTLOG_FATAL 0xbad
> -#define DPU_EVTLOG_ERROR 0xebad
> -
> -#define DPU_DBG_DUMP_DATA_LIMITER (NULL)
> -
> -enum dpu_dbg_evtlog_flag {
> - DPU_EVTLOG_CRITICAL = BIT(0),
> - DPU_EVTLOG_IRQ = BIT(1),
> - DPU_EVTLOG_VERBOSE = BIT(2),
> - DPU_EVTLOG_ALWAYS = -1
> -};
> -
> enum dpu_dbg_dump_flag {
> DPU_DBG_DUMP_IN_LOG = BIT(0),
> DPU_DBG_DUMP_IN_MEM = BIT(1),
> };
>
> -#ifdef CONFIG_DRM_DPU_EVTLOG_DEBUG
> -#define DPU_EVTLOG_DEFAULT_ENABLE (DPU_EVTLOG_CRITICAL |
> DPU_EVTLOG_IRQ)
> -#else
> -#define DPU_EVTLOG_DEFAULT_ENABLE 0
> -#endif
> -
> -/*
> - * evtlog will print this number of entries when it is called through
> - * sysfs node or panic. This prevents kernel log from evtlog message
> - * flood.
> - */
> -#define DPU_EVTLOG_PRINT_ENTRY 256
> -
> -/*
> - * evtlog keeps this number of entries in memory for debug purpose.
> This
> - * number must be greater than print entry to prevent out of bound
> evtlog
> - * entry array access.
> - */
> -#define DPU_EVTLOG_ENTRY (DPU_EVTLOG_PRINT_ENTRY * 4)
> -#define DPU_EVTLOG_MAX_DATA 15
> -#define DPU_EVTLOG_BUF_MAX 512
> -#define DPU_EVTLOG_BUF_ALIGN 32
> -
> -struct dpu_dbg_evtlog_log {
> - s64 time;
> - const char *name;
> - int line;
> - u32 data[DPU_EVTLOG_MAX_DATA];
> - u32 data_cnt;
> - int pid;
> -};
> -
> -/**
> - * @filter_list: Linked list of currently active filter strings
> - */
> -struct dpu_dbg_evtlog {
> - struct dpu_dbg_evtlog_log logs[DPU_EVTLOG_ENTRY];
> - u32 first;
> - u32 last;
> - u32 curr;
> - u32 next;
> - u32 enable;
> - spinlock_t spin_lock;
> - struct list_head filter_list;
> -};
> -
> -extern struct dpu_dbg_evtlog *dpu_dbg_base_evtlog;
> -
> -/**
> - * DPU_EVT32 - Write a list of 32bit values to the event log, default
> area
> - * ... - variable arguments
> - */
> -#define DPU_EVT32(...) dpu_evtlog_log(dpu_dbg_base_evtlog, __func__, \
> - __LINE__, DPU_EVTLOG_ALWAYS, ##__VA_ARGS__, \
> - DPU_EVTLOG_DATA_LIMITER)
> -
> -/**
> - * DPU_EVT32_VERBOSE - Write a list of 32bit values for verbose event
> logging
> - * ... - variable arguments
> - */
> -#define DPU_EVT32_VERBOSE(...) dpu_evtlog_log(dpu_dbg_base_evtlog,
> __func__, \
> - __LINE__, DPU_EVTLOG_VERBOSE, ##__VA_ARGS__, \
> - DPU_EVTLOG_DATA_LIMITER)
> -
> -/**
> - * DPU_EVT32_IRQ - Write a list of 32bit values to the event log, IRQ
> area
> - * ... - variable arguments
> - */
> -#define DPU_EVT32_IRQ(...) dpu_evtlog_log(dpu_dbg_base_evtlog,
> __func__, \
> - __LINE__, DPU_EVTLOG_IRQ, ##__VA_ARGS__, \
> - DPU_EVTLOG_DATA_LIMITER)
> -
> /**
> * DPU_DBG_DUMP - trigger dumping of all dpu_dbg facilities
> * @va_args: list of named register dump ranges and regions to dump,
> as
> @@ -128,74 +30,10 @@ extern struct dpu_dbg_evtlog *dpu_dbg_base_evtlog;
> * Including the special name "panic" will trigger a panic after
> * the dumping work has completed.
> */
> -#define DPU_DBG_DUMP(...) dpu_dbg_dump(false, __func__, ##__VA_ARGS__,
> \
> - DPU_DBG_DUMP_DATA_LIMITER)
> -
> -/**
> - * DPU_DBG_DUMP_WQ - trigger dumping of all dpu_dbg facilities,
> queuing the work
> - * @va_args: list of named register dump ranges and regions to dump,
> as
> - * registered previously through dpu_dbg_reg_register_base and
> - * dpu_dbg_reg_register_dump_range.
> - * Including the special name "panic" will trigger a panic after
> - * the dumping work has completed.
> - */
> -#define DPU_DBG_DUMP_WQ(...) dpu_dbg_dump(true, __func__,
> ##__VA_ARGS__, \
> - DPU_DBG_DUMP_DATA_LIMITER)
> +#define DPU_DBG_DUMP(...) dpu_dbg_dump(false, __func__, ##__VA_ARGS__,
> NULL)
>
> #if defined(CONFIG_DEBUG_FS)
>
> -/**
> - * dpu_evtlog_init - allocate a new event log object
> - * Returns: evtlog or -ERROR
> - */
> -struct dpu_dbg_evtlog *dpu_evtlog_init(void);
> -
> -/**
> - * dpu_evtlog_destroy - destroy previously allocated event log
> - * @evtlog: pointer to evtlog
> - * Returns: none
> - */
> -void dpu_evtlog_destroy(struct dpu_dbg_evtlog *evtlog);
> -
> -/**
> - * dpu_evtlog_log - log an entry into the event log.
> - * log collection may be enabled/disabled entirely via debugfs
> - * log area collection may be filtered by user provided flags via
> debugfs.
> - * @evtlog: pointer to evtlog
> - * @name: function name of call site
> - * @line: line number of call site
> - * @flag: log area filter flag checked against user's debugfs request
> - * Returns: none
> - */
> -void dpu_evtlog_log(struct dpu_dbg_evtlog *evtlog, const char *name,
> int line,
> - int flag, ...);
> -
> -/**
> - * dpu_evtlog_dump_all - print all entries in event log to kernel log
> - * @evtlog: pointer to evtlog
> - * Returns: none
> - */
> -void dpu_evtlog_dump_all(struct dpu_dbg_evtlog *evtlog);
> -
> -/**
> - * dpu_evtlog_is_enabled - check whether log collection is enabled for
> given
> - * event log and log area flag
> - * @evtlog: pointer to evtlog
> - * @flag: log area filter flag
> - * Returns: none
> - */
> -bool dpu_evtlog_is_enabled(struct dpu_dbg_evtlog *evtlog, u32 flag);
> -
> -/**
> - * dpu_evtlog_dump_to_buffer - print content of event log to the given
> buffer
> - * @evtlog: pointer to evtlog
> - * @evtlog_buf: target buffer to print into
> - * @evtlog_buf_size: size of target buffer
> - * Returns: number of bytes written to buffer
> - */
> -ssize_t dpu_evtlog_dump_to_buffer(struct dpu_dbg_evtlog *evtlog,
> - char *evtlog_buf, ssize_t evtlog_buf_size);
> -
> /**
> * dpu_dbg_init_dbg_buses - initialize debug bus dumping support for
> the chipset
> * @hwversion: Chipset revision
> @@ -203,7 +41,7 @@ ssize_t dpu_evtlog_dump_to_buffer(struct
> dpu_dbg_evtlog *evtlog,
> void dpu_dbg_init_dbg_buses(u32 hwversion);
>
> /**
> - * dpu_dbg_init - initialize global dpu debug facilities: evtlog,
> regdump
> + * dpu_dbg_init - initialize global dpu debug facilities: regdump
> * @dev: device handle
> * Returns: 0 or -ERROR
> */
> @@ -289,24 +127,6 @@ void dpu_dbg_reg_register_dump_range(const char
> *base_name,
> */
> void dpu_dbg_set_dpu_top_offset(u32 blk_off);
>
> -/**
> - * dpu_evtlog_set_filter - update evtlog filtering
> - * @evtlog: pointer to evtlog
> - * @filter: pointer to optional function name filter, set to NULL
> to disable
> - */
> -void dpu_evtlog_set_filter(struct dpu_dbg_evtlog *evtlog, char
> *filter);
> -
> -/**
> - * dpu_evtlog_get_filter - query configured evtlog filters
> - * @evtlog: pointer to evtlog
> - * @index: filter index to retrieve
> - * @buf: pointer to output filter buffer
> - * @bufsz: size of output filter buffer
> - * Returns: zero if a filter string was returned
> - */
> -int dpu_evtlog_get_filter(struct dpu_dbg_evtlog *evtlog, int index,
> - char *buf, size_t bufsz);
> -
> /**
> * dsi_ctrl_debug_dump - dump dsi debug dump status
> */
> @@ -317,35 +137,6 @@ static inline void dsi_ctrl_debug_dump(void) {}
> #endif
>
> #else
> -static inline struct dpu_dbg_evtlog *dpu_evtlog_init(void)
> -{
> - return NULL;
> -}
> -
> -static inline void dpu_evtlog_destroy(struct dpu_dbg_evtlog *evtlog)
> -{
> -}
> -
> -static inline void dpu_evtlog_log(struct dpu_dbg_evtlog *evtlog,
> - const char *name, int line, int flag, ...)
> -{
> -}
> -
> -static inline void dpu_evtlog_dump_all(struct dpu_dbg_evtlog *evtlog)
> -{
> -}
> -
> -static inline bool dpu_evtlog_is_enabled(struct dpu_dbg_evtlog
> *evtlog,
> - u32 flag)
> -{
> - return false;
> -}
> -
> -static inline ssize_t dpu_evtlog_dump_to_buffer(struct dpu_dbg_evtlog
> *evtlog,
> - char *evtlog_buf, ssize_t evtlog_buf_size)
> -{
> - return 0;
> -}
>
> static inline void dpu_dbg_init_dbg_buses(u32 hwversion)
> {
> @@ -385,17 +176,6 @@ void dpu_dbg_set_dpu_top_offset(u32 blk_off)
> {
> }
>
> -static inline void dpu_evtlog_set_filter(
> - struct dpu_dbg_evtlog *evtlog, char *filter)
> -{
> -}
> -
> -static inline int dpu_evtlog_get_filter(struct dpu_dbg_evtlog *evtlog,
> - int index, char *buf, size_t bufsz)
> -{
> - return -EINVAL;
> -}
> -
> static inline void dsi_ctrl_debug_dump(void)
> {
> }
> diff --git a/drivers/gpu/drm/msm/dpu_dbg_evtlog.c
> b/drivers/gpu/drm/msm/dpu_dbg_evtlog.c
> deleted file mode 100644
> index ef132c015a7e..000000000000
> --- a/drivers/gpu/drm/msm/dpu_dbg_evtlog.c
> +++ /dev/null
> @@ -1,306 +0,0 @@
> -/* Copyright (c) 2016-2018, 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
> - * only version 2 as published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - */
> -
> -#define pr_fmt(fmt) "dpu_dbg:[%s] " fmt, __func__
> -
> -#include <linux/delay.h>
> -#include <linux/spinlock.h>
> -#include <linux/ktime.h>
> -#include <linux/debugfs.h>
> -#include <linux/uaccess.h>
> -#include <linux/dma-buf.h>
> -#include <linux/slab.h>
> -
> -#include "dpu_dbg.h"
> -#include "dpu_trace.h"
> -
> -#define DPU_EVTLOG_FILTER_STRSIZE 64
> -
> -struct dpu_evtlog_filter {
> - struct list_head list;
> - char filter[DPU_EVTLOG_FILTER_STRSIZE];
> -};
> -
> -static bool _dpu_evtlog_is_filtered_no_lock(
> - struct dpu_dbg_evtlog *evtlog, const char *str)
> -{
> - struct dpu_evtlog_filter *filter_node;
> - bool rc;
> -
> - if (!str)
> - return true;
> -
> - /*
> - * Filter the incoming string IFF the list is not empty AND
> - * a matching entry is not in the list.
> - */
> - rc = !list_empty(&evtlog->filter_list);
> - list_for_each_entry(filter_node, &evtlog->filter_list, list)
> - if (strnstr(str, filter_node->filter,
> - DPU_EVTLOG_FILTER_STRSIZE - 1)) {
> - rc = false;
> - break;
> - }
> -
> - return rc;
> -}
> -
> -bool dpu_evtlog_is_enabled(struct dpu_dbg_evtlog *evtlog, u32 flag)
> -{
> - return evtlog && (evtlog->enable & flag);
> -}
> -
> -void dpu_evtlog_log(struct dpu_dbg_evtlog *evtlog, const char *name,
> int line,
> - int flag, ...)
> -{
> - unsigned long flags;
> - int i, val = 0;
> - va_list args;
> - struct dpu_dbg_evtlog_log *log;
> -
> - if (!evtlog)
> - return;
> -
> - if (!dpu_evtlog_is_enabled(evtlog, flag))
> - return;
> -
> - spin_lock_irqsave(&evtlog->spin_lock, flags);
> -
> - if (_dpu_evtlog_is_filtered_no_lock(evtlog, name))
> - goto exit;
> -
> - log = &evtlog->logs[evtlog->curr];
> - log->time = ktime_to_us(ktime_get());
> - log->name = name;
> - log->line = line;
> - log->data_cnt = 0;
> - log->pid = current->pid;
> -
> - va_start(args, flag);
> - for (i = 0; i < DPU_EVTLOG_MAX_DATA; i++) {
> -
> - val = va_arg(args, int);
> - if (val == DPU_EVTLOG_DATA_LIMITER)
> - break;
> -
> - log->data[i] = val;
> - }
> - va_end(args);
> - log->data_cnt = i;
> - evtlog->curr = (evtlog->curr + 1) % DPU_EVTLOG_ENTRY;
> - evtlog->last++;
> -
> - trace_dpu_evtlog(name, line, log->data_cnt, log->data);
> -exit:
> - spin_unlock_irqrestore(&evtlog->spin_lock, flags);
> -}
> -
> -/* always dump the last entries which are not dumped yet */
> -static bool _dpu_evtlog_dump_calc_range(struct dpu_dbg_evtlog *evtlog)
> -{
> - if (!evtlog)
> - return false;
> -
> - evtlog->first = evtlog->next;
> -
> - if (evtlog->last == evtlog->first)
> - return false;
> -
> - if (evtlog->last < evtlog->first) {
> - evtlog->first %= DPU_EVTLOG_ENTRY;
> - if (evtlog->last < evtlog->first)
> - evtlog->last += DPU_EVTLOG_ENTRY;
> - }
> -
> - if ((evtlog->last - evtlog->first) > DPU_EVTLOG_PRINT_ENTRY) {
> - pr_info("evtlog skipping %d entries, last=%d\n",
> - evtlog->last - evtlog->first - DPU_EVTLOG_PRINT_ENTRY,
> - evtlog->last - 1);
> - evtlog->first = evtlog->last - DPU_EVTLOG_PRINT_ENTRY;
> - }
> - evtlog->next = evtlog->first + 1;
> -
> - return true;
> -}
> -
> -ssize_t dpu_evtlog_dump_to_buffer(struct dpu_dbg_evtlog *evtlog,
> - char *evtlog_buf, ssize_t evtlog_buf_size)
> -{
> - int i;
> - ssize_t off = 0;
> - struct dpu_dbg_evtlog_log *log, *prev_log;
> - unsigned long flags;
> -
> - if (!evtlog || !evtlog_buf)
> - return 0;
> -
> - spin_lock_irqsave(&evtlog->spin_lock, flags);
> -
> - /* update markers, exit if nothing to print */
> - if (!_dpu_evtlog_dump_calc_range(evtlog))
> - goto exit;
> -
> - log = &evtlog->logs[evtlog->first % DPU_EVTLOG_ENTRY];
> -
> - prev_log = &evtlog->logs[(evtlog->first - 1) % DPU_EVTLOG_ENTRY];
> -
> - off = snprintf((evtlog_buf + off), (evtlog_buf_size - off),
> "%s:%-4d",
> - log->name, log->line);
> -
> - if (off < DPU_EVTLOG_BUF_ALIGN) {
> - memset((evtlog_buf + off), 0x20, (DPU_EVTLOG_BUF_ALIGN - off));
> - off = DPU_EVTLOG_BUF_ALIGN;
> - }
> -
> - off += snprintf((evtlog_buf + off), (evtlog_buf_size - off),
> - "=>[%-8d:%-11llu:%9llu][%-4d]:", evtlog->first,
> - log->time, (log->time - prev_log->time), log->pid);
> -
> - for (i = 0; i < log->data_cnt; i++)
> - off += snprintf((evtlog_buf + off), (evtlog_buf_size - off),
> - "%x ", log->data[i]);
> -
> - off += snprintf((evtlog_buf + off), (evtlog_buf_size - off), "\n");
> -exit:
> - spin_unlock_irqrestore(&evtlog->spin_lock, flags);
> -
> - return off;
> -}
> -
> -void dpu_evtlog_dump_all(struct dpu_dbg_evtlog *evtlog)
> -{
> - char buf[DPU_EVTLOG_BUF_MAX];
> -
> - if (!evtlog)
> - return;
> -
> - while (dpu_evtlog_dump_to_buffer(evtlog, buf, sizeof(buf)))
> - pr_info("%s", buf);
> -}
> -
> -struct dpu_dbg_evtlog *dpu_evtlog_init(void)
> -{
> - struct dpu_dbg_evtlog *evtlog;
> -
> - evtlog = kzalloc(sizeof(*evtlog), GFP_KERNEL);
> - if (!evtlog)
> - return ERR_PTR(-ENOMEM);
> -
> - spin_lock_init(&evtlog->spin_lock);
> - evtlog->enable = DPU_EVTLOG_DEFAULT_ENABLE;
> -
> - INIT_LIST_HEAD(&evtlog->filter_list);
> -
> - return evtlog;
> -}
> -
> -int dpu_evtlog_get_filter(struct dpu_dbg_evtlog *evtlog, int index,
> - char *buf, size_t bufsz)
> -{
> - struct dpu_evtlog_filter *filter_node;
> - unsigned long flags;
> - int rc = -EFAULT;
> -
> - if (!evtlog || !buf || !bufsz || index < 0)
> - return -EINVAL;
> -
> - spin_lock_irqsave(&evtlog->spin_lock, flags);
> - list_for_each_entry(filter_node, &evtlog->filter_list, list) {
> - if (index--)
> - continue;
> -
> - /* don't care about return value */
> - (void)strlcpy(buf, filter_node->filter, bufsz);
> - rc = 0;
> - break;
> - }
> - spin_unlock_irqrestore(&evtlog->spin_lock, flags);
> -
> - return rc;
> -}
> -
> -void dpu_evtlog_set_filter(struct dpu_dbg_evtlog *evtlog, char
> *filter)
> -{
> - struct dpu_evtlog_filter *filter_node, *tmp;
> - struct list_head free_list;
> - unsigned long flags;
> - char *flt;
> -
> - if (!evtlog)
> - return;
> -
> - INIT_LIST_HEAD(&free_list);
> -
> - /*
> - * Clear active filter list and cache filter_nodes locally
> - * to reduce memory fragmentation.
> - */
> - spin_lock_irqsave(&evtlog->spin_lock, flags);
> - list_for_each_entry_safe(filter_node, tmp, &evtlog->filter_list,
> list) {
> - list_del_init(&filter_node->list);
> - list_add_tail(&filter_node->list, &free_list);
> - }
> - spin_unlock_irqrestore(&evtlog->spin_lock, flags);
> -
> - /*
> - * Parse incoming filter request string and build up a new
> - * filter list. New filter nodes are taken from the local
> - * free list, if available, and allocated from the system
> - * heap once the free list is empty.
> - */
> - while (filter && (flt = strsep(&filter, "|\r\n\t ")) != NULL) {
> - if (!*flt)
> - continue;
> -
> - if (list_empty(&free_list)) {
> - filter_node = kzalloc(sizeof(*filter_node), GFP_KERNEL);
> - if (!filter_node)
> - break;
> -
> - INIT_LIST_HEAD(&filter_node->list);
> - } else {
> - filter_node = list_first_entry(&free_list,
> - struct dpu_evtlog_filter, list);
> - list_del_init(&filter_node->list);
> - }
> -
> - /* don't care if copy truncated */
> - (void)strlcpy(filter_node->filter, flt,
> - DPU_EVTLOG_FILTER_STRSIZE);
> -
> - spin_lock_irqsave(&evtlog->spin_lock, flags);
> - list_add_tail(&filter_node->list, &evtlog->filter_list);
> - spin_unlock_irqrestore(&evtlog->spin_lock, flags);
> - }
> -
> - /*
> - * Free any unused filter_nodes back to the system.
> - */
> - list_for_each_entry_safe(filter_node, tmp, &free_list, list) {
> - list_del(&filter_node->list);
> - kfree(filter_node);
> - }
> -}
> -
> -void dpu_evtlog_destroy(struct dpu_dbg_evtlog *evtlog)
> -{
> - struct dpu_evtlog_filter *filter_node, *tmp;
> -
> - if (!evtlog)
> - return;
> -
> - list_for_each_entry_safe(filter_node, tmp, &evtlog->filter_list,
> list) {
> - list_del(&filter_node->list);
> - kfree(filter_node);
> - }
> - kfree(evtlog);
> -}