Commit Graph

5137 Commits

Author SHA1 Message Date
Richard Zhao
3b75042842 gpu: nvgpu: vgpu: remove cmd TSG_BIND_GR_CTX
RM server only needed TSG_BIND_GR_CTX to set vm and tsg for gr_ctx. It
could be done when alloc gr_ctx, so removing TSG_BIND_GR_CTX.

Jira GVSCI-179

Change-Id: Ic7fdcceecd2fa0ea1f29a50b797c8261d6e0720b
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1977576
Reviewed-by: Automatic_Commit_Validation_User
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: Aparna Das <aparnad@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>
2018-12-27 15:24:28 -08:00
Richard Zhao
d37187f1f8 gpu: nvgpu: vgpu: remove cmd CHANNEL_BIND_GR_CTX
Since gr_ctx has been moved to tsg, channel bind gr_ctx does nothing on
RM server.

Jira GVSCI-179

Change-Id: I80025c66beb943e0fe0e4cbb84db1b16d3b34b5b
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1977575
Reviewed-by: Automatic_Commit_Validation_User
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: Aparna Das <aparnad@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>
2018-12-27 15:24:25 -08:00
Richard Zhao
e768a5b2ca gpu: nvgpu: vgpu: use tsgid to get gr_ctx for BIND_GR_CTXSW_BUFFERS
It's for getting rid of gr_ctx handle and gr_ctx management on RM
server. gr_ctx will be got from tsgid.

Jira GVSCI-179

Change-Id: Ifc82bac6941413c392c6e1994d5a79c961e05eb0
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1977574
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: Aparna Das <aparnad@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>
2018-12-27 15:24:21 -08:00
Nitin Kumbhar
7cec4ba326 gpu: nvgpu: add platform control for gc off
The GC-OFF feature shall be available only for selective
dGPUs like Volta, etc. To enable this, add a platform flag
to control GC-OFF feature for a given dGPU.

If GC-OFF is not enabled for a dGPU, EPERM error will be
returned by kernel interfaces.

JIRA NVGPU-1100

Change-Id: Ic9e4492b2bb8916d520e78ecb6a500ccd349b70c
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1923249
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-misra <svc-mobile-misra@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>
2018-12-27 15:24:10 -08:00
Vaikundanathan S
4fcdc2771f gpu: nvgpu: Send Clock Load command to PMU
Clock command needs to be sent to PMU before
VFE computation.
Update Voltage step size to 6.25mV from 10mV

JIRA NVGPU-1150

Change-Id: I8f32313b2011050fdfeff7baba062239d620e51d
Signed-off-by: Vaikundanathan S <vaikuns@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1972986
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-23 02:13:41 -08:00
Nicolas Benech
37bc782b46 gpu: nvgpu: Fix MISRA 17.7 in pmgr
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. This patch fixes the last violations in the pmgr module.

JIRA NVGPU-677

Change-Id: I4824fe73fefff802ae7bc4145049b4afd87eb222
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1978213
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
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>
2018-12-21 13:24:48 -08:00
Nicolas Benech
7dd186e754 gpu: nvgpu: Fix MISRA 17.7 pmu_wait_message_cond
MISRA Rule-17.7 requires the return value of all functions to be used.
Fix is either to use the return value or change the function to return
void. Most of the time, callers of pmu_wait_message_cond ignore the
return value. This patch changes the signature to return void, and adds
a new pmu_wait_message_cond_status for callers that need the return
information.

JIRA NVGPU-677

Change-Id: Ibaa15b04c4d40a7de73f39a7d6eb68f9e3da71f3
Signed-off-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1978211
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-21 13:24:44 -08:00
Alex Waterman
150905fff2 gpu: nvgpu: Combine else paths in nvgpu_assert()
The else path in the nvgpu_assert() call definition handles the
non-Linux kernel platforms. These platforms are generally safety
conscious and as a result care about MISRA scans and unit testing.
The static inline hides the BUG_ON() call from the unit test
branch analyzer and the MISRA analyzer. Note: the MISRA issue
still exists; however, it's just not seen when analyzing patches
that only use the nvgpu_assert() call.

