Commit Graph

343 Commits

Author SHA1 Message Date
Thomas Fleury
1160f083d4 gpu: nvgpu: move ce code to common/ce and hal/ce
Merged gk20a_ce_delete_context and gk20a_ce_delete_context_priv.

Renamed
- gk20a_init_ce_support -> nvgpu_ce_init_support
- gk20a_ce_destroy -> nvgpu_ce_destroy
- gk20a_ce_suspend -> nvgpu_ce_suspend
- gk20a_ce_create_context -> nvgpu_ce_create_context
- gk20a_ce_delete_context -> nvgpu_ce_delete_context
- gk20a_ce_execute_ops -> nvgpu_ce_execute_ops
- gk20a_ce_prepare_submit -> nvgpu_ce_prepare_submit
- gk20a_ce_put_fences -> nvgpu_ce_put_fences
- gk20a_ce_delete_gpu_context -> nvgpu_ce_delete_gpu_context
- gk20a_ce_get_method_size -> nvgpu_ce_get_method_size
- gk20a_gpu_ctx -> nvgpu_ce_gpu_ctx
- gk20a_gpu_ctx_from_list -> nvgpu_ce_gpu_ctx_from_list
- gk20a_ce_app -> nvgpu_ce_app
- gk20a_ce_debugfs_init -> nvgpu_ce_debugfs_init
- gk20a_get_valid_launch_flags -> nvgpu_ce_get_valid_launch_flags
- gk20a_ce2_isr -> gk20a_ce2_stall_isr
- gp10b_ce_isr -> gp10b_ce_stall_isr
- gv11b_ce_isr -> gv11b_ce_stall_isr

Inlined
- ce*_nonblockpipe_isr
- ce*_blockpipe_isr
- ce*_launcherr_isr

Added ce_priv.h for ce private definitions.

Moved files to common/ce and hal/fifo/ce
- ce2.c -> common/ce2/ce.c
- ce2_gk20a.c -> hal/ce/ce2_gk20a.c
- ce2_gk20a.h -> hal/ce/ce2_gk20a.h
- ce_gp10b.c -> hal/ce/ce_gp10b.c
- ce_gp10b.h -> hal/ce/ce_gp10b.h
- ce_gv11b.c -> hal/ce/ce_gv11b.c
- ce_gv11b.h -> hal/ce/ce_gv11b.h

Updated makefiles and #include directives

Jira NVGPU-1992

Change-Id: Ia6064bf51b7a254085be43a112d056cb6fb6c3b2
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2093503
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-19 13:55:11 -07:00
Thomas Fleury
7fb397b0b3 gpu: nvgpu: add format_gpfifo_entry HAL for pbdma
Removed dependency on pbdma hw headers in ce2, cde and submit.

Added the following HAL to format gpfifo entries:
- pbdma.format_gpfifo_entry

Jira NVGPU-1992
Jira NVGPU-1990

Change-Id: I322d6bcd832b0ea5bbe2c2871b8f96b2793d8a65
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2093502
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-19 13:54:56 -07:00
Nicolas Benech
97d65cb60d gpu: nvgpu: fix MISRA 17.7 in nvgpu.hal.*
MISRA Rule-17.7 requires the return value of all functions to be
used. Fix is either to use the return value or change the function
to return void. This patch contains fixes for all 17.7 violations
in the following units:
- nvgpu.hal.bus
- nvgpu.hal.fb
- nvgpu.hal.fifo
- nvgpu.hal.gr

JIRA NVGPU-3153

Change-Id: Iac9477ee7c36a0f2f8840e178dc5418e600f9c84
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2100652
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-19 12:14:46 -07:00
Deepak Nibade
d0907087c1 gpu: nvgpu: remove gfxp_wfi_timeout_count/unit fields from gr.ctx_vars struct
gfxp_wfi_timeout_count/unit fields were stored in gr_gk20a.ctx_vars
struct so that any user could configure them through sysfs nodes

