Commit Graph

5780 Commits

Author SHA1 Message Date
Sagar Kamble
8da1bde7db gpu: nvgpu: define nvgpu_falcon_get_mem_size
Currently we have DMEM version of the API to get the size of falcon
memory. Let us convert it to generic as needed at multiple places.

JIRA: NVGPU-1993

Change-Id: If612b0a10e27619e4b6132773907eb21f0569a27
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2023074
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-13 11:15:51 -07:00
Sagar Kamble
8765df40b0 gpu: nvgpu: add parameter check to falcon_print_mem
Bounds check was not done while accessing IMEM & DMEM data for printing.

JIRA NVGPU-1993

Change-Id: I7a1bb5fa64c68e643712c4af8b28e94303e213f8
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2030620
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-13 11:15:36 -07:00
Sagar Kamble
ad1842d4a2 gpu: nvgpu: create separate mutex for IMEM and DMEM access
Access to IMEM and DMEM can be done parallely as they have separate
control and data registers. Hence they need not be synchronized
using single copy_lock. Prepare separate mutex locks.

JIRA NVGPU-1993

Change-Id: Ie4bfcb6cef0259c6fb98a86bdbcc378ff5725ee5
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2030617
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-13 11:15:26 -07:00
Vinod G
f1c9c1ebc0 gpu: nvgpu: remove unused register and fields
cleanup header for removal of czf_bypass and pd_max_batches support.

JIRA NVGPU-2967

Change-Id: I7a1d8dfeabb87e3653c70a560282f99ff4310ce7
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2071070
Reviewed-by: Automatic_Commit_Validation_User
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-03-13 08:54:45 -07:00
Vinod G
e8b6580953 gpu: nvgpu: remove pd_max_batches support
remove unused pd_max_batches implementation.
remove pd_max_batches support from gr_gk20a struct and sysfs

Bug 200492671

Change-Id: Ibfd81a6aec88610175495018759c27341b637e52
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2070058
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Seshendra Gadagottu <sgadagottu@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-03-13 08:54:21 -07:00
Vinod G
3856aa54d8 gpu: nvgpu: remove czf_bypass support
remove unused czf_bypass support
clean up the czf_bypass from sysfs implementation, gr_gk20a struct,
hal support in gp10b for init_czf_bypass and set_czf_bypass.

Bug 200492671

Change-Id: I2412410838581341c777d07cf4b2fad2d4163956
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2070057
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-13 08:54:12 -07:00
Seema Khowala
cb91bf1e13 gpu: nvgpu: protect recovery with engines_reset_mutex
Rename gr_reset_mutex to engines_reset_mutex and acquire it
before initiating recovery. Recovery running in parallel with
engine reset is not recommended.

On hitting engine reset, h/w drops the ctxsw_status to INVALID in
fifo_engine_status register. Also while the engine is held in reset
h/w passes busy/idle straight through. fifo_engine_status registers
are correct in that there is no context switch outstanding
as the CTXSW is aborted when reset is asserted.

Use deferred_reset_mutex to protect deferred_reset_pending variable
If deferred_reset_pending is true then acquire engines_reset_mutex
and call gk20a_fifo_deferred_reset.
gk20a_fifo_deferred_reset would also check the value of
deferred_reset_pending before initiating reset process

Bug 2092051
Bug 2429295
Bug 2484211
Bug 1890287

Change-Id: I47de669a6203e0b2e9a8237ec4e4747339b9837c
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2022373
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-13 06:34:31 -07:00
Seema Khowala
7e2f124fd1 gpu: nvgpu: wait for gr.initialized before changing cg/pg
set gr.initialized to false in the beginning of gk20a_gr_reset() and
set it to true at the end of successful execution of gk20a_gr_reset.

Use gk20a_gr_wait_initialized() to enable/disable cg/pg
functions to make sure engine is out of reset and initialized.

Bug 2092051
Bug 2429295
Bug 2484211
Bug 1890287

Change-Id: Ic7b0b71382c6d852a625c603dad8609c43b7f20f
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2030827
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-13 06:34:17 -07:00
Seema Khowala
672e6bc31e gpu: nvgpu: disable elpg before ctxsw_disable
if fecs is sent stop_ctxsw method, elpg entry/exit cannot happen
and may timeout. It could manifest as different error signatures
depending on when stop_ctxsw fecs method gets sent with respect
to pmu elpg sequence. It could come as pmu halt or abort or
maybe ext error too.

