Commit Graph

2584 Commits

Author SHA1 Message Date
Alex Waterman
25ee1d45f9 gpu: nvgpu: Fixup formatting in VM code
Fixup a minor spacing issue in the VM code.

Change-Id: Ia4aaa3cdd7cb63958870cebb51821bf640d56123
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1499446
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
2017-06-13 16:24:34 -07:00
Mahantesh Kumbar
c18364d0c4 gpu: nvgpu: moved pg out from pmu_gk20a.c/h
- moved pg related code to pmu_pg.c under common/pmu folder
  PG state machine support methods
  PG ACK handlers
  AELPG methods
  PG enable/disable methods

-prepended with nvgpu_ for elpg/aelpg global methods
by replacing gk20a_

JIRA NVGPU-97

Change-Id: I2148a69ff86b5c5d43c521ff6e241db84afafd82
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: http://git-master/r/1498363
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-06-13 13:19:47 -07:00
Seema Khowala
45355f00e7 gpu: nvgpu: use hww_esr_reset field to reset hwww_esr
Use hww_esr_reset field to clear hww errors

Change-Id: I4b5da20c8a4bcfe2dea357d3d2ebd53678673b48
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: http://git-master/r/1500965
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-06-13 09:14:03 -07:00
Seema Khowala
64050935e9 gpu: nvgpu: add sked exception detection and handling
Needed to detect and clear sked exception

Bug 200315442

Change-Id: Ia85e8827e563addf7b9d0f95ef192379bb808638
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: http://git-master/r/1500860
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-06-13 09:14:03 -07:00
Mahantesh Kumbar
e9267bb3e5 gpu: nvgpu: reorganize PMU F/W support
- Moved pmu f/w related support from pmu_gk20a.c
to "drivers/gpu/nvgpu/common/pmu/pmu_fw.c" file
- Prepended with nvgpu_ for global functions & replaced
wherever used
- Moved below list related to PMU f/w
  init/remove,
  PMU version specific ops,
  non-secure ucode blob prepare,

JIRA NVGPU-56

Change-Id: Ifdad8c560bd233e98728717d5868119e9d8e8d90
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: http://git-master/r/1480636
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
2017-06-13 02:40:16 -07:00
Mahantesh Kumbar
8c66aef3bd gpu: nvgpu: reorganize PMU FB alloc/free
Moved PMU FB access related code from pmu_gk20a.c to
"drivers/gpu/nvgpu/common/pmu/pmu.c" file
- Prepended with nvgpu_ for global functions & replaced
wherever used.

JIRA NVGPU-56
JIRA NVGPU-94

Change-Id: I42bfd9d216e6b35672a9738f01302d954b32b69e
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: http://git-master/r/1480551
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
2017-06-13 02:40:15 -07:00
Mahantesh Kumbar
69dee6a648 gpu: nvgpu: reorganize PMU init
- Moved PMU init code from pmu_gk20a.c to
"drivers/gpu/nvgpu/common/pmu/pmu.c" file
- Moved below related methods
  SW/HW init,
  init msg handler,
  deinit/destroy,
  PMU state machine
-Created HAL methods to read message queue tail
& supported mutex count.
-prepend with nvgpu_ for pmu init global
mehtods

JIRA NVGPU-56
JIRA NVGPU-92

Change-Id: Iea9efc194fefa74fb5641d2b2f4633577d2c3a47
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: http://git-master/r/1480002
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-06-12 11:03:37 -07:00
Richard Zhao
914bb78a7d gpu: nvgpu: vgpu: move TEGRA_VGPU_ATTRIB_PREEMPT_CTX_SIZE to constants
Also removed deprecated TEGRA_VGPU_ATTRIB_*, but leave a place holder
in case someone wants to use this command in future.

Jira VFND-3796

Change-Id: Ic36a59db238d276b0e3dd68a9d8ec5834a04333d
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: http://git-master/r/1457497
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-06-09 14:55:12 -07:00
Mahantesh Kumbar
40ca7cc573 gpu: nvgpu: reorganize PMU IPC
- Moved PMU IPC related code to
drivers/gpu/nvgpu/common/pmu/pmu_ipc.c file,
-Below is the list which are moved
  seq
  mutex
  queue
  cmd/msg post & process
  event handling