But the sysfs nodes are legacy and not being actively used by anyone.
Hence delete the sysfs nodes to configure these fields.

Since the gfxp timeout unit/count can now be statically programmed,
make following changes
- remove g->ops.gr.init_gfxp_wfi_timeout_count() hal
- remove g->ops.gr.get_max_gfxp_wfi_timeout_count() hal
- update g->ops.gr.init.preemption_state() hals to configure the values
  using macros instead of caller passing the values
- update g->ops.gr.init.gfxp_wfi_timeout() hals to configure the values
  using macros instead of caller passing the values

Finally, we don't need to store gfxp_wfi_timeout_count/unit fields
anymore, hence delete them from gr_gk20a.ctx_vars

Jira NVGPU-3112

Change-Id: Idbe5ab3053228dd177aca253545aac36d38ca8ad
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2100219
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-19 08:44:44 -07:00
Vinod G
556e139077 gpu: nvgpu: Cleanup for gr_gk20a header
Removed unused struct from gr_gk20a.h
Change static allocation for struct gr_gk20a to dynamic type.
Change all the files that being affected by that change.

Call gr allocation from corresponding init_support functions, which
are part of the probe functions.
nvgpu_pci_init_support in pci.c
vgpu_init_support in vgpu_linux.c
gk20a_init_support in module.c

Call gr free before the gk20a free call in nvgpu_free_gk20a.

Rename struct gr_gk20a to struct nvgpu_gr

JIRA NVGPU-3132

Change-Id: Ief5e664521f141c7378c4044ed0df5f03ba06fca
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2095798
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-19 00:04:00 -07:00
Philip Elcan
37253f8ccb gpu: nvgpu: init: cleanup headers
Remove unnecessary header files from nvgpu.common.hal.init unit.

Change-Id: I60f979cd700c3a8fc5fd78cfcac0298e1766ac25
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2098916
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-18 15:56:46 -07:00
Philip Elcan
f0640b9d10 gpu: nvgpu: create nvgpu.common.hal.init unit
Move hal init from chip-specific paths to hal/init. Update makefiles and
include paths to match.

JIRA NVGPU-2023

Change-Id: I810c817bb0ba83dcf5ed4d05df502e85c2fd77df
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2098915
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-18 15:56:31 -07:00
Seema Khowala
da9dee85e2 gpu: nvgpu: move mmu fault handling to hal/fifo
Move chip specific mmu fault handling from
fifo_gk20a.c to hal/fifo/mmu_fault_gk20a.c

Move gk20a_teardown_ch_tsg to hal/rc/rc_gk20a.c

JIRA NVGPU-1314

Change-Id: Idf88b1c312bc9f46c2508f2c63e948d71d622297
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094051
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-18 15:56:08 -07:00
Seema Khowala
6ba1f5db3b gpu: nvgpu: move chip specific teardown_mask/unmask_intr
Move chip specific functions for teardown_mask_intr and
teardown_unmask_intr to hal/fifo/fifo_intr_[chip].[ch]

Renamed
teardown_mask_intr -> intr_set_recover_mask
teardown_unmask_intr -> intr_unset_recover_mask

JIRA NVGPU-1314

Change-Id: If233565cbdb09d77cfebd4346edcc3fe64584355
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2093980
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-18 15:55:53 -07:00
Seema Khowala
ca628dfd6e gpu: nvgpu: move engine functions to engines.c
Removed
fifo.runlist_busy_engines ops

Moved to engines.c and renamed
gk20a_fifo_get_failing_engine_data -> nvgpu_engine_find_busy_doing_ctxsw
gk20a_fifo_get_faulty_id_type -> nvgpu_engine_get_id_and_type
gk20a_fifo_runlist_busy_engines -> nvgpu_engine_get_runlist_busy_engines

JIRA NVGPU-1314

