Commit Graph

297 Commits

Author SHA1 Message Date
Nitin Kumbhar
82b5f356d0 gpu: nvgpu: make nvgpu_gr_subctx a priv struct
Make struct nvgpu_gr_subctx a private struct and add
an api to access subctx header.

JIRA NVGPU-3060

Change-Id: Ia1f0471084f90eddd31ddc6869bd767866f9b4e2
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2088531
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-06 04:34:25 -07:00
Seshendra Gadagottu
7ea63fbe0b gpu: nvgpu: move init context functionality to gr falcon unit
Moved following functionality from gr to gr falcon common
gr_gk20a_init_ctxsw -> nvgpu_gr_falcon_init_ctxsw
gr_gk20a_init_ctx_state -> nvgpu_gr_falcon_init_ctx_state
gk20a_init_gr_bind_fecs_elpg -> nvgpu_gr_falcon_bind_fecs_elpg

Replaced code in gr_gk20a.c by calling corresponding gr falcon common
calls and moved all relevant code to gr falcon unit.

Moved following gr ops from gr to gr falcon:
int (*init_ctx_state)(struct gk20a *g);

Moved functionality from gr to relevant gr falcon hals:
gr_gk20a_init_ctx_state -> gm20b_gr_falcon_init_ctx_state
gr_gp10b_init_ctx_state -> gp10b_gr_falcon_init_ctx_state

JIRA NVGPU-1881

Change-Id: I027e1972a7747275311df99679235804dc0e16fe
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2084391
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-06 04:34:11 -07:00
Aparna Das
bd8b866758 gpu: nvgpu: vgpu: cleanup vgpu.h
- delete vgpu_is_reduced_bar1(). Current implementation maps only
that portion of BAR1 that is reserved for guest in case of
reduced BAR1. However this code is obsolete and reduced BAR1
check is always false. Delete related function vgpu_is_reduced_bar1()
and conditional mapping.

- move vgpu_mm_bar1_map_userd() delcaration from vgpu.h
to mm_vgpu.h

- move vgpu_gp10b_init_hal() and vgpu_gv11b_init_hal()
declarations from vgpu.h to new header files
vgpu/gp10b/vgpu_hal_gp10b.h and vgpu/gv11b/vgpu_hal_gv11b.h
respectively.

Jira GVSCI-334

Change-Id: I11a297a0aba1afd8b0ad022169ba7f734bcd952c
Signed-off-by: Aparna Das <aparnad@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2081152
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-04 13:27:33 -07:00
Aparna Das
862bddc3eb gpu: nvgpu: vgpu: delete vgpu.c
Create vgpu unit init. Move init related functions from
vgpu.c to init_vgpu.c under common/vgpu/init path and
create corresponding header file.

Create vgpu child unit init hal. Move functions
vgpu_init_hal() and vgpu_detect_chip() to a new
file init_hal_vgpu.c under common/vgpu/init path and
create corresponding header file.

Also move os specific hal init vgpu function declaration
vgpu_init_hal_osi() to a new file
include/nvgpu/vgpu/os_init_hal_vgpu.h separating it from
generic vgpu.h

Jira GVSCI-334

Change-Id: I07290e3be5061a2349689228265c8b28ebadab88
Signed-off-by: Aparna Das <aparnad@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2081153
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-04 13:27:18 -07:00
Aparna Das
13b07bdac2 gpu: nvgpu: vgpu: move fifo functions to fifo_vgpu file
File vgpu.c contains fifo related function implementations.
Move these to fifo_vgpu.c and make changes in corresponding
header file.

Jira GVSCI-334

Change-Id: I83d53f75949f6400285f5bc9cce0242aa97554dc
Signed-off-by: Aparna Das <aparnad@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2082185
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-04 13:26:53 -07:00
Aparna Das
1a6a28e23b gpu: nvgpu: vgpu: create vgpu intr unit
Move interrupt related functions to intr/intr_vgpu.c
creating new vgpu unit intr.

Jira GVSCI-334

Change-Id: I6473b9b932cef34c30a02b42228cbeb9e0dea195
Signed-off-by: Aparna Das <aparnad@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2082184
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-04 13:26:38 -07:00
Aparna Das
012f46ef74 gpu: nvgpu: vgpu: create common ivc unit
Move ivc comm related functions to ivc/comm_vgpu.c.
These functions call os specific ivc counterparts.

Jira GVSCI-334

