diff --git a/drivers/video/rockchip/rve/include/rve_drv.h b/drivers/video/rockchip/rve/include/rve_drv.h index 592c1087ba67..cbdc66dc4a3f 100644 --- a/drivers/video/rockchip/rve/include/rve_drv.h +++ b/drivers/video/rockchip/rve/include/rve_drv.h @@ -159,6 +159,10 @@ struct rve_sche_pid_info_t { pid_t pid; /* hw total use time, per hrtimer */ u32 hw_time_total; + + uint32_t last_job_rd_bandwidth; + uint32_t last_job_wr_bandwidth; + uint32_t last_job_cycle_cnt; }; struct rve_sche_session_info_t { diff --git a/drivers/video/rockchip/rve/include/rve_reg.h b/drivers/video/rockchip/rve/include/rve_reg.h index 7a68e3b1097c..5969aa9d881e 100644 --- a/drivers/video/rockchip/rve/include/rve_reg.h +++ b/drivers/video/rockchip/rve/include/rve_reg.h @@ -82,7 +82,7 @@ int rve_init_reg(struct rve_job *job); int rve_get_version(struct rve_scheduler_t *scheduler); void rve_dump_read_back_reg(struct rve_scheduler_t *scheduler); -void rve_get_monitor_info(struct rve_scheduler_t *scheduler); +void rve_get_monitor_info(struct rve_job *job); #endif diff --git a/drivers/video/rockchip/rve/rve_debugger.c b/drivers/video/rockchip/rve/rve_debugger.c index 00476911bf0f..f156435405cf 100644 --- a/drivers/video/rockchip/rve/rve_debugger.c +++ b/drivers/video/rockchip/rve/rve_debugger.c @@ -171,11 +171,18 @@ static int rve_load_show(struct seq_file *m, void *data) load = (busy_time_total * 100000 / RVE_LOAD_INTERVAL); seq_printf(m, "\t load = %d\n", load); - seq_printf(m, "-----------------------------------\n"); + + seq_printf(m, "---------------- PID INFO ---------------\n"); for (i = 0; i < RVE_MAX_PID_INFO; i++) { seq_printf(m, "\t [pid: %d] hw_time_total = %llu us\n", pid_info[i].pid, ktime_to_us(pid_info[i].hw_time_total)); + seq_printf(m, "\t\t last_job_rd_bandwidth: %u bytes/s\n", + pid_info[i].last_job_rd_bandwidth); + seq_printf(m, "\t\t last_job_wr_bandwidth: %u bytes/s\n", + pid_info[i].last_job_wr_bandwidth); + seq_printf(m, "\t\t last_job_cycle_cnt/s: %u\n", + pid_info[i].last_job_cycle_cnt); } return 0; } diff --git a/drivers/video/rockchip/rve/rve_drv.c b/drivers/video/rockchip/rve/rve_drv.c index ef43adec1565..3022135c0c96 100644 --- a/drivers/video/rockchip/rve/rve_drv.c +++ b/drivers/video/rockchip/rve/rve_drv.c @@ -66,6 +66,11 @@ static enum hrtimer_restart hrtimer_handler(struct hrtimer *timer) scheduler->timer.busy_time_record = scheduler->timer.busy_time; scheduler->timer.busy_time = 0; + /* monitor */ + scheduler->session.rd_bandwidth = 0; + scheduler->session.wr_bandwidth = 0; + scheduler->session.cycle_cnt = 0; + for (i = 0; i < RVE_MAX_PID_INFO; i++) { if (scheduler->session.pid_info[i].pid > 0) scheduler->session.pid_info[i].hw_time_total = 0; @@ -80,9 +85,6 @@ static enum hrtimer_restart hrtimer_handler(struct hrtimer *timer) idr_for_each(&ctx_manager->ctx_id_idr, &rve_ctx_set_debuf_info_cb, ctx_manager); spin_unlock_irqrestore(&ctx_manager->lock, flags); - - /* monitor */ - rve_get_monitor_info(scheduler); } hrtimer_forward_now(timer, kt); diff --git a/drivers/video/rockchip/rve/rve_job.c b/drivers/video/rockchip/rve/rve_job.c index d66c6c975fd4..19b87936d5d2 100644 --- a/drivers/video/rockchip/rve/rve_job.c +++ b/drivers/video/rockchip/rve/rve_job.c @@ -398,8 +398,10 @@ void rve_job_done(struct rve_scheduler_t *scheduler, int ret) error_flag = rve_read(RVE_SWREG6_IVE_WORK_STA, scheduler); + rve_get_monitor_info(job); + if (DEBUGGER_EN(MSG)) - pr_err("irq thread work_status[%.8x]\n", error_flag); + pr_info("irq thread work_status[%.8x]\n", error_flag); /* disable llp enable, TODO: support pause mode */ rve_write(0, RVE_SWLTB3_ENABLE, scheduler); diff --git a/drivers/video/rockchip/rve/rve_reg.c b/drivers/video/rockchip/rve/rve_reg.c index adaadc9a880a..44b305cce0db 100644 --- a/drivers/video/rockchip/rve/rve_reg.c +++ b/drivers/video/rockchip/rve/rve_reg.c @@ -8,6 +8,7 @@ #define pr_fmt(fmt) "rve_reg: " fmt #include "rve_reg.h" +#include "rve_job.h" void rve_soft_reset(struct rve_scheduler_t *scheduler) { @@ -232,10 +233,16 @@ int rve_get_version(struct rve_scheduler_t *scheduler) return 0; } -void rve_get_monitor_info(struct rve_scheduler_t *scheduler) +void rve_get_monitor_info(struct rve_job *job) { + struct rve_sche_pid_info_t *pid_info = NULL; + struct rve_scheduler_t *scheduler = NULL; unsigned long flags; uint32_t rd_bandwidth, wr_bandwidth, cycle_cnt; + int i; + + scheduler = rve_job_get_scheduler(job); + pid_info = scheduler->session.pid_info; /* monitor */ if (DEBUGGER_EN(MONITOR)) { @@ -248,9 +255,22 @@ void rve_get_monitor_info(struct rve_scheduler_t *scheduler) spin_lock_irqsave(&scheduler->irq_lock, flags); - scheduler->session.rd_bandwidth = rd_bandwidth; - scheduler->session.wr_bandwidth = wr_bandwidth; - scheduler->session.cycle_cnt = cycle_cnt; + for (i = 0; i < RVE_MAX_PID_INFO; i++) { + if (pid_info[i].pid == job->pid) { + pid_info[i].last_job_rd_bandwidth = rd_bandwidth; + pid_info[i].last_job_wr_bandwidth = wr_bandwidth; + pid_info[i].last_job_cycle_cnt = cycle_cnt; + break; + } + } + + if (DEBUGGER_EN(MSG)) + pr_info("rd_bandwidth = %d, wd_bandwidth = %d, cycle_cnt = %d\n", + rd_bandwidth, wr_bandwidth, cycle_cnt); + + scheduler->session.rd_bandwidth += rd_bandwidth; + scheduler->session.wr_bandwidth += wr_bandwidth; + scheduler->session.cycle_cnt += cycle_cnt; spin_unlock_irqrestore(&scheduler->irq_lock, flags); }