If ctxsw failed to disable, do not read engine info and just abort tsg.

Bug 2092051
Bug 2429295
Bug 2484211
Bug 1890287

Change-Id: I5f3ba07663bcafd3f0083d44c603420b0ccf6945
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2014914
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-13 06:34:02 -07:00
Divya Singhatwaria
59bf4b39ff gpu: nvgpu: refactor PG unit
- Move the PG unit source code to common/pmu/pg/ folder
- Separate PG unit headers under include/nvgpu/pmu/pmu_pg.h

NVGPU-1973

Change-Id: I7dfaad9abd809ba8374c3c4380a8d0c857bcab95
Signed-off-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2031676
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-13 04:14:19 -07:00
Seema Khowala
d27f875d2c gpu: nvgpu: change err to info print if failing eng id is -1
For handle_sched_error, change err to info print for failing eng
id returned as -1 i.e. FIFO_INVAL_ENGINE_ID as no engine is found
busy doing ctxsw. May be ctxsw already finished for the context
for which ctxsw timeout intr was triggered.

Possible Causes:
a)
On hitting engine reset, h/w drops the ctxsw_status to INVALID in
fifo_engine_status register. Also while the engine is held in reset
h/w passes busy/idle straight through. fifo_engine_status registers
are correct in that there is no context switch outstanding
as the CTXSW is aborted when reset is asserted.
This is just a side effect of how gv100 and earlier versions of
ctxsw_timeout behave.
With gv10b and later, h/w snaps the context at the point of error
so that s/w can see the tsg_id which caused the HW timeout.
b)
If engines are not busy and ctxsw state is valid then intr occurred
in the past and if the ctxsw state has moved on to VALID from LOAD
or SAVE, it means that whatever timed out eventually finished
anyways. The problem with this is that s/w cannot conclude which
context caused the problem as maybe more switches occurred before
intr is handled.

Bug 2092051
Bug 2429295
Bug 2484211
Bug 1890287

Change-Id: Ia79bee6e860fb179ee39024c963671d4f8245227
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2030866
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-13 04:14:10 -07:00
Mahantesh Kumbar
9c89f6d7cb gpu: nvgpu: Add ACR HS ucode self load & bootstrap support
ACR HS ucode self-load & bootstrap functionality was part of FB
unit to support FB mem-unlock HS ucode & this needs to access
some ACR structs which will be part of ACR private headers &
adding constraints to implement ACR unit private header support.

JIRA NVGPU-2907

Change-Id: I6c6c7504ffe55426b377e9bcf911d4005813bb31
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2069724
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 23:34:21 -07:00
Mahantesh Kumbar
b86354fef9 gpu: nvgpu: ACR struct wpr_carveout_info dependency cleanup
struct wpr_carveout_info is used to fetch WPR info by passing
as parameter to FB HAL, changed to pass multiple params to get
WPR base & size individually from FB HAL which removes dependency
between ACR & FB.

JIRA NVGPU-2907

Change-Id: I03af1a5358fcab5dc8237899d16a0b51a6779b1f
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2069617
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 23:34:13 -07:00
Mahantesh Kumbar
0c4999b154 gpu: nvgpu: ACR struct hs_acr dependency cleanup
Currenlty struct hs_acr passed to engine falcon bootstrap function
to pass falcon info to the falcon unit to execute the ACR HS bin 
using engine falcon, as engine already cached the falcon info as 
part its structure so removed struct hs_acr parameter pass.

JIRA NVGPU-2907

Change-Id: I0b647b2763c52e97de0c17cfdd273486138ee404
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2069593
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 23:33:58 -07:00
Debarshi Dutta
d91f7b44ef gpu: nvgpu: remove unused function gk20a_fifo_is_engine_busy
The function gk20a_fifo_is_engine_busy is not used and hence removed.

Jira NVGPU-1315

Change-Id: I98599d9f3e94d0ccfc9df4db0e8d5c699b6a6e87
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2033633
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 13:36:39 -07:00
Debarshi Dutta
dc0e037d8c gpu: nvgpu: move engine_status_dump functions to common.fifo.hal.engine_status
The functions gk20a_dump_eng_status and gv11b_dump_eng_status belongs
to engine_status HAL unit.