Change-Id: I886dddb71c43975cb83a3508005ab1136b7adadc
Signed-off-by: Aparna Das <aparnad@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2082183
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-04 13:26:23 -07:00
Aparna Das
1ec9183d47 gpu: nvgpu: vgpu: create ptimer unit
Move vgpu ptimer related functions from vgpu.c to
ptimer/ptimer_vgpu.c creating new vgpu unit ptimer.

Jira GVSCI-334

Change-Id: Ic039c699fede06f01775d10f181f8f7f9d0b8f72
Signed-off-by: Aparna Das <aparnad@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2013357
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-04 13:25:28 -07:00
Deepak Nibade
45e1207223 gpu: nvgpu: add common.gr.obj_ctx apis to initialize/set preemption mode
These HALs are used to initialize and set preeemption modes
g->ops.gr.init_ctxsw_preemption_mode()
g->ops.gr.set_ctxsw_preemption_mode()
g->ops.gr.update_ctxsw_preemption_mode()

They are all h/w independent except for the functional support for
GFXP/CILP preemption support which is only present on gp10b+ chips

Add a characteristics flag NVGPU_SUPPORT_PREEMPTION_GFXP for these
preemption modes and set this flag for gp10b+ chips

Use this flag and unify all above HALs into below common functions
nvgpu_gr_obj_ctx_init_ctxsw_preemption_mode()
nvgpu_gr_obj_ctx_set_ctxsw_preemption_mode()
nvgpu_gr_obj_ctx_update_ctxsw_preemption_mode()

vGPU specific code also directly calls below vGPU specific APIs
vgpu_gr_init_ctxsw_preemption_mode()
vgpu_gr_set_ctxsw_preemption_mode()

g->ops.gr.update_ctxsw_preemption_mode() is not needed for vGPU since
it is handled by vserver

Above g->ops.gr.*_ctxsw_preemption_mode() HALs are no more required
hence delete them

Jira NVGPU-1887

Change-Id: I9b3164bcf01e5e3c27e52369c9364e0ee23a9662
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2088507
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-04 11:35:09 -07:00
Seema Khowala
ea1649ab6b gpu: nvgpu: move init_engine_info from fifo to engine
Move init_engine_info from fifo to engine unit

Rename init_engine_info to init_info

Rename gm20b_fifo_init_engine_info to nvgpu_engine_init_info

JIRA NVGPU-1313

Change-Id: I30186a601ed004a125018ac1ccda0284273b83c4
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2085408
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-04 04:07:52 -07:00
Seema Khowala
d0f45117f1 gpu: nvgpu: move get_engines_mask_on_id from fifo to engine
Move get_engines_mask_on_id fifo hal to engine hal as get_mask_on_id

Rename gk20a_fifo_engines_on_id to nvgpu_engine_get_mask_on_id

JIRA NVGPU-1313

Change-Id: I3582195e0a0d6f6722e9f160331e77d1a338783e
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2084320
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-04 04:07:37 -07:00
Vinod G
7d60eb5bf0 gpu: nvgpu: move handle_gcc_exception to hal
Move handle_gcc_exception to hal.gr.intr
Pass g->ecc.gr.gpccs_ecc_corrected_err_count[gpc].counter and
g->ecc.gr.gpccs_ecc_uncorrected_err_count[gpc].counter variable pointers
as function parameter to avoid dereferencing the g->ecc struct
inside the hal function

Update g->ops.gr.handle_gcc_exception to
g->ops.gr.intr.handle_gcc_exception

JIRA NVGPU-3016

Change-Id: Iaac9bd1763673567d8c29258d2f1952d061785a6
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2087199
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-03 13:36:30 -07:00
Vinod G
4431de48f8 gpu: nvgpu: move handle_gpc_gpcmmu_exception to hal
Move handle_gpc_gpcmmu_exception to hal.gr.intr
Pass g->ecc.gr.mmu_l1tlb_ecc_corrected_err_count[gpc].counter
and g->ecc.gr.mmu_l1tlb_ecc_uncorrected_err_count[gpc].counter pointers
as function parameter to avoid dereferencing g->ecc inside hal function

Update g->ops.gr.handle_gpc_gpcmmu_exception to
g->ops.gr.intr.handle_gpc_gpcmmu_exception

JIRA NVGPU-3016