Change-Id: I89c81f331321d47a616a785082d66f9b4a51ff71
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2093788
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-18 15:55:24 -07:00
Vinod G
058057853c gpu: nvgpu: add fecs_read_ctxsw_status hal
Add fecs hal to read ctxsw_status0 and ctxsw_status1.
This helps to avoid direct fecs register access from
gr isr error report function.

JIRA NVGPU-3016

Change-Id: I6f9725f825ba3b80b309cc2e95a1069d3c03f34f
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2098248
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-16 22:35:30 -07:00
Vinod G
3d2942e412 gpu: nvgpu: move nvgpu_report_gr_exception to common.gr.intr
Move the nvgpu_report_gr_exception call from gr_gk20a to
gr_intr.c as nvgpu_gr_intr_report_exception

Move local function gk20a_gr_get_channel_from_ctx to gr_intr.c
as nvgpu_gr_intr_get_channel_from_ctx

JIRA NVGPU-1891

Change-Id: I21521ad50989582d8f166a98a21ea3b1dcd3bbff
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2098229
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-16 22:35:15 -07:00
Alex Waterman
3a764030b1 gpu: nvgpu: Add new mm HAL and move cache code to that HAL
Add a new MM HAL directory to contain all MM related HAL units.
As part of this change add cache unit to the MM HAL. This contains
several related fixes:

1. Move the cache code in gk20a/mm_gk20a.c and gv11b/mm_gv11b.c to
   the new cache HAL. Update makefiles and header includes to take
   this into account. Also rename gk20a_{read,write}l() to their
   nvgpu_ variants.

2. Update the MM gops: move the cache related functions to the new
   cache HAL and update all calls to this HAL to reflect the new
   name.

3. Update some direct calls to gk20a MM cache ops to pass through
   the HAL instead.

4. Update the unit tests for various MM related things to use the
   new MM HAL locations.

This change accomplishes two architecture design goals. Firstly it
removes a multiple HW include from mm_gk20a.c (the flush HW header).
Secondly it moves code from the gk20a/ and gv11b/ directories into
more proper locations under hal/.

JIRA NVGPU-2042

Change-Id: I91e4bdca4341be4dbb46fabd72622b917769f4a6
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2095749
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-16 17:06:42 -07:00
Seema Khowala
c570ba99ed gpu: nvgpu: move sched error bad tsg recovery
Move sched error bad tsg recovery from fifo_intr_gv11b.c
to common/rc/rc.c

JIRA NVGPU-1314

Change-Id: Ic731a3162cad2fe184d764f0b3ad98acc1f382cb
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2095621
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-16 17:05:49 -07:00
Seema Khowala
1882a7413d gpu: nvgpu: move runlist update timeout rc to common/rc
Move runlist update timeout recovery from runlist.c to
rc.c
Move RC_TYPE defines from fifo.h to rc.h

JIRA NVGPU-1314

Change-Id: I66925ca9fba904c523be69ad99808e3de33a7d46
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2093666
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-16 17:05:10 -07:00
Deepak Nibade
d8ec4e4e12 gpu: nvgpu: move zcull size initialization to falcon unit
Move zcull size initialization to hal.gr.zcull unit.
This removes zcull dependency on falcon unit

Add new variable zcull_image_size to gr_gk20a.ctx_vars struct

Pass the size to nvgpu_gr_zcull_init()/vgpu_gr_init_gr_zcull() as
parameter to initialize zcull info

Jira NVGPU-3112

Change-Id: I54d966073dad658b4aad3a529f44c0478208b10c
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2098507
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-16 13:05:20 -07:00
Thomas Fleury
3c4d6c95df gpu: nvgpu: move usermode to hal/fifo
Moved the following HALs from fifo to usermode
- fifo.ring_channel_doorbell -> usermode.ring_doorbell
- fifo.doorbell_token -> usermode.doorbell_token
- fifo.usermode_base -> usermode.base

Created the following HAL
- usermode.setup_hw