1) The corresponding declaration and definitions of the above functions
are moved from fifo_{arch} files to engine_status_{arch} files.

2) The corresponding HAL pointer .dump_eng_status is moved from
fifo to engine_status HAL unit.

3) gv11b_dump_eng_status is now based to gv100b_dump_eng_status

4) Small changes in the files for ENGINE_STATUS such as correction of
HEADER DEFINES etc

Jira NVGPU-1315

Change-Id: I7fc06eab97206bc3b78c6f5c7aa30fa2c034961c
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2033632
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 13:36:29 -07:00
Debarshi Dutta
8fae143b57 gpu: nvgpu: remove HAL pointer for gk20a_fifo_wait_engine_idle
The corresponding HAL pointer for gk20a_fifo_wait_engine_idle is not
being invoked anywhere and hence they are removed from the code.

The function gk20a_fifo_wait_engine_idle belongs to engine unit and is
only called in a non-safe build, hence its moved to engine unit and is
restricted by a non-safe build flag NVGPU_ENGINE
Also, gk20a_fifo_wait_engine_idle is renamed to nvgpu_engine_wait_for_idle

Jira NVGPU-1315

Change-Id: Ie550c7e46a4284dfe368859d828b1994df34185f
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2033631
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 13:36:14 -07:00
Debarshi Dutta
adc27cc9b4 gpu: nvgpu: move engine_activity functions to common.fifo.engine unit.
The following functions belong to engine unit and are moved
gk20a_fifo_enable_engine_activity
gk20a_fifo_enable_all_engine_activity
gk20a_fifo_disable_engine_activity
gk20a_fifo_disable_all_engine_activity

These are renamed by replacing gk20a_fifo with nvgpu_engine as prefix.
These functions are only invoked by linux build and not required for
safety build and hence they are defined when
-DNVGPU_ENGINE is enabled.

Jira NVGPU-1315

Change-Id: I39d820879bb55b40e754526c657d794930a4b6a1
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2032606
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 13:36:00 -07:00
Debarshi Dutta
2eea2b23c5 gpu: nvgpu: add non-safe compile flag NVGPU_ENGINE
common.fifo.engine unit has both safe as well as non-safe functions.
The build flag NVGPU_ENGINE is used to restrict the use of
non-safe functions of the engine unit in safety builds.

Jira NVGPU-1315

Change-Id: Ic363ad547e07136024a254c078fdf0194fafc265
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2032605
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 13:35:45 -07:00
Debarshi Dutta
3d5fc5a6a1 gpu: nvgpu: move is_fault_engine_subid_gpc hal from fifo to hal.engine
is_fault_engine_subid_gpc HAL pointer belongs to engine HAL unit instead of
fifo. This patch moves the HAL pointer to a newly constructed engine
HAL unit.

The following new files are added under HAL/fifo/

engines_gm20b.h
engines_gm20b.c
engines_gv11b.h
engines_gv11b.c

Jira NVGPU-1315

Change-Id: If28686bf7350563b06b13348a9fe3ef0099c35b2
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2031659
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 13:35:21 -07:00
Seshendra Gadagottu
ba761b53d6 gpu: nvgpu: move gk20a_cbc_op to cbc.h
Move enum gk20a_cbc_op from gk20a.h to cbc.h.
Also re-named gk20a_cbc_op to nvgpu_cbc_op.

Modified code to use new enum type nvgpu_cbc_op.

JIRA NVGPU-2897

Change-Id: I7df5af82fb84ff1c06ea48dcf03983a24fcd32b5
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2030998
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 13:35:06 -07:00
Seshendra Gadagottu
cc74fd9303 gpu: nvgpu: unify cbc_init in cbc and fb units
Pre-volta, cbc config is part of hw ltc and from volta onwards this is
moved to hw fb. Because of this, cbc_init functions are present in both
cbc unit and fb unit. Pre-volta uses cbc_init from cbc unit and from
volta onwards it uses cbc_init from fb unit.

With this patch, unified two cbc_init functions to cbc unit and created
new fb hal for cbc_configure. cbc unit uses fb hal for cbc_config and
fb unit is independent of cbc unit.

JIRA NVGPU-2897