Change-Id: I9698cf71b568caf8e259996f84b4f26aded865f5
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2087198
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-03 13:36:15 -07:00
Seema Khowala
93fd6644f4 gpu: nvgpu: move mmu_fault hals to hal/fifo
Moved below hals from {chip}/fifo_{chip}.[ch] to hal/fifo

get_mmu_fault_info
get_mmu_fault_desc
get_mmu_fault_client_desc
get_mmu_fault_gpc_desc

Moved gk20a_fifo_handle_dropped_mmu_fault to hal/fifo

JIRA NVGPU-1313

Change-Id: I949bcd482156c6e381006387372f13770277e8c5
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2083287
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-03 13:35:33 -07:00
Deepak Nibade
e3e8138404 gpu: nvgpu: move global ctx commit hal to common.gr.obj_ctx unit
gr_gk20a_commit_global_ctx_buffers() is h/w independent, hence move it
to common unit common.gr.obj_ctx and rename it as
nvgpu_gr_obj_ctx_commit_global_ctx_buffers()

Delete g->ops.gr.commit_global_ctx_buffers hal

Jira NVGPU-1887

Change-Id: If1c840237b8ba2c13bed40a4315810073756aeb9
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2088506
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-03 09:56:44 -07:00
Thomas Fleury
46aedec681 gpu: nvgpu: create init_subctx_pdb HAL for ramin
Add the followin ramin HAL:
- ramin.init_subctx_pdb

Moved code from mm to ramin:
- gv11b_ramin_init_subctx_pdb

Jira NVGPU-3015

Change-Id: I6690b5c30055c65778e55f552bea822c0640e815
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2087952
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-03 09:56:29 -07:00
Thomas Fleury
04e156f09d gpu: nvgpu: add set_adr_limit to ramin HAL
Added the following HAL
- ramin.set_adr_limit

Jira NVGPU-3015

Change-Id: I7982bbf46a2f26cfba3b4f5986b533f79b299038
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2077839
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-03 09:55:38 -07:00
Thomas Fleury
ba4bfe7fdf gpu: nvgpu: move init_pdb to ramin HAL
Replaced the following HAL
- mm.init_pdb

With
- ramin.init_pdb

Jira NVGPU-3015

Change-Id: Ie77aad5c5f83ef263b46739a52986296aca05468
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2077838
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-03 09:55:23 -07:00
Thomas Fleury
3e406d25e7 gpu: nvgpu: move set_big_page_size to ramin HAL
Moved the following HAL:
- mm.set_big_page_size

To ramin:
- ramin.set_big_page_size

Jira NVGPU-3015

Change-Id: Ifdc1dc9b6e5564986bb175bb61fd6be75a74f4ac
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2077837
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-03 09:55:08 -07:00
Thomas Fleury
26a94593e5 gpu: nvgpu: add set_gr_ptr to ramin
Added ramin unit under common/fifo

Added hal to set gr ctx (or subctx) in ramin:
- ramin.set_gr_ptr

Implemented
- gk20a_ramin_set_gr_ptr
- gv11b_ramin_set_gr_ptr

Jira NVGPU-3015

Change-Id: I79d7e7c9819ecf27e02ef44a89143c567df89af8
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2075940
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-03 09:54:54 -07:00
Nitin Kumbhar
26b90cc6f3 gpu: nvgpu: move nvgpu_gr_zcull to common
The nvgpu_gr_zcull struct need not be part of public zcull
header. Move it to a common.gr unit header and update gr/hal
users.

JIRA NVGPU-3060

Change-Id: I5c821f98ab304c5486b4a2630ac5827f1203dae7
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2084806
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: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-03 07:44:23 -07:00
Seshendra Gadagottu
60b1a431c0 gpu: nvgpu: move ctxsw enable/disable and halt_pipe to gr falcon
Following functions are moved from gr_gk20a.c to common gr_falcon.c
gr_gk20a_disable_ctxsw -> nvgpu_gr_falcon_disable_ctxsw
gr_gk20a_enable_ctxsw -> nvgpu_gr_falcon_enable_ctxsw
gr_gk20a_halt_pipe ->  nvgpu_gr_falcon_halt_pipe

Added new gr falcon hal to control ctxsw:
int gm20b_gr_falcon_ctrl_ctxsw(struct gk20a *g, u32 fecs_method,
			u32 data, u32 *ret_val)
Parameters:
fecs_method: will be specified by a generic define provided in gr_falcon.h
header.
data: input data parameter (if any), set it to zero, if method did not
require any data input.
ret_val: pointer to expected output.

