diff --git a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c index 0fc39bf40..764ffe1a5 100644 --- a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.c @@ -22,9 +22,6 @@ * DEALINGS IN THE SOFTWARE. */ -#include -#include - #include #include #include @@ -61,14 +58,14 @@ #define CSS_MAX_PERFMON_IDS 256 /* reports whether the hw queue overflowed */ -static inline bool css_hw_get_overflow_status(struct gk20a *g) +bool css_hw_get_overflow_status(struct gk20a *g) { const u32 st = perf_pmasys_control_membuf_status_overflowed_f(); return st == (gk20a_readl(g, perf_pmasys_control_r()) & st); } /* returns how many pending snapshot entries are pending */ -static inline u32 css_hw_get_pending_snapshots(struct gk20a *g) +u32 css_hw_get_pending_snapshots(struct gk20a *g) { return gk20a_readl(g, perf_pmasys_mem_bytes_r()) / sizeof(struct gk20a_cs_snapshot_fifo_entry); @@ -245,7 +242,7 @@ static void css_gr_free_shared_data(struct gr_gk20a *gr) } -static struct gk20a_cs_snapshot_client* +struct gk20a_cs_snapshot_client* css_gr_search_client(struct nvgpu_list_node *clients, u32 perfmon) { struct gk20a_cs_snapshot_client *client; diff --git a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.h b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.h index bee8f4fbd..8aefe8487 100644 --- a/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/css_gr_gk20a.h @@ -129,6 +129,8 @@ struct gk20a_cs_snapshot { struct gk20a_cs_snapshot_fifo_entry *hw_get; }; +bool css_hw_get_overflow_status(struct gk20a *g); +u32 css_hw_get_pending_snapshots(struct gk20a *g); void css_hw_set_handled_snapshots(struct gk20a *g, u32 done); int css_hw_enable_snapshot(struct channel_gk20a *ch, struct gk20a_cs_snapshot_client *cs_client); @@ -140,5 +142,7 @@ u32 css_gr_release_perfmon_ids(struct gk20a_cs_snapshot *data, u32 count); int css_hw_check_data_available(struct channel_gk20a *ch, u32 *pending, bool *hw_overflow); +struct gk20a_cs_snapshot_client* +css_gr_search_client(struct nvgpu_list_node *clients, u32 perfmon); #endif /* CSS_GR_GK20A_H */ diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index bc4bd6821..2605f9542 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -1185,6 +1185,8 @@ struct gpu_ops { u32 count); int (*detach_snapshot)(struct channel_gk20a *ch, struct gk20a_cs_snapshot_client *client); + bool (*get_overflow_status)(struct gk20a *g); + u32 (*get_pending_snapshots)(struct gk20a *g); } css; #endif struct { diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index 715946beb..6bc13a7fd 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c @@ -625,6 +625,8 @@ static const struct gpu_ops gm20b_ops = { .set_handled_snapshots = css_hw_set_handled_snapshots, .allocate_perfmon_ids = css_gr_allocate_perfmon_ids, .release_perfmon_ids = css_gr_release_perfmon_ids, + .get_overflow_status = css_hw_get_overflow_status, + .get_pending_snapshots = css_hw_get_pending_snapshots, }, #endif .falcon = { diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c index 632f10636..f46f20efb 100644 --- a/drivers/gpu/nvgpu/gp106/hal_gp106.c +++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c @@ -742,6 +742,8 @@ static const struct gpu_ops gp106_ops = { .set_handled_snapshots = css_hw_set_handled_snapshots, .allocate_perfmon_ids = css_gr_allocate_perfmon_ids, .release_perfmon_ids = css_gr_release_perfmon_ids, + .get_overflow_status = css_hw_get_overflow_status, + .get_pending_snapshots = css_hw_get_pending_snapshots, }, #endif .xve = { diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index 80e07b78c..d8e69dd80 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c @@ -672,6 +672,8 @@ static const struct gpu_ops gp10b_ops = { .set_handled_snapshots = css_hw_set_handled_snapshots, .allocate_perfmon_ids = css_gr_allocate_perfmon_ids, .release_perfmon_ids = css_gr_release_perfmon_ids, + .get_overflow_status = css_hw_get_overflow_status, + .get_pending_snapshots = css_hw_get_pending_snapshots, }, #endif .falcon = { diff --git a/drivers/gpu/nvgpu/gv100/hal_gv100.c b/drivers/gpu/nvgpu/gv100/hal_gv100.c index 4e1c3fb80..b881aaf7e 100644 --- a/drivers/gpu/nvgpu/gv100/hal_gv100.c +++ b/drivers/gpu/nvgpu/gv100/hal_gv100.c @@ -832,6 +832,8 @@ static const struct gpu_ops gv100_ops = { .set_handled_snapshots = gv11b_css_hw_set_handled_snapshots, .allocate_perfmon_ids = css_gr_allocate_perfmon_ids, .release_perfmon_ids = css_gr_release_perfmon_ids, + .get_overflow_status = gv11b_css_hw_get_overflow_status, + .get_pending_snapshots = gv11b_css_hw_get_pending_snapshots, }, #endif .xve = { diff --git a/drivers/gpu/nvgpu/gv11b/css_gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/css_gr_gv11b.c index b4e2cb791..7f03be64f 100644 --- a/drivers/gpu/nvgpu/gv11b/css_gr_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/css_gr_gv11b.c @@ -22,9 +22,6 @@ * DEALINGS IN THE SOFTWARE. */ -#include -#include - #include #include #include @@ -33,7 +30,9 @@ #include #include #include +#include #include +#include #include "gk20a/gk20a.h" #include "gk20a/css_gr_gk20a.h" @@ -44,14 +43,14 @@ /* reports whether the hw queue overflowed */ -static inline bool css_hw_get_overflow_status(struct gk20a *g) +bool gv11b_css_hw_get_overflow_status(struct gk20a *g) { const u32 st = perf_pmasys_control_membuf_status_overflowed_f(); return st == (gk20a_readl(g, perf_pmasys_control_r()) & st); } /* returns how many pending snapshot entries are pending */ -static inline u32 css_hw_get_pending_snapshots(struct gk20a *g) +u32 gv11b_css_hw_get_pending_snapshots(struct gk20a *g) { return gk20a_readl(g, perf_pmasys_mem_bytes_r()) / sizeof(struct gk20a_cs_snapshot_fifo_entry); @@ -74,7 +73,7 @@ static void gv11b_css_hw_reset_streaming(struct gk20a *g) perf_pmasys_control_membuf_clear_status_doit_f()); /* pointing all pending snapshots as handled */ - gv11b_css_hw_set_handled_snapshots(g, css_hw_get_pending_snapshots(g)); + gv11b_css_hw_set_handled_snapshots(g, gv11b_css_hw_get_pending_snapshots(g)); } /* informs hw how many snapshots have been processed (frees up fifo space) */ @@ -199,10 +198,10 @@ int gv11b_css_hw_check_data_available(struct channel_gk20a *ch, u32 *pending, if (!css->hw_snapshot) return -EINVAL; - *pending = css_hw_get_pending_snapshots(g); + *pending = gv11b_css_hw_get_pending_snapshots(g); if (!*pending) return 0; - *hw_overflow = css_hw_get_overflow_status(g); + *hw_overflow = gv11b_css_hw_get_overflow_status(g); return 0; } diff --git a/drivers/gpu/nvgpu/gv11b/css_gr_gv11b.h b/drivers/gpu/nvgpu/gv11b/css_gr_gv11b.h index 186f5fcc6..26db4ee83 100644 --- a/drivers/gpu/nvgpu/gv11b/css_gr_gv11b.h +++ b/drivers/gpu/nvgpu/gv11b/css_gr_gv11b.h @@ -31,5 +31,8 @@ void gv11b_css_hw_disable_snapshot(struct gr_gk20a *gr); int gv11b_css_hw_check_data_available(struct channel_gk20a *ch, u32 *pending, bool *hw_overflow); void gv11b_css_hw_set_handled_snapshots(struct gk20a *g, u32 done); +bool gv11b_css_hw_get_overflow_status(struct gk20a *g); +u32 gv11b_css_hw_get_pending_snapshots(struct gk20a *g); + #endif /* CSS_GR_GV11B_H */ diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c index ab9ff7076..84d8a811f 100644 --- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c @@ -761,6 +761,8 @@ static const struct gpu_ops gv11b_ops = { .set_handled_snapshots = gv11b_css_hw_set_handled_snapshots, .allocate_perfmon_ids = css_gr_allocate_perfmon_ids, .release_perfmon_ids = css_gr_release_perfmon_ids, + .get_overflow_status = gv11b_css_hw_get_overflow_status, + .get_pending_snapshots = gv11b_css_hw_get_pending_snapshots, }, #endif .falcon = {