NVGPU-56

Change-Id: Ic380faa27de4e5574d5b22500125e86027fd4b5d
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: http://git-master/r/1478167
GVS: Gerrit_Virtual_Submit
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-06-09 11:13:54 -07:00
Terje Bergstrom
821d1cab90 gpu: nvgpu: Move error notifier free to Linux module
Freeing error notifier involves calling dma_buf API, which is Linux
specific. Move the free to happen in Linux specific channel close
path.

JIRA NVGPU-65

Change-Id: Ifd8b31bb8c8af13975c34add00f51dd869cfd76a
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1498583
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
2017-06-08 19:13:34 -07:00
Deepak Goyal
1dfcf1833b gpu: nvgpu: Update PMU firmware version.
This patch also updates PMU cmdline args as
required by updated firmware.

GPUT19x-30

Change-Id: I44214007046081a44acc7284eb2854d0548a8da8
Signed-off-by: Deepak Goyal <dgoyal@nvidia.com>
Reviewed-on: http://git-master/r/1498188
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
2017-06-08 07:54:24 -07:00
Deepak Nibade
0ad7f1d9aa gpu: nvgpu: use nvgpu specific nvhost APIs
Remove use of linux specifix header files
<linux/nvhost.h> and <linux/nvhost_ioctl.h>
and use nvgpu specific header file <nvgpu/nvhost.h>
instead
This is needed to remove all Linux dependencies
from nvgpu driver

Replace all nvhost_*() calls by
nvgpu_nvhost_*() calls from new nvgpu library

Remove platform device pointer host1x_dev
from struct gk20a and add struct
nvgpu_nvhost_dev instead

Jira NVGPU-29

Change-Id: Ia7af70602cfc16f9ccc380752538c05a9cbb8a67
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1489726
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2017-06-08 06:37:15 -07:00
Deepak Nibade
2c9713e21c gpu: nvgpu: add nvhost abstraction files
Add new abstraction file common/linux/nvhost.c for all
nvhost APIs and operations and export them from
header <nvgpu/nvhost.h>

This file will be compiled only if config
CONFIG_TEGRA_GK20A_NVHOST is set

Define struct nvgpu_nvhost_dev in a separate private
header nvhost_priv.h

Jira NVGPU-29

Change-Id: I17e1f7836d4854feadff0c339bc093e78ba7f3eb
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1489725
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2017-06-08 06:37:15 -07:00
Terje Bergstrom
942029a433 gpu: nvgpu: Split non-stall interrupt handling
Split handling of stalling interrupt to Linux specific chip
agnostic and OS independent chip specific parts.

Linux specific chip independent part contains handler for ISR
and passing the control to a bottom half worker. It uses the new MC
HALs intr_nonstall (query interrupt status), intr_nonstall_pause
(pause interrupts), intr_nonstall_resume (resume interrupts), and
is_intr1_pending (query per-engine interrupt bit).

MC HAL isr_nonstall is removed, because its work is now handled in
chip independent code.

JIRA NVGPU-26

Change-Id: I3e4c9905ef6eef7f1cc9f71b0278518ae663f87e
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1497048
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-06-07 20:07:00 -07:00
Terje Bergstrom
fc724baa4b gpu: nvgpu: Add MC HAL is_intr1_pending
Add MC HAL is_intr1_pending. At the same time introduce nvgpu_unit
that is passed as parameter to is_intr1_pending. The API is passed
contents of intr1 register and an engine number, and returns true
if there's an interrupt pending for the engine.

JIRA NVGPU-26

Change-Id: I8e6363dd78572f8e41dbab2b258036ed168b6f75
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1497870
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-06-07 20:06:55 -07:00
seshendra Gadagottu
8efe596b01 gpu: nvgpu: implement chip specific fb cbc_init
Add function pointer in fb to add chip specific
cbc init.

GPUT19X-70