Added following ops for gr falcon:
int (*halt_pipe)(struct gk20a *g); -> this is moved from gr
int (*disable_ctxsw)(struct gk20a *g);
int (*enable_ctxsw)(struct gk20a *g);

JIRA NVGPU-1881

Change-Id: Idb3b7355b5a0bd3b9bb01f9f424c5d607616f540
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2081308
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-02 16:04:59 -07:00
Vinod G
22fb278755 gpu: nvgpu: move handle_gpc_gpccs_exception hal
Move handle_gpc_gpccs_exception hal to hal.gr.intr
Pass g->ecc.gr.gpccs_ecc_corrected_err_count[gpc].counter and
g->ecc.gr.gpccs_ecc_uncorrected_err_count[gpc].counter variable address
as parameter to function to avoid dereferencing g->ecc variable
inside hal function.

Update g->ops.gr.handle_gpc_gpcss_exception call to
g->ops.gr.intr.handle_gpc_gpcss_exception

JIRA NVGPU-3016

Change-Id: I6cab6428eb6785261f34ca21f2ce055a9995b408
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2087197
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-02 15:04:29 -07:00
Vinod G
5f8aa39fd9 gpu: nvgpu: add new get_tpc_exception hal
Add new hal to get_tpc_exception to hal.gr.intr

This hal helps to avoid register read from the
common handle_tpc_exception function. Add a new struct to report the
tpc_exception type back to the common code to handle the exception.

JIRA NVGPU-3016

Change-Id: Ib504ade0b06b85cd38ccf166328784bab072573e
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2085387
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-02 15:04:15 -07:00
Philip Elcan
191aeb5cf8 gpu: nvgpu: regops: u32 num_ops for exec_regops
The exec_regops() API was using a u64 for the num_ops parameter. The
lower level APIs used by exec_regops() expect u32s for this value.
Update the interface to use u32.

This eliminates MISRA Rule 10.3 violations for assignment of objects of
different essential or narrower types.

JIRA: NVGPU-3023

Change-Id: I5a2a22916f81d8b3d882d224d07eedffcde1e3ee
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2084207
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-01 15:55:14 -07:00
Deepak Nibade
0e909daf1a gpu: nvgpu: add common.gr.setup unit
Add new unit common.gr.setup that provides runtime setup interfaces to
other units outside of GR unit or to OS-specific code

Move zcull setup call to this unit.
New unit now exposes nvgpu_gr_setup_bind_ctxsw_zcull() to setup zcull
This API internally calls common.gr.zcull API nvgpu_gr_zcull_ctx_setup()

Add new hal g->ops.gr.setup.bind_ctxsw_zcull() and remove
g->ops.gr.zcull.bind_ctxsw_zcull()

Remove nvgpu_channel_gr_zcull_setup() from channel unit
Also remove ctx/subctx header includes sicne channel code need not
configure zcull

Remove gm20b_gr_bind_ctxsw_zcull() since binding is done from common
code

Jira NVGPU-1886

Change-Id: I6f04d19a8b8c003734702c5f6780a03ffc89b717
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2086602
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-01 11:06:32 -07:00
Debarshi Dutta
993fbd085e gpu: nvgpu: update pbdma HAL Ops method names
HAL ops specific to pbdma are now updated to remove the word "pbdma"
from the function names in order to follow the convention
g->ops.pbdma.{function_name}()

Jira NVGPU-2950

Change-Id: I43ddb5c842b31c97da8fe35f4762de0478916702
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2075438
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-04-01 10:14:25 -07:00
Vinod G
9b044a541f gpu: nvgpu: move handle_tpc_mpc_exception hal
Move handle_tpc_mpc_exception hal to hal.gr.intr
This hal is implemented only for gv11b.
gv100/gv11b and tu104 use the same hal.

JIRA NVGPU-3016

Change-Id: Ic22ae538c735ac69ca73bf653638037eff7757ec
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2085386
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-30 08:08:35 -07:00
Deepak Nibade
f1402db43f gpu: nvgpu: delete gr_gv11b_update_ctxsw_preemption_mode()
There is nothing h/w specific in gr_gv11b_update_ctxsw_preemption_mode
anymore. Delete it and re-use gp10b specific hal for volta/tu104

Update gr_gp10b_update_ctxsw_preemption_mode to call platform specific
hals if defined

Jira NVGPU-1887