Jira NVGPU-2978

Change-Id: I856ea24c126fa22d2f3fe860d4b14087c6d7330b
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094813
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-16 13:04:27 -07:00
Seema Khowala
c0cf011600 gpu: nvgpu: move gk20a_decode_pbdma_chan_eng_ctx_status
Moved from fifo_gk20a.c to common/fifo/fifo.c
gk20a_decode_pbdma_chan_eng_ctx_status

Renamed
gk20a_decode_pbdma_chan_eng_ctx_status ->
nvgpu_fifo_decode_pbdma_ch_eng_status

JIRA NVGPU-2950

Change-Id: I10ec766a28b1b7dabd334bacfb76a6aa14f49fe6
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094651
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-16 10:46:02 -07:00
Seshendra Gadagottu
12a06fe060 gpu: nvgpu: move ctxsw related data to gr falcon
Added new function to add require sw initionaltions. before enabling
gr hw. Added nvgpu_netlist_init_ctx_vars and nvgpu_gr_falcon_init_support
as part of this function:
int nvgpu_gr_prepare_sw(struct gk20a *g)

Moved following structure defs from gr_gk20a.h to gr_falcon.h and
renamed appropriately:
gk20a_ctxsw_ucode_segment -> nvgpu_ctxsw_ucode_segment
gk20a_ctxsw_ucode_segments -> nvgpu_ctxsw_ucode_segments

Moved following struct to gr_falcon_priv.h:
gk20a_ctxsw_ucode_info -> nvgpu_ctxsw_ucode_info

Moved following data from struct gk20a to new structure in gr_falcon_priv.h
struct nvgpu_gr_falcon:
struct nvgpu_mutex ctxsw_disable_lock;
int ctxsw_disable_count;
struct gk20a_ctxsw_ucode_info ctxsw_ucode_info;

Also moved following data from gr_gk20.h to struct nvgpu_gr_falcon:
struct nvgpu_mutex fecs_mutex;
bool skip_ucode_init;
wait_ucode_status
GR_IS_UCODE related enums
eUcodeHandshakeInit enums

Now add a pointer to this new data structure from struct gr_gk20a to
access gr_falcon related data and modified code to reflect this
change:
struct nvgpu_gr_falcon *falcon;

Added following functions to access gr_falcon data:
struct nvgpu_mutex *nvgpu_gr_falcon_get_fecs_mutex(
				struct nvgpu_gr_falcon *falcon);
struct nvgpu_ctxsw_ucode_segments *nvgpu_gr_falcon_get_fecs_ucode_segments(
				struct nvgpu_gr_falcon *falcon);
struct nvgpu_ctxsw_ucode_segments *nvgpu_gr_falcon_get_gpccs_ucode_segments(
				struct nvgpu_gr_falcon *falcon);
void *nvgpu_gr_falcon_get_surface_desc_cpu_va(
				struct nvgpu_gr_falcon *falcon);

JIRA NVGPU-1881

Change-Id: I9100891989b0d6b57c49f2bf00ad839a72bc7c7e
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2091358
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-16 04:05:37 -07:00
Mahantesh Kumbar
2cf8feedd8 gpu: nvgpu: Create PMU HAL
Moved PMU HAL code from common/pmu/pmu_chip.c/h to hal at path
hal/pmu/pmu_chip.c/h file.

some code may need more cleanup but will take care in new patches

JIRA NVGPU-2002

Change-Id: I281a2c15e55292e0716b0a4c71f4469c97dd71ab
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2089410
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-16 02:54:46 -07:00
Deepak Nibade
2adcb51a45 gpu: nvgpu: add hal.gr.init hal to detect SM arch
Add new hal g->ops.gr.init.detect_sm_arch() in hal.gr.init unit to get
SM arch information. Remove g->ops.gr.detect_sm_arch().

Move corresponding functions to hal.gr.init unit

Remove unused function declaration for gr_gv11b_init_sw_veid_bundle()

