Commit Graph

294 Commits

Author SHA1 Message Date
Johnny Liu
97c41a6222 drm/tegra: Enabling ICC for NVENC
In order to avoid the NVENC performance bottleneck from EMC,
NVENC needs to ask for the required memory bandwidth for itself
according to its current frequency and load.

Bug 4097374

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I504a741126d52c3ae847918b4c4ab6e6a27823e7
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2914622
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-10 19:35:33 -07:00
Johnny Liu
6fc7c1ad7c drm/tegra: Enabling ICC for NVDEC
In order to avoid the NVDEC performance bottleneck from EMC,
NVDEC needs to ask for the required memory bandwidth for itself
according to its current frequency and load.

Bug 4097374

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I2daff5d3616db03d7576e8e9433aebbf3d566e86
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2914610
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-10 19:35:27 -07:00
Johnny Liu
856af79422 drm/tegra: Enabling ICC for VIC
In order to avoid the VIC performance bottleneck from EMC,
VIC needs to ask for the required memory bandwidth for itself
according to its current frequency.

Bug 4097374

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ieeeace34a935f96f949e5c8429f2f2b4edaa556c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2897536
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-06-10 19:35:18 -07:00
Mikko Perttunen
fe8568a159 gpu: host1x: Optimization for very short syncpoint waits
For tasks that execute very quickly, but not quickly enough to be
already complete by the time execution reaches host1x_syncpt_wait,
the proportion of time spent in allocating a fence and invoking
dma_fence_wait_timeout becomes dominating in comparison to the
time it actually takes to execute the task.

To improve wait latency in these cases, replace the current
"is threshold already reached" check with a short spin loop
to catch these situations before going to the heavy machinery.
For longer waits, since this function blocks anyway, the only
negative effect is slightly increased CPU consumption due to
the loop.

Bug 4001325

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I44e99cda88b4bcb33f190884d1a2e5f7588cb775
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2881716
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2916412
2023-06-10 04:05:28 -07:00
Mikko Perttunen
c8025c218b gpu: host1x: Wait prefences outside MLOCK
The current submission opcode sequence first takes the engine MLOCK,
and then switches to HOST1X class to wait prefences. This is fine
while we only use a single channel per engine and there is no
virtualization, since jobs are serialized on that one channel anyway.
However, when that assumption doesn't hold, we are keeping the
engine locked while not running anything on it while waiting for
prefences to complete.

To resolve this, execute wait commands in the beginning of the job
outside the engine MLOCK. We still take the HOST1X MLOCK because
recent hardware requires register opcodes to be executed within some
MLOCK, but the hardware also allows unlimited channels to take the
HOST1X MLOCK at the same time.

Jira HOSTX-4687

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I783cbc7f1bbd7415fbf0e61163935186b2ba0a44
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2911124
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-29 15:08:46 -07:00
Johnny Liu
57ec58a831 drm/tegra: Add module dependency with tegra_wmark
Add module dependency between drm and tegra_wmark. The drm clients are
the users of tegra_wmark governor exploiting the actmon hardware to
perform DFS.

Bug 200493763
Bug 4077910
Bug 4074193
Bug 3788919

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I2e790d6a5969635c18cb3023c72e8a1fcd5f8e63
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2900081
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-09 22:27:41 -07:00
Johnny Liu
4d3c70f632 drm/tegra: Bridge tegra_wmark devfreq with host1x
To support actmon DFS for nvjpg with tegra_wmark govenor, the nvjpg
driver needs to provide interrupt handling callback function for host1x,
and watermark update callback for tegra_wmark govenor.

Bug 4074193

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ib651d5c6519bcf455416185220a18b52cef6b6f0
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2900058
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-09 22:27:37 -07:00
Johnny Liu
bd6fc54120 drm/tegra: Bridge tegra_wmark devfreq with host1x
To support actmon DFS for nvenc with tegra_wmark govenor, the nvenc
driver needs to provide interrupt handling callback function for host1x,
and watermark update callback for tegra_wmark govenor.