Change-Id: I12f73945d99498de965a671fd8e258b5c95bbabe
Signed-off-by: seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: http://git-master/r/1484524
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-06-07 13:35:28 -07:00
Alex Waterman
048c6b062a gpu: nvgpu: Separate GMMU mapping impl from mm_gk20a.c
Separate the non-chip specific GMMU mapping implementation code
out of mm_gk20a.c. This puts all of the chip-agnostic code into
common/mm/gmmu.c in preparation for rewriting it.

JIRA NVGPU-12
JIRA NVGPU-30

Change-Id: I6f7fdac3422703f5e80bb22ad304dc27bba4814d
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1480228
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-06-06 17:09:22 -07:00
Alex Waterman
c21f5bca9a gpu: nvgpu: Remove extraneous VM init/deinit APIs
Support only VM pointers and ref-counting for maintaining VMs. This
dramatically reduces the complexity of the APIs, avoids the API
abuse that has existed, and ensures that future VM usage is
consistent with current usage.

Also remove the combined VM free/instance block deletion. Any place
where this was done is now replaced with an explict free of the
instance block and a nvgpu_vm_put().

JIRA NVGPU-12
JIRA NVGPU-30

Change-Id: Ib73e8d574ecc9abf6dad0b40a2c5795d6396cc8c
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1480227
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-06-06 17:09:16 -07:00
Alex Waterman
c2b63150cd gpu: nvgpu: Unify vm_init for vGPU and regular GPU
Unify the initialization routines for the vGPU and regular GPU paths.
This helps avoid any further code divergence. This also assumes that
the code running on the regular GPU essentially works for the vGPU.
The only addition is that the regular GPU path calls an API in the
vGPU code that sends the necessary RM server message.

JIRA NVGPU-12
JIRA NVGPU-30

Change-Id: I37af1993fd8b50f666ae27524d382cce49cf28f7
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1480226
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-06-06 17:09:11 -07:00
Alex Waterman
6bd7d22c0f gpu: nvgpu: Fix big_pages logic in nvgpu_vm_init
Fix the way big_pages is handled in nvgpu_vm_init(). Prior to this
patch big_pages could wind up being true even if disable_bigpages is
set in the mm struct. Clearly this is wrong.

The logic is now simplified a little bit and makes it so that if the
disable_bigpages field is set then the resulting VM created by
nvgpu_vm_init() has only one user area (no need for a second LP user
area) and the big_pages field for the VM is set to false.

JIRA NVGPU-12
JIRA NVGPU-30

Change-Id: If5dc7fcf3fa4e070f87295406f0afe414269b702
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1493318
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-06-06 17:09:05 -07:00
Konsta Holtta
80197d2c9d gpu: nvgpu: split vidmem_is_vidmem
As the vidmem_is_vidmem flag has got two separate meanings in one bit,
split it in two bits into the enabled() API:

Add NVGPU_MM_HONORS_APERTURE bit, which is the same as vidmem_is_vidmem
with its original meaning, and use it to test which aperture bits to
write to hardware.

Add NVGPU_MM_UNIFIED_MEMORY bit, which has the opposite meaning: that
the GPU shares the SoC memory. When this flag is false, the GPU has its
own local video memory.

Jira NVGPU-86

Change-Id: I2d0bed3b1ede5a712be99323d3035b154bb23c3a
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/1496080
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-06-06 11:05:03 -07:00
Deepak Nibade
26487b82df gpu: nvgpu: move clk_gm20b debugfs to Linux module
Move debugfs code from clk_gm20b.c to file in Linux module
common/linux/debug_clk.c
This file will be compiled only if CONFIG_DEBUG_FS is set

Define below new HAL APIs for various clock operations
which can be accessed from debug file
init_debugfs()
get_voltage()
get_gpcclk_clock_counter()
pll_reg_write()
get_pll_debug_data()

Export nvgpu_pl_to_div() and nvgpu_div_to_pl() so
that these can be accessed from debug_clk.c

Add new structure nvgpu_clk_pll_debug_data so that
all required register values for debugging can be
made available in debug_clk.c

Add new API gm20b_get_gpc_pll_parms() so that statically
defined variable can be accessed in debug_clk.c too

