summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny He <suhe@nvidia.com>2017-06-30 18:54:03 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-07-24 02:35:06 -0400
commit8140c51e6cd212517fc343e6f8f8694bbad98f3b (patch)
treecf453fdf283484bbbaaf22c5690550bf546c1f22
parentd9f906c1e0f06f54e545727817d227a0bac46a0a (diff)
gpu: nvgpu: gv11b: Reorg fifo HAL initialization
Reorganize HAL initialization to remove inheritance and construct the gpu_ops struct at compile time. This patch only covers the fifo sub-module of the gpu_ops struct. Perform HAL function assignments in hal_gxxxx.c through the population of a chip-specific copy of gpu_ops. Jira NVGPU-74 Change-Id: I7c81edfa785a4ecafef41aae7b82d6b1707d294e Signed-off-by: Sunny He <suhe@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1522554 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/gv11b/fifo_gv11b.c119
-rw-r--r--drivers/gpu/nvgpu/gv11b/fifo_gv11b.h58
-rw-r--r--drivers/gpu/nvgpu/gv11b/hal_gv11b.c76
3 files changed, 163 insertions, 90 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
index b0270150..e210d40d 100644
--- a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.c
@@ -59,7 +59,7 @@ static inline void gv11b_usermode_writel(struct gk20a *g, u32 r, u32 v)
59 gk20a_dbg(gpu_dbg_reg, "usermode r=0x%x v=0x%x", r, v); 59 gk20a_dbg(gpu_dbg_reg, "usermode r=0x%x v=0x%x", r, v);
60} 60}
61 61
62static void gv11b_get_tsg_runlist_entry(struct tsg_gk20a *tsg, u32 *runlist) 62void gv11b_get_tsg_runlist_entry(struct tsg_gk20a *tsg, u32 *runlist)
63{ 63{
64 64
65 u32 runlist_entry_0 = ram_rl_entry_type_tsg_v(); 65 u32 runlist_entry_0 = ram_rl_entry_type_tsg_v();
@@ -85,7 +85,7 @@ static void gv11b_get_tsg_runlist_entry(struct tsg_gk20a *tsg, u32 *runlist)
85 85
86} 86}
87 87
88static void gv11b_get_ch_runlist_entry(struct channel_gk20a *c, u32 *runlist) 88void gv11b_get_ch_runlist_entry(struct channel_gk20a *c, u32 *runlist)
89{ 89{
90 struct gk20a *g = c->g; 90 struct gk20a *g = c->g;
91 u32 addr_lo, addr_hi; 91 u32 addr_lo, addr_hi;
@@ -126,7 +126,7 @@ static void gv11b_userd_writeback_config(struct gk20a *g)
126 126
127} 127}
128 128
129static int channel_gv11b_setup_ramfc(struct channel_gk20a *c, 129int channel_gv11b_setup_ramfc(struct channel_gk20a *c,
130 u64 gpfifo_base, u32 gpfifo_entries, 130 u64 gpfifo_base, u32 gpfifo_entries,
131 unsigned long acquire_timeout, u32 flags) 131 unsigned long acquire_timeout, u32 flags)
132{ 132{
@@ -219,7 +219,7 @@ static void gv11b_ring_channel_doorbell(struct channel_gk20a *c)
219 usermode_notify_channel_pending_id_f(hw_chid)); 219 usermode_notify_channel_pending_id_f(hw_chid));
220} 220}
221 221
222static u32 gv11b_userd_gp_get(struct gk20a *g, struct channel_gk20a *c) 222u32 gv11b_userd_gp_get(struct gk20a *g, struct channel_gk20a *c)
223{ 223{
224 struct nvgpu_mem *userd_mem = &g->fifo.userd; 224 struct nvgpu_mem *userd_mem = &g->fifo.userd;
225 u32 offset = c->chid * (g->fifo.userd_entry_size / sizeof(u32)); 225 u32 offset = c->chid * (g->fifo.userd_entry_size / sizeof(u32));
@@ -228,7 +228,7 @@ static u32 gv11b_userd_gp_get(struct gk20a *g, struct channel_gk20a *c)
228 offset + ram_userd_gp_get_w()); 228 offset + ram_userd_gp_get_w());
229} 229}
230 230
231static u64 gv11b_userd_pb_get(struct gk20a *g, struct channel_gk20a *c) 231u64 gv11b_userd_pb_get(struct gk20a *g, struct channel_gk20a *c)
232{ 232{
233 struct nvgpu_mem *userd_mem = &g->fifo.userd; 233 struct nvgpu_mem *userd_mem = &g->fifo.userd;
234 u32 offset = c->chid * (g->fifo.userd_entry_size / sizeof(u32)); 234 u32 offset = c->chid * (g->fifo.userd_entry_size / sizeof(u32));
@@ -238,7 +238,7 @@ static u64 gv11b_userd_pb_get(struct gk20a *g, struct channel_gk20a *c)
238 return ((u64)hi << 32) | lo; 238 return ((u64)hi << 32) | lo;
239} 239}
240 240
241static void gv11b_userd_gp_put(struct gk20a *g, struct channel_gk20a *c) 241void gv11b_userd_gp_put(struct gk20a *g, struct channel_gk20a *c)
242{ 242{
243 struct nvgpu_mem *userd_mem = &g->fifo.userd; 243 struct nvgpu_mem *userd_mem = &g->fifo.userd;
244 u32 offset = c->chid * (g->fifo.userd_entry_size / sizeof(u32)); 244 u32 offset = c->chid * (g->fifo.userd_entry_size / sizeof(u32));
@@ -251,24 +251,24 @@ static void gv11b_userd_gp_put(struct gk20a *g, struct channel_gk20a *c)
251 gv11b_ring_channel_doorbell(c); 251 gv11b_ring_channel_doorbell(c);
252} 252}
253 253
254static void channel_gv11b_unbind(struct channel_gk20a *ch) 254void channel_gv11b_unbind(struct channel_gk20a *ch)
255{ 255{
256 gk20a_dbg_fn(""); 256 gk20a_dbg_fn("");
257 257
258 gk20a_fifo_channel_unbind(ch); 258 gk20a_fifo_channel_unbind(ch);
259} 259}
260 260
261static u32 gv11b_fifo_get_num_fifos(struct gk20a *g) 261u32 gv11b_fifo_get_num_fifos(struct gk20a *g)
262{ 262{
263 return ccsr_channel__size_1_v(); 263 return ccsr_channel__size_1_v();
264} 264}
265 265
266static bool gv11b_is_fault_engine_subid_gpc(struct gk20a *g, u32 engine_subid) 266bool gv11b_is_fault_engine_subid_gpc(struct gk20a *g, u32 engine_subid)
267{ 267{
268 return (engine_subid == gmmu_fault_client_type_gpc_v()); 268 return (engine_subid == gmmu_fault_client_type_gpc_v());
269} 269}
270 270
271static void gv11b_dump_channel_status_ramfc(struct gk20a *g, 271void gv11b_dump_channel_status_ramfc(struct gk20a *g,
272 struct gk20a_debug_output *o, 272 struct gk20a_debug_output *o,
273 u32 chid, 273 u32 chid,
274 struct ch_state *ch_state) 274 struct ch_state *ch_state)
@@ -322,7 +322,7 @@ static void gv11b_dump_channel_status_ramfc(struct gk20a *g,
322 gk20a_debug_output(o, "\n"); 322 gk20a_debug_output(o, "\n");
323} 323}
324 324
325static void gv11b_dump_eng_status(struct gk20a *g, 325void gv11b_dump_eng_status(struct gk20a *g,
326 struct gk20a_debug_output *o) 326 struct gk20a_debug_output *o)
327{ 327{
328 u32 i, host_num_engines; 328 u32 i, host_num_engines;
@@ -355,7 +355,7 @@ static void gv11b_dump_eng_status(struct gk20a *g,
355 gk20a_debug_output(o, "\n"); 355 gk20a_debug_output(o, "\n");
356} 356}
357 357
358static u32 gv11b_fifo_intr_0_error_mask(struct gk20a *g) 358u32 gv11b_fifo_intr_0_error_mask(struct gk20a *g)
359{ 359{
360 u32 intr_0_error_mask = 360 u32 intr_0_error_mask =
361 fifo_intr_0_bind_error_pending_f() | 361 fifo_intr_0_bind_error_pending_f() |
@@ -698,7 +698,7 @@ static int gv11b_fifo_poll_runlist_preempt_pending(struct gk20a *g,
698 return ret; 698 return ret;
699} 699}
700 700
701static int gv11b_fifo_is_preempt_pending(struct gk20a *g, u32 id, 701int gv11b_fifo_is_preempt_pending(struct gk20a *g, u32 id,
702 unsigned int id_type, unsigned int timeout_rc_type) 702 unsigned int id_type, unsigned int timeout_rc_type)
703{ 703{
704 struct fifo_gk20a *f = &g->fifo; 704 struct fifo_gk20a *f = &g->fifo;
@@ -747,7 +747,7 @@ static int gv11b_fifo_is_preempt_pending(struct gk20a *g, u32 id,
747 return ret; 747 return ret;
748} 748}
749 749
750static int gv11b_fifo_preempt_channel(struct gk20a *g, u32 chid) 750int gv11b_fifo_preempt_channel(struct gk20a *g, u32 chid)
751{ 751{
752 struct fifo_gk20a *f = &g->fifo; 752 struct fifo_gk20a *f = &g->fifo;
753 u32 tsgid; 753 u32 tsgid;
@@ -784,7 +784,7 @@ static int __locked_fifo_preempt_runlists(struct gk20a *g, u32 runlists_mask)
784 return ret; 784 return ret;
785} 785}
786 786
787static int gv11b_fifo_preempt_tsg(struct gk20a *g, u32 tsgid) 787int gv11b_fifo_preempt_tsg(struct gk20a *g, u32 tsgid)
788{ 788{
789 struct fifo_gk20a *f = &g->fifo; 789 struct fifo_gk20a *f = &g->fifo;
790 u32 ret = 0; 790 u32 ret = 0;
@@ -868,7 +868,7 @@ static int __locked_fifo_preempt_ch_tsg(struct gk20a *g, u32 id,
868} 868}
869 869
870 870
871static int gv11b_fifo_preempt_ch_tsg(struct gk20a *g, u32 id, 871int gv11b_fifo_preempt_ch_tsg(struct gk20a *g, u32 id,
872 unsigned int id_type, unsigned int timeout_rc_type) 872 unsigned int id_type, unsigned int timeout_rc_type)
873{ 873{
874 struct fifo_gk20a *f = &g->fifo; 874 struct fifo_gk20a *f = &g->fifo;
@@ -906,7 +906,7 @@ static int gv11b_fifo_preempt_ch_tsg(struct gk20a *g, u32 id,
906 906
907} 907}
908 908
909static void gv11b_fifo_teardown_ch_tsg(struct gk20a *g, u32 act_eng_bitmask, 909void gv11b_fifo_teardown_ch_tsg(struct gk20a *g, u32 act_eng_bitmask,
910 u32 id, unsigned int id_type, unsigned int rc_type, 910 u32 id, unsigned int id_type, unsigned int rc_type,
911 struct mmu_fault_info *mmfault) 911 struct mmu_fault_info *mmfault)
912{ 912{
@@ -1058,7 +1058,7 @@ static void gv11b_fifo_teardown_ch_tsg(struct gk20a *g, u32 act_eng_bitmask,
1058 nvgpu_pmu_enable_elpg(g); 1058 nvgpu_pmu_enable_elpg(g);
1059} 1059}
1060 1060
1061static void gv11b_fifo_init_pbdma_intr_descs(struct fifo_gk20a *f) 1061void gv11b_fifo_init_pbdma_intr_descs(struct fifo_gk20a *f)
1062{ 1062{
1063 /* 1063 /*
1064 * These are all errors which indicate something really wrong 1064 * These are all errors which indicate something really wrong
@@ -1118,7 +1118,7 @@ static u32 gv11b_fifo_intr_0_en_mask(struct gk20a *g)
1118 return intr_0_en_mask; 1118 return intr_0_en_mask;
1119} 1119}
1120 1120
1121static int gv11b_init_fifo_reset_enable_hw(struct gk20a *g) 1121int gv11b_init_fifo_reset_enable_hw(struct gk20a *g)
1122{ 1122{
1123 u32 intr_stall; 1123 u32 intr_stall;
1124 u32 mask; 1124 u32 mask;
@@ -1232,7 +1232,7 @@ static const char *const gv11b_sched_error_str[] = {
1232 "bad_tsg", 1232 "bad_tsg",
1233}; 1233};
1234 1234
1235static bool gv11b_fifo_handle_sched_error(struct gk20a *g) 1235bool gv11b_fifo_handle_sched_error(struct gk20a *g)
1236{ 1236{
1237 u32 sched_error; 1237 u32 sched_error;
1238 1238
@@ -1348,7 +1348,7 @@ static u32 gv11b_fifo_ctxsw_timeout_info(struct gk20a *g, u32 active_eng_id)
1348 return tsgid; 1348 return tsgid;
1349} 1349}
1350 1350
1351static bool gv11b_fifo_handle_ctxsw_timeout(struct gk20a *g, u32 fifo_intr) 1351bool gv11b_fifo_handle_ctxsw_timeout(struct gk20a *g, u32 fifo_intr)
1352{ 1352{
1353 bool ret = false; 1353 bool ret = false;
1354 u32 tsgid = FIFO_INVAL_TSG_ID; 1354 u32 tsgid = FIFO_INVAL_TSG_ID;
@@ -1411,7 +1411,7 @@ static bool gv11b_fifo_handle_ctxsw_timeout(struct gk20a *g, u32 fifo_intr)
1411 return ret; 1411 return ret;
1412} 1412}
1413 1413
1414static unsigned int gv11b_fifo_handle_pbdma_intr_0(struct gk20a *g, 1414unsigned int gv11b_fifo_handle_pbdma_intr_0(struct gk20a *g,
1415 u32 pbdma_id, u32 pbdma_intr_0, 1415 u32 pbdma_id, u32 pbdma_intr_0,
1416 u32 *handled, u32 *error_notifier) 1416 u32 *handled, u32 *error_notifier)
1417{ 1417{
@@ -1460,7 +1460,7 @@ static unsigned int gv11b_fifo_handle_pbdma_intr_0(struct gk20a *g,
1460 * will have to be destroyed. 1460 * will have to be destroyed.
1461 */ 1461 */
1462 1462
1463static unsigned int gv11b_fifo_handle_pbdma_intr_1(struct gk20a *g, 1463unsigned int gv11b_fifo_handle_pbdma_intr_1(struct gk20a *g,
1464 u32 pbdma_id, u32 pbdma_intr_1, 1464 u32 pbdma_id, u32 pbdma_intr_1,
1465 u32 *handled, u32 *error_notifier) 1465 u32 *handled, u32 *error_notifier)
1466{ 1466{
@@ -1537,7 +1537,7 @@ unsigned int gv11b_fifo_get_eng_method_buffer_size(struct gk20a *g)
1537 return buffer_size; 1537 return buffer_size;
1538} 1538}
1539 1539
1540static void gv11b_fifo_init_eng_method_buffers(struct gk20a *g, 1540void gv11b_fifo_init_eng_method_buffers(struct gk20a *g,
1541 struct tsg_gk20a *tsg) 1541 struct tsg_gk20a *tsg)
1542{ 1542{
1543 struct vm_gk20a *vm = g->mm.bar2.vm; 1543 struct vm_gk20a *vm = g->mm.bar2.vm;
@@ -1577,7 +1577,7 @@ static void gv11b_fifo_init_eng_method_buffers(struct gk20a *g,
1577 1577
1578} 1578}
1579 1579
1580static void gv11b_fifo_deinit_eng_method_buffers(struct gk20a *g, 1580void gv11b_fifo_deinit_eng_method_buffers(struct gk20a *g,
1581 struct tsg_gk20a *tsg) 1581 struct tsg_gk20a *tsg)
1582{ 1582{
1583 struct vm_gk20a *vm = g->mm.bar2.vm; 1583 struct vm_gk20a *vm = g->mm.bar2.vm;
@@ -1596,7 +1596,7 @@ static void gv11b_fifo_deinit_eng_method_buffers(struct gk20a *g,
1596} 1596}
1597 1597
1598#ifdef CONFIG_TEGRA_GK20A_NVHOST 1598#ifdef CONFIG_TEGRA_GK20A_NVHOST
1599static int gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c, 1599int gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c,
1600 u32 syncpt_id, struct nvgpu_mem *syncpt_buf) 1600 u32 syncpt_id, struct nvgpu_mem *syncpt_buf)
1601{ 1601{
1602 struct page **pages; 1602 struct page **pages;
@@ -1631,14 +1631,14 @@ static int gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c,
1631 return err; 1631 return err;
1632} 1632}
1633 1633
1634static void gv11b_fifo_free_syncpt_buf(struct channel_gk20a *c, 1634void gv11b_fifo_free_syncpt_buf(struct channel_gk20a *c,
1635 struct nvgpu_mem *syncpt_buf) 1635 struct nvgpu_mem *syncpt_buf)
1636{ 1636{
1637 nvgpu_gmmu_unmap(c->vm, syncpt_buf, syncpt_buf->gpu_va); 1637 nvgpu_gmmu_unmap(c->vm, syncpt_buf, syncpt_buf->gpu_va);
1638 nvgpu_dma_free(c->g, syncpt_buf); 1638 nvgpu_dma_free(c->g, syncpt_buf);
1639} 1639}
1640 1640
1641static void gv11b_fifo_add_syncpt_wait_cmd(struct gk20a *g, 1641void gv11b_fifo_add_syncpt_wait_cmd(struct gk20a *g,
1642 struct priv_cmd_entry *cmd, u32 off, 1642 struct priv_cmd_entry *cmd, u32 off,
1643 u32 id, u32 thresh, u64 gpu_va_base) 1643 u32 id, u32 thresh, u64 gpu_va_base)
1644{ 1644{
@@ -1668,12 +1668,12 @@ static void gv11b_fifo_add_syncpt_wait_cmd(struct gk20a *g,
1668 nvgpu_mem_wr32(g, cmd->mem, off++, 0x4 | (0x1 << 12)); 1668 nvgpu_mem_wr32(g, cmd->mem, off++, 0x4 | (0x1 << 12));
1669} 1669}
1670 1670
1671static u32 gv11b_fifo_get_syncpt_wait_cmd_size(void) 1671u32 gv11b_fifo_get_syncpt_wait_cmd_size(void)
1672{ 1672{
1673 return 8; 1673 return 8;
1674} 1674}
1675 1675
1676static void gv11b_fifo_add_syncpt_incr_cmd(struct gk20a *g, 1676void gv11b_fifo_add_syncpt_incr_cmd(struct gk20a *g,
1677 bool wfi_cmd, struct priv_cmd_entry *cmd, 1677 bool wfi_cmd, struct priv_cmd_entry *cmd,
1678 u32 id, u64 gpu_va_base) 1678 u32 id, u64 gpu_va_base)
1679{ 1679{
@@ -1706,13 +1706,13 @@ static void gv11b_fifo_add_syncpt_incr_cmd(struct gk20a *g,
1706 nvgpu_mem_wr32(g, cmd->mem, off++, 0); 1706 nvgpu_mem_wr32(g, cmd->mem, off++, 0);
1707} 1707}
1708 1708
1709static u32 gv11b_fifo_get_syncpt_incr_cmd_size(bool wfi_cmd) 1709u32 gv11b_fifo_get_syncpt_incr_cmd_size(bool wfi_cmd)
1710{ 1710{
1711 return 9; 1711 return 9;
1712} 1712}
1713#endif /* CONFIG_TEGRA_GK20A_NVHOST */ 1713#endif /* CONFIG_TEGRA_GK20A_NVHOST */
1714 1714
1715static int gv11b_init_fifo_setup_hw(struct gk20a *g) 1715int gv11b_init_fifo_setup_hw(struct gk20a *g)
1716{ 1716{
1717 struct fifo_gk20a *f = &g->fifo; 1717 struct fifo_gk20a *f = &g->fifo;
1718 1718
@@ -1790,58 +1790,3 @@ void gv11b_mmu_fault_id_to_eng_pbdma_id_and_veid(struct gk20a *g,
1790 else 1790 else
1791 *pbdma_id = FIFO_INVAL_PBDMA_ID; 1791 *pbdma_id = FIFO_INVAL_PBDMA_ID;
1792} 1792}
1793
1794void gv11b_init_fifo(struct gpu_ops *gops)
1795{
1796 gp10b_init_fifo(gops);
1797 /* for gv11b no need to do any thing special for fifo hw setup */
1798 gops->fifo.init_fifo_setup_hw = gv11b_init_fifo_setup_hw;
1799 gops->fifo.runlist_entry_size = ram_rl_entry_size_v;
1800 gops->fifo.get_tsg_runlist_entry = gv11b_get_tsg_runlist_entry;
1801 gops->fifo.get_ch_runlist_entry = gv11b_get_ch_runlist_entry;
1802 gops->fifo.get_num_fifos = gv11b_fifo_get_num_fifos;
1803 gops->fifo.userd_gp_get = gv11b_userd_gp_get;
1804 gops->fifo.userd_gp_put = gv11b_userd_gp_put;
1805 gops->fifo.userd_pb_get = gv11b_userd_pb_get;
1806 gops->fifo.setup_ramfc = channel_gv11b_setup_ramfc;
1807 gops->fifo.resetup_ramfc = NULL;
1808 gops->fifo.unbind_channel = channel_gv11b_unbind;
1809 gops->fifo.eng_runlist_base_size = fifo_eng_runlist_base__size_1_v;
1810 gops->fifo.free_channel_ctx_header = gv11b_free_subctx_header;
1811 gops->fifo.device_info_fault_id = top_device_info_data_fault_id_enum_v;
1812 gops->fifo.is_fault_engine_subid_gpc = gv11b_is_fault_engine_subid_gpc;
1813 gops->fifo.trigger_mmu_fault = NULL;
1814 gops->fifo.get_mmu_fault_info = NULL;
1815 gops->fifo.dump_pbdma_status = gk20a_dump_pbdma_status;
1816 gops->fifo.dump_eng_status = gv11b_dump_eng_status;
1817 gops->fifo.dump_channel_status_ramfc = gv11b_dump_channel_status_ramfc;
1818 gops->fifo.intr_0_error_mask = gv11b_fifo_intr_0_error_mask;
1819 gops->fifo.preempt_channel = gv11b_fifo_preempt_channel;
1820 gops->fifo.preempt_tsg = gv11b_fifo_preempt_tsg;
1821 gops->fifo.is_preempt_pending = gv11b_fifo_is_preempt_pending;
1822 gops->fifo.preempt_ch_tsg = gv11b_fifo_preempt_ch_tsg;
1823 gops->fifo.init_pbdma_intr_descs = gv11b_fifo_init_pbdma_intr_descs;
1824 gops->fifo.reset_enable_hw = gv11b_init_fifo_reset_enable_hw;
1825 gops->fifo.teardown_ch_tsg = gv11b_fifo_teardown_ch_tsg;
1826 gops->fifo.handle_sched_error = gv11b_fifo_handle_sched_error;
1827 gops->fifo.handle_ctxsw_timeout = gv11b_fifo_handle_ctxsw_timeout;
1828 gops->fifo.handle_pbdma_intr_0 =
1829 gv11b_fifo_handle_pbdma_intr_0;
1830 gops->fifo.handle_pbdma_intr_1 =
1831 gv11b_fifo_handle_pbdma_intr_1;
1832 gops->fifo.init_eng_method_buffers =
1833 gv11b_fifo_init_eng_method_buffers;
1834 gops->fifo.deinit_eng_method_buffers =
1835 gv11b_fifo_deinit_eng_method_buffers;
1836#ifdef CONFIG_TEGRA_GK20A_NVHOST
1837 gops->fifo.alloc_syncpt_buf = gv11b_fifo_alloc_syncpt_buf;
1838 gops->fifo.free_syncpt_buf = gv11b_fifo_free_syncpt_buf;
1839 gops->fifo.add_syncpt_wait_cmd = gv11b_fifo_add_syncpt_wait_cmd;
1840 gops->fifo.get_syncpt_wait_cmd_size =
1841 gv11b_fifo_get_syncpt_wait_cmd_size;
1842 gops->fifo.add_syncpt_incr_cmd = gv11b_fifo_add_syncpt_incr_cmd;
1843 gops->fifo.get_syncpt_incr_cmd_size =
1844 gv11b_fifo_get_syncpt_incr_cmd_size;
1845#endif
1846
1847}
diff --git a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.h b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.h
index 8a2b32f8..3fb2f6e9 100644
--- a/drivers/gpu/nvgpu/gv11b/fifo_gv11b.h
+++ b/drivers/gpu/nvgpu/gv11b/fifo_gv11b.h
@@ -40,10 +40,66 @@
40#define CHANNEL_INFO_VEID0 0 40#define CHANNEL_INFO_VEID0 0
41 41
42struct gpu_ops; 42struct gpu_ops;
43void gv11b_init_fifo(struct gpu_ops *gops); 43
44void gv11b_fifo_reset_pbdma_and_eng_faulted(struct gk20a *g, 44void gv11b_fifo_reset_pbdma_and_eng_faulted(struct gk20a *g,
45 struct channel_gk20a *refch, 45 struct channel_gk20a *refch,
46 u32 faulted_pbdma, u32 faulted_engine); 46 u32 faulted_pbdma, u32 faulted_engine);
47void gv11b_mmu_fault_id_to_eng_pbdma_id_and_veid(struct gk20a *g, 47void gv11b_mmu_fault_id_to_eng_pbdma_id_and_veid(struct gk20a *g,
48 u32 mmu_fault_id, u32 *active_engine_id, u32 *veid, u32 *pbdma_id); 48 u32 mmu_fault_id, u32 *active_engine_id, u32 *veid, u32 *pbdma_id);
49
50void gv11b_get_tsg_runlist_entry(struct tsg_gk20a *tsg, u32 *runlist);
51void gv11b_get_ch_runlist_entry(struct channel_gk20a *c, u32 *runlist);
52int channel_gv11b_setup_ramfc(struct channel_gk20a *c,
53 u64 gpfifo_base, u32 gpfifo_entries,
54 unsigned long acquire_timeout, u32 flags);
55u32 gv11b_userd_gp_get(struct gk20a *g, struct channel_gk20a *c);
56u64 gv11b_userd_pb_get(struct gk20a *g, struct channel_gk20a *c);
57void gv11b_userd_gp_put(struct gk20a *g, struct channel_gk20a *c);
58void channel_gv11b_unbind(struct channel_gk20a *ch);
59u32 gv11b_fifo_get_num_fifos(struct gk20a *g);
60bool gv11b_is_fault_engine_subid_gpc(struct gk20a *g, u32 engine_subid);
61void gv11b_dump_channel_status_ramfc(struct gk20a *g,
62 struct gk20a_debug_output *o,
63 u32 chid,
64 struct ch_state *ch_state);
65void gv11b_dump_eng_status(struct gk20a *g,
66 struct gk20a_debug_output *o);
67u32 gv11b_fifo_intr_0_error_mask(struct gk20a *g);
68int gv11b_fifo_is_preempt_pending(struct gk20a *g, u32 id,
69 unsigned int id_type, unsigned int timeout_rc_type);
70int gv11b_fifo_preempt_channel(struct gk20a *g, u32 chid);
71int gv11b_fifo_preempt_tsg(struct gk20a *g, u32 tsgid);
72int gv11b_fifo_preempt_ch_tsg(struct gk20a *g, u32 id,
73 unsigned int id_type, unsigned int timeout_rc_type);
74void gv11b_fifo_teardown_ch_tsg(struct gk20a *g, u32 act_eng_bitmask,
75 u32 id, unsigned int id_type, unsigned int rc_type,
76 struct mmu_fault_info *mmfault);
77void gv11b_fifo_init_pbdma_intr_descs(struct fifo_gk20a *f);
78int gv11b_init_fifo_reset_enable_hw(struct gk20a *g);
79bool gv11b_fifo_handle_sched_error(struct gk20a *g);
80bool gv11b_fifo_handle_ctxsw_timeout(struct gk20a *g, u32 fifo_intr);
81unsigned int gv11b_fifo_handle_pbdma_intr_0(struct gk20a *g,
82 u32 pbdma_id, u32 pbdma_intr_0,
83 u32 *handled, u32 *error_notifier);
84unsigned int gv11b_fifo_handle_pbdma_intr_1(struct gk20a *g,
85 u32 pbdma_id, u32 pbdma_intr_1,
86 u32 *handled, u32 *error_notifier);
87void gv11b_fifo_init_eng_method_buffers(struct gk20a *g,
88 struct tsg_gk20a *tsg);
89void gv11b_fifo_deinit_eng_method_buffers(struct gk20a *g,
90 struct tsg_gk20a *tsg);
91int gv11b_fifo_alloc_syncpt_buf(struct channel_gk20a *c,
92 u32 syncpt_id, struct nvgpu_mem *syncpt_buf);
93void gv11b_fifo_free_syncpt_buf(struct channel_gk20a *c,
94 struct nvgpu_mem *syncpt_buf);
95void gv11b_fifo_add_syncpt_wait_cmd(struct gk20a *g,
96 struct priv_cmd_entry *cmd, u32 off,
97 u32 id, u32 thresh, u64 gpu_va_base);
98u32 gv11b_fifo_get_syncpt_wait_cmd_size(void);
99void gv11b_fifo_add_syncpt_incr_cmd(struct gk20a *g,
100 bool wfi_cmd, struct priv_cmd_entry *cmd,
101 u32 id, u64 gpu_va_base);
102u32 gv11b_fifo_get_syncpt_incr_cmd_size(bool wfi_cmd);
103int gv11b_init_fifo_setup_hw(struct gk20a *g);
104
49#endif 105#endif
diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
index 8dc9900a..b6c17c7d 100644
--- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c
@@ -20,6 +20,7 @@
20#include <linux/tegra_gpu_t19x.h> 20#include <linux/tegra_gpu_t19x.h>
21 21
22#include "gk20a/gk20a.h" 22#include "gk20a/gk20a.h"
23#include "gk20a/fifo_gk20a.h"
23#include "gk20a/css_gr_gk20a.h" 24#include "gk20a/css_gr_gk20a.h"
24#include "gk20a/mc_gk20a.h" 25#include "gk20a/mc_gk20a.h"
25#include "gk20a/dbg_gpu_gk20a.h" 26#include "gk20a/dbg_gpu_gk20a.h"
@@ -29,10 +30,12 @@
29 30
30#include "gm20b/ltc_gm20b.h" 31#include "gm20b/ltc_gm20b.h"
31#include "gm20b/gr_gm20b.h" 32#include "gm20b/gr_gm20b.h"
33#include "gm20b/fifo_gm20b.h"
32 34
33#include "gp10b/ltc_gp10b.h" 35#include "gp10b/ltc_gp10b.h"
34#include "gp10b/mc_gp10b.h" 36#include "gp10b/mc_gp10b.h"
35#include "gp10b/priv_ring_gp10b.h" 37#include "gp10b/priv_ring_gp10b.h"
38#include "gp10b/fifo_gp10b.h"
36 39
37#include "hal_gv11b.h" 40#include "hal_gv11b.h"
38#include "gr_gv11b.h" 41#include "gr_gv11b.h"
@@ -49,10 +52,14 @@
49#include "fifo_gv11b.h" 52#include "fifo_gv11b.h"
50#include "gv11b_gating_reglist.h" 53#include "gv11b_gating_reglist.h"
51#include "regops_gv11b.h" 54#include "regops_gv11b.h"
55#include "subctx_gv11b.h"
52 56
53#include <nvgpu/debug.h> 57#include <nvgpu/debug.h>
54 58
55#include <nvgpu/hw/gv11b/hw_proj_gv11b.h> 59#include <nvgpu/hw/gv11b/hw_proj_gv11b.h>
60#include <nvgpu/hw/gv11b/hw_fifo_gv11b.h>
61#include <nvgpu/hw/gv11b/hw_ram_gv11b.h>
62#include <nvgpu/hw/gv11b/hw_top_gv11b.h>
56 63
57static int gv11b_get_litter_value(struct gk20a *g, int value) 64static int gv11b_get_litter_value(struct gk20a *g, int value)
58{ 65{
@@ -202,6 +209,72 @@ static const struct gpu_ops gv11b_ops = {
202 .pg_gr_load_gating_prod = 209 .pg_gr_load_gating_prod =
203 gr_gv11b_pg_gr_load_gating_prod, 210 gr_gv11b_pg_gr_load_gating_prod,
204 }, 211 },
212 .fifo = {
213 .init_fifo_setup_hw = gv11b_init_fifo_setup_hw,
214 .bind_channel = channel_gm20b_bind,
215 .unbind_channel = channel_gv11b_unbind,
216 .disable_channel = gk20a_fifo_disable_channel,
217 .enable_channel = gk20a_fifo_enable_channel,
218 .alloc_inst = gk20a_fifo_alloc_inst,
219 .free_inst = gk20a_fifo_free_inst,
220 .setup_ramfc = channel_gv11b_setup_ramfc,
221 .channel_set_priority = gk20a_fifo_set_priority,
222 .channel_set_timeslice = gk20a_fifo_set_timeslice,
223 .default_timeslice_us = gk20a_fifo_default_timeslice_us,
224 .setup_userd = gk20a_fifo_setup_userd,
225 .userd_gp_get = gv11b_userd_gp_get,
226 .userd_gp_put = gv11b_userd_gp_put,
227 .userd_pb_get = gv11b_userd_pb_get,
228 .pbdma_acquire_val = gk20a_fifo_pbdma_acquire_val,
229 .preempt_channel = gv11b_fifo_preempt_channel,
230 .preempt_tsg = gv11b_fifo_preempt_tsg,
231 .update_runlist = gk20a_fifo_update_runlist,
232 .trigger_mmu_fault = NULL,
233 .get_mmu_fault_info = NULL,
234 .wait_engine_idle = gk20a_fifo_wait_engine_idle,
235 .get_num_fifos = gv11b_fifo_get_num_fifos,
236 .get_pbdma_signature = gp10b_fifo_get_pbdma_signature,
237 .set_runlist_interleave = gk20a_fifo_set_runlist_interleave,
238 .tsg_set_timeslice = gk20a_fifo_tsg_set_timeslice,
239 .force_reset_ch = gk20a_fifo_force_reset_ch,
240 .engine_enum_from_type = gp10b_fifo_engine_enum_from_type,
241 .device_info_data_parse = gp10b_device_info_data_parse,
242 .eng_runlist_base_size = fifo_eng_runlist_base__size_1_v,
243 .init_engine_info = gk20a_fifo_init_engine_info,
244 .runlist_entry_size = ram_rl_entry_size_v,
245 .get_tsg_runlist_entry = gv11b_get_tsg_runlist_entry,
246 .get_ch_runlist_entry = gv11b_get_ch_runlist_entry,
247 .is_fault_engine_subid_gpc = gv11b_is_fault_engine_subid_gpc,
248 .dump_pbdma_status = gk20a_dump_pbdma_status,
249 .dump_eng_status = gv11b_dump_eng_status,
250 .dump_channel_status_ramfc = gv11b_dump_channel_status_ramfc,
251 .intr_0_error_mask = gv11b_fifo_intr_0_error_mask,
252 .is_preempt_pending = gv11b_fifo_is_preempt_pending,
253 .init_pbdma_intr_descs = gv11b_fifo_init_pbdma_intr_descs,
254 .reset_enable_hw = gv11b_init_fifo_reset_enable_hw,
255 .teardown_ch_tsg = gv11b_fifo_teardown_ch_tsg,
256 .handle_sched_error = gv11b_fifo_handle_sched_error,
257 .handle_pbdma_intr_0 = gv11b_fifo_handle_pbdma_intr_0,
258 .handle_pbdma_intr_1 = gv11b_fifo_handle_pbdma_intr_1,
259 .init_eng_method_buffers = gv11b_fifo_init_eng_method_buffers,
260 .deinit_eng_method_buffers =
261 gv11b_fifo_deinit_eng_method_buffers,
262 .tsg_bind_channel = gk20a_tsg_bind_channel,
263 .tsg_unbind_channel = gk20a_tsg_unbind_channel,
264#ifdef CONFIG_TEGRA_GK20A_NVHOST
265 .alloc_syncpt_buf = gv11b_fifo_alloc_syncpt_buf,
266 .free_syncpt_buf = gv11b_fifo_free_syncpt_buf,
267 .add_syncpt_wait_cmd = gv11b_fifo_add_syncpt_wait_cmd,
268 .get_syncpt_wait_cmd_size = gv11b_fifo_get_syncpt_wait_cmd_size,
269 .add_syncpt_incr_cmd = gv11b_fifo_add_syncpt_incr_cmd,
270 .get_syncpt_incr_cmd_size = gv11b_fifo_get_syncpt_incr_cmd_size,
271#endif
272 .resetup_ramfc = NULL,
273 .device_info_fault_id = top_device_info_data_fault_id_enum_v,
274 .free_channel_ctx_header = gv11b_free_subctx_header,
275 .preempt_ch_tsg = gv11b_fifo_preempt_ch_tsg,
276 .handle_ctxsw_timeout = gv11b_fifo_handle_ctxsw_timeout,
277 },
205 .mc = { 278 .mc = {
206 .intr_enable = mc_gv11b_intr_enable, 279 .intr_enable = mc_gv11b_intr_enable,
207 .intr_unit_config = mc_gp10b_intr_unit_config, 280 .intr_unit_config = mc_gp10b_intr_unit_config,
@@ -267,6 +340,7 @@ int gv11b_init_hal(struct gk20a *g)
267 340
268 gops->ltc = gv11b_ops.ltc; 341 gops->ltc = gv11b_ops.ltc;
269 gops->clock_gating = gv11b_ops.clock_gating; 342 gops->clock_gating = gv11b_ops.clock_gating;
343 gops->fifo = gv11b_ops.fifo;
270 gops->mc = gv11b_ops.mc; 344 gops->mc = gv11b_ops.mc;
271 gops->debug = gv11b_ops.debug; 345 gops->debug = gv11b_ops.debug;
272 gops->dbg_session_ops = gv11b_ops.dbg_session_ops; 346 gops->dbg_session_ops = gv11b_ops.dbg_session_ops;
@@ -289,14 +363,12 @@ int gv11b_init_hal(struct gk20a *g)
289 gv11b_init_gr(gops); 363 gv11b_init_gr(gops);
290 gv11b_init_fecs_trace_ops(gops); 364 gv11b_init_fecs_trace_ops(gops);
291 gv11b_init_fb(gops); 365 gv11b_init_fb(gops);
292 gv11b_init_fifo(gops);
293 gv11b_init_ce(gops); 366 gv11b_init_ce(gops);
294 gv11b_init_gr_ctx(gops); 367 gv11b_init_gr_ctx(gops);
295 gv11b_init_mm(gops); 368 gv11b_init_mm(gops);
296 gv11b_init_pmu_ops(gops); 369 gv11b_init_pmu_ops(gops);
297 gv11b_init_regops(gops); 370 gv11b_init_regops(gops);
298 gv11b_init_therm_ops(gops); 371 gv11b_init_therm_ops(gops);
299 gk20a_init_tsg_ops(gops);
300 372
301 g->name = "gv11b"; 373 g->name = "gv11b";
302 374