Bug 4077910

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ibe1e2aa220e534f095261b609adca851a075fc09
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2900048
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-09 22:27:32 -07:00
Johnny Liu
fa6b38eb2a drm/tegra: Bridge tegra_wmark devfreq with host1x
To support actmon DFS for nvdec with tegra_wmark govenor, the nvdec
driver needs to provide interrupt handling callback function for host1x,
and watermark update callback for tegra_wmark govenor.

Bug 200493763

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I0cbf882da1ccb3243c48fc65dce6eec5f68f6abe
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2900038
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-09 22:27:28 -07:00
Johnny Liu
e4fcb41e8a drm/tegra: Bridge tegra_wmark devfreq with host1x
To support actmon DFS for vic with tegra_wmark govenor, the vic driver
needs to provide interrupt handling callback function for host1x, and
watermark update callback for tegra_wmark govenor.

Bug 3788919

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Id1e623e1d64dc0c571d24a65163c0fccc5bdbc0a
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2898326
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-09 22:27:23 -07:00
Johnny Liu
18b0b032d4 gpu: host1x: Support updating actmon watermark
Add support for updating actmon watermark thresholds so that
actmon DFS can work properly.

Add support for enabling or disabling watermark interrupts.

Bug 3788919

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Id1d0b744bc8a0a19fccbb3044d4267ae35cd5feb
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2897816
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-09 22:27:19 -07:00
Mikko Perttunen
1b89a8395f gpu: host1x: Syncpoint interrupt sharding
Support sharded syncpoint interrupts on Tegra234+. This feature
allows specifying one of eight interrupt lines for each syncpoint
to lower processing latency of syncpoint threshold
interrupts.

Jira HOSTX-4710

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Idfcb04e97c944b8e1c26a8f62e8393180692eb30
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2898521
Reviewed-by: Santosh BS <santoshb@nvidia.com>
Reviewed-by: Johnny Liu <johnliu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-05 07:36:31 -07:00
Johnny Liu
df86f78c76 drm/tegra: Enable devfreq for the nvjpg client
Enable devfreq for the nvjpg client with userspace governor by default.

Bug 4074193

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ic70651b5af4648808b188560e4c09da00c5dde55
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2895739
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-02 09:20:01 -07:00
Johnny Liu
a61d58efd6 drm/tegra: Enable devfreq for the nvenc client
Enable devfreq for the nvenc client with userspace governor by default.

Bug 4077910

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I2a7f3c047f3d7a6ba8d9219fcd0af85eeeaf7e99
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2895731
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-02 09:19:56 -07:00
Johnny Liu
4ed6734269 drm/tegra: Enable devfreq for the nvdec client
Enable devfreq for the nvdec client with userspace governor by default.

Bug 200493763

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Iee5da899b499da2c89c0e3fee5e2d616b1869d2b
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2895716
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-02 09:19:51 -07:00
Johnny Liu
3b42f92d4d gpu: host1x: Export normalized actmon active time
The exported interface will be used by devfreq framework to get the
load information of the monitored device.

Bug 3788919

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Id95c8398f44e2c94bd83c1f83d7a7d93d1f2609d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2892879
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-28 03:33:02 -07:00
Johnny Liu
0544985a0f drm/tegra: Enable devfreq for the vic client
Enable devfreq for the vic client with userspace governor by default.

Bug 3788919

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Idb0a0a2fb432590309acea9c4a161017d5291dca
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2892875
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-28 03:32:52 -07:00
Johnny Liu
03fd3f1188 gpu: host1x: Enable general interrupts for actmon
Host1x general interrupts include actmon-related interrupts, axi
timeout interrupts, and illegal access interrupts. This change enables
actmon-related interrupts only.

Bug 3788919

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Iea1f1622a11afa72f70f8d10efebd857a51cc4e2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2889825
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-28 03:32:38 -07:00
Laxman Dewangan
cc389c145d gpu: host1x: Get rid of explicit header inclusion
The required headers for gpu/host1x driver are already
included in the master makefile. Hence, it is not
required to add include path explicitly.

Bug 4087103