Jira NVGPU-2961

Change-Id: Idfd5ce19c06978dc31cbcec2cd01cb2912eb3cf9
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2097534
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-15 13:15:01 -07:00
Deepak Nibade
efae66471c gpu: nvgpu: add hal.gr.init hal to get patch slots
Add new hal g->ops.gr.init.get_patch_slots() in hal.gr.init unit to get
patch slot count. Remove g->ops.gr.get_patch_slots().

Move corresponding functions to hal.gr.init unit

This hal does not need to be set for vGPU since it is not called in
that case

Jira NVGPU-2961

Change-Id: Ide488ae93af53a755da95faa268563070bd24bea
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2097533
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-15 13:14:46 -07:00
Deepak Nibade
e25afe5ea2 gpu: nvgpu: add hal.gr.init hal to get max subctx count
Add new HAL API g->ops.gr.init.get_max_subctx_count() in hal.gr.init
unit that returns max subctx count defined by h/w

Use this new hal in all GR code instead of using value stored in struct
fifo_gk20a

Jira NVGPU-2961

Change-Id: I5db1d827c3b7581a5ba7aca4314ba2f5a590d80c
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2097532
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-15 13:14:32 -07:00
Philip Elcan
e3f5e6c271 gpu: nvgpu: gr: fix MISRA 10.3 violations
MISRA Rule 10.3 prohibits assigning objects of different essential or
narrower type. This fixes MISRA 10.3 violations in the gr unit.

JIRA NVGPU-3115

Change-Id: I9817d74eb927f6e52a13d31114e2c579fd65dd32
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094443
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-15 10:55:57 -07:00
Deepak Nibade
4ba9592877 gpu: nvgpu: add common.gr.setup api to free subctx
Add new API nvgpu_gr_setup_free_subctx() in common.gr.ctx to free subctx
Call this via hal g->ops.gr.setup.free_subctx()

Subctx allocations happens through gr.setup api right now hence it makes
sense to provide subctx free api through same unit

Remove g->ops.channel.free_ctx_header() hal since we now have gr.setup
hal

Remove gv11b/subctx_gv11b.* files since they are no longer needed and
all the code in them has been moved to common units

Jira NVGPU-1886

Change-Id: I3d58fc3665ed9b6ffba830249a4cd30af7b857f4
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094994
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-14 17:33:54 -07:00
Vinod G
4a606720e2 gpu: nvgpu: Move set_shader_exception to hal
Move set_shader_exception function which involves
register read/writes to hal.gr.intr

Use this hal from handle_sw_method functions.

JIRA NVGPU-3016

Change-Id: I834363d111b0a0a971c95119c662200237369c96
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094751
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-13 10:24:41 -07:00
Vinod G
3ef8e6b099 gpu: nvgpu: add fecs_host_intr hals
Add three hals in gr.falcon
- fecs_host_intr_status
 This reads the fecs_host_intr_status, set the variables in the
 nvgpu_fecs_host_intr_status struct to report back for gr to handle the
 interrupts properly
- fecs_host_clear_intr
 This helps to clear the needed bits in fecs_host_intr.
- read_fecs_ctxsw_mailbox
 This reads the ctxsw_mailbox register based on register index.

Use these hals in gk20a_gr_handle_fecs_error and
gp10b_gr_handle_fecs_error functions.

JIRA NVGPU-1881

Change-Id: Ia02a254acc38e7e25c7c3605e9f1dda4da898543
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2093917
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-13 10:24:26 -07:00
Vinod G
815c102e5d gpu: nvgpu: move get_nonpes_aware_tpc hal to hal.gr.init
Move get_nonpes_aware_tpc hal to hal.gr.init . This hal is
implemented for gv11b.

Update sm_id_numbering hal to pass the gr_config struct pointer
as parameter to avoid dereferencing from gr inside hal.

JIRA NVGPU-2951