Change-Id: Idae9ebf780b1e76abf847d8b39aa40c0e0560084
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2084751
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-30 00:35:06 -07:00
Deepak Nibade
8586aca4de gpu: nvgpu: add hal.gr.init hal to commit gfxp timeout
Add new hal g->ops.gr.init.gfxp_wfi_timeout() in hal.gr.init unit
to commit gfxp timeout
Define gv11b chip specific operation

Use new hal in gr_gv11b_update_ctxsw_preemption_mode() instead of
directly committing using register accessors

Jira NVGPU-2961

Change-Id: I7694e3128920d9a2856faecf2e3d10a11f0f986e
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2084750
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-30 00:34:51 -07:00
Deepak Nibade
48bb865324 gpu: nvgpu: add hal.gr.init hal to commit cbes_reserve
Add new hal g->ops.gr.init.commit_cbes_reserve() in hal.gr.init unit
to commit cbes reserve
Define gp10b and gv11b chip specific operations

Use new hals in gr_gp10b_update_ctxsw_preemption_mode() and
gr_gv11b_update_ctxsw_preemption_mode() instead of directly committing
using register accessors

Jira NVGPU-2961

Change-Id: Iea2032ea61264c286b1fab46435ff5a84c90d3da
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2084749
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-30 00:34:37 -07:00
Deepak Nibade
71dd4c476a gpu: nvgpu: add hal.gr.init hal to commit spill ctxsw buffer
Add new hal g->ops.gr.init.commit_ctxsw_spill() in hal.gr.init unit
to commit spill ctxsw buffer
Define gp10b and gv11b operations

Use new hals in gr_gp10b_update_ctxsw_preemption_mode() and
gr_gv11b_update_ctxsw_preemption_mode() instead of directly committing
using register accessors

Jira NVGPU-2961

Change-Id: Iced02d304f12bcb4e78ea31a7728baa04081e325
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2084748
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-30 00:34:22 -07:00
Deepak Nibade
96990766b6 gpu: nvgpu: add hal.gr.init hals to get preemption buffer sizes
Below hals are used to get preemption buffer sizes
g->ops.gr.get_ctx_spill_size()
g->ops.gr.get_ctx_pagepool_size()
g->ops.gr.get_ctx_betacb_size()
g->ops.gr.get_ctx_attrib_cb_size()

Move them to hal.gr.init unit
Copy over corresponding gp10b/gv11b definitions

Remove pagepool and attrib_cb size hals from gv11b since gv11b can
re-use gp10b hals

Add spill size and betacb size hals for gv100 and tu104 too since
register values are different on those chips

Remove g->ops.gr.init_gfxp_rtv_cb() hal and replace it by
g->ops.gr.init.get_gfxp_rtv_cb_size() which returns the size of RTV
cb size

Jira NVGPU-2961

Change-Id: I3f2f973c120dbfd22067366f87d06b5c9162defb
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2084747
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-30 00:34:07 -07:00
Thomas Fleury
b8ceeae21e gpu: nvgpu: move enable/disable from fifo to tsg
Moved enable/disable HALs from fifo to tsg:
- tsg.enable
- tsg.disable

gk20a_tsg_enable and gv11b_tsg_enable are moved to HAL,
since they are chip specific, even though they do not
directly access chip registers.

Removed vgpu_gv11b_tsg_enable as it was identical to
gv11b_tsg_enable.

Changed gv11b_fifo_locked_abort_runlist_active_tsgs and
gv11b_fifo_teardown_ch_tsg to use tsg.enable HAL instead
of calling directly gk20a_disable_tsg HAL implementation.

Jira NVGPU-2979

Change-Id: I721650c64dcf8cd158652e362292af45df43819f
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2083156
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-29 10:34:14 -07:00
Vinod G
897c7263f1 gpu: nvgpu: move handle_tex_exception hal
Move handle_tex_exception hal function to hal.gr.intr
Move hal function for gm20b and gp10b chips.
Removed the null implementation in gv11b hal.

Modify ops->gr.handle_tex_exception call to
ops->gr.intr.handle_tex_exception

JIRA NVGPU-3016

Change-Id: Ifd88ab6f35301525f7a58e8ccf2f4796dda640bf
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2084387
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-29 07:44:21 -07:00
Debarshi Dutta
b1ceb5c4d2 gpu: nvgpu: modify handle_pbdma_intr* functions
RC_TYPE_PBDMA_FAULT is the only recovery type for all the pbdma intr
functions. Thus, rc_type variable is changed to a boolean type
in all implementations of handle_pbdma_intr* functions.