Change-Id: Ib359e1e19b8837d41c0129d478dc4848d51ce7ee
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2894612
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-28 02:19:45 -07:00
Johnny Liu
d5eff2f344 drm/tegra: Register actmon for the nvdec client
Register nvdec actmon to export the engine utilization information in
the debugfs.

Bug 200493763
Bug 3923137

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I6e445a4e4ce729f2a1af63ed95f4110916b1adb0
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2892036
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-27 08:12:42 -07:00
Johnny Liu
9db84e035b drm/tegra: Register actmon for the nvjpg client
Register nvjpg actmon to export the engine utilization information in
the debugfs.

Bug 4074193
Bug 3923137

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: If061703e23d9de8b270e93694a295f7e1153ceb5
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2891935
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-27 08:12:37 -07:00
Johnny Liu
16620428cd drm/tegra: Register actmon for the nvenc client
Register nvenc actmon to export the engine utilization information in
the debugfs.

Bug 4077910
Bug 3923137

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I70800bbc2ad37d69e9697a47a161e64c60dcb383
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2891911
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-27 08:12:32 -07:00
Laxman Dewangan
f53fa88eae drm: Get rid of explicit header inclusion
The required headers for drm driver are already
included in the master makefile. Hence, it is not
required to add include path explicitly.

Bug 4087103

Change-Id: If3cf11e333fb07498329c935072904dae652bf9f
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2894611
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-27 02:55:36 -07:00
Mikko Perttunen
5395e466bf drm/tegra: Job hardware timestamping support
Add support for emitting ftrace events for job submissions with
hardware timestamps, including configuring engines to capture
timestamps when execution starts and ends.

Bug 3829397

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I3a3f6fcf931d7f8fb337f029af7729ffc2cbb972
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2891349
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-26 20:08:33 -07:00
Mikko Perttunen
a9aeb2991d gpu: host1x: Add reg_write job command
Add a job command to allow inserting engine register writes into
the job opcode sequence. This allows TegraDRM to insert a method
to enable gathering of engine execution timestamps.

Bug 3829397

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I80f3c4c4f7ecc7dee0444eca06564cafd8442f75
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2891348
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-26 20:08:13 -07:00
Jon Hunter
0f857d6cff gpu: host1x-nvhost: Remove unused argument
The integer argument returned by the NVHOST interrupt notifier has never
been supported by the host1x-nvhost driver. The DLA driver's
nvdla_queue_update() function that is called by this notifier has been
update so that it no longer uses this argument. Given that there are no
other users of this notifier for the host1x-nvhost driver, let's remove
this unused variable.

Bug 4059530

Change-Id: I04dda2ea7338f0c7ee55e6e968b46f063eecae90
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2892312
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Mitch Harwell <mharwell@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-24 15:38:02 -07:00
Johnny Liu
f826f7efc3 drm/tegra: Register actmon for the vic client
Register vic actmon to export the engine utilization information in the
debugfs.

Bug 3788919

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I3bde644a7708d0b59f6e3a24fc40f4b95b6a6789
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2887424
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-19 10:49:38 -07:00
Johnny Liu
fa8cf02e87 gpu: host1x: Add actmon registration interface
Provide the actmon registration interface for host1x clients. The
registration process will create the debugfs for the actmon associated
with the host1x client, and initialize the actmon registers.

Bug 3788919

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I313bf52a5eda1663e26c2579788a873ca4081459
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2886696
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-19 10:49:34 -07:00
Johnny Liu
d99906cfaa gpu: host1x: Retrieve actmon clock
The common actmon clock is used for load calculation for the soc engines
under host1x.

Bug 3583603

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I8e6e119d32d15e29b10d1131b8ec21fb3a5834ff
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2886695
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-19 10:49:23 -07:00
Gerrit Code Review
0260612296 Merge "drm: Integrate drm drivers from kernel/nvidia to kernel/nvidia-oot" into dev-main 2023-04-05 06:05:18 -07:00
Laxman Dewangan
7f8cad749d gpu: nvgpu: Remove dummy Makefile of nvgpu
nvgpu is getting build from kernel/nvgpu and it is
not required to copy in nvidia-oot.