Remove global variable dvfs_safe_max_freq and add
it to struct clk_gk20a so that it can accessed
from both clk_gm20b.c and debug_clk.c

Jira NVGPU-62

Change-Id: I3ae70b40235e78141a686686930e1f178ad59453
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1488903
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-06-06 11:04:57 -07:00
Deepak Nibade
9902a49b0b gpu: nvgpu: fix use of untrusted scalar value
Kind value can be passed to API nvgpu_vm_map() from User
space (through IOCTL NVGPU_AS_IOCTL_MAP_BUFFER_EX)

But kind value is not checked for sane values
before storing it in bfr.kind_v
And then we use this kind value as array index
in gk20a_kind_is_supported() which is incorrect

Fix this by ensuring in nvgpu_vm_map() that the
kind value is well within range

Bug 200291879
Coverity id : 2567923
Coverity id : 2567924

Change-Id: Ic57395018727cbd2260c929581db256e427316c6
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1496597
GVS: Gerrit_Virtual_Submit
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-06-06 08:13:43 -07:00
Deepak Nibade
793bc318c5 gpu: nvgpu: remove logically dead code
In nvgpu_vm_map(), variable "inserted" can never be
true in error path
Hence remove the logically dead code

Bug 200291879
Coverity id : 2567920

Change-Id: I5428f7d52f1d4f815c04d90ea651668dd72ba985
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1495906
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
2017-06-06 08:13:43 -07:00
Deepak Nibade
fe86835633 gpu: nvgpu: fix resource leak
We pass (struct device_attribute *) to gp10b_ecc_stat_create()
and gr_gp10b_ecc_stat_create() and then assign a memory
allocation to this pointer
But since this pointer is local copy to function, static
pointer variables are never set in gr_gp10b_create_sysfs()

This also results in a resource leak since we never free
the storage assigned to local variable

Fix this by adding correct parameter (struct device_attribute **)
so that the address of the allocation is returned to the caller
correctly

Bug 200291879
Coverity id : 2567934

Change-Id: I7ac79810d9e22a568ae3cd1a69eb3f59a8d356ac
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1495905
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
2017-06-06 08:13:43 -07:00
Deepak Nibade
d4fcf90047 gpu: nvgpu: fix recursive include from clk.h
Fix recursion in header include sequence :
gk20a.h -> clk.h -> gk20a.h
by removing gk20a.h include from clk/clk.h

Fix the compile time error by forward declaring
struct gk20a

Coverity id : 2567917
Bug 200291879

Change-Id: I8fc3a8787dae91ae1a070c63bae6550596734603
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1495904
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
2017-06-06 08:13:43 -07:00
Stephen Warren
345fc00445 gpu: nvgpu: remove duplicate \n from log messages
nvgpu_log/info/warn/err() internally add a \n to the end of the message.
Hence, callers should not include a \n at the end of the message. Doing
so results in duplicate \n being printed, which ends up creating empty
log messages. Remove the duplicate \n from all err/warn messages.

(This message was updated in parallel with the previous change to fix
this particular issue)

Bug 1928311

Change-Id: I789f8c4b4084539ac901ed0f6b815518900cee90
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: http://git-master/r/1495020
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-06-06 08:13:36 -07:00
Terje Bergstrom
0ebe462c13 gpu: nvgpu: Use nvgpu_cond in notifier wq
Change notifier wait queue to use nvgpu_cond instead of Linux wait
queue.

JIRA NVGPU-14

Change-Id: I197a0ef6c0a2331ca0dbb3480bdb89d45ba73020
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1469853
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
2017-06-05 13:53:13 -07:00
Mahantesh Kumbar
673dd97160 gpu: nvgpu: moved & renamed "struct pmu_gk20a"
- Renamed "struct pmu_gk20a" to "struct nvgpu_pmu" then moved
to file "pmu.h" under folder "drivers/gpu/nvgpu/include/nvgpu/"

- Included header file "pmu.h" to dependent file &
removed "pmu_gk20a.h" include if its usage is not present.

- Replaced "struct pmu_gk20a" with "struct nvgpu_pmu" in dependent
source & header files.