Change-Id: Ib62f0b08547b031bcb5011c837e43c74931a22fe
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2030906
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 13:34:36 -07:00
Seshendra Gadagottu
a3289cb80c gpu: nvgpu: create cbc unit
Create Compression Bit Cache(CBC) unit to have comptags
cache related functionality in one place. In this patch

Moved following gpu ops from ltc to cbc and renamed accordingly:
  void (*init)(struct gk20a *g, struct gr_gk20a *gr);
  u64 (*get_base_divisor)(struct gk20a *g);
  int (*alloc_comptags)(struct gk20a *g, struct gr_gk20a *gr);
  int (*ctrl)(struct gk20a *g, enum gk20a_cbc_op op,
		u32 min, u32 max);
  u32 (*fix_config)(struct gk20a *g, int base);

To avoid ambiguity renamed function pointer from
init_comptags to alloc_comptags.

Moved following function from ltc.h to cbc.h:
nvgpu_ltc_alloc_cbc -> nvgpu_cbc_alloc

Also changed file name that implemented
nvgpu_cbc_alloc functionality from
os/ltc.c -> os/linux-cbc.c

JIRA NVGPU-2897

Change-Id: Ide32a98567e9a3f0a784d62221a6f484f8343e53
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2030194
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 13:34:21 -07:00
Deepak Nibade
bc6feecb91 gpu: nvgpu: support active_unit_mask for subunit entries in hwpm_map
In case of FBPA we need to consider mask of active FBPAs on dGPUs.
For that we have GR unit HAL g->ops.gr.add_ctxsw_reg_pm_fbpa()

Generic support to consider active mask of unit need not be in a HAL,
move it to common code in add_ctxsw_buffer_map_entries_subunits() itself
This API now supports providing active_unit_mask as its parameter

In case we don't need to consider unit mask caller will simply pass
~U32(0U) to indicate all units are active

In case of FBPA, add a new HAL g->ops.gr.hwpm_pm.get_active_fbpa_mask()
which gets mask of active FBPAs, and pass this value to common API
add_ctxsw_buffer_map_entries_subunits()

Jira NVGPU-2895

Change-Id: I0d208ce53abcd36929c25a4d248868d6eaa5c70d
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2069472
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 11:47:16 -07:00
Deepak Nibade
ad8a3ca53e gpu: nvgpu: create hal.gr.hwpm_map unit
Create a new HAL unit hal.gr.hwpm_map that provides chip specific
support to common.gr.hwpm_map unit

We currently have common.gr HAL g->ops.gr.add_ctxsw_reg_perf_pma()
to handle chip specific alignment of perf_pma list
We only adjust the offset of list and remaining code is same

Hence delete above HAL, and add new HAL under hal.gr.hwpm_map
g->ops.gr.hwpm_map.align_regs_perf_pma() which returns correct
alignment if HAL is defined

Remove gr_gv100_add_ctxsw_reg_perf_pma() and
gr_gk20a_add_ctxsw_reg_perf_pma() APIs since they are no longer used

Simplify perf_pma parsing by fixing alignment with new HAL and then
directly calling add_ctxsw_buffer_map_entries()

Jira NVGPU-2895

Change-Id: I1852db846e1f5441e482028c79a3f39c5142b0c2
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2069471
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 11:47:01 -07:00
Deepak Nibade
c0a0b6419d gpu: nvgpu: remove hw_top_gv100.h include from gr_gv100.c
In gr_gv100_get_active_fpba_mask(), we directly access top_* register
from hw_top_gv100.h h/w header to read FBPA count.

Add a new HAL in TOP unit to return max FBPA count
g->ops.top.get_max_fbpas_count()

Use this HAL in gr_gv100.c to get FBPA count and remove direct access
of top_* register, and also remove hw_top_gv100.h header include

Jira NVGPU-2895

Change-Id: Idfba553b24d7d6abf124a84b1490987e8cbf1985
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2069470
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 11:46:46 -07:00
Vedashree Vidwans
300f734f9f gpu: nvgpu: unit: fix page_table_faults.init test
Bug fix in nvgpu_aperture_mask_raw function hits BUG() due to invalid aperture
type. This patch resolves the issue by initializing mem_wr_mem and mem_rd_mem
aperture value to APERTURE_SYSMEM type.

JIRA NVGPU-2933