"handled" variable is unused and removed from all the implementations of
handle_pbdma_intr* functions.

handle_pbdma_intr* HAL ops are renamed to handle_intr*.

Jira NVGPU-2950

Change-Id: I9605d930225a38ed76f25b6a94cb02d855f522dd
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2083748
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-29 04:47:19 -07:00
Seshendra Gadagottu
0f1726ae1f gpu: nvgpu: support for non-secure/secure ctxsw loading
Code for secure/non-secure ctxsw booting spread across gr_gk20a.c
and gr_gm20b.c. With this change this code is move to gr falcon unit.

Ctxsw loading is now supported with 2 supported common functions:
1.Non secure boot:
 int nvgpu_gr_falcon_load_ctxsw_ucode(struct gk20a *g);
2.Secure boot:
int nvgpu_gr_falcon_load_secure_ctxsw_ucode(struct gk20a *g);

Now gr ops function "int (*load_ctxsw_ucode)(struct gk20a *g);" is moved to
gr falcon ops and in chip hals it is set with secure/non-secure booting.

Non-secure booting: nvgpu_gr_falcon_load_ctxsw_ucode support ctxsw loading
in 2 methods: bit-banging uode or booting with bootloader

A. Common and hal functions for non-secure bit-banging ctxsw loading:
Common: static void nvgpu_gr_falcon_load_dmem(struct gk20a *g) ->
Hals: void (*load_gpccs_dmem)(struct gk20a *g,i
			 const u32 *ucode_u32_data, u32 size);
      void (*load_fecs_dmem)(struct gk20a *g,
			const u32 *ucode_u32_data, u32 size);
Common: static void nvgpu_gr_falcon_load_imem(struct gk20a *g) ->
Hals:  void (*load_gpccs_imem)(struct gk20a *g,
			 const u32 *ucode_u32_data, u32 size);
       void (*load_fecs_imem)(struct gk20a *g,
			const u32 *ucode_u32_data, u32 size);
Other basic HALs:
void (*configure_fmodel)(struct gk20a *g); -> configure fmodel for ctxsw loading
void (*start_ucode)(struct gk20a *g);  -> start running ctxcw ucode