This patch combines the __POSIX__ path with the general else path
to ensure that all non-Linux platforms use the aforementioned
static inline.

JIRA NVGPU-1246

Change-Id: I3f267224acd0b27429302118872c40ca6d7b9137
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1977276
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-21 13:24:27 -08:00
Tejal Kudav
a307b6eb77 gpu: nvgpu: Move nvlink HAL files to common/nvlink
Move the nvlink HAL code to unit specific directory as part
of nvgpu restructing.
This move is done after removing usage of other unit's hardware
headers from nvlink. Also confirmed that no other unit files are
including nvlink hardware headers.

JIRA NVGPU-966

Change-Id: I301e3f8de37c5792a3e1e799b97e5fdfc131f058
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975259
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-21 13:24:19 -08:00
Scott Long
d5f26aa074 gpu: nvgpu: MISRA 10.1 fixes to pmu/sec2
MISRA Rule 10.1 states that operands shall not be of an
inappropriate essential type.

For example, the use of bitwise OR on signed values is not
permitted.

Both the pmu_read_message() and sec2_read_message() routines
do this in some cases when an error (or unexpected number of
bytes) is returned from the falcon queue pop/rewind routines.

This patch eliminates the MISRA violations by modifying these
cases to return the falcon queue operation error unmodified in the
corresponding status argument (or use -EINVAL in the event the
requested number of bytes isn't returned).

To reduce code duplication new pmu_falcon_queue_read() and
sec2_falcon_queue_read() routines are added here to wrap the
code that handles the error for the respective units.

Note that higher up in the call sequence (tu104_sec2_isr() in the
sec2_read_message() case and gk20a_pmu_isr() in the pmu_read_message()
case) the actual status value is only checked for non-zero or ignored
altogether.  So it appears no existing code would depend on the
bitwise OR result anyway.

JIRA NVGPU-650

Change-Id: Id303523ac096f1989e612044082e0a62ae8179c2
Signed-off-by: Scott Long <scottl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1972624
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-21 13:24:10 -08:00
Preetham Chandru R
9ad31113e8 gpu: nvgpu: RDMA implementation
This change adds RDMA supports for tegra iGPU.
1. Cuda Process allocates the memory and passes
   the VA and size to the custom kernel driver.
2. The custom kernel driver maps the user allocated
   buf and does the DMA to/from it.
3. Only supports iGPU + cudaHostAlloc sysmem
4. Works only for a given process.
5. Address should be sysmem page aligned and size should
   be multiple of sysmem page size.
6. The custom kernel driver must register a free_callback when get_page()
   function is called.

Bug 200438879

Signed-off-by: Preetham Chandru R <pchandru@nvidia.com>
Change-Id: I43ec45734eb46d30341d0701550206c16e051106
Reviewed-on: https://git-master.nvidia.com/r/1953780
(cherry picked from commit d6278955f6)
Reviewed-on: https://git-master.nvidia.com/r/1821407
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-21 05:35:45 -08:00
Mahantesh Kumbar
18299e0f86 gpu: nvgpu: remove unnecessary error print of falcon queue
-For queue full there is pmu_dbg message & returned with
 EAGAIN error to end caller for retry, so intermediate error
 message is not correct print for queue full.

Bug 200477931
Bug 200475876

Change-Id: I263f66f7a8d8f1b98985f32f9daa49b09309c359
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1976889
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-20 21:46:55 -08:00
rmylavarapu
604170d30f gpu: nvgpu: Port nvgpu to support GV100 from r400
Changes
1. Corrected VF point boardobject get status offset in Super surface structure.
2. RPC command ID values for Perf unit is different from R400 firmware. Updated with the correct values.
3. Update the PMU firmware with version number: 25133717

PMU firmware can be taken from P4CL #25453641

JIRA NVGPU-1604

Change-Id: I307fa4b643cdf827a223ec0530fe4851b4592df5
Signed-off-by: rmylavarapu <rmylavarapu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975886
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: Vaikundanathan S <vaikuns@nvidia.com>
Tested-by: Vaikundanathan S <vaikuns@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>
2018-12-20 21:46:43 -08:00
tkudav
c6e021589e gpu: nvgpu: PS3.5 VFE VAR and EQU changes
Changes between GV100 and Turing VFE pstate tables-
1. PS3.5 ucode packs two sets of vfe boardobjgrp - primary and
   rppm in new struct whose name is appended with suffix pack. The
   rppm (runtime power and performance model) set is needed to
   achieve Max Q. The rppm set is not relevant to Automotive SKUs and
   entries are set to 'disabled'. But the turing ucode in R400 uses
   the 'pack' struct to calculate supersurface offset and size of
   vfe_var/equ boardobjgrp.
2. Header size has been increased to add RPPM related VFE variable
   and equation count.

VFE Variables boardobjgrp specific changes-
1. New var type 'single caller specified' had been added to represent
   generic type of variable which is not associated with voltage or
   frequency but identified by a Unique ID.
2. The frequency variable type can be associated with a clock domain,
   if the clock domain index availability flag is set.

VFE Equations boardobjgrp specific changes-
1. New entry type 'scalar' had been added to allow scaling equation
   pointed by 'equ_idx_to_scale'.
2. More ouput types are added to represent the equation evaluation
   results.

We modify the nvgpu Turing driver and GV100 ucode to adapt to these
changes.
This patch also fixes some MISRA defects in touched files.

JIRA NVGPU-1178

Change-Id: I90910ac8dccf0b98a588cbc442dc11ac4fbd2e61
Signed-off-by: tkudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1928999
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vaikundanathan S <vaikuns@nvidia.com>
Tested-by: Vaikundanathan S <vaikuns@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>
2018-12-20 21:46:29 -08:00
Seeta Rama Raju
49d3881f36 gpu: nvgpu: include: fix MISRA 10.4 Violations
Adding "U" at the end of the integer literals to have
same type of operands when an bitwise operation is performed.

JIRA NVGPU-1468

Change-Id: I283496e4973ae9567334d365d10a38d273355446
Signed-off-by: Seeta Rama Raju <srajum@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1964166
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Alex Waterman <alexw@nvidia.com>
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>
2018-12-20 16:25:32 -08:00
tkudav
f6df40f945 gpu: nvgpu: Use device_info parsing HAL for nvlink
Nvlink related information like pri_base, reset and intr enum etc.
is present in device_info table under the engine_type = IOCTRL.
Update the nvlink code to use the HALs exposed by "Top" unit to get
the above described information.

JIRA NVGPU-966

Change-Id: Ie2247cfbcc42bf7b7e8280e2e678086ef06a474c
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1969401
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: svc-mobile-misra <svc-mobile-misra@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>
2018-12-20 09:26:04 -08:00
tkudav
3267530f22 gpu: nvgpu: Use device_info parsing HAL for Fifo
Update the fifo code to use the HALs exposed by "Top" unit to
read data from device_info table.

The information for GRAPHICS engine in device_info table is
now parsed using the get_device_info HAL from "Top" unit.

Copy engine(CE) has multiple entries in the device_info table
corresponding to each instance of the engine. Prior to Pascal, each
instance of an engine was denoted by different engine type.
For example in GM20B, there are engine types like COPY_ENGINE0,
COPY_ENGINE1 and so on. In Pascal and chips beyond, a new field
called "inst_id" is added and the engine_type is kept the same for
different instances of an engine. For example in GP10B, all copy
engine entries have same engine type i.e ENGINE_LCE, but different
inst_ids. So for Pascal and chips beyond, we use a different HAL to
get CE information from device_info table.

JIRA NVGPU-1053

Change-Id: Ib40a616d903a5dbef5730678c2ebc3454b8e900d
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1969400
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: svc-mobile-misra <svc-mobile-misra@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>
2018-12-20 09:26:01 -08:00
tkudav
38f8b3fb00 gpu: nvgpu: Add HALs for device_info table parsing
The device_info table is an array of registers which contain engine
specific data for engines like CE, graphics, nvdec, ioctrl etc.
These registers contain data like intr_enum, reset_enum, pri_base
and so on. The Top unit would include HAL to parse this table and
get data for a particular engine.
Some engines like CE have multiple entries in the device_info table
corresponding to each instance of the engine. Prior to Pascal, each
instance of an engine was denoted by different engine type.
For example in GM20B, there are engine types like COPY_ENGINE0,
COPY_ENGINE1 and so on. In Pascal and chips beyond, a new field
called "inst_id" is added and the engine_type is kept the same.
For example in GP10B, all copy engine entries have same engine type
i.e ENGINE_LCE, but different inst_ids. So for Pascal and chips
beyond, add HAL to get number of entries corresponding to an engine
type.The "get_device_info" HAL will parse a specific instance
of the engine using inst_id argument

JIRA NVGPU-1053

Change-Id: Ie3058b1c1bfdd87bfa47e5f037d049d9d50cfc0b
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1969399
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-20 09:25:57 -08:00
Vaikundanathan S
e39c193163 gpu:nvgpu: Export master_slave_domains_grp_mask
master_slave_domains_grp_mask needs to be set for all
programmable master/slave domains
Update gpc_clk VF curve count to 1, as there is no plan to support
secondary VF curve.

JIRA NVGPU-1150

Change-Id: I29427fa0eba53c088d20d3f9398717463081d3e3
Signed-off-by: Vaikundanathan S <vaikuns@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1969369
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: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-20 02:34:28 -08:00
Divya Singhatwaria
db533523c0 gpu: nvgpu: fix MISRA Rule 16.x violations in pmu
MISRA Rule 16.4 emphasizes on having a non-empty default label
for every switch case

MISRA Rule 16.6 emphasizes that every switch statement
shall have atleast two switch-clauses

JIRA NVGPU-1545
JIRA NVGPU-1557

Change-Id: I2d124ac0d66d8c490c59d262ddc647045d455633
Signed-off-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1970216
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-20 01:24:38 -08:00
Konsta Holtta
7a4c2f050f gpu: nvgpu: unit: add inactive channel runlist test
Cover the case where a tsg has channels that are not in the active map
of the runlist.

Jira NVGPU-1174

Change-Id: I63e71b5a295a427d9fab351f3b610134c72b040a
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975382
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-19 19:44:36 -08:00
Konsta Holtta
517b901f5f gpu: nvgpu: unit: test tsg timeslice, split fmt tests
Cover the nondefault path of tsg timeslice settings and split out the
three tsg format checks to be separate tests so that the timeslice test
fits in nicely.

Jira NVGPU-1174

Change-Id: Icaa99de81392a4b811247c5ca32526e22a61da84
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975381
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-19 19:44:32 -08:00
Konsta Holtta
8ca9f3a8cb gpu: nvgpu: unit: use args for runlist interleaving
The interleaving tests (full and oversize) are very similar in code. Add
common args struct for them and have just one function to process args.

Jira NVGPU-1174

Change-Id: I535aeb020454d3f87ad1148560f29ca7fff4ae2d
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975380
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-19 19:44:28 -08:00
Konsta Holtta
e315011691 gpu: nvgpu: unit: align runlist test naming
A last minute fix in the runlist construction code rework reorganized
the order such that the ringbuf list starts with the highest level, not
lowest. Some tests were not updated though. Adjust comments and naming
to indicate what the tests really do, and add one more test to cover all
branches in the interleaved construction logic.

Jira NVGPU-1174

Change-Id: If608a35be2c5cf8f400df6673cd10c983ab91845
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975379
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-19 19:44:25 -08:00
Seema Khowala
3c44590b58 gpu: nvgpu: dump eng id and status upon timeout
Dump eng id and fifo_engine_status if eng fails to idle.
This change is helpful for debugging issues where engine
is not getting idle or intermittently getting idle due to
bad settings of registers in hals set by init_therm_setup_hw
and elcg_init_idle_filters

Bug 2115080

Change-Id: I4c6d144d3fc575db3f30596de6e536fd07753789
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1722194
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-19 18:03:34 -08:00
Thomas Fleury
4b1cfa5636 gpu: nvgpu: uppercase for VBIOS version
Use uppercase to display VBIOS version to match nvflash_eng,
spreadsheets, and Docker's manifest.

Bug 200473234

Change-Id: Idb3f802c41da8ebd0268386687be6a99c38dd9c3
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975518
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Eric Yuen <eyuen@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-19 14:55:15 -08:00
Vinod G
043ffd0c6a gpu: nvgpu: update gr hal for dgpu vdk
gr hal load_ctxsw_ucode changed for dgpu vdk.
This helps to avoid any pmu related code access.

JIRA NVGPU-1564

Change-Id: I8026ab88c8a8efba6cb1ee45f9ad5371ee08b1af
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1974091
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-19 14:55:11 -08:00
Vaikundanathan S
6efe7d92be gpu:nvgpu: Update vin Boardobj structure
Added fields coarse_control and offset_vfe_idx.
Set offset_vfe_idx to 0xFF(invalid) as we do not supoport.

JIRA NVGPU-1150

Change-Id: Ib8faf7a8be338cab6ed079d1aa5c20d71a116a14
Signed-off-by: Vaikundanathan S <vaikuns@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1965892
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-19 14:55:02 -08:00
Philip Elcan
6db2be854c gpu: nvgpu: posix: use MISRA-friendly true/false
In stdbool.h, gcc defines true and false as 1 and 0, respectively. Using
these as booleans generates MISRA 14.4 violations. So, define them as
real booleans in the POSIX types.h.

JIRA NVGPU-1022

Change-Id: Ic00e6ffb885c8d60ed40ca10ca5d686b4c2d39eb
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975425
Reviewed-by: Nicolas Benech <nbenech@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Scott Long <scottl@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>
2018-12-19 11:24:46 -08:00
Philip Elcan
90024cb73a gpu: nvgpu: misc MISRA 14.4 fixes
This fixes a few lingering MISRA Rule 14.4 violations.  Rule 14.4
requires that the condition of an if statement be a boolean.

JIRA NVGPU-1022

Change-Id: Ib6293e00e0436fceee9f7bf0ada1b6ac01a82faa
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1975424
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-19 11:24:42 -08:00
Richard Zhao
54e02c01f8 gpu: nvgpu: move userd slab init to common function
gk20a_init_fifo_setup_sw_common() is both called by vsrv and native
driver, so move the userd slab init to it.

Bug 2422486
Bug 200474793

Change-Id: Ic008bb16b3e9f36799c2c20e0c2cb449c236b469
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1973532
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-18 16:54:04 -08:00
Vinod G
57c392b0d2 gpu: nvgpu: fb hal update for dgpu vdk
SW code doesnot support secure boot for fmodel simulation.
Hence it  will fail mem_unlock firmware load.
Disable fb mem_unlock hal for dgpu vdk.

JIRA NVGPU-1564

Change-Id: I771bfee39e89171b614274b097de156a5bc351a0
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1974079
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-18 15:44:06 -08:00
Antony Clince Alex
7fb33cf87b gpu: nvgpu: Defer pstate deinit to driver remove
The PMU pstate deinit was invoked part of gpu power off. This frees and clears
the pmgr_pmu struct which causes the pmu remove support to crash when it
tries to access the pmgr_pmu object for freeing up the pmu board objects.
Deferred pstate deinit to nvgpu driver removal as there is no reason for it be
invoked part of prepare poweroff sequence.

JIRA NVGPU-1618

Change-Id: I2eb52000f0732d0abed54946e0843367b119d443
Signed-off-by: Antony Clince Alex <aalex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1971225
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-18 12:13:42 -08:00
Vinod G
d62281a15a gpu: nvgpu: enable graphics preemption
Support Graphics preemption feature in tu104.

JIRA NVGPUT-98

Change-Id: Ib1fe41b5ac12e4f61986f8c933b6f85bb961b9f2
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1964586
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-18 11:04:13 -08:00
Vinod G
6cbd4c1435 gpu: nvgpu: Add tu104 hal for vidmem get size
Add vidmem get size hal for dGpu Vdk
support in tu104.

JIRA NVGPU-1564

Change-Id: I6ce34fa965b59d27552f8264227d8e87b314234e
Signed-off-by: Vinod G <vinodg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1968141
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-18 09:54:07 -08:00
Thomas Fleury
3943f87d69 gpu: nvgpu: userd slab cleanup
Follow-up change to rename g->ops.mm.bar1_map (and implementations)
to more specific g->ops.mm.bar1_map_userd.
Also use nvgpu_big_zalloc() to allocate userd slabs memory descriptors.

Bug 2422486
Bug 200474793

Change-Id: Iceff3bd1d34d56d3bb9496c179fff1b876b224ce
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1970891
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-17 12:33:43 -08:00
Richard Zhao
e9066a46c9 gpu: nvgpu: vgpu: remove vgpu_gr_gp10b_alloc_gr_ctx
vgpu_gr_gp10b_alloc_gr_ctx is identical to vgpu_gr_alloc_gr_ctx now.

Jira NVGPU-1527

Change-Id: I9c568569d1a744a5a91a4d72536e3654d545d53e
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1973424
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-17 11:24:12 -08:00
Kary Jin
5b1b9eeab1 gpu: nvgpu: Add reboot handler
Add a reboot handler to make sure that nvgpu does not try to busy
the GPU if the system is going down. If the system is going down
then any number of subsystems nvgpu depends on may already have
been deinitialized.

Bug 200333709
Bug 200454316

Change-Id: I2ceaf7ca4fb88643310874b5b26937ef44c6e3dd
Signed-off-by: Kary Jin <karyj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1927018
(cherry picked from commit 9d2e50de42)
Reviewed-on: https://git-master.nvidia.com/r/1927030
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-17 11:23:56 -08:00
Debarshi Dutta
0188b93e30 gpu: nvgpu: move gk20a_fifo_recover_tsg into tsg unit
gk20a_fifo_recover_tsg does high-level software calls and
invokes gk20a_fifo_recover. This function belongs to the tsg unit and
is moved to tsg.c file. Also, the function is renamed to
nvgpu_tsg_recover.

Jira NVGPU-1237

Change-Id: Id1911fb182817b0cfc47b3219065cba6c4ca507a
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1970034
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-14 21:55:07 -08:00
Debarshi Dutta
fb114f8fda gpu: nvgpu: move gk20a_fifo_recover_ch to channel unit
gk20a_fifo_recover_ch does high-level calls and invokes
gk20a_fifo_recover. This function belongs to the channel unit and is
moved to the file channel.c. Also, the function is renamed to
nvgpu_channel_recover.

Jira NVGPU-1237

Change-Id: I31890f85fdb2c42648cc063dd9c4e7e35930dcef
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1970033
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-14 21:54:58 -08:00
Debarshi Dutta
fcd216e170 gpu: nvgpu: move gk20a_fifo_engines_on_id to ops struct
gk20a_fifo_engines_on_id uses H/W headers to return a valid active
engine mask. This qualifies the function to be invoked via a struct
gpu_ops function pointer instead.

Jira NVGPU-1237

Change-Id: Ice30610ef51cf4471b3750f21d38e6648953e9e2
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1970032
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-14 21:54:48 -08:00
Debarshi Dutta
ac4c2d4ae0 gpu: nvgpu: move fifo RC_TYPE_* definitions to common header
The RC_TYPE_* definitions in fifo_gk20a.h are generic and are moved to
a newly constructed common header <nvgpu/fifo.h>

Jira NVGPU-1237

Change-Id: Ia1bb80b9b0047675c7abfb6ce6ccd42a2e99f41f
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1970031
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-14 21:54:39 -08:00
Debarshi Dutta
7f58347ed9 gpu: nvgpu: move tsg functions to common
Any tsg specific functions that does high-level software-centric
operations below to the TSG unit and not the FIFO unit.
Move the below public functions as well as their dependent
static functions to common/fifo/tsg.c and also rename them to use the
prefix nvgpu_tsg_*

gk20a_fifo_set_ctx_mmu_error_tsg
gk20a_fifo_abort_tsg
gk20a_fifo_error_tsg
gk20a_fifo_check_tsg_ctxsw_timeout

Jira NVGPU-1237

Change-Id: I4e3da821a878d4b4a0a0b53fbb7f4c10f135f58d
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1934299
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-14 21:54:26 -08:00
Debarshi Dutta
57f03e3a20 gpu: nvgpu: move channel functions to common
Any channel specific functions having high-level software-centric
operations belong to the channel unit and not the FIFO unit.
Move the below public functions as well as their dependent
static functions to common/fifo/channel.c. Also, rename the functions
to use the prefix nvgpu_channel_*.

gk20a_fifo_set_ctx_mmu_error_ch
gk20a_fifo_error_ch
gk20a_fifo_check_ch_ctxsw_timeout

Jira NVGPU-1237

Change-Id: Id6b6d69bbed193befbfc4c30ecda1b600d846199
Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1932358
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-14 21:54:17 -08:00
Thomas Fleury
89200e3c75 gpu: nvgpu: use GPL license for linux code
Linux specific code should have GPL license

Bug 2463898

Change-Id: I38de0a6e57a2154f3d736cd0373015a8fa146987
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1973408
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-14 18:23:52 -08:00
Thomas Fleury
5f3b8cecc0 gpu: nvgpu: use MIT license for common code
Common code must use MIT license.

Bug 2463898

Change-Id: If3b253a7df8eda5e56f1827b28858881a31bb5db
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1973407
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
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>
2018-12-14 18:23:43 -08:00
Richard Zhao
2992990431 gpu: nvgpu: separate common tsg open/release functions
The common functions are shared with RM server. When add new variables
to struct tsg_gk20a, it won't have to add init code in RM server.

Bug 200473570

Change-Id: Ic12337ac8834599e23056d4c8bdb7ece9664f68e
Signed-off-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1971838
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-14 16:05:57 -08:00
Konsta Holtta
07993bbbd8 gpu: nvgpu: add runlist_write_state HAL
The function gk20a_fifo_sched_disable_rw accesses HW directly. Rename it
and add a HAL indirection so that it can be called from chip-independent
code.

Also fix some trivial MISRA violations in the function.

Jira NVGPU-1309

Change-Id: Icf320738d3d1d4baa40257a9da3ca2c6b7fefc0b
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1971274
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-14 12:06:08 -08:00
Deepak Nibade
924502875c gpu: nvgpu: dGpu VDK support
Modified the pci dev_id from
tu102 to tu104.

JIRA NVGPU-1564

Change-Id: Ib057d11ccd5d69d00b9c569ba947f4328b49885a
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1774971
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-14 10:55:55 -08:00
Deepak Nibade
fdc15553bc gpu: nvgpu: add new HAL to initialize preemption mode
g->ops.gr.alloc_gr_ctx HAL right now allocates graphics context and
also initializes preemption mode for various platforms

Separate out a new HAL g->ops.gr.init_ctxsw_preemption_mode that
initializes preemption mode and call it from gk20a_alloc_obj_ctx()
after context is created

g->ops.gr.alloc_gr_ctx now only allocates the context as the name
suggests

Jira NVGPU-1527

Change-Id: I8a44672d5ab2ebfe315e6334115265e4ee4f24f0
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1972254
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2018-12-14 00:35:39 -08:00