Change-Id: Ib4879697781a1b8d73e9428299d489aa5228c9a0
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2035197
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 11:46:13 -07:00
Vedashree Vidwans
bc2ee54301 gpu: nvgpu: Add check for invalid nvgpu_aperture
Currently, in nvgpu_aperture_mask_raw function, if NVGPU_MM_HONORS_APERTURE
flag is disabled, invalid or junk aperture input is changed to APERTURE_VIDMEM
instead of raising a warning.To resolve this bug, need to check if input
aperture is APERTURE_INVALID or undefined.

This patch adds APERTURE_MAX_ENUM to nvgpu_aperture structure which
gives upperbound of nvgpu_aperture types. This patch also adds condition in
nvgpu_aperture_mask_raw function to check for invalid or undefined aperture
input. For invalid inputs, function will BUG().

Jira NVGPU-2933

Change-Id: Ic9d260250e3083d693f025c6e32657f6a863aafb
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2034281
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 11:46:03 -07:00
Vedashree Vidwans
0931d699a5 gpu: nvgpu: unit: nvgpu_mem unit test
This new unit test covers 100% of the nvgpu.common.mm.nvgpu_mem module
lines and almost all branches.

Jira NVGPU-2235

Change-Id: I400a42f3e8f22736576a7d23abdd46a53ee9d145
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2030978
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 11:45:29 -07:00
Vedashree Vidwans
e34ff7574d gpu: nvgpu: posix: added dma_alloc_vid functions
Implement allocate and free functions for mocking vidmem in posix.

JIRA 2235

Change-Id: I4d5889b9b52e8cd7396dad5f880ec55dbc31c30e
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2032021
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 11:45:14 -07:00
Tejal Kudav
a6f0ce7971 gpu: nvgpu: Add nvlink "minion" unit
Move the code involved in dealing with minion into a separate unit
called "nvlink_minion". This unit includes minion HW access, ucode
handling, exposing state of minion and also dealing with minion
interrupts. The interfaces to this unit are partially exposed using
g->ops.nvlink.minion ops and rest are part of nvlink_minion.h public
header.

JIRA NVGPU-2860

Change-Id: Iea9288ea5f0b26688540b1eb8ab64afd756941a4
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2030103
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 11:44:59 -07:00
Philip Elcan
a3ba265dd6 gpu: nvgpu: mm: fix MISRA 10.3 violations
MISRA Rule 10.3 prohibits implicit assignment of objects of different
size or essential type. This resolves a number of 10.3 violations in the
nvgpu/common/mm unit.

JIRA NVGPU-2935

Change-Id: Ic9d826bf67417962aab433d08d3e922de26e3edc
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2036117
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-03-12 08:56:33 -07:00
Deepak Nibade
2f5e5596d3 gpu: nvgpu: move FECS trace initialization call to linux
gk20a_ctxsw_trace_init() is defined in linux specific code, but it is
right now being called from common functions gk20a_finalize_poweron()
and vgpu_finalize_poweron_common() in common code

Move this call to linux specific common function
nvgpu_finalize_poweron_linux() instead

Jira NVGPU-1880

Change-Id: I2548683f1a0378194ff5dd84c94936ccf0f9d17b
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2069474
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 03:07:43 -07:00
Deepak Nibade
b6febf2fdc gpu: nvgpu: remove unused API to trace channel reset
Function gk20a_ctxsw_trace_channel_reset() is not being called from
anywhere, hence remove it

Jira NVGPU-1880

Change-Id: I6445a7c96dc35a1e05d38f80db5335daca96f1cb
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2069473
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 03:07:34 -07:00
Rajesh Devaraj
4b9f3992e0 gpu: nvgpu: Enable the reporting of PRI timeout
Enable the reporting of PRI timeout and related FECS error code.

Jira NVGPU-1868

Change-Id: Idc72efba943e4c0da5ffced717d3426a823aaa5d
Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2029806
Reviewed-by: Raghuram Kothakota <rkothakota@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 01:54:58 -07:00
Seema Khowala
937c6dcbad gpu: nvgpu: move hal/cg to hal/power_features/cg
This is to make the directory structure same under common and hal

JIRA NVGPU-2014

Change-Id: Ibd5fc2bbfb3fb259386c2ddd8b03ecdb83d9d454
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2036301
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-12 00:44:41 -07:00
Philip Elcan
eda88f56ab gpu: nvgpu: unit: allow units to link against libraries
Allow unit tests to define NVGPU_UNIT_SHARED_LIBRARIES in their
tmake files for linking if necessary. For example, pthreads.