Change-Id: I1e06b634cc36741e116e41e581a18c7f5b373945
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2093835
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-13 10:24:12 -07:00
Seshendra Gadagottu
4faeea63aa gpu: nvgpu: create class unit
Created class unit under hal and moved all valid class check related
functionality to this unit. Moved all class defs from gr to a new header
include/nvgpu/class.h.

Moved following hals from gr to newly created class unit:
bool (*is_valid_class)(struct gk20a *g, u32 class_num); -->
		 bool (*is_valid)(u32 class_num);
bool (*is_valid_gfx_class)(struct gk20a *g, u32 class_num); -->
		bool (*is_valid_gfx)(u32 class_num);
bool (*is_valid_compute_class)(struct gk20a *g, u32 class_num); -->
		bool (*is_valid_compute)(u32 class_num);

JIRA NVGPU-3109

Change-Id: I01123e9b984613d4bddb2d8cf23d63410e212408
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2095542
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-13 09:13:48 -07:00
Vinod G
b0973eacbb gpu: nvgpu: Add handle_class_error hal
Add handle_class_error hal, which reports more data
regarding class error. Move all register access code in
gk20a_gr_handle_class_error function to this hal.

JIRA NVGPU-3016

Change-Id: I868268267f1879974795c2829e816a6956551b58
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2092877
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-12 15:33:43 -07:00
Vinod G
1095f0eea3 gpu: nvgpu: Update read_pending_interrupts hal
Modify read_pending_interrupts hal to report the pending gr interrupt
bit back to isr to process.

semaphore_timeout interrupt bit is removed after gk20a chip.
Remove that bit checking from the isr function.
Remove some static functions for handling interrupt, which only calls
gk20a_gr_set_error_notifier. Call that function directly from isr

JIRA NVGPU-3016

Change-Id: Ic7084f038114fbce6d6b5c10a806dee6280e5c0a
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2092876
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-12 15:33:29 -07:00
Alex Waterman
28c98f0f7d gpu: nvgpu: Move ECC code into ECC hal directory
Refactor the ECC code present under gp10b/, gv11b/, and tu104/. To
do this a few things were required:

Firstly, move the ecc related C and H files under the aforementioned
directories over to their new home under hal/gr/ecc/. Also copy over
the ECC HAL code present in gp10b/gp10b.c - not sure why this was
there but it, too, needed to be refactored. Also handle all the
updated header paths and Makefiles to take these movements into
account.

Secondly add a new HAL in GR (gr.ecc) to handle ECC HAL ops. There's
only two: detect and init. init() was copied over from gr and detect
was added so that the common ECC code can call it in a chip agnostic
way. This is required so that the ECC detect can be moved out of the
gp10b init characteristics function.

Lastly update the ECC init flow in the common ecc module to call
detect() right before init().

JIRA NVGPU-3074

Change-Id: Iba1464a904f9a91a45f30902beadf6f912607e40
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2090977
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-12 15:32:50 -07:00
Antony Clince Alex
2a226092a6 gpu: nvgpu: configure ctxsw ucode wdt timeout period
At present the ctxsw ucode wdt timeout period is set to maximum.
Calculate the wdt count value as per the specified timeout and SYSCLK
frequency.

Jira NVGPU-1861

Change-Id: Id85abcccb256e69191bd0540aa7980029ddefc85
Signed-off-by: Antony Clince Alex <aalex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2088572
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-12 12:13:53 -07:00
Deepak Nibade
c26ae849b5 gpu: nvgpu: create common.hal.ptimer unit
Create common.hal.ptimer unit by moving all ptimer chip files under
hal/ directory

Update Makefiles and include paths accordingly

Jira NVGPU-2028

Change-Id: Ie5ce1cf4604ee26bc51bad8856a4141df085d451
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094289
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-12 04:05:18 -07:00
Deepak Nibade
88c8baa29f gpu: nvgpu: create common.hal.regops unit
Create common.hal.regops unit by moving all regops chip files under
hal/ directory