Remove the dummy makefile which was added as placeholder
for the nvgpu makefile.

Bug 4038415

Change-Id: I3fa6945a94c0f2233b55ec19d21ec4a92f715fde
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2882139
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-04 21:58:16 -07:00
Gerrit Code Review
197d2ed9eb Merge "host1x-nvhost: Integrate host1x-nvhost drivers from kernel/nvidia" into dev-main 2023-04-04 21:56:39 -07:00
Mikko Perttunen
10c73be4bf gpu: host1x-nvhost: Fix invalid NULL check
NULL check in is_valid_pt_ext was negated, making this function
useless. Fix the check.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I8764bcfceb457bf26ef79ebffdf17526d4174849
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2861958
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Arvind M
8942623b15 gpu: host1x-nvhost: avoid setting flcn irq at boot
[1] The DLA firmware configures the DEST and MASK registers during
    the initialization.
[2] In OOT, the DLA KMD is accidentally setting the interrupts. This
    will result in enabling additional interrupts that the firmware
    does not handle (like NVDLA_GENERIC_INTR_FAULT_CRITICAL).
[3] This commit fixes the issue by avoiding the interrupt settings
    at the DLA KMD.

Bug 3960841

Change-Id: Ied77ac7564ae3b3202b9cceaf08ad3c7da9f947c
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2861253
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Arvind M
bc86b17fa2 host1x: kmd: enable irq on poweron
[1] Since the irq is not enabled during the power-on, the firmware
    is not communicable state upon module reset.
[2] This commit fixes the issue by enabling irq on power-on.

Bug 3979666
Bug 3975703

Change-Id: I746a9236b390ab2d429df1f4a3f6243745147b65
Signed-off-by: Arvind M <am@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2858111
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
Reviewed-by: Ayush Kumar <ayushk@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Amit Sharma (SW-TEGRA) <amisharma@nvidia.com>
2023-04-03 14:06:51 +00:00
Sanif Veeras
b394e81a9e video:tegra:host: add gpu specific syncpt pool
- Support allocation from the GPU specific syncpoint pool
  after reading from the Device Tree
- Expose an interface for the NvGPU driver to allocate
  the syncpoint from the GPU pool

Jira HOSTX-4515

Change-Id: Ie5cc9ec22c039b958b0c0a1750f959ebbf6c6bee
Signed-off-by: Sanif Veeras <sveeras@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2820453
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-by: Raghavendra Vishnu Kumar <rvk@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Mahesh Kumar
88028eda4b gpu: host1x-nvhost: Align syncpt interface APIs
The syncpt interface APIs in the host1x-nvhost driver slightly differ
from those in the legacy nvhost driver because instead of passing the
platform device structure for the host1x device, the platform device
structure for the host1x client device is passed.

By aligning the APIs so that we pass the platform device structure for
the host1x in all implementations, we can simplify the PVA driver and
directly use the APIs in the NVIDIA display driver.

The NVIDIA display driver requires some additional syncpt interface APIs
and so implement these as well.

Bug 3713048

Change-Id: I507e6fd066e6e22c0c47c20ba0dd3be5fa033c59
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2813827
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Jon Hunter
7d40c3953e gpu: host1x-nvhost: Fix mapping of syncpt shim
With Linux v6.1, if CONFIG_PCI_P2PDMA is enabled, then mapping the
syncpt shim causes a kernel paging request fault. The fault occurs when
dma_map_sg_attrs() is called in by nvhost_syncpt_unit_interface_init(),
which is attempting to map the syncpt shim MMIO space.