JIRA NVGPU-2251

Change-Id: Ieeae10fe981d82e2caa0fbde041b72b0887b6ca6
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2034425
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-11 18:24:01 -07:00
Nicolas Benech
99721cca0d nvgpu: unit: unit test for nvgpu.interface.lock
This unit test covers all APIs of the nvgpu.interface.lock and
verify their behavior.

JIRA NVGPU-2245

Change-Id: I317663ab45a2cc93ddd46edccc9c3fdc37148e72
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2034205
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-11 18:23:52 -07:00
Sami Kiminki
49d72d7bfc gpu: nvgpu: Remove unneeded __packed attributes from UAPI structs
Remove __packed attributes from structs where the binary layout does
not change by the removal. That makes their use easier in userspace,
as __packed also changes the alignment rules of the structs and their
members.

With certain compilers, the packed alignment breaks code that assigns
pointers or C++ references to the struct field members. This is
because the modern C/C++ specifications require that pointer values
are aligned by the pointed type. But if the struct is packed, the
fields are no longer guaranteed to be naturally aligned by the language,
even if they are in practice.

Bug 1777616
Bug 1902982
JIRA GCSS-289

Change-Id: I30af9ee2f24a9c08dc591d3de012280f6e7d0cb2
Signed-off-by: Sami Kiminki <skiminki@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2035940
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-11 13:53:29 -07:00
Mahantesh Kumbar
ae96316a85 gpu: nvgpu: separate ACR bootstrap functionality from common ACR
Currently  ACR bootstrap functions are mixed with common
ACR public functions file, so need to separate it out

JIRA NVGPU-2911

Change-Id: I433514f1924a13e206d80d756b78056dbb2e4841
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2033812
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-11 05:24:05 -07:00
Deepak Nibade
4ba2b6f142 gpu: nvgpu: remove ctx/method init load from GR boot
Loading of ctx/method init values from NET image is done in GR boot
sequence and also in golden image creation
Doing this during GR boot creation is unnecessary since those writes
are anyways part of golden image itself

Hence remove those method loads from gk20a_init_gr_setup_hw()

Also remove g->ops.gr.commit_global_timeslice() call since that too
is covered during golden image creation

Since above code is removed disabling and restoring fe_go_idle timeout
is also not needed

Jira NVGPU-1885

Change-Id: Ic6eb4bea7ceb36bb1420f58446785cefe25066df
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2034042
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-11 04:34:44 -07:00
Seema Khowala
ffb1869144 gpu: nvgpu: add nvgpu_pg_elpg_protected_call macro
gr_gk20a_elpg_protected_call is renamed as
nvgpu_pg_elpg_protected_call and resides in common/
power_features/pg.c

JIRA NVGPU-2014

Change-Id: Id027d9a81ca93e0d47bbeeeb537d5fcd882f68d3
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2034274
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-08 16:25:36 -08:00
Seema Khowala
c905858565 gpu: nvgpu: add cg and pg function
Add new power/clock gating functions that can be called by
other units.

New clock_gating functions will reside in cg.c under
common/power_features/cg unit.

New power gating functions will reside in pg.c under
common/power_features/pg unit.

Use nvgpu_pg_elpg_disable and nvgpu_pg_elpg_enable to disable/enable
elpg and also in gr_gk20a_elpg_protected macro to access gr registers.

Add cg_pg_lock to make elpg_enabled, elcg_enabled, blcg_enabled
and slcg_enabled thread safe.

JIRA NVGPU-2014

Change-Id: I00d124c2ee16242c9a3ef82e7620fbb7f1297aff
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2025493
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-08 16:24:35 -08:00
Alex Waterman
7172d96bcd gpu: nvgpu: unit: Final pd_cache requirement verification tests
These tests implement the pd_cache requirement verification tests for
all pd_cache requirements and test specifications. They cover:

  o  PD GPU address computation
  o  PD offset computation
  o  Init
  o  Multiple inits
  o  Cleanup*

[*] the cleanup needs some more POSIX memory API support: we need a way
to make sure that all outstanding allocations are freed.

JIRA NVGPU-1323