Update Makefiles and include paths accordingly

Jira NVGPU-2037

Change-Id: Iac1833b8916d919f7d448d17f5dd7a853760f55c
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094288
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-12 04:05:04 -07:00
Nitin Kumbhar
8664b3be6c gpu: nvgpu: make ctx structs private
Add ctx_priv.h header for structs which are used within
nvgpu_gr_ctx. APIs are added to manage fields of nvgpu_gr_ctx.

JIRA NVGPU-3060

Change-Id: I396fbbb5199e354c62772e901e3bbf61d135f3b1
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2090398
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-12 04:04:31 -07:00
Thomas Fleury
9f233a6ab4 gpu: nvgpu: add setup_sw and cleanup_sw for pbdma
Create common/fifo/pbdma.c and move pbdma common code:
- nvgpu_pbdma_setup_sw
- nvgpu_pbdma_cleanup_sw
- nvgpu_pbdma_find_for_runlist
- nvgpu_pbdma_init_intr_descs

Moved the following HAL from fifo to pbdma
- fifo.find_pbdma_for_runlist -> pbdma.find_for_runlist

Added the following HALs
- fifo.init_pbdma_map
- pbdma.setup_sw
- pbdma.cleanup_sw

Jira NVGPU-2950

Change-Id: I17802ee61de669c3e17792b4505efb5e2bf530d3
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2092999
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-12 01:15:59 -07:00
Thomas Fleury
2dcf026e12 gpu: nvgpu: add setup_hw HAL for pbdma
Add the following HAL
- pbdma.setup_hw

This HAL takes care of setting up pbdma timeout.

Jira NVGPU-2950

Change-Id: I966d52efcd8d199c5aa5d248c7152fc47be7a431
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2093000
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-12 01:15:44 -07:00
Seema Khowala
66cb9495a5 gpu: nvgpu: move mmu_fault_pending ops out from mm
Moved
-mmu_fault_pending mm ops to is_mmu_fault_pending mc ops
-mmu_fault_pending fb ops to is_mmu_fault_pending fb.intr ops. This
is needed to check if mmu fault intr is pending for volta onwards.

Added
is_mmu_fault_pending fifo ops. This is needed to check if mmu fault
interrupt is pending for chips prior to volta

JIRA NVGPU-1313

Change-Id: Ie8e778387cd486cb19b18c4aee734c581dcd9229
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094895
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-11 22:25:01 -07:00
Vinod G
63fb543f63 gpu: nvgpu: Clean up gr_gk20a.h and gk20a.h
Initial cleanup process of gk20a.h
Remove unused structs. Add more structs to avoid including
gr_gk20a.h. This need more structs to be moved from gr_gk20a.h
Remove including pramin.h/acr.h/falcon.h and sim.h

Removed unused struct and netlist.h include from gr_gk20a.h

JIRA NVGPU-3132
JIRA NVGPU-3079

Change-Id: I1e965dd572e8e45bb20fca73ea566a6411aeebc1
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094732
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-11 22:24:46 -07:00
Seshendra Gadagottu
6fb37f04ca gpu: nvgpu: move chip specific perf files to hal
Moved chip specific perf related files to hal from common.

JIRA NVGPU-3131

Change-Id: I4fb1b6a619712ee82e20b2b08a76ad5361e690c1
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2095563
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-11 18:53:55 -07:00
Thomas Fleury
4c84bf54ff gpu: nvgpu: move runlist HALs to hal/fifo
Move runlists HALs to hal/fifo.
Update makefiles and include directives.

Renamed
- gk20a_readl -> nvgpu_readl
- gk20a_writel -> nvgpu_writel

Jira NVGPU-1988