JIRA NVGPU-56

Change-Id: Ia3c606616831027093d5c216959c6a40d7c2632e
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: http://git-master/r/1479209
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-06-04 23:05:18 -07:00
David Nieto
7668ccb2a2 gpu: nvgpu: Add support for engine specific counters
Add support for chip engine specific error counters

JIRA: GPUT19X-82

Change-Id: I1b2686bd58c2d4e060a0a79c6b9e505811490a90
Signed-off-by: David Nieto <dmartineznie@nvidia.com>
Reviewed-on: http://git-master/r/1490824
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-06-04 20:34:58 -07:00
David Nieto
a1220b49ae gpu: nvgpu : GPC MMU ECC support
Adding support for handling of GPC MMU errors

JIRA: GPUT19X-112

Change-Id: Iadeef017587e5dce3698026eef4ad94676c3c02b
Signed-off-by: David Nieto <dmartineznie@nvidia.com>
Reviewed-on: http://git-master/r/1490771
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-06-04 20:34:57 -07:00
David Nieto
651f970d1c gpu: nvgpu: chip specific L2 ECC error support
Adding support for handling of chip specific ECC memory errors

JIRA: GPUT19X-112

Change-Id: I1c04ac1d5233c332b300540eade1b73527c46ff7
Signed-off-by: David Nieto <dmartineznie@nvidia.com>
Reviewed-on: http://git-master/r/1489020
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-06-04 20:34:57 -07:00
Mahantesh Kumbar
96cf9748a7 gpu: nvgpu: nvgpu_thread to handle PMU state changes
- Replaced schedule_worker() with nvgpu_thread along
with nvgpu_cond_wait() to handle PMU state machine
changes during boot.

- Added new state "PMU_STATE_EXIT" to exit
PMU state machine loop & wait for the
thread stop signal.

- In gk20a_init_pmu_setup_sw() thread creates &
starts thread execution to handle PMU state changes.

- In pmu_destroy() thread post PMU_STATE_EXIT
& waits for pending operation to complete
before thread destroy.

JIRA NVGPU-56

Change-Id: I951208bf88e82c281e3e678ddc603d58aec5ab10
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: http://git-master/r/1487882
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-06-02 10:53:47 -07:00
Deepak Nibade
6090a8a7ee gpu: nvgpu: move debugfs code to linux module
Since all debugfs code is Linux specific, remove
it from common code and move it to Linux module

Debugfs code is now divided into below
module specific files :

common/linux/debug.c
common/linux/debug_cde.c
common/linux/debug_ce.c
common/linux/debug_fifo.c
common/linux/debug_gr.c
common/linux/debug_mm.c
common/linux/debug_allocator.c
common/linux/debug_kmem.c
common/linux/debug_pmu.c
common/linux/debug_sched.c

Add corresponding header files for above modules too
And compile all of above files only if CONFIG_DEBUG_FS is set

Some more details of the changes made

- Move and rename gk20a/debug_gk20a.c to common/linux/debug.c
- Move and rename gk20a/debug_gk20a.h to include/nvgpu/debug.h

- Remove gm20b/debug_gm20b.c and gm20b/debug_gm20b.h and call
  gk20a_init_debug_ops() directly from gm20b_init_hal()

- Update all debug APIs to receive struct gk20a as parameter
  instead of receiving struct device pointer
- Update API gk20a_dmabuf_get_state() to receive struct gk20a
  pointer instead of struct device

- Include <nvgpu/debug.h> explicitly in all files where debug
  operations are used
- Remove "gk20a/platform_gk20a.h" include from HAL files
  which no longer need this include

- Add new API gk20a_debug_deinit() to deinitialize debugfs
  and call it from gk20a_remove()
- Move API gk20a_debug_dump_all_channel_status_ramfc() to
  gk20a/fifo_gk20a.c

Jira NVGPU-62