Change-Id: If6398ad09c9d38f5ac2fdad057bb933f88224599
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2034273
GVS: Gerrit_Virtual_Submit
Reviewed-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-08 14:04:18 -08:00
Philip Elcan
40e26014d6 gpu: nvgpu: atomic: add missing atomic ops
There were a number of atomic ops that didn't have both 32bit and
64bit implementations for nvgpu. This adds the missing pieces.

JIRA NVGPU-2842

Change-Id: I985dc9ba7e1c187d2b7986f3c3e8452937134d45
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2035186
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-08 12:54:38 -08:00
Rajesh Devaraj
cf7d338c8a gpu: nvgpu: Moving chip-agnostic SDL APIs
This patch restructures the position of chip-agnostic SDL related APIs
from HALs. Specifically, it moves nvgpu_*_report_ecc_error APIs from
LTC, PMU, HUBMMU, and GR units of gv11b.

Jira NVGPU-2722

Change-Id: I19424ee71083dd3cbc0d0021e5e3721e436082a6
Signed-off-by: Rajesh Devaraj <rdevaraj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2034849
Reviewed-by: Raghuram Kothakota <rkothakota@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-08 09:26:47 -08:00
Deepak Nibade
8ac8b27ba4 gpu: nvgpu: move gp10b fecs_trace HAL to gr/fecs trace unit
Rename gp10b/fecs_trace_tu104.* files to
common/gr/fecs_trace/fecs_trace_gp10b.*

Also move HAL API gp10b_fecs_trace_flush() to gr/fecs_trace unit

Remove fecs_trace_gp10b.h header include from rest of the code

Jira NVGPU-1880

Change-Id: Ia27c70ed7071751c17345f65599591be1e34c49d
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2032708
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-08 07:07:43 -08:00
Deepak Nibade
3391aa9d84 gpu: nvgpu: move fecs_trace bind/unbind calls to gr/fecs_trace unit
Move below calls to gr/fecs_trace unit
gk20a_fecs_trace_bind_channel()
gk20a_fecs_trace_unbind_channel()

And rename them to
nvgpu_gr_fecs_trace_bind_channel()
nvgpu_gr_fecs_trace_unbind_channel()

We are not accessing any fifo/ch/tsg construct in gr/fecs_trace unit
hence update parameter list of above APIs to receive inst_block,
gr_ctx, subctx pointers directly instead of receiving channel_gk20a

Delete gk20a/fecs_trace_gk20a.* files since they are no longer
required. All the contents in those files are now moved to gr/fecs_trace
unit

Jira NVGPU-1880

Change-Id: I7ef9f0b66781b45155035237172ae400f02740e4
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2032707
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-08 07:07:27 -08:00
Deepak Nibade
8ce2a97d8e gpu: nvgpu: create common.gr.hwpm_map unit
Create new unit common.gr.hwpm_map with source file common/gr/hwpm_map.c
and public header include/nvgpu/gr/hwpm_map.h

Move all APIs in gr_gk20a.c that handle hwpm_map functionality to this
new unit. This unit now exposes below struct that is included in struct
gr_gk20a

struct nvgpu_gr_hwpm_map {
	u32 pm_ctxsw_image_size;

	u32 count;
	struct ctxsw_buf_offset_map_entry *map;

	bool init;
}

Expose below APIs
nvgpu_gr_hwpm_map_init() - initialize HWPM map meta-data with given size
nvgpu_gr_hwpm_map_deinit() - deinitialize HWPM map
nvgpu_gr_hwmp_map_find_priv_offset() - find a given offset in the map

The sequence to create the map by reading various netlist segments is
moved to a static API nvgpu_gr_hwpm_map_create()

Jira NVGPU-2894

Change-Id: I07d31169d2ff18a496eb79a726027b847d5f0e06
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2032777
GVS: Gerrit_Virtual_Submit
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-08 05:55:29 -08:00
Mahantesh Kumbar
ed530d99fe gpu: nvgpu: print PMU command/message unit-id upon RPC failure
Print PMU command/message unit-id upon RPC failure
to know which command/message failed using RPC unit-id

Bug 200499055

Change-Id: Ifbe033347c5e1902328acc5c1f96f38860093fd2
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2034783
Reviewed-by: Ramesh Mylavarapu <rmylavarapu@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2019-03-07 22:54:51 -08:00