Change-Id: Ia8f9f50d42f0863c522a0d2caca0b9c775be597a
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2092749
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-11 16:45:30 -07:00
Philip Elcan
8e9ec4f1b7 gpu: nvgpu: fifo: fix MISRA 10.3 violations
MISRA Rule 10.3 prohibits assigning objects of different essential or
narrower type. This fixes MISRA 10.3 violations in the fifo unit.

JIRA NVGPU-3115

Change-Id: I5a0e1134f731631faa3aa31b5d88781c200306e0
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094444
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-11 15:05:52 -07:00
Seshendra Gadagottu
6489b140ae gpu: nvgpu: remove un-used functions from fb_gv100
Following two functions modified and moved to fb intr
sub-unit. So, cleaning-up code to remove them.

void gv100_fb_enable_hub_intr(struct gk20a *g);
void gv100_fb_disable_hub_intr(struct gk20a *g);

JIRA NVGPU-2034

Change-Id: Ic2ff88fcfb66b243a87ae4ba75177dedc68f1d2b
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094540
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-11 14:14:59 -07:00
Seshendra Gadagottu
eb7ba260fb gpu: nvgpu: move chip specific netlist files to hal
Move chip specific netlist files from common to hal.

JIRA NVGPU-2040

Change-Id: I88875d0720e93c99cf470df5945efaef41abb9de
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2093859
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-11 01:37:59 -07:00
Seema Khowala
b4ec1c5dff gpu: nvgpu: move dump_channel_status from fifo to channel
Renamed and moved from fifo to channel
gk20a_debug_dump_all_channel_status_ramfc -> nvgpu_channel_debug_dump_all
gk20a_dump_channel_status_ramfc -> gk20a_channel_debug_dump
gv11b_dump_channel_status_ramfc -> gv11b_channel_debug_dump

Moved nvgpu_channel_dump_info struct to channel.h
Moved nvgpu_channel_hw_state struct to channel.h
Moved dump_channel_status_ramfc fifo ops to channel ops
as debug_dump

JIRA NVGPU-2978

Change-Id: I696e5029d9e6ca4dc3516651b4d4f5230fe8b0b0
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2092709
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-10 16:15:50 -07:00
Nitin Kumbhar
c649ca9fd6 gpu: nvgpu: move gr config structs to priv header
Move sm_info and nvgpu_gr_config struts to a private
header and add APIs to access member fields.

JIRA NVGPU-3060

Change-Id: I90f44333f19cb8cb939c0a0f90d9a03f6c036080
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2091563
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-10 15:04:21 -07:00
Thomas Fleury
3bb0f8ec0b gpu: nvgpu: add include file in tsg_gv11b.c
Add missing include <nvgpu/dma.h> in tsg_gv11b.c
It is needed for nvgpu_dma_* operations.

Jira NVGPU-2979

Change-Id: Iaea2ea40e58ca341f01aa35f948cd340107a1045
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2094486
Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Tested-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
2019-04-10 11:05:46 -07:00
Thomas Fleury
9121f84e67 gpu: nvgpu: move post_event_id from fifo to tsg
Moved the following HAL from fifo to tsg:
- tsg.post_event_id

Implemented as
- nvgpu_tsg_post_event_id

Jira NVGPU-2979

Change-Id: I074233aaf96b33d011b50b1465ea5d76e0a43689
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2087186
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-10 10:36:44 -07:00
Thomas Fleury
35e9663bd0 gpu: nvgpu: move eng_method_bufers from fifo to tsg
Moved init/deinit eng method buffers from fifo to tsg
- tsg.init_eng_method_buffers
- tsg.deinit_eng_method_buffers

Moved gv11b_fifo_init_ramfc_eng_method_buffer to the
following tsg HAL:
- tsg.bind_channel_eng_method_buffers

This HAL is now called during bind_channel.

Added the following ramin HAL:
- ramin.set_ramfc_eng_method_buffer

Jira NVGPU-2979

Change-Id: I96f6ff15d2176d4e3714fa8fe65a9126b3fff82c
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2087185
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-10 10:36:28 -07:00