Commit Graph

180 Commits

Author SHA1 Message Date
Jon Hunter
c8a0c93fc1 drivers: Drop '-next' from driver names
The OOT variants of the host1x and tegra-drm drivers originally had
a '-next' suffix in the name to differentiate these from the upstream
versions. Now that the OOT drivers are installed under the 'updates'
directory, the '-next' suffix can be dropped because 'kmod' will
prioritise loading the variant in 'updates' over those built from the
kernel tree.

Bug 4410785

Change-Id: I29287ddb935b681a5ee8a3326428eba82715da76
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3065465
(cherry picked from commit eee13a1edb)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3063836
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-26 03:09:59 -08:00
Jon Hunter
61319aef4d drm/tegra: Don't print error on probe defer
The following error messages are sometimes observed on boot ...

 tegra-nvjpg 15380000.nvjpg: failed to get icc write handle
 tegra-nvdec 15480000.nvdec: failed to get icc write handle
 tegra-nvjpg 15540000.nvjpg: failed to get icc write handle
 tegra-nvenc 154c0000.nvenc: failed to get icc write handle
 tegra-vic 15340000.vic: failed to get icc write handle
 tegra-nvjpg 15380000.nvjpg: failed to get icc write handle

The above messages are harmless because the ICC core is returning
-EPROBE_DEFER to indicate that the ICC provider is not available. When
-EPROBE_DEFER is returned the kernel will attempt to probe the device
again and so print an error on -EPROBE_DEFER can be misleading. Fix the
above by using the function dev_err_probe() to print error messages
because this function will only print an error message if the error code
is not -EPROBE_DEFER.

Bug 3436156
Bug 4496044

