diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile index 30e27234f..fd637c6b9 100644 --- a/drivers/gpu/nvgpu/Makefile +++ b/drivers/gpu/nvgpu/Makefile @@ -197,6 +197,12 @@ nvgpu-y += \ hal/gr/zbc/zbc_gm20b.o \ hal/gr/zbc/zbc_gp10b.o \ hal/gr/zbc/zbc_gv11b.o \ + hal/gr/gr/gr_gk20a.o \ + hal/gr/gr/gr_gm20b.o \ + hal/gr/gr/gr_gp10b.o \ + hal/gr/gr/gr_gv100.o \ + hal/gr/gr/gr_gv11b.o \ + hal/gr/gr/gr_tu104.o \ hal/init/hal_gm20b.o \ hal/init/hal_gp10b.o \ hal/init/hal_gv100.o \ @@ -521,9 +527,7 @@ nvgpu-y += \ common/ce/ce.o \ common/debugger.o \ gk20a/fifo_gk20a.o \ - gk20a/gr_gk20a.o \ gk20a/mm_gk20a.o \ - gm20b/gr_gm20b.o \ gm20b/mm_gm20b.o nvgpu-$(CONFIG_GK20A_VIDMEM) += \ @@ -569,16 +573,12 @@ nvgpu-$(CONFIG_GK20A_CYCLE_STATS) += \ common/cyclestats/cyclestats.o nvgpu-y += \ - gp10b/gr_gp10b.o \ gp10b/mm_gp10b.o \ gp106/bios_gp106.o \ - gv11b/gr_gv11b.o \ gv11b/mm_gv11b.o \ gv100/mm_gv100.o \ gv100/bios_gv100.o \ - gv100/gr_gv100.o \ tu104/mm_tu104.o \ tu104/fifo_tu104.o \ - tu104/gr_tu104.o \ tu104/bios_tu104.o \ tu104/fbpa_tu104.o diff --git a/drivers/gpu/nvgpu/Makefile.sources b/drivers/gpu/nvgpu/Makefile.sources index 971f63954..15e39e1cf 100644 --- a/drivers/gpu/nvgpu/Makefile.sources +++ b/drivers/gpu/nvgpu/Makefile.sources @@ -243,22 +243,16 @@ srcs += common/sim/sim.c \ common/nvlink/nvlink.c \ common/fence/fence.c \ gk20a/fifo_gk20a.c \ - gk20a/gr_gk20a.c \ gk20a/mm_gk20a.c \ - gm20b/gr_gm20b.c \ gm20b/mm_gm20b.c \ - gp10b/gr_gp10b.c \ gp10b/mm_gp10b.c \ - gv11b/gr_gv11b.c \ gv11b/mm_gv11b.c \ gp106/bios_gp106.c \ gv100/mm_gv100.c \ gv100/bios_gv100.c \ - gv100/gr_gv100.c \ tu104/bios_tu104.c \ tu104/fbpa_tu104.c \ tu104/fifo_tu104.c \ - tu104/gr_tu104.c \ tu104/mm_tu104.c \ hal/mm/cache/flush_gk20a.c \ hal/mm/cache/flush_gv11b.c \ @@ -308,6 +302,12 @@ srcs += common/sim/sim.c \ hal/gr/zbc/zbc_gm20b.c \ hal/gr/zbc/zbc_gp10b.c \ hal/gr/zbc/zbc_gv11b.c \ + hal/gr/gr/gr_gk20a.c \ + hal/gr/gr/gr_gm20b.c \ + hal/gr/gr/gr_gp10b.c \ + hal/gr/gr/gr_gv100.c \ + hal/gr/gr/gr_gv11b.c \ + hal/gr/gr/gr_tu104.c \ hal/init/hal_gm20b.c \ hal/init/hal_gp10b.c \ hal/init/hal_gv100.c \ diff --git a/drivers/gpu/nvgpu/common/gr/hwpm_map.c b/drivers/gpu/nvgpu/common/gr/hwpm_map.c index 44f86d990..70ae063d9 100644 --- a/drivers/gpu/nvgpu/common/gr/hwpm_map.c +++ b/drivers/gpu/nvgpu/common/gr/hwpm_map.c @@ -30,7 +30,7 @@ #include /* needed for pri_is_ppc_addr_shared */ -#include "gk20a/gr_pri_gk20a.h" +#include "hal/gr/gr/gr_pri_gk20a.h" #include "gr_priv.h" #define NV_PCFG_BASE 0x00088000U diff --git a/drivers/gpu/nvgpu/common/regops/regops.c b/drivers/gpu/nvgpu/common/regops/regops.c index 5bb887ff3..5efec9f26 100644 --- a/drivers/gpu/nvgpu/common/regops/regops.c +++ b/drivers/gpu/nvgpu/common/regops/regops.c @@ -22,9 +22,6 @@ * DEALINGS IN THE SOFTWARE. */ -#include "gk20a/gr_gk20a.h" -#include "common/gr/gr_priv.h" - #include #include #include @@ -33,6 +30,10 @@ #include #include +/* Access ctx buffer offset functions in gr_gk20a.h */ +#include "hal/gr/gr/gr_gk20a.h" +#include "common/gr/gr_priv.h" + static int regop_bsearch_range_cmp(const void *pkey, const void *pelem) { const u32 key = *(const u32 *)pkey; diff --git a/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c b/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c index fb832e05c..db2bb8a8b 100644 --- a/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c +++ b/drivers/gpu/nvgpu/common/vgpu/gp10b/vgpu_hal_gp10b.c @@ -59,6 +59,9 @@ #include "hal/gr/config/gr_config_gm20b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gm20b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gp10b.h" +#include "hal/gr/gr/gr_gk20a.h" +#include "hal/gr/gr/gr_gm20b.h" +#include "hal/gr/gr/gr_gp10b.h" #include "hal/netlist/netlist_gp10b.h" #include "hal/perf/perf_gm20b.h" #include "hal/sync/syncpt_cmdbuf_gk20a.h" @@ -85,12 +88,8 @@ #include "common/vgpu/init/init_vgpu.h" #include "vgpu_hal_gp10b.h" -#include "gk20a/gr_gk20a.h" - #include "gp10b/mm_gp10b.h" -#include "gp10b/gr_gp10b.h" -#include "gm20b/gr_gm20b.h" #include "gm20b/mm_gm20b.h" #include diff --git a/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c index adc2dca54..8059b8f90 100644 --- a/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c +++ b/drivers/gpu/nvgpu/common/vgpu/gv11b/vgpu_hal_gv11b.c @@ -64,6 +64,11 @@ #include "hal/gr/ctxsw_prog/ctxsw_prog_gm20b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gp10b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gv11b.h" +#include "hal/gr/gr/gr_gk20a.h" +#include "hal/gr/gr/gr_gm20b.h" +#include "hal/gr/gr/gr_gp10b.h" +#include "hal/gr/gr/gr_gv11b.h" +#include "hal/gr/gr/gr_gv100.h" #include "hal/perf/perf_gv11b.h" #include "hal/netlist/netlist_gv11b.h" #include "hal/sync/syncpt_cmdbuf_gv11b.h" @@ -95,18 +100,11 @@ #include "common/vgpu/ptimer/ptimer_vgpu.h" #include "vgpu_hal_gv11b.h" -#include "gk20a/gr_gk20a.h" - -#include #include #include -#include "gp10b/gr_gp10b.h" #include -#include - -#include #include #include diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/hal/gr/gr/gr_gk20a.c similarity index 99% rename from drivers/gpu/nvgpu/gk20a/gr_gk20a.c rename to drivers/gpu/nvgpu/hal/gr/gr/gr_gk20a.c index c6be8fabb..7a7678b33 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_gk20a.c @@ -24,19 +24,11 @@ #include #include -#include -#include -#include #include #include -#include #include -#include -#include -#include #include #include -#include #include #include #include @@ -44,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -52,10 +43,6 @@ #include #include #include -#include -#include -#include -#include #include #include "gr_gk20a.h" @@ -1390,7 +1377,7 @@ bool gk20a_is_channel_ctx_resident(struct channel_gk20a *ch) return ret; } -int __gr_gk20a_exec_ctx_ops(struct channel_gk20a *ch, +static int gr_exec_ctx_ops(struct channel_gk20a *ch, struct nvgpu_dbg_reg_op *ctx_ops, u32 num_ops, u32 num_ctx_wr_ops, u32 num_ctx_rd_ops, bool ch_is_curr_ctx) @@ -1669,7 +1656,7 @@ int gr_gk20a_exec_ctx_ops(struct channel_gk20a *ch, nvgpu_log(g, gpu_dbg_fn | gpu_dbg_gpu_dbg, "is curr ctx=%d", ch_is_curr_ctx); - err = __gr_gk20a_exec_ctx_ops(ch, ctx_ops, num_ops, num_ctx_wr_ops, + err = gr_exec_ctx_ops(ch, ctx_ops, num_ops, num_ctx_wr_ops, num_ctx_rd_ops, ch_is_curr_ctx); tmp_err = g->ops.gr.enable_ctxsw(g); diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h b/drivers/gpu/nvgpu/hal/gr/gr/gr_gk20a.h similarity index 91% rename from drivers/gpu/nvgpu/gk20a/gr_gk20a.h rename to drivers/gpu/nvgpu/hal/gr/gr/gr_gk20a.h index 292b9d0a3..b3bb707ee 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_gk20a.h @@ -26,9 +26,7 @@ #include -#include "mm_gk20a.h" - -struct nvgpu_gr_ctx; +struct gk20a; struct channel_gk20a; struct nvgpu_warpstate; struct dbg_session_gk20a; @@ -45,24 +43,16 @@ struct nvgpu_warpstate { /* sm */ bool gk20a_gr_sm_debugger_attached(struct gk20a *g); u32 gk20a_gr_get_sm_no_lock_down_hww_global_esr_mask(struct gk20a *g); - int gr_gk20a_exec_ctx_ops(struct channel_gk20a *ch, struct nvgpu_dbg_reg_op *ctx_ops, u32 num_ops, u32 num_ctx_wr_ops, u32 num_ctx_rd_ops, bool *is_curr_ctx); -int __gr_gk20a_exec_ctx_ops(struct channel_gk20a *ch, - struct nvgpu_dbg_reg_op *ctx_ops, u32 num_ops, - u32 num_ctx_wr_ops, u32 num_ctx_rd_ops, - bool ch_is_curr_ctx); int gr_gk20a_get_ctx_buffer_offsets(struct gk20a *g, - u32 addr, - u32 max_offsets, + u32 addr, u32 max_offsets, u32 *offsets, u32 *offset_addrs, - u32 *num_offsets, - bool is_quad, u32 quad); + u32 *num_offsets, bool is_quad, u32 quad); int gr_gk20a_get_pm_ctx_buffer_offsets(struct gk20a *g, - u32 addr, - u32 max_offsets, + u32 addr, u32 max_offsets, u32 *offsets, u32 *offset_addrs, u32 *num_offsets); int gr_gk20a_update_smpc_ctxsw_mode(struct gk20a *g, @@ -70,11 +60,9 @@ int gr_gk20a_update_smpc_ctxsw_mode(struct gk20a *g, bool enable_smpc_ctxsw); int gr_gk20a_update_hwpm_ctxsw_mode(struct gk20a *g, struct channel_gk20a *c, - u64 gpu_va, - u32 mode); - + u64 gpu_va, u32 mode); void gk20a_gr_resume_single_sm(struct gk20a *g, - u32 gpc, u32 tpc, u32 sm); + u32 gpc, u32 tpc, u32 sm); void gk20a_gr_resume_all_sms(struct gk20a *g); void gk20a_gr_suspend_single_sm(struct gk20a *g, u32 gpc, u32 tpc, u32 sm, @@ -84,16 +72,13 @@ void gk20a_gr_suspend_all_sms(struct gk20a *g, int gr_gk20a_set_sm_debug_mode(struct gk20a *g, struct channel_gk20a *ch, u64 sms, bool enable); bool gk20a_is_channel_ctx_resident(struct channel_gk20a *ch); - int gk20a_gr_lock_down_sm(struct gk20a *g, u32 gpc, u32 tpc, u32 sm, u32 global_esr_mask, bool check_errors); int gk20a_gr_wait_for_sm_lock_down(struct gk20a *g, u32 gpc, u32 tpc, u32 sm, u32 global_esr_mask, bool check_errors); - u32 gk20a_gr_get_sm_hww_warp_esr(struct gk20a *g, u32 gpc, u32 tpc, u32 sm); u32 gk20a_gr_get_sm_hww_global_esr(struct gk20a *g, u32 gpc, u32 tpc, u32 sm); - bool gr_gk20a_suspend_context(struct channel_gk20a *ch); bool gr_gk20a_resume_context(struct channel_gk20a *ch); int gr_gk20a_suspend_contexts(struct gk20a *g, @@ -107,13 +92,11 @@ int gr_gk20a_wait_for_pause(struct gk20a *g, struct nvgpu_warpstate *w_state); int gr_gk20a_resume_from_pause(struct gk20a *g); int gr_gk20a_clear_sm_errors(struct gk20a *g); u32 gr_gk20a_tpc_enabled_exceptions(struct gk20a *g); - void gk20a_gr_get_esr_sm_sel(struct gk20a *g, u32 gpc, u32 tpc, u32 *esr_sm_sel); void gk20a_gr_init_ovr_sm_dsm_perf(void); void gk20a_gr_get_ovr_perf_regs(struct gk20a *g, u32 *num_ovr_perf_regs, u32 **ovr_perf_regs); - int gr_gk20a_decode_priv_addr(struct gk20a *g, u32 addr, enum ctxsw_addr_type *addr_type, u32 *gpc_num, u32 *tpc_num, u32 *ppc_num, u32 *be_num, diff --git a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c b/drivers/gpu/nvgpu/hal/gr/gr/gr_gm20b.c similarity index 99% rename from drivers/gpu/nvgpu/gm20b/gr_gm20b.c rename to drivers/gpu/nvgpu/hal/gr/gr/gr_gm20b.c index 0d410c404..0ec8832e7 100644 --- a/drivers/gpu/nvgpu/gm20b/gr_gm20b.c +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_gm20b.c @@ -34,17 +34,15 @@ #include #include #include -#include #include #include -#include "gk20a/gr_gk20a.h" -#include "common/gr/gr_priv.h" - +#include "gr_gk20a.h" #include "gr_gm20b.h" +#include "common/gr/gr_priv.h" + #include -#include #include void gr_gm20b_set_alpha_circular_buffer_size(struct gk20a *g, u32 data) diff --git a/drivers/gpu/nvgpu/gm20b/gr_gm20b.h b/drivers/gpu/nvgpu/hal/gr/gr/gr_gm20b.h similarity index 98% rename from drivers/gpu/nvgpu/gm20b/gr_gm20b.h rename to drivers/gpu/nvgpu/hal/gr/gr/gr_gm20b.h index 01523d5ec..524caba15 100644 --- a/drivers/gpu/nvgpu/gm20b/gr_gm20b.h +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_gm20b.h @@ -25,8 +25,11 @@ #ifndef NVGPU_GM20B_GR_GM20B_H #define NVGPU_GM20B_GR_GM20B_H +#include + struct gk20a; struct nvgpu_warpstate; +enum nvgpu_event_id_type; int gm20b_gr_tpc_disable_override(struct gk20a *g, u32 mask); int gr_gm20b_commit_global_cb_manager(struct gk20a *g, diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c b/drivers/gpu/nvgpu/hal/gr/gr/gr_gp10b.c similarity index 99% rename from drivers/gpu/nvgpu/gp10b/gr_gp10b.c rename to drivers/gpu/nvgpu/hal/gr/gr/gr_gp10b.c index 20208f3c9..545a753c0 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.c +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_gp10b.c @@ -24,10 +24,8 @@ #include #include -#include #include #include -#include #include #include #include @@ -40,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -48,14 +45,12 @@ #include #include -#include "gk20a/gr_gk20a.h" -#include "gm20b/gr_gm20b.h" -#include "gp10b/gr_gp10b.h" +#include "gr_gk20a.h" +#include "gr_gp10b.h" #include "common/gr/gr_priv.h" #include -#include void gr_gp10b_set_bes_crop_debug3(struct gk20a *g, u32 data) { diff --git a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h b/drivers/gpu/nvgpu/hal/gr/gr/gr_gp10b.h similarity index 88% rename from drivers/gpu/nvgpu/gp10b/gr_gp10b.h rename to drivers/gpu/nvgpu/hal/gr/gr/gr_gp10b.h index 4ff18d1bd..cbbef3af8 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_gp10b.h +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_gp10b.h @@ -25,23 +25,19 @@ #ifndef NVGPU_GR_GP10B_H #define NVGPU_GR_GP10B_H -#include "gk20a/mm_gk20a.h" +#include struct gk20a; -struct nvgpu_gr_isr_data; +struct channel_gk20a; struct nvgpu_gr_ctx; -struct nvgpu_preemption_modes_rec; +struct dbg_session_gk20a; struct gk20a_debug_output; #define NVC097_BES_CROP_DEBUG4_CLAMP_FP_BLEND_TO_INF 0x0U #define NVC097_BES_CROP_DEBUG4_CLAMP_FP_BLEND_TO_MAXVAL 0x1U -void gr_gp10b_create_sysfs(struct gk20a *g); -void gr_gp10b_remove_sysfs(struct gk20a *g); int gr_gp10b_set_cilp_preempt_pending(struct gk20a *g, struct channel_gk20a *fault_ch); -int gr_gp10b_commit_global_cb_manager(struct gk20a *g, - struct nvgpu_gr_ctx *gr_ctx, bool patch); void gr_gp10b_set_bes_crop_debug3(struct gk20a *g, u32 data); void gr_gp10b_set_bes_crop_debug4(struct gk20a *g, u32 data); void gr_gp10b_set_alpha_circular_buffer_size(struct gk20a *g, u32 data); @@ -62,7 +58,6 @@ int gr_gp10b_suspend_contexts(struct gk20a *g, int gr_gp10b_set_boosted_ctx(struct channel_gk20a *ch, bool boost); int gp10b_gr_fuse_override(struct gk20a *g); -int gr_gp10b_init_preemption_state(struct gk20a *g); bool gr_gp10b_suspend_context(struct channel_gk20a *ch, bool *cilp_preempt_pending); #endif /* NVGPU_GR_GP10B_H */ diff --git a/drivers/gpu/nvgpu/gv100/gr_gv100.c b/drivers/gpu/nvgpu/hal/gr/gr/gr_gv100.c similarity index 97% rename from drivers/gpu/nvgpu/gv100/gr_gv100.c rename to drivers/gpu/nvgpu/hal/gr/gr/gr_gv100.c index 1d4354dd8..b00ed065f 100644 --- a/drivers/gpu/nvgpu/gv100/gr_gv100.c +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_gv100.c @@ -30,14 +30,13 @@ #include #include -#include "gk20a/gr_gk20a.h" -#include "gk20a/gr_pri_gk20a.h" +#include "gr_gk20a.h" +#include "gr_pri_gk20a.h" +#include "gr_gv100.h" + #include "common/gr/gr_priv.h" -#include "gv100/gr_gv100.h" - #include -#include #include void gr_gv100_set_gpc_tpc_mask(struct gk20a *g, u32 gpc_index) diff --git a/drivers/gpu/nvgpu/gv100/gr_gv100.h b/drivers/gpu/nvgpu/hal/gr/gr/gr_gv100.h similarity index 92% rename from drivers/gpu/nvgpu/gv100/gr_gv100.h rename to drivers/gpu/nvgpu/hal/gr/gr/gr_gv100.h index 6ac7ae592..43f69ef09 100644 --- a/drivers/gpu/nvgpu/gv100/gr_gv100.h +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_gv100.h @@ -25,10 +25,11 @@ #ifndef NVGPU_GR_GV100_H #define NVGPU_GR_GV100_H +#include + +struct gk20a; + void gr_gv100_set_gpc_tpc_mask(struct gk20a *g, u32 gpc_index); -void gr_gv100_program_sm_id_numbering(struct gk20a *g, - u32 gpc, u32 tpc, u32 smid); -int gr_gv100_load_smid_config(struct gk20a *g); void gr_gv100_split_fbpa_broadcast_addr(struct gk20a *g, u32 addr, u32 num_fbpas, u32 *priv_addr_table, u32 *t); diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/hal/gr/gr/gr_gv11b.c similarity index 99% rename from drivers/gpu/nvgpu/gv11b/gr_gv11b.c rename to drivers/gpu/nvgpu/hal/gr/gr/gr_gv11b.c index aab68a7bf..9d6ec8405 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_gv11b.c @@ -22,49 +22,42 @@ * DEALINGS IN THE SOFTWARE. */ -#include -#include #include #include #include #include #include -#include #include #include -#include #include #include #include #include #include -#include #include #include #include #include -#include #include #include -#include "gk20a/gr_pri_gk20a.h" +#include "gr_pri_gk20a.h" +#include "gr_pri_gv11b.h" +#include "gr_gk20a.h" +#include "gr_gp10b.h" +#include "gr_gv11b.h" + #include "common/gr/gr_priv.h" -#include "gk20a/gr_gk20a.h" - -#include "gm20b/gr_gm20b.h" - -#include "gp10b/gr_gp10b.h" - -#include "gv11b/gr_gv11b.h" -#include "gv11b/mm_gv11b.h" -#include "gv11b/gr_pri_gv11b.h" - #include -#include #include #include +#define EGPC_PRI_BASE 0x580000U +#define EGPC_PRI_SHARED_BASE 0x480000U + +#define PRI_BROADCAST_FLAGS_SMPC BIT32(17) + u32 gr_gv11b_ctxsw_checksum_mismatch_mailbox_val(void) { return gr_fecs_ctxsw_mailbox_value_ctxsw_checksum_mismatch_v(); @@ -623,13 +616,11 @@ static void gr_gv11b_handle_icache_exception(struct gk20a *g, u32 gpc, u32 tpc, gr_pri_gpc0_tpc0_sm_icache_ecc_status_reset_task_f()); } -int gr_gv11b_handle_tpc_sm_ecc_exception(struct gk20a *g, +void gr_gv11b_handle_tpc_sm_ecc_exception(struct gk20a *g, u32 gpc, u32 tpc, bool *post_event, struct channel_gk20a *fault_ch, u32 *hww_global_esr) { - int ret = 0; - /* Check for L1 tag ECC errors. */ gr_gv11b_handle_l1_tag_exception(g, gpc, tpc, post_event, fault_ch, hww_global_esr); @@ -644,8 +635,6 @@ int gr_gv11b_handle_tpc_sm_ecc_exception(struct gk20a *g, /* Check for L0 && L1 icache ECC errors. */ gr_gv11b_handle_icache_exception(g, gpc, tpc, post_event, fault_ch, hww_global_esr); - - return ret; } void gr_gv11b_set_alpha_circular_buffer_size(struct gk20a *g, u32 data) diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.h b/drivers/gpu/nvgpu/hal/gr/gr/gr_gv11b.h similarity index 89% rename from drivers/gpu/nvgpu/gv11b/gr_gv11b.h rename to drivers/gpu/nvgpu/hal/gr/gr/gr_gv11b.h index 15ebe7a73..ade03e432 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.h +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_gv11b.h @@ -25,29 +25,15 @@ #ifndef NVGPU_GR_GV11B_H #define NVGPU_GR_GV11B_H -#define EGPC_PRI_BASE 0x580000U -#define EGPC_PRI_SHARED_BASE 0x480000U - -#define PRI_BROADCAST_FLAGS_SMPC BIT32(17) - struct gk20a; -struct gr_gk20a; -struct nvgpu_gr_ctx; struct nvgpu_warpstate; -struct nvgpu_tsg_sm_error_state; -struct gr_ctx_desc; -struct nvgpu_gr_isr_data; struct gk20a_debug_output; -void gr_gv11b_create_sysfs(struct gk20a *g); -void gr_gv11b_remove_sysfs(struct gk20a *g); u32 gr_gv11b_ctxsw_checksum_mismatch_mailbox_val(void); - -int gr_gv11b_handle_tpc_sm_ecc_exception(struct gk20a *g, +void gr_gv11b_handle_tpc_sm_ecc_exception(struct gk20a *g, u32 gpc, u32 tpc, bool *post_event, struct channel_gk20a *fault_ch, u32 *hww_global_esr); -void gr_gv11b_enable_gpc_exceptions(struct gk20a *g); void gr_gv11b_set_alpha_circular_buffer_size(struct gk20a *g, u32 data); void gr_gv11b_set_circular_buffer_size(struct gk20a *g, u32 data); int gr_gv11b_dump_gr_status_regs(struct gk20a *g, @@ -92,8 +78,6 @@ int gv11b_gr_lock_down_sm(struct gk20a *g, bool check_errors); void gv11b_gr_clear_sm_hww(struct gk20a *g, u32 gpc, u32 tpc, u32 sm, u32 global_esr); -int gr_gv11b_handle_tpc_mpc_exception(struct gk20a *g, - u32 gpc, u32 tpc, bool *post_event); void gv11b_gr_init_ovr_sm_dsm_perf(void); void gv11b_gr_init_sm_dsm_reg_info(void); void gv11b_gr_get_sm_dsm_perf_regs(struct gk20a *g, @@ -118,12 +102,8 @@ void gv11b_gr_egpc_etpc_priv_addr_table(struct gk20a *g, u32 addr, u32 gpc_num, u32 tpc_num, u32 broadcast_flags, u32 *priv_addr_table, u32 *t); u32 gv11b_gr_get_egpc_base(struct gk20a *g); -int gr_gv11b_init_preemption_state(struct gk20a *g); - int gr_gv11b_handle_ssync_hww(struct gk20a *g, u32 *ssync_esr); u32 gv11b_gr_sm_offset(struct gk20a *g, u32 sm); - -u32 gr_gv11b_get_pmm_per_chiplet_offset(void); int gr_gv11b_decode_priv_addr(struct gk20a *g, u32 addr, enum ctxsw_addr_type *addr_type, u32 *gpc_num, u32 *tpc_num, u32 *ppc_num, u32 *be_num, diff --git a/drivers/gpu/nvgpu/gk20a/gr_pri_gk20a.h b/drivers/gpu/nvgpu/hal/gr/gr/gr_pri_gk20a.h similarity index 100% rename from drivers/gpu/nvgpu/gk20a/gr_pri_gk20a.h rename to drivers/gpu/nvgpu/hal/gr/gr/gr_pri_gk20a.h diff --git a/drivers/gpu/nvgpu/gv11b/gr_pri_gv11b.h b/drivers/gpu/nvgpu/hal/gr/gr/gr_pri_gv11b.h similarity index 96% rename from drivers/gpu/nvgpu/gv11b/gr_pri_gv11b.h rename to drivers/gpu/nvgpu/hal/gr/gr/gr_pri_gv11b.h index 48bef867e..dcfc36a74 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_pri_gv11b.h +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_pri_gv11b.h @@ -1,7 +1,7 @@ /* * GV11B/GV100 Graphics Context Pri Register Addressing * - * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), diff --git a/drivers/gpu/nvgpu/tu104/gr_tu104.c b/drivers/gpu/nvgpu/hal/gr/gr/gr_tu104.c similarity index 94% rename from drivers/gpu/nvgpu/tu104/gr_tu104.c rename to drivers/gpu/nvgpu/hal/gr/gr/gr_tu104.c index 4e1a44251..29d16635c 100644 --- a/drivers/gpu/nvgpu/tu104/gr_tu104.c +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_tu104.c @@ -21,25 +21,12 @@ */ #include -#include #include -#include #include -#include #include -#include -#include -#include -#include -#include "gk20a/gr_gk20a.h" -#include "gk20a/gr_pri_gk20a.h" - -#include "gp10b/gr_gp10b.h" - -#include "gv11b/gr_gv11b.h" - -#include "tu104/gr_tu104.h" +#include "gr_pri_gk20a.h" +#include "gr_tu104.h" #include diff --git a/drivers/gpu/nvgpu/tu104/gr_tu104.h b/drivers/gpu/nvgpu/hal/gr/gr/gr_tu104.h similarity index 96% rename from drivers/gpu/nvgpu/tu104/gr_tu104.h rename to drivers/gpu/nvgpu/hal/gr/gr/gr_tu104.h index 6913aebfd..3242baa2c 100644 --- a/drivers/gpu/nvgpu/tu104/gr_tu104.h +++ b/drivers/gpu/nvgpu/hal/gr/gr/gr_tu104.h @@ -26,18 +26,13 @@ #include struct gk20a; -struct nvgpu_preemption_modes_rec; -struct nvgpu_gr_ctx; int gr_tu104_init_sw_bundle64(struct gk20a *g); - void gr_tu10x_create_sysfs(struct gk20a *g); void gr_tu10x_remove_sysfs(struct gk20a *g); - int gr_tu104_get_offset_in_gpccs_segment(struct gk20a *g, enum ctxsw_addr_type addr_type, u32 num_tpcs, u32 num_ppcs, u32 reg_list_ppc_count, u32 *__offset_in_segment); - void gr_tu104_init_sm_dsm_reg_info(void); void gr_tu104_get_sm_dsm_perf_ctrl_regs(struct gk20a *g, u32 *num_sm_dsm_perf_ctrl_regs, u32 **sm_dsm_perf_ctrl_regs, diff --git a/drivers/gpu/nvgpu/hal/init/hal_gm20b.c b/drivers/gpu/nvgpu/hal/init/hal_gm20b.c index 5f07e63a7..3fea6e838 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_gm20b.c +++ b/drivers/gpu/nvgpu/hal/init/hal_gm20b.c @@ -83,6 +83,8 @@ #include "hal/gr/config/gr_config_gm20b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gm20b.h" #include "hal/gr/fecs_trace/fecs_trace_gm20b.h" +#include "hal/gr/gr/gr_gk20a.h" +#include "hal/gr/gr/gr_gm20b.h" #include "hal/pmu/pmu_gk20a.h" #include "hal/pmu/pmu_gm20b.h" #include "hal/sync/syncpt_cmdbuf_gk20a.h" @@ -97,9 +99,8 @@ #include "common/fifo/channel_gm20b.h" #include "common/pmu/pg/pg_sw_gm20b.h" -#include "gk20a/gr_gk20a.h" -#include "gm20b/gr_gm20b.h" #include "gm20b/mm_gm20b.h" + #include "hal_gm20b.h" #include diff --git a/drivers/gpu/nvgpu/hal/init/hal_gp10b.c b/drivers/gpu/nvgpu/hal/init/hal_gp10b.c index f7f12c1da..494cc266a 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_gp10b.c +++ b/drivers/gpu/nvgpu/hal/init/hal_gp10b.c @@ -100,6 +100,9 @@ #include "hal/gr/intr/gr_intr_gp10b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gm20b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gp10b.h" +#include "hal/gr/gr/gr_gk20a.h" +#include "hal/gr/gr/gr_gp10b.h" +#include "hal/gr/gr/gr_gm20b.h" #include "hal/pmu/pmu_gk20a.h" #include "hal/pmu/pmu_gm20b.h" #include "hal/pmu/pmu_gp10b.h" @@ -117,12 +120,7 @@ #include "common/fifo/channel_gm20b.h" #include "common/clk_arb/clk_arb_gp10b.h" -#include "gk20a/gr_gk20a.h" - -#include "gp10b/gr_gp10b.h" #include "gp10b/mm_gp10b.h" - -#include "gm20b/gr_gm20b.h" #include "gm20b/mm_gm20b.h" #include "hal_gp10b.h" diff --git a/drivers/gpu/nvgpu/hal/init/hal_gv100.c b/drivers/gpu/nvgpu/hal/init/hal_gv100.c index 7463ce090..d68afd684 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_gv100.c +++ b/drivers/gpu/nvgpu/hal/init/hal_gv100.c @@ -108,6 +108,11 @@ #include "hal/gr/ctxsw_prog/ctxsw_prog_gm20b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gp10b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gv11b.h" +#include "hal/gr/gr/gr_gk20a.h" +#include "hal/gr/gr/gr_gm20b.h" +#include "hal/gr/gr/gr_gp10b.h" +#include "hal/gr/gr/gr_gv100.h" +#include "hal/gr/gr/gr_gv11b.h" #include "hal/pmu/pmu_gk20a.h" #include "hal/pmu/pmu_gm20b.h" #include "hal/pmu/pmu_gp10b.h" @@ -137,25 +142,20 @@ #include "common/fifo/channel_gv11b.h" #include "common/fifo/channel_gv100.h" -#include "gk20a/gr_gk20a.h" - -#include "gm20b/gr_gm20b.h" #include "gm20b/mm_gm20b.h" #include "gp106/bios_gp106.h" -#include "gp10b/gr_gp10b.h" #include "gp10b/mm_gp10b.h" -#include "gv11b/gr_gv11b.h" #include "gv11b/mm_gv11b.h" #include "hal_gv100.h" #include "gv100/bios_gv100.h" -#include "gv100/gr_gv100.h" #include "gv100/mm_gv100.h" #include "hal/clk/clk_gv100.h" +#include #include #include #include diff --git a/drivers/gpu/nvgpu/hal/init/hal_gv11b.c b/drivers/gpu/nvgpu/hal/init/hal_gv11b.c index e1e033110..6853118f7 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_gv11b.c +++ b/drivers/gpu/nvgpu/hal/init/hal_gv11b.c @@ -109,6 +109,11 @@ #include "hal/gr/ctxsw_prog/ctxsw_prog_gm20b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gp10b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gv11b.h" +#include "hal/gr/gr/gr_gk20a.h" +#include "hal/gr/gr/gr_gm20b.h" +#include "hal/gr/gr/gr_gp10b.h" +#include "hal/gr/gr/gr_gv100.h" +#include "hal/gr/gr/gr_gv11b.h" #include "hal/pmu/pmu_gk20a.h" #include "hal/pmu/pmu_gm20b.h" #include "hal/pmu/pmu_gp106.h" @@ -131,18 +136,10 @@ #include "common/fifo/channel_gv11b.h" #include "common/clk_arb/clk_arb_gp10b.h" -#include "gk20a/gr_gk20a.h" - -#include "gm20b/gr_gm20b.h" #include "gm20b/mm_gm20b.h" - #include "gp10b/mm_gp10b.h" -#include "gp10b/gr_gp10b.h" - -#include "gv100/gr_gv100.h" #include "hal_gv11b.h" -#include "gv11b/gr_gv11b.h" #include "gv11b/mm_gv11b.h" #include diff --git a/drivers/gpu/nvgpu/hal/init/hal_tu104.c b/drivers/gpu/nvgpu/hal/init/hal_tu104.c index 83d53b1f3..a877b84cb 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_tu104.c +++ b/drivers/gpu/nvgpu/hal/init/hal_tu104.c @@ -115,6 +115,12 @@ #include "hal/gr/ctxsw_prog/ctxsw_prog_gm20b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gp10b.h" #include "hal/gr/ctxsw_prog/ctxsw_prog_gv11b.h" +#include "hal/gr/gr/gr_gk20a.h" +#include "hal/gr/gr/gr_gm20b.h" +#include "hal/gr/gr/gr_gp10b.h" +#include "hal/gr/gr/gr_gv11b.h" +#include "hal/gr/gr/gr_gv100.h" +#include "hal/gr/gr/gr_tu104.h" #include "hal/pmu/pmu_gk20a.h" #include "hal/pmu/pmu_gm20b.h" #include "hal/pmu/pmu_gp106.h" @@ -151,25 +157,16 @@ #include "hal/fifo/pbdma_status_gm20b.h" #include "common/clk_arb/clk_arb_gv100.h" -#include "gk20a/gr_gk20a.h" - -#include "gm20b/gr_gm20b.h" #include "gm20b/mm_gm20b.h" #include "hal/clk/clk_gv100.h" - -#include "gp10b/gr_gp10b.h" #include "gp10b/mm_gp10b.h" -#include "gv11b/gr_gv11b.h" #include "gv11b/mm_gv11b.h" -#include "gv100/gr_gv100.h" - #include "tu104/mm_tu104.h" #include "tu104/fifo_tu104.h" -#include "tu104/gr_tu104.h" #include "tu104/bios_tu104.h" #include "tu104/fbpa_tu104.h" #include "hal_tu104.h" diff --git a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h index 8ff1cff16..1b67c3865 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h @@ -359,7 +359,7 @@ struct gpu_ops { u32 global_esr); void (*get_esr_sm_sel)(struct gk20a *g, u32 gpc, u32 tpc, u32 *esr_sm_sel); - int (*handle_tpc_sm_ecc_exception)(struct gk20a *g, + void (*handle_tpc_sm_ecc_exception)(struct gk20a *g, u32 gpc, u32 tpc, bool *post_event, struct channel_gk20a *fault_ch, u32 *hww_global_esr); diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c index 26f826fb0..de443d2a6 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c @@ -40,7 +40,8 @@ #include #include -#include "gk20a/gr_gk20a.h" +/* remove gr_gk20a.h after moving nvgpu_warpstate to separate header */ +#include "hal/gr/gr/gr_gk20a.h" #include "common/gr/gr_priv.h" #include "ioctl_ctrl.h" diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c b/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c index 5d801d7d5..83c4ce22e 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_dbg.c @@ -42,9 +42,10 @@ #include -#include "common/gr/gr_priv.h" +/* Access gr_gk20a_suspend_context and gr_gk20a_resume_context functions */ +#include "hal/gr/gr/gr_gk20a.h" -#include "gk20a/gr_gk20a.h" +#include "common/gr/gr_priv.h" #include "os_linux.h" #include "platform_gk20a.h" #include "ioctl_dbg.h" diff --git a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c index 4750c5722..c2c9d0489 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c @@ -43,7 +43,6 @@ #include "platform_gk20a.h" #include "platform_gk20a_tegra.h" #include "platform_gp10b.h" -#include "platform_gp10b_tegra.h" #include "scale.h" /* Select every GP10B_FREQ_SELECT_STEP'th frequency from h/w table */ diff --git a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.h b/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.h deleted file mode 100644 index 85b46b9a7..000000000 --- a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef _PLATFORM_GP10B_TEGRA_H_ -#define _PLATFORM_GP10B_TEGRA_H_ - -#include "gp10b/gr_gp10b.h" - -#endif diff --git a/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c index c5ee846c0..4827f3712 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c @@ -38,11 +38,9 @@ #include "scale.h" #include "platform_gp10b.h" -#include "platform_gp10b_tegra.h" #include "os_linux.h" #include "platform_gk20a_tegra.h" -#include "gv11b/gr_gv11b.h" #define EMC3D_GV11B_RATIO 500 diff --git a/drivers/gpu/nvgpu/os/linux/sysfs.c b/drivers/gpu/nvgpu/os/linux/sysfs.c index 5bf320d20..6acf35b79 100644 --- a/drivers/gpu/nvgpu/os/linux/sysfs.c +++ b/drivers/gpu/nvgpu/os/linux/sysfs.c @@ -36,7 +36,6 @@ #include "os_linux.h" #include "sysfs.h" #include "platform_gk20a.h" -#include "gv11b/gr_gv11b.h" #define PTIMER_FP_FACTOR 1000000