B.Common and hal functions for non-secure ctxsw loading with bootloader
First get the ctxsw ucode using: nvgpu_gr_falcon_init_ctxsw_ucode, then
Common: static void nvgpu_gr_falcon_load_with_bootloader(struct gk20a *g)
        void nvgpu_gr_falcon_bind_instblk((struct gk20a *g) ->
Hal: void (*bind_instblk)(struct gk20a *g, struct nvgpu_mem *mem, u64 inst_ptr);

Common: nvgpu_gr_falcon_load_ctxsw_ucode_segments ->
		nvgpu_gr_falcon_load_ctxsw_ucode_header ->
		nvgpu_gr_falcon_load_ctxsw_ucode_boot for both fecs and gpccs ->
Hals: void (*load_ctxsw_ucode_header)(struct gk20a *g, u32 reg_offset,
	u32 boot_signature, u32 addr_code32, u32 addr_data32,
	u32 code_size, u32 data_size);
void (*load_ctxsw_ucode_boot)(struct gk20a *g, u64 reg_offset, u32 boot_entry,
	u32 addr_load32, u32 blocks, u32 dst);
Other basic HAL to get gpccs start offset:
  u32 (*get_gpccs_start_reg_offset)(void);

C.Secure booting is support with gpmu and acr and with following additional
common function in gr falcon.
static void nvgpu_gr_falcon_load_gpccs_with_bootloader(struct gk20a *g) ->
  nvgpu_gr_falcon_bind_instblk and  nvgpu_gr_falcon_load_ctxsw_ucode_segments
Additional basic hals:
void (*start_gpccs)(struct gk20a *g);
void (*start_fecs)(struct gk20a *g);

Following ops from gr is removed, since it is not required to set by chip hals:
void (*falcon_load_ucode)(struct gk20a *g, u64 addr_base,
	struct gk20a_ctxsw_ucode_segments *segments, u32 reg_offset);

Now this is handled by static common function:
static int nvgpu_gr_falcon_copy_ctxsw_ucode_segments( struct gk20a *g,
	struct nvgpu_mem *dst, struct gk20a_ctxsw_ucode_segments *segments,
	u32 *bootimage, u32 *code, u32 *data)

JIRA NVGPU-1881

Change-Id: I895a03faaf1a21286316befde24765c8b55075cf
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2083388
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-29 01:15:50 -07:00
Deepak Nibade
7f91045874 gpu: nvgpu: add hal.gr.init hals to load netlist bundles
Add new hal g->ops.gr.init.load_sw_bundle_init() in hal.gr.init unit
and move corresponding code from gk20a_init_sw_bundle()
Add this hal to all the supported chips

Move g->ops.gr.init_sw_veid_bundle() hal to hal.gr.init unit
Move definition of hal to gv11b chip file of hal.gr.init
Add this hal for gv11b/gv100/tu104

Move g->ops.gr.init_sw_bundle64() hal to hal.gr.init unit
Move definition of hal to tu104 chip file of hal.gr.init
Add this hal for tu104

Jira NVGPU-2961

Change-Id: I560c2ba95fb820275d5ccb46939007c58481ccbb
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2083631
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-28 12:59:07 -07:00
Deepak Nibade
b429101b90 gpu: nvgpu: move hal.gr.ctxsw_prog unit to hal/ directory
Move common.hal.gr.ctxsw_prog unit from common/ to hal/ directory
since whole unit provides HAL interface only

Jira NVGPU-2007

Change-Id: I855e2d4263e7e743c7917620c3a25fe534ba93fe
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2083779
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-28 09:26:28 -07:00
Debarshi Dutta
52cbc88a00 gpu: nvgpu: add pbdma intr_enable HAL ops.
A new HAL ops intr_enable() is constructed in
hal.fifo.pbdma unit. The implementation for this HAL ops
is based on gm20b and gv11b architectures.

Jira NVGPU-2950

Change-Id: Ifd9c3bfad4264449c52f411e8cad8674c3756048
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2073536
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-28 01:15:07 -07:00
Debarshi Dutta
ce5c43d24a gpu: nvgpu: re-org top level pbdma interrupt handler
fifo_pbdma_isr is moved to fifo_intr_gk20a HAL unit and renamed to
gk20a_fifo_pbdma_isr.

The pbdma specific handling part of the function
gk20a_fifo_handle_pbdma_intr is now separated into a top level HAL
function named handle_pbdma_intr. This HAL function is implemented
for GM20B and all the other architectures use the same implementation.
handle_pbdma_intr can accept NULL values for the parameters handled and
error_notifier.

gk20a_fifo_handle_pbdma_intr is called from
gv11b_fifo_poll_pbdma_chan_status and gk20a_fifo_pbdma_isr.
The call to gk20a_fifo_handle_pbdma_intr from
gv11b_fifo_poll_pbdma_chan_status doesn't progress to recovery.
Thus, the function gk20a_fifo_handle_pbdma_intr is removed to decouple
pbdma handling from recovery. gv11b_fifo_poll_pbdma_chan_status now
directly calls the HAL handle_pbdma_intr. For gk20a_fifo_pbdma_isr,
rc_type is used to proceed to recovery by calling
gk20a_fifo_pbdma_fault_rc.

gk20a_fifo_pbdma_fault_rc is changed to public from static.

Jira NVGPU-2950

Change-Id: I4f3597aca2317d4b745cd47bab9dd95c927160a9
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2073535
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-28 01:14:53 -07:00
Vinod G
ae0704fe7e gpu: nvgpu: move enable_hww_exceptions hal to hal.gr.intr
Move enable_hww_exceptions hal to hal.gr.intr
Modify the calls g->ops.gr.enable_hww_exceptions to
g->ops.gr.intr.enable_hww_exceptions

JIRA NVGPU-3016

Change-Id: Ic83596acd748ca379ef81f31a7f194ab0aea1dff
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2082077
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-27 22:56:03 -07:00
Vaibhav Kachore
f0a5f97ebb gpu: nvgpu: vgpu: initialize tgid for FECS trace
- "tsg->tgid" is used for getting "pid" of contexts
in FECS trace support.
- "tsg->tgid" was unitialized for virtualized platforms
which was resulting in "pid" to be "0" for all contexts.
- This patch initializes tgid to fix this issue.

Jira NVGPU-1880

Change-Id: I59c30aca4609d61d09c465b7ec39983095af669b
Signed-off-by: Vaibhav Kachore <vkachore@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2081759
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-27 22:55:33 -07:00
Vinod G
22cb47c077 gpu: nvgpu: move fbp_en_mask hal to hal.gr.init
Move fbp_en_mask hal to hal.gr.init.

Calls to g->ops.gr.fbp_en_mask is modified to
g->ops.gr.init.fbp_en_mask

JIRA NVGPU-2951

Change-Id: I555ec3691226a9dd8555fa91f5ec90010d83ddd3
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2081370
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-27 22:55:09 -07:00
Thomas Fleury
2e68f784b0 gpu: nvgpu: move ramfc capture to ramfc
Replaced the following hal
- fifo.capture_channel_ram_dump

With
- ramfc.capture_ram_dump

This HAL captures all fields in ramfc. It no longer
reads hw_state (this has to be done from common code).

Jira NVGPU-1750

Change-Id: I92ee58a7a90fbd0b155acf66b1b6ff22a8e3259e
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2075939
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
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-27 20:35:32 -07:00
Thomas Fleury
6009662fa5 gpu: nvgpu: move resetup_ramfc to common channel
On gp10b, ramfc contains information related to syncpoint
protection, which restricts the syncpoint increment operation
to a safe set of syncpoints. This information must be
updated when a syncpoint is assigned to a channel.

Added the following ramfc HALs
- ramfc.get_syncpt
- ramfc.set_syncpt

And replaced
- fifo.resetup_ramfc

With
- channel.set_syncpt

Use new ramfc HALs, move resetup_ramfc implementation
from fifo to common channel code:
- nvgpu_channel_set_syncpt

NVGPU-1750

Change-Id: I036a0b7b2d9fd6ccd9f30094ae33e6c38a96e0cc
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2075938
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-27 20:35:23 -07:00
Thomas Fleury
1701a267bc gpu: nvgpu: move setup ramfc code to common
Create ramfc under common/fifo

Created the following HAL:
- ramfc.setup
- ramfc.commit_userd

Moved setup code to ramfc HAL:
- vgpu_channel_setup_ramfc
- gk20a_fifo_setup_ramfc
- channel_gp10b_setup_ramfc
- channel_gv11b_setup_ramfc
- channel_tu104_setup_ramfc

Renamed as:
- <chip>_ramfc_setup

Moved commit userd code to ramfc HAL:
- gk20a_fifo_commit_userd
- channel_gp10b_commit_userd

Renamed as:
- <chip>_ramfc_commit_userd

Jira NVGPU-1750

Change-Id: Ieb1bd2866fd77601edd218f879ababf4f90db54a
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2069947
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-27 20:35:04 -07:00
Seema Khowala
b650c773ac gpu: nvgpu: rename clock_gating ops to cg
Rename clock_gating ops to cg

JIRA NVGPU-2014

Change-Id: Iae3c5739c1dcecb1fa8364a509b646162b43d2a2
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2082270
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-27 13:44:58 -07:00
Seshendra Gadagottu
9346b104d4 gpu: nvgpu: ltc: create sub-unit for ltc intr
Created sub-unit for ltc interrupt handling.
Following 2-hals are moved from ltc to ltc intr unit:
void (*isr)(struct gk20a *g, u32 ltc);
void (*en_illegal_compstat)(struct gk20a *g, bool enable)

Added new hal in ltc intr sub-unit for configuring ltc interrupts:
void (*configure)(struct gk20a *g);

Moved ltc interrupt related code from ltc to ltc intr unit.
Chip ltc.intr hals are populated with updated function names
created in ltc intr unit.

Converted all "unsigned int" usage to "u32" in ltc and ltc intr units
to match with hardware 32 bit register read/write.

JIRA NVGPU-3042
JIRA NVGPU-2044

Change-Id: I8684dfcc8ae343e4588b93f2b0ccde0e227635df
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2081140
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-27 10:26:02 -07:00
Deepak Nibade
ee433c55bf gpu: nvgpu: move global cb_manager commit hal to hal.gr.init
Move g->ops.gr.commit_global_cb_manager() hal to hal.gr.init unit as
g->ops.gr.init.commit_global_cb_manager()

Move hal definitions to gm20b/gp10b hal files appropriately

Add nvgpu_gr_config pointer to the parameter list of this hal so that
it does not have to dereference struct gr_gk20a in hal.gr.init unit

Jira NVGPU-2961

Change-Id: Iaff476648fa6abdf5a79be500f65a40eb90c0b08
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2077219
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-03-27 10:25:37 -07:00