Change-Id: I47b77e5a0f2bdb817a832daa305246c8803f456b
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3075237
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-13 02:24:56 -08:00
Jon Hunter
233a7eb320 drivers: Fix missing headers for Linux v6.8
For Linux v6.8, commit ef175b29a242 ("of: Stop circularly including
of_device.h and of_platform.h") updated the OF headers included by these
header files. This breaks the build for various drivers and so fix this
by including the headers that are actually needed for each driver.

Bug 4448428

Change-Id: Ia40ab13f865d5631c96855ecc49145848f99c996
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3032442
(cherry picked from commit ab65399274)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3063003
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-25 13:55:11 -08:00
Jon Hunter
32f23c8ab2 gpu/drm: tegra: Fix build for Linux v6.8
Building the Tegra DRM driver with Linux v6.8 fails with the following
error ...

 drivers/gpu/drm/tegra/hdmi.c:623:25: error: implicit declaration of
 function ‘drm_eld_size’; did you mean ‘mm_cid_size’?
 [-Werror=implicit-function-declaration]
  623 |    size_t length = drm_eld_size(hdmi->output.connector.eld), i;
      |                    ^~~~~~~~~~~~

Commit ("8eb80946ab0c drm/edid: split out drm_eld.h from drm_edid.h")
added the header file 'drm/drm_eld.h' which now needs to be included to
build the Tegra DRM driver. Fix the build issue by using conftest to
detect the presence of the header 'drm/drm_eld.h' and include this
header if present.

Bug 4448428

Change-Id: Ifb17648d1dc721e1f0de3f864f4cc76450eea394
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027485
(cherry picked from commit 8d5286c379)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055252
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-17 04:40:10 -08:00
Jon Hunter
069d6bb3eb drivers: Enable -Wmissing-prototypes
The compiler option -Wmissing-prototypes is being enabled globally in
the upstream Linux kernel and this causes build failures for various
drivers. The build failures occur because either the driver is missing
an include file which has the prototype or because the function is not
declared statically when it should be (ie. there are no external users).

Fix the various build failures and enable -Wmissing-prototypes to
prevent any new instances from occurring. Note that the only driver that
is not fixed at the moment is rtl8822ce due to large number of failures
and so build this with '-Wno-missing-prototypes' for now, which is not
different to how it was being compiled prior to this change.

Bug 4404965

Change-Id: Ie5572d23659e0346fa035d645d9043b0a6da5fdc
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027488
(cherry picked from commit d5391a25ab)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3034644
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:10 -08:00
Laxman Dewangan
e91b43420c drm/tegra: Use conftest for drm_debugfs_remove_files()
The function drm_debugfs_remove_file() has extra argument in
Linux 6.7 with change commit 8e455145d8f16 ("drm/debugfs: rework
drm_debugfs_create_files implementation v2")

Use conftest to findout this new argument presence.

Bug 4346767

Change-Id: I77346a85c8841f915f4a8f3f471af1e03240fa62
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028576
(cherry picked from commit 1ae406004f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031239
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:01 -08:00
Laxman Dewangan
5b6fed0199 gpu: drm: Add root argument on drm_debugfs_remove_files() for Linux 6.7
Add root argument in the call drm_debugfs_remove_files() for Linux 6.7
as per below change from mainline:

***
commit 8e455145d8f163aefa6b9cc29478e0a9f82276e6
Author: Christian König <ckoenig.leichtzumerken@gmail.com>

    drm/debugfs: rework drm_debugfs_create_files implementation v2
***

Bug 4346767

Change-Id: Iadc878d66b093fd72b4524052dee9dbb24e82c1d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3019998
(cherry picked from commit b17be80108)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031427
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:10:56 -08:00
Jon Hunter
b5d808a6ff drm/tegra: Avoid kernel version checks
Instead of using kernel version checks in the Tegra DRM driver for the
tegra_fb_ops structure, just check if the appropriate definition is
defined and if so use it. This fixes building the Tegra DRM driver
against some 3rd party kernels that include backports from upstream.

Note that this also aligns the driver closer to the upstream code by
using the same definitions that the upstream driver uses.

Bug 4346767

Change-Id: I8cb40899d0bf7cdc233e5f4cee7b6afb6f12d015
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027832
(cherry picked from commit 086fc6d3da)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3030330
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-08 02:54:19 -08:00
Jon Hunter
6fe3abc899 drm/tegra: Drop version check
The version check in the Tegra DRM GEM code is not necessary because
this is a fix to the code and so remove the version check.

Bug 3820317

Change-Id: Ib7f5bd2bdb61af50e17399079aa2439bf8d352b1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026925
(cherry picked from commit 91c367006c)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3029984
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-07 09:10:06 -08:00
Jon Hunter
a6701b19b9 drivers: Use conftest for vm_flags
The conftest script has a test for checking if the vm_area struct has a
const vm_flags member. So enable this test and use the definition
generated in the appropriate drivers.

Bug 4374520

Change-Id: I0e7bd105fe8a821b0af23c0a5553b8d4468fa8c4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026924
(cherry picked from commit d0e427c6e1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3029982
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-07 09:09:56 -08:00
Jon Hunter
daec781815 conftest: Add devm_tegra_core_dev_init_opp_table_common
Add a test to the conftest script to check if the function
devm_tegra_core_dev_init_opp_table_common() is present in the kernel and
use the definition generated in the host1x driver.

Bug 3820317

Change-Id: Id04da12c8ced7129141036aaa26375113c544374
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026923
(cherry picked from commit 732a0db90e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3029981
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-07 09:09:46 -08:00
Jon Hunter
60adf47e0f drm/tegra: Always use devm_pm_runtime_enable
The function devm_pm_runtime_enable() has been supported since Linux
v5.15 and so always use this function.

Bug 3820317

Change-Id: I805f3c681822b4bfc825b671c54a7dea2199f351
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026922
(cherry picked from commit 591949a2f1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3029980
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-07 09:09:41 -08:00
Jon Hunter
a3b3ef5cab drm/tegra: Add conftest for fd/handle conversions
Add tests to the conftest script to check if the functions
drm_gem_prime_fd_to_handle() and drm_gem_prime_handle_to_fd() are
exported in the Linux kernel and use the definition generated by
conftest for compiling the Tegra DRM driver.

Bug 4346767

Change-Id: I56b76617bf4644a5851484dd7d4eecd3888f3b5b
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3015841
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2023-11-20 13:24:26 -08:00
Johnny Liu
7ff7dcd36a drm/tegra: Send ICC requests with peak_bw
When BPMP BWMGR receives ICC avg_bw requests from different memory
clients, it will sum up all avg_bw values together and use it to
determine the final EMC frequency.

Transitioning to ICC peak_bw requests will cause BPMP to evaluate
the bandwidth requirements of each memory client individually,
selecting the maximum bandwidth request from among all the clients
to determine the final EMC frequency.

This modification prevents excessive memory bandwidth allocation
when multiple host1x clients collaborate for data processing.
Currently, host1x clients request the full theoretical 100% data
bandwidth, even though the system typically doesn't fully utilize
that amount during runtime.

To address the issue of insufficient memory bandwidth when multiple
host1x clients are used together, we can reduce the boost_up_threshold
value of cactmon DFS. This adjustment ensures that when actual memory
bandwidth utilization surpasses the specified boost-up bandwidth
threshold, EMC frequency will be further scaled by one step further
to alleviate the problem.

Bug 4328471

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I826a374666f38718652c5cae449c0aadeabfbdb5
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2996561
(cherry picked from commit 21c6a3b3e8)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3014611
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-13 14:56:26 -08:00
Laxman Dewangan
0f76fc5e17 gpu: drm: fb: Align deferred IO ops helper name for Linux6.6
The FB deferred IO ops helper name is changed in Linux 6.6 with
below mainline kernel change:
---
commit 744d35d3436fbeed9131f6ab717aeb3f775b19c4
Author: Thomas Zimmermann <tzimmermann@suse.de>
Date:   Sat Jul 29 21:26:49 2023 +0200

    fbdev: Align deferred I/O with naming of helpers

---
Use the new macros name.

Bug 4346767

Change-Id: Idc2e2319994fd2ed7040d8d5528a0d6074257420
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3008092
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-01 20:25:28 -07:00
Laxman Dewangan
abfab2085e drm: Remove initialization of fd/handle conversion for Linux 6.6
The functions for fd/handle conversion are unexported as it is
used internally to drm_prime based on following change:
---
Author: Thomas Zimmermann <tzimmermann@suse.de>
Date:   Tue Jun 20 09:59:59 2023 +0200

    drm/prime: Unexport helpers for fd/handle conversion
---

Remove the initialisation of these functions pointer.

Bug 4346767

Change-Id: I821f4e63663a7f35e5fa39ed84383765ed8599fa
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3008091
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-01 20:25:23 -07:00
Johnny Liu
a4afff1535 drm/tegra: Register OFA as a devfreq device
Unit actmon is used to realize dynamic frequency scaling for OFA.
Therefore, registering OFA as one of devfreq devices to expose frequency
controllability to userspace.

Bug 4310958

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I6a74f4b4ae54f014091549fa7f6df94c9a9c99ef
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3001884
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-24 14:00:41 -07:00
Johnny Liu
1a32649b75 drm/tegra: Support client get_rate for OFA
When actmon reports the client usage information, it will call the
get_rate callback provided by the client, and divide the number of
sampled active clock cycles from the actmon counter register with the
current client rate to determine the client usage value.

Bug 4338396

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I5e3f69b8ed1d90407fe0b8202e7c9cde75a0dd30
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3000330
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-20 01:33:31 -07:00
vasukis
610533a15d tegra: hwpm: Add HWPM-NVDEC registration mechanism
- Add support to extend NVDEC IP for HWPM profiling.

DOS-SHR-7601

Change-Id: I93efd02b348829c33d9ba90cfc39b8b824f64347
Signed-off-by: vasukis <vasukis@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2983398
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-12 20:13:26 -07:00
Jon Hunter
413055df75 drm/tegra: Fix build for Linux v6.5
In Linux v6.5, commit 62aeaeaa1b26 ("drm/aperture: Remove primary
argument") removed the 'primary' argument from the function
drm_aperture_remove_framebuffers(). Update the test in conftest script
for drm_aperture_remove_framebuffers() to test for this and use the
generated definition accordlingly in the Tegra DRM driver to fix the
build for Linux v6.5.

Bug 4221847

Change-Id: I7a7bb3a029b236e0ce42c1a404085757d95374d1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2990528
2023-10-08 13:10:35 -07:00
Jon Hunter
d021a4fbae drm/tegra: Fix build for Linux v6.4
In Linux v6.4, the various drm_scdc_get/set functions were updated to
take an argument of type 'struct drm_connector'. Add a new test to the
conftest script that checks if this argument is used and use the
definition created by conftest to select which version of the function
is used.

Bug 4221847

Change-Id: Id6b6396bbe875a0268f8fe2f68ae08f78a32c954
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2989035
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-07 13:03:15 -07:00
Johnny Liu
0840137ad6 drm/tegra: Enable actmon for OFA
OFA has unit actmon monitoring its active time. Enabling actmon for OFA
to export load information of OFA.

Bug 4310958

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I8df79f266da71c0cc248e603a07fec7508cbb8ce
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2990240
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-04 07:44:57 -07:00
Vedashree Vidwans
cbf177852b drm/tegra: add hwpm support in video ip driver
Add IP-HWPM interface in NVENC, OFA and VIC drivers. This code will
- register with HWPM driver during probe
- expose power management and register read/write function.

Bug 4158030

Change-Id: I9311c9fc31cffadf11c36b6e4516f0da84dcbdf4
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2954070
Reviewed-by: Santosh BS <santoshb@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-03 18:57:48 -07:00
Jon Hunter
fc7367debb drm/tegra: Fix crash when engine probe fails
If probing of the VIC engine fails then the following crash is observed
...

 tegra-vic 15340000.vic: devfreq_add_device: Unable to find governor for
  the device
 tegra-vic 15340000.vic: failed to init devfreq: -22
 tegra-vic: probe of 15340000.vic failed with error -22
 tegra-nvdec 15480000.nvdec: Adding to iommu group 45
 list_add corruption. prev->next should be next
  (ffff000094505f80), but was 0000000000000000. (prev=ffff000095245cf0).
 ------------[ cut here ]------------
 kernel BUG at lib/list_debug.c:26!
 Internal error: Oops - BUG: 00000000f2000800 [#1] SMP
 ...

 pc : __list_add_valid+0x80/0x84
 lr : __list_add_valid+0x80/0x84
 ...

 Call trace:
 __list_add_valid+0x80/0x84
 host1x_subdev_register+0x80/0x170 [host1x_next]
 __host1x_client_register+0xac/0x160 [host1x_next]
 nvdec_probe+0x1c8/0x58c [tegra_drm_next]
 platform_probe+0x6c/0xe0
 really_probe+0xc4/0x3dc
 __driver_probe_device+0x114/0x190
 driver_probe_device+0x44/0x114
 __driver_attach+0xcc/0x1f0
 bus_for_each_dev+0x78/0xd0
 driver_attach+0x28/0x30
 bus_add_driver+0xbc/0x220
 driver_register+0x70/0x120
 __platform_register_drivers+0x70/0x140
 host1x_drm_init+0x58/0x1000 [tegra_drm_next]
 do_one_initcall+0x48/0x2d0
 do_init_module+0x5c/0x270
 load_module+0xb08/0xc70
 __do_sys_init_module+0x1dc/0x214
 __arm64_sys_init_module+0x20/0x2c
 invoke_syscall.constprop.0+0x7c/0xd0
 el0_svc_common.constprop.0+0x140/0x150
 do_el0_svc+0x38/0xa0
 el0_svc+0x38/0x18c
 el0t_64_sync_handler+0xb4/0x130
 el0t_64_sync+0x17c/0x180
 Code: aa0103e2 910fa000 aa0403e1 941b9509 (d4210000)
 ---[ end trace f8f20f933fe03c7e ]---

The problem is that some of the engines are not cleaning up correctly on
probe failure and so fix this by adding the necessary calls clean up if
probe fails.

Bug 4303860

Change-Id: Ife1e0ce7429458d187422162a298cc140f0e3bc4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2986790
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-28 22:00:56 -07:00
Jon Hunter
07dbfa8de1 gpu: host1x: Make host1x_actmon_unregister() return void
The function host1x_actmon_unregister() never fails and so never returns
an error. Make this function return void to simplify the code.

Bug 4303860

Change-Id: I9e1cd403bd6db8e2d4ac6831ed26e1436638456f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2986789
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-28 22:00:51 -07:00
Uwe Kleine-König
ee866593b7 UPSTREAM: gpu: host1x: Make host1x_client_unregister() return void
This function returned zero unconditionally. Make it return no value and
simplify all callers accordingly.

Bug 4303860

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Change-Id: I07bf696e8af7c3472355b52549fb43ff3987c108
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2986788
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-28 22:00:46 -07:00
Jon Hunter
5a26b0ef9d drm/tegra: Add conftest support
Instead of relying on kernel version to determine if certain functions
or structure are present in the kernel, use the conftest.sh script to
test which functions, structures, etc are present at compile time. This
is beneficial for working with 3rd party Linux kernels that may have
back-ported upstream changes into their kernel and so the kernel version
checks do not work.

Bug 4119327

Change-Id: If315b18af74c830e9ba3993208de3a3326c4187d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2984415
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-28 21:45:17 -07:00
vasukis
842bf32431 tegra: hwpm: Add HWPM registration in Virt_engine
- HWPM driver to profile OFA, VIC and NVENC IPs. Hence
add the IP-HWPM registration mechanism.
- Power management is not implemented as IPs are expected
to stay powered on as long as Guest-OS-0 stays powered on.
- Register operations for Read, Write to be handled by exposing
IP Perfmuxes within the hypervisor.

Bug 4170733
DOS-SHR-7601

Change-Id: I2936e9cc5539b7a5c93993694fbd1d866e2f6877
Signed-off-by: vasukis <vasukis@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2948008
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-19 08:22:15 -07:00
Kartik Rajput
5256b57dcd drm/tegra: fb: Use dedicated IO helpers
Upstream commit "43049f17b526"

[drm/i915: Implement dedicated fbdev I/O helpers]

Removed dedicated DRM helper APIs and introduced helper to define
dedicated IO helpers.

Use FB_IO_HELPERS to define fbdev helper APIs.

Bug 4276500

Change-Id: Iece6d2999bdcbafbdf8191d47441e2c8018063b7
Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2978955
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-14 20:45:29 -07:00
Jon Hunter
c563f4b4e4 drm/tegra: Drop devm_gpiod_get_from_of_node
The function devm_fwnode_gpiod_get() has been supported since Linux v5.5
and so it is not necessary to support devm_gpiod_get_from_of_node for
pre-v6.3 kernels. Drop devm_gpiod_get_from_of_node() support to simplify
the Tegra DRM driver.

Bug 4119327

Change-Id: I5d1fb433d99f350e127e439f351412f8ec3ebc8f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2979270
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-14 13:32:14 -07:00
Jon Hunter
cdc64f43fa drivers: Drop version check for DMA BUF namespace
The MODULE_IMPORT_NS macro adds a namespace tag to the module
information. The DMA_BUF namespace is required for Linux v5.16+ kernels
for drivers that use DMA BUF, there is no reason not to populate this
for earlier kernels. Furthermore, some 3rd party kernels prior to v5.16
may require this too and so drop the version check around the DMA BUF
namespace.

Bug 4119327

Change-Id: If8a5e90340f7a0582247cb91611d275ec1f4990e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2979260
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-13 22:21:25 -07:00
Jon Hunter
214beca091 drivers: Add compilation flag for iosys-map.h
Determining whether the header file iosys-map.h is present in the kernel
is currently determine by kernel version. However, for Linux v5.15,
iosys-map.h has been backported in order to support simple-framebuffer
for early display. Therefore, we cannot rely on the kernel version to
indicate whether iosys-map is present. This is also true for 3rd party
Linux kernels that backport changes as well. Fix this by adding a
compile time flag, that will be set accordingly by the conftest script
if this header is present.

Bug 4119327
Bug 4228080

Change-Id: Ibd814285b2a07932ede2fbe9e6dc8fd03039d0c3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971954
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-12 22:12:04 -07:00
Johnny Liu
837b275df5 drm/tegra: Resume device frequency with Fmax
Avoid using suspend_freq to set the Fmax for the device, since it will
re-enable the actmon watermark interrupts again if the suspend_freq is
not zero in the devfreq_suspend_device call.

Since we want to make sure device is running at Fmax but avoid using
suspend_freq, we can forcelly override the resume_freq with the
scaling_max_freq to reach the same effect.

Bug 4271562

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ia19a7ef9de14643abf1b174b6180e40a847de132
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2974074
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-06 12:05:33 -07:00
Johnny Liu
8b99f1f5b8 drm/tegra: Set static Fmax for suspend frequency
The suspend_freq is a fixed value for devfreq core, while the
resume_freq will be changed dynamically based on the last previous
updated frequency value of the device.

When device is put into suspend mode, devfreq core will update the
resume frequency with the suspend frequency. Therefore, when the device
is resumed back again, it will run at suspend_freq.

Forcelly set the suspend_freq as Fmax so that device will run at Fmax
when it is resumed back.

Bug 4269900

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ic6511613ae5d02831a66dd1c2a93f21c142bf3a7
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2973229
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-05 03:46:11 -07:00
Thierry Reding
fe4df61d9f drm/tegra: Remove existing framebuffer only if we support display
Tegra DRM doesn't support display on Tegra234 and later, so make sure
not to remove any existing framebuffers in that case.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Change-Id: I410c6dc73b3b00caf9bef4b3a047c741223e75f0
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2968311
Reviewed-by: Santosh Galma <galmar@nvidia.com>
Tested-by: Santosh Galma <galmar@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-04 08:18:39 -07:00
Jian-Min Liu
719d3fa024 nvidia-oot: use TEGRA_SYSTEM_TYPE_ACK as ack macro
Use config TEGRA_SYSTEM_TYPE_ACK to control kernel builds only
base on the system type which also aliged to Makefile use.

Bug 4223187

Change-Id: I276208d180d1b3459eccb80d8fdb818f4507d3df
Signed-off-by: Jian-Min Liu <jianminl@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2966713
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-24 23:32:04 -07:00
Vamsee Vardhan Thummala
46f980b806 drm/tegra: firewall: Check for is_addr_reg existence in IMM check
In the IMM opcode check, don't call is_addr_reg if it's not set.

Fixes: 8cc95f3fd35e ("drm/tegra: Add job firewall")
Change-Id: I2b7b35afeed774a571fd147aa922718f644c5c88
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Vamsee Vardhan Thummala <vthummala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2966639
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-24 23:21:30 -07:00
Johnny Liu
a588ad882d drm/tegra: Derive count weight from max freq
The original resume_freq will be overridden when the device is put
into suspend mode. Therefore, the resume cycle won't always use the
max frequency of the device to set the actmon count weight.

Change the implementation to use scaling_max_freq to always use the
max frequency of the device to set the actmon count weight.

Bug 4252125

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Iaaae8ada989cd1ed7dd728fb526ad4391a2f192c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2967098
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-24 09:24:42 -07:00
Johnny Liu
1dcfd26f70 drm/tegra: Set nvjpg actmon count weight once
Change the implementation to set count weight values for both actmon and
the engine once in runtime resume cycle to align the implementation as
nvdec for kernel upstream.

Bug 4251915

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I6df0f13d1c58402cb78e4e05ff6cd6cd21ef2c4b
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2965505
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-23 02:34:10 -07:00
Johnny Liu
d6a45460a5 drm/tegra: Set nvenc actmon count weight once
Change the implementation to set count weight values for both actmon and
the engine once in runtime resume cycle to align the implementation as
nvdec for kernel upstream.

Bug 4251915

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ie2df685e990a4ebcd5a83db23db3c3bc8ab2af37
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2965502
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-23 02:34:04 -07:00
Johnny Liu
f279ce0dfc drm/tegra: Set vic actmon count weight once
Change the implementation to set count weight values for both actmon and
the engine once in runtime resume cycle to align the implementation as
nvdec for kernel upstream.

Bug 4251915

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I63f625a2f64eb8c626c21389b5a3680001495fd5
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2965500
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-23 02:33:58 -07:00
Bruce Xu
db10888783 nvidia-oot: set/clear vm_flags via function
In new kernel, need to update vm_flags via kernel
provided function. Otherwise below error is met:
./include/linux/mm_types.h:476:20: note: non-static data member
'vm_flags' declared const here
                const vm_flags_t vm_flags;
                ~~~~~~~~~~~~~~~~~^~~~~~~~
1 error generated.

Bug 4196760

Change-Id: I03455af7ce3623d0d8a0f0cd56d569ef3c7af9ea
Signed-off-by: Bruce Xu <brucex@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2938942
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-11 05:19:43 -07:00
Johnny Liu
d412dc39e1 drm/tegra: Set actmon count weight for nvdec once
Method invocation for updating count weight for nvdec may conflict
with a job being submitted through host1x.

Change the implementation to set count weight values for both actmon and
the engine once in runtime resume cycle to prevent possible conflicts.

Bug 3962196

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I19d160abd90373721df78cdb107ca396a206a6e8
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2952692
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-08-09 10:50:55 -07:00
Johnny Liu
69d9f479a4 drm/tegra: Unify logic for suspend and resume
Two main changes for the suspend and resume:
1. Set clock to Fmin/Fmax in suspend/resume cycles
2. Reorder the code in suspend and resume functions and add recovering
   logic when error happens in between

Bug 4224081

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Iadb0b1f960ca8b9c80094d1769a2d90496263124
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2948452
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-08-09 10:40:23 -07:00
Johnny Liu
d171c817ec drm/tegra: Correct icc cleanup logic
Since devm_of_icc_get is used, no need to call icc_put when device probe
fails or device driver is removed.

Bug 4222919

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ide313c6f56e1bef83ffe3718cd434abbdaeec869
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2947933
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-04 14:09:18 -07:00
Mikko Perttunen
89cd5927c9 drm/tegra: Enable timestamping for virtual engines
Enable timestamping for virtual engines except for NVJPG, as it
doesn't support timestamping currently.

Bug 4174916

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I36d426f3d6d83c056a7cf10555460966fc820e6c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2942199
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-02 14:05:28 -07:00
Jon Hunter
9f2ed528c8 drm/tegra: Fix interconnect support for Linux v6.2+
Interconnect support for multimedia engines is disable for Linux v6.2
kernels. Rather than always disabling interconnect support for these
kernels, we just need to ensure the necessary upstream kernel patches
are in place for Linux v6.2 kernels. Therefore, enable interconnect
support for all kernels.

Bug 4097374

Change-Id: Ibceb866ba239454a131543cdff90e68007b28942
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2937758
Reviewed-by: Johnny Liu <johnliu@nvidia.com>
Reviewed-by: Sumit Gupta <sumitg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-20 01:16:09 -07:00
Johnny Liu
ff572997a3 drm/tegra: Wrap register init code in function
Put the actmon-related register initialization code in the function for
readability.

Bug 4183393

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Id68d128ae330105da0d3f76270fe38d57c12c740
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2931793
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-07-10 10:05:47 -07:00
Johnny Liu
3264c9dfca drm/tegra: Skip non-clock update in suspend mode
When the device is in suspend mode, There is no point to update
actmon count weight and send ICC request for the device.

If ICC request is sent for the device in suspend mode, in osidle state,
the default EMC frequency will be affected due to the accumulated ICC
bandwidth QoS constraint, and affect the overall osidle power.

Bug 4168788

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I8700b131b5f914d93feed9f8a9d792c2fdaa9b53
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2931905
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-07-07 07:01:02 -07:00
Johnny Liu
da7cd1c546 drm/tegra: Enable disable actmon in RPM callbacks
Actmon should be enabled only when engines are active.

Bug 4168788

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ifb4bfe67357402266080331ea18ae2a9af2d85ee
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2931890
Reviewed-by: Santosh BS <santoshb@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-07-07 07:00:52 -07:00