Change-Id: I076975d3d7f669bdbe9212fa33d98529377feeb6
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1488902
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2017-06-02 06:53:35 -07:00
Deepak Nibade
be7f22db8b gpu: nvgpu: use nvgpu specific lock APIs in kmem
Use lock/mutex APIs from nvgpu/lock.h instead of
using Linux specific APIs in kmem.c
This patch is needed in order to remove Linux
dependency from nvgpu driver

Jira NVGPU-62

Change-Id: Ic3484857bc2fa1917724681f68c1626c1235baea
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1492107
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2017-06-02 06:53:34 -07:00
Seema Khowala
a7e6339637 gpu: nvgpu: *gr_bind_fecs_elpg called only if can_elpg set
gk20a_init_gr_bind_fecs_elpg(g) should not be called if system
does not support gpmu

Bug 200306035

Change-Id: Ifdc3bb326993cd42bfa9aece06881c8426b83a8b
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: http://git-master/r/1486043
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-06-01 14:13:23 -07:00
Vijayakumar
38ec046691 gpu: nvgpu: pass right data to aelpg control calls
Fill aelpg controller id explicitly and use right structure within
command union

bug 1932265

Change-Id: Ie06bf8b1b124e67871dd1443e14a1080473a7ab1
Signed-off-by: Vijayakumar <vsubbu@nvidia.com>
Reviewed-on: http://git-master/r/1493125
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Adeel Raza <araza@nvidia.com>
Tested-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
2017-05-31 22:53:48 -07:00
Mahantesh Kumbar
f97d62eb8f gpu: nvgpu: Avoid NULL dereference of flcn
-issue: flcn pointer in nvgpu_flcn_sw_init()
 will be NULL in default case of switch,
 and that results in NULL pointer
 dereference on flcn->flcn_id.
-Fix: Used flcn_id parameter to print
 falcon id in default case.

Coverity ID: 2514311
Coverity ID: 2514313

Bug 200291879

Change-Id: I7008817c22cdf8d9d9027cc1b724e2424b4a3d8e
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: http://git-master/r/1491694
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-05-31 10:14:51 -07:00
Alex Waterman
8d6b5cc349 gpu: nvgpu: Move unify_address_spaces to flags
Use the enabled flags API to handle the unify_address_sapce spaces
flag.

JIRA NVGPU-84
JIRA NVGPU-12
JIRA NVGPU-30

Change-Id: Id1b59aed4b349d6067615991597d534936cc5ce9
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1488307
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-05-30 13:24:35 -07:00
Alex Waterman
66a2511a36 gpu: nvgpu: Begin removing variables in struct gk20a
Begin removing all of the myriad flag variables in struct gk20a and
replace that with one API that checks for flags being enabled or
disabled. The API is as follows:

  bool nvgpu_is_enabled(struct gk20a *g, int flag);
  bool __nvgpu_set_enabled(struct gk20a *g, int flag, bool state);

These APIs allow many of the gk20a flags to be replaced by defines.
This makes flag usage consistent and saves a small amount of memory in
struct gk20a. Also it makes struct gk20a easier to read since there's
less clutter scattered through out.

JIRA NVGPU-84

Change-Id: I6525cecbe97c4e8379e5f53e29ef0b4dbd1a7fc2
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1488049
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-05-30 13:24:35 -07:00
Seema Khowala
b817e9e207 gpu: nvgpu: add fifo ops get_mmu_fault_info
This is needed to take care of gp10b h/w header
changes. gp10b changes as compared to legacy gpu chips
-fault_info_fault_type field width is changed
-fault_info_write field is removed
-fault_info_access_type field is added
-fault_info_engine_subid is removed
-fault_info_client_type is added
-fault_info_client field width has changed

JIRA GPUT19X-7
JIRA GPUT19X-12

Change-Id: Iebf28cc6c851830524049b67a71cd72fb4a28948
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: http://git-master/r/1487319
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-05-30 11:04:10 -07:00
Seema Khowala
c3192b5acc gpu: nvgpu: use mmu_fault_info struct for legacy gpu chips
Removed fifo_mmu_fault_info_gk20a struct to use
new mmu_fault_info struct

JIRA GPUT19X-7
JIRA GPUT19X-12