The function dma_map_sg_attrs() calls iomm_dma_map_sg() and since
upstream Linux commit 30280eee2db1 ("iommu/dma: support PCI P2PDMA pages
in dma-iommu map_sg") was added this now calls is_pci_p2pdma_page(). The
function is_pci_p2pdma_page() requires that there is a 'struct page'
associated with the sg, but this is not the case and so deferencing the
'struct page' pointer returned by sg_page() results in a paging fault.

Using dma_map_sg_attrs() to map MMIO that is not associated with valid
page structures is not guaranteed to work. Therefore, fix this by using
dma_map_resource() to map the syncpt shim instead.

Bug 3871422

Change-Id: I2b08a3b78be0850bff44e62bfc93c8d095eb82a2
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2818417
(cherry picked from commit 97f1282f2959c208effebf93cc5061d6e7fa6c55)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2819086
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Jon Hunter
6cd2f00c46 nvhost: Add clean up function for syncpt interface
Drivers, such as the PVA and DLA driver, that call
nvhost_syncpt_unit_interface_init() during probe are missing a call to
clean-up the DMA mappings this function may create if the driver probe
fails or if the driver is removed. The function
nvhost_syncpt_unit_interface_init() may make a call to
dma_map_sg_attrs() and we need to ensure that dma_unmap_sg_attrs() is
called if the probe of the driver fails or if the driver is unloaded.
Add a new function, nvhost_syncpt_unit_interface_deinit(), that calls
dma_unmap_sg_attrs() if needed for drivers to call.

Bug 3800349

Change-Id: I62a4e19cd42878dac54fa623509440596ffdf17f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2801280
(cherry picked from commit cee12fb989186611aa9deb5ada45831ab5f783aa)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2801934
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Mikko Perttunen
968b6f758f gpu: host1x-nvhost: Adapt for change in host1x_fence_create
Add 'true' parameter to enable internal timeout since there is no
external cancellation mechanism.

Also change kfree to kfree_rcu to ensure workqueue is not freed
during callback.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Ib0ef9a211bafbdd911dc90175a18680880e3e2f8
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2786638
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Jon Hunter
9d0dda14ae gpu: host1x-nvhost: Update include path
When building the host1x-nvhost driver as an external module, the driver
source is now copied into a common location with all the other external
modules. Therefore, we can now use the 'srctree.nvidia' path for finding
the necessary header files for Host1x. Update the include search paths
to use 'srctree.nvidia' when building the driver.

Bug 3817518

Change-Id: I443dd4cb6d01c4e9be8f3c02550b1050d0bcfd28
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2785956
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Jon Hunter
2e94a90e1d gpu: host1x-nvhost: Update syncpt helper functions
- add get aperture API
- add get syncpt offset api

Bug 3768126

Change-Id: I95ae6a149e8a362317f4f1c89e7a1eac3c596fe4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2782259
Tested-by: Omar Nemri <onemri@nvidia.com>
Reviewed-by: Omar Nemri <onemri@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 14:06:51 +00:00
Jon Hunter
b5c5a485da gpu: host1x-nvhost: Add support for Tegra234
Add support for Tegra234 in the host1x-nvhost driver.

Bug 3724727

Change-Id: I3e42d066ce22a461d71f26c120f08aed96f30430
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2759200
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2023-04-03 14:06:51 +00:00
Nan Wang
96d0bbd387 pva: support both upstream and downstream kernel
1. Replace nvhost print functions with PVA driver's private
implementation with similar functionalities.

2. Change syncpoint from host managed to client managed so that
syncpoint max value is tracked inside PVA driver. This change is needed
because upstream host1x driver doesn't allow decrement of max value.

3. Various minor changes for adapting to upstream kernel APIs.

Bug 3662478

Change-Id: I16eff6c06c51afe0f274598e1273404924d18684
Signed-off-by: Nan Wang <nanwa@nvidia.com>
Signed-off-by: Abhinaya Agrawal <abhinayaa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2710684
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 14:06:51 +00:00
Abhinaya Agrawal
c87eb8b8d9 drivers: Fix host1x and nvhost debugfs cleanup
Both host1x and nvhost expose APIs that deinitialize the debugfs
and remove debugfs files/directories that were created. At present,
debugfs_remove() is inovked to do this. However,
debugfs_remove_recursive() should instead be used to ensure that
all files within a debugfs are recursively removed before the
directory is removed.

Bug 3662478

Change-Id: Idb7d1458c02f57f6d656a7bfe1df3adf5e0497aa
Signed-off-by: Abhinaya Agrawal <abhinayaa@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2714042
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Omar Nemri <onemri@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Jon Hunter
58159f3b83 gpu: host1x-nvhost: Move falcon initialisation
Some host1x clients, such as PVA, do not have a falcon microprocessor
and currently the host1x-nvhost shim driver assumes that all clients do.
Fix this by moving the falcon initialisation code from the
nvhost_module_init() function and into the
nvhost_flcn_finalize_poweron() function. This aligns with the
implementation in the downstream nvhost driver.

JIRA LS-493

Change-Id: Ic94c3489cefa6fd256f111d8e6c7afb539b5bc8a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2710548
Reviewed-by: Nan Wang <nanwa@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Jon Hunter
ad8058fce9 gpu: host1x-nvhost: Fix client unloading
After unloading the NVDLA driver and then reloading the NVDLA, the
kernel is crashing. The host1x-nvhost driver is missing a call to
class_destroy() in nvhost_client_device_release() which gets called when
removing the DLA driver and this is preventing the DLA driver from
creating the class again when reloading. The crash then occurs because
when the driver is reloaded, creating the class for the DLA driver
fails and then the host1x-nvhost driver incorrectly calls
device_destroy() even though the device has not been created yet. Fix
this by ensuring the class_destroy() is called by
nvhost_client_device_release() and in the necessary error paths and then
remove the call to device_destroy().

Finally, replace request_irq() with devm_request_irq() to ensure that
the interrupts are also released as necessary on removal.

Bug 3641820

Change-Id: Ia328bf63d528e8c31bff1d7b3ac0d5dddc22f1f5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2710546
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Jon Hunter
c103925414 gpu: host1x-nvhost: Fix casting and functions declarations
Sparse reports the following warnings for the host1x-nvhost driver ...

 drivers/gpu/host1x-nvhost/falcon.c:65:27: warning: cast to restricted __le32
 drivers/gpu/host1x-nvhost/nvhost.c:205:22: warning: symbol
	'nvhost_syncpt_get_by_id' was not declared. Should it be static?
 drivers/gpu/host1x-nvhost/nvhost.c:768:5: warning: symbol
 	'nvhost_module_runtime_resume' was not declared. Should it be static?
 drivers/gpu/host1x-nvhost/nvhost.c:796:5: warning: symbol
 	'nvhost_module_runtime_suspend' was not declared. Should it be static?

Fix the above by correcting the cast in falcon_copy_firmware_image(), remove
the function nvhost_syncpt_get_by_id() because it is not used, and make the
nvhost_module_runtime_resume/suspend functions static.

JIRA LS-410

Change-Id: I2c923fccd0b6e53d17198617b90905c6cd06eb5c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2670180
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Jon Hunter
9ecd6942b9 gpu: host1x-nvhost: Fix build for Linux v5.10
When compiling the host1x-nvhost driver for Linux v5.10 it is currently
failing and the following errors are seen ...

 host1x-nvhost/nvhost.c: In function ‘nvhost_intr_do_work’:
 nvhost.c:554:2: error: implicit declaration of function ‘kfree’
 [-Werror=implicit-function-declaration]
  kfree(host1x_cb);
    ^~~~~
 host1x-nvhost/nvhost.c: In function ‘nvhost_intr_register_notifier’:
 nvhost.c:579:7: error: implicit declaration of function ‘kzalloc’
 [-Werror=implicit-function-declaration]
      cb = kzalloc(sizeof(*cb), GFP_KERNEL);
             ^~~~~~~

Fix this by including slab.h.

JIRA LS-410

Change-Id: I8a56d33933d3e57c04b011e2c6da03d5f2bbc707
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2667882
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00
Jon Hunter
9f0425f9c1 gpu: host1x-nvhost: Fix clock rate setup
The host1x-nvhost driver by default configures the clock rates for
the host1x client devices to the maximum supported rate because
there is runtime clock scaling support yet. However, currently the
host1x-nvhost driver is only setting the rate for the client's first
clock and not the others. Fix this by correcting the index used when
iterating through the list of clocks.

JIRA LS-410

Change-Id: If410ee25548c0dddecc5b0de9d8b6f4f687fd73c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2657897
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 14:06:51 +00:00