Change-Id: I1987ff1b07e7dbdbee58d7e5f585faacf4846e54
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: http://git-master/r/1487240
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-05-30 11:04:05 -07:00
Seema Khowala
e8f4e52efe gpu: nvgpu: remove "gk20a_channel_worker_process" prints
dbg_mask option that enables gpu_dbg_fn bit litters
uart with "gk20a_channel_worker_process" prints.

Change-Id: I0489db630cc94e909a871233744ec264627b4cea
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: http://git-master/r/1490979
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
2017-05-30 09:53:22 -07:00
Seema Khowala
68300d9c02 gpu: nvgpu: add enable_exceptions gr ops
This is needed to enable chip specific gr exceptions

JIRA GPUT19X-75

Change-Id: I5ca8d0e51d00947c3ab1675bb6331207def433a4
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: http://git-master/r/1474851
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-05-30 08:43:35 -07:00
Konsta Holtta
351793947b gpu: nvgpu: drop tegra idle registration calls
The deprecated functions tegra_{register,unregister}_idle_unidle() have
not existed in ages, so remove this dead code.

Change-Id: I45005844d59282ff9638cce1c61002bddab74ce2
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/1488813
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-05-29 15:13:27 -07:00
skadamati
9f86bd1d9c gpu: nvgpu: Fix build failure by missing headers
Forward declare struct file & inode

../../../nvgpu/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c:26:0:
../../../nvgpu/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.h:29:57:
 error: 'struct file' declared inside parameter list [-Werror]
int gk20a_ctxsw_dev_release(struct inode *inode, struct file *filp);

Bug 200310575

Change-Id: I872b3a2483fb4dda9569aca1b4729bcd8acd5968
Signed-off-by: skadamati <skadamati@nvidia.com>
Reviewed-on: http://git-master/r/1490166
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
2017-05-29 02:53:42 -07:00
seshendra Gadagottu
c0822cb22e gpu: nvgpu: add chip specific sync point support
Added support for chip specific sync point implementation.
Relevant fifo hal functions are added and updated for
legacy chips.

JIRA GPUT19X-2

Change-Id: I9a9c36d71e15c384b5e5af460cd52012f94e0b04
Signed-off-by: seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: http://git-master/r/1258232
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-05-26 14:07:12 -07:00
skadamati
e21e6e947b gpu: nvgpu: Fix build failure by missing headers
Move the platform_gk20a.h include out of the ifdef CONFIG_DEBUG_FS
in the CDE code since dev_from_gk20a() is used regardless of
whether debugfs is enabled.

Also modify some of the CE ops to take a struct gk20a instead of a
struct device. This avoids any requirement for including
linux/device.h or platform_gk20a.h.

Bug 200310575

Change-Id: Ifef963cd0f66d05094a698200386cc6140920eac
Signed-off-by: skadamati <skadamati@nvidia.com>
Reviewed-on: http://git-master/r/1487830
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-05-26 03:34:42 -07:00
Stephen Warren
2e338c77ea gpu: nvgpu: remove duplicate \n from log messages
nvgpu_log/info/warn/err() internally add a \n to the end of the message.
Hence, callers should not include a \n at the end of the message. Doing
so results in duplicate \n being printed, which ends up creating empty
log messages. Remove the duplicate \n from all err/warn messages.

Bug 1928311

Change-Id: I99362c5327f36146f28ba63d4e68181589735c39
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-on: http://git-master/r/1487232
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-05-26 03:34:30 -07:00
Terje Bergstrom
726900b843 gpu: nvgpu: Split stalling interrupt handling
Split handling of stalling interrupt to Linux specific chip
agnostic and OS independent chip specific parts.

Linux specific chip independent part contains handler for ISR
and passing the control to a bottom half. It uses the new MC HALs
intr_stall (query interrupt status), intr_pause (pause interrupts)
and intr_resume (resume interrupts).

MC HAL isr_stall now returns void and gets called in thread context
and thus remove isr_thread_stall and replace the implementation with
isr_stall.

JIRA NVGPU-26

Change-Id: I206f330f6fc4a1f4def47c5f986585ac4080216d
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1480243
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2017-05-26 03:34:08 -07:00