Commit Graph

406 Commits

Author SHA1 Message Date
Jon Hunter
732a0db90e 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
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-06 16:36:21 -08:00
Jon Hunter
591949a2f1 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
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-06 16:36:11 -08:00
Jon Hunter
45cee87fa7 gpu/host1x: Use conftest for Linux v6.3
Use conftest to determine if the uevent() function pointer in the
bus_type structure has a const dev argument. This fixes the build for
Linux kernels prior to Linux v6.3 that include the upstream change that
changed the arguments to this function.

Bug 4014315

Change-Id: I1553e08c951be9dd27141c273bf91be38dd954a6
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3019964
(cherry picked from commit 5fe2e2aacc)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3020430
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-11-28 01:52:18 -08:00
Jon Hunter
5615d9f984 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/+/3015723
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-11-24 15:24:38 -08:00
Laxman Dewangan
b17be80108 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
Reviewed-by: Suresh Mangipudi <smangipudi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-23 11:09:27 -08:00
Mikko Perttunen
6a8e488b48 drm/tegra: virt: Add WAR for retrieving clock rate
Normal clock APIs are not necessarily accessible from guest,
so as a workaround, use the BPMP debugfs interface to determine
engine rate when calculating usage.

Bug 4090576

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Ibbffb5700162aec18317c43e9b7e03e3b8227be2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2988957
(cherry picked from commit c8dc95c94b6c1077a6ff3e51cacef4913387828f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2991018
Reviewed-by: Johnny Liu <johnliu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-15 04:12:11 -08:00
Johnny Liu
21c6a3b3e8 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
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-11 02:28:29 -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
Mikko Perttunen
41c454c6e4 gpu: host1x-fence: Skip over stub fences
Since kernel 6.1, merging SYNC_FILE FDs will coalesce
signaled fences into a stub fence - no longer a host1x
fence. To avoid breakage on userspace side, detect such
situations here and instead of returning an error, omit
such fences when processing.

Bug 4199972

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I22451ffa22c388bbeeb3528e4760730c3f83bc1b
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3002691
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-24 23:58:02 -07:00
Johnny Liu
1b6da7e345 gpu: host1x: Enable actmon interrupt for OFA
To support interrupt-driven DFS, we need to enable actmon interrupt for
OFA.

Bug 4310958

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I0615ad4b28bb6d4bc6cd666eb354901f294f6173
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3001885
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-24 14:00:56 -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
Johnny Liu
cbde6ba274 gpu: host1x: NULL check before get_rate
Avoid calling get_rate function pointer when it is not supported by
the client driver.

Bug 4338396

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Iee7f26865d82235de7a5b41347546c1195a7ea48
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3000315
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-20 01:33:26 -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
Jon Hunter
ce678a37b1 drivers: Add conftest test for class_create
In Linux v6.4, the module pointer argument is removed from the
class_create() function. Add a test to the conftest script that checks
if this argument for the class_create() function has been removed and
use the definition created by conftest to select which version of the
function is used.

Bug 4183168
Bug 4221847

Change-Id: I440e4b318001886cd0319bb3499ba33178475e8c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2989020
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-10-05 17:54:05 -07:00
Johnny Liu
e0b77a8761 gpu: host1x: add actmon information for OFA
OFA is one of the host1x clients. One unit actmon is used for OFA.

Bug 4310958

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I27bf72d642530740eb67954ef93177d56e63db87
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2990250
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-10-04 07:45:02 -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
ae64ed46c8 gpu: host1x: 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: I56281fa5d95862338bd8a43d6e22225c27590462
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2984422
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-09-28 21:45:27 -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
Johnny Liu
6323c46280 gpu: host1x-fence: Share host1x compatible string
Same compatible string can be shared between host1x_next and
host1x_fence kernel modules so that those two modules will get
automatically loaded.

Bug 4291144

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Icf8b3fce960318c129194330c694e47826c440ee
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2983673
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-26 12:22:03 -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
Kartik Rajput
d57bc53365 gpu: host1x-nvhost: Fix compilation issues with Kernel-6.5
Upstream commit "7e3f926bf453"

[rcu/kvfree: Eliminate k[v]free_rcu() single argument macro]

Removes the single-argument kvfree_rcu() and kfree_rcu() macros. Code
that would have previously used these single-argument kvfree_rcu() and
kfree_rcu() macros should instead use kvfree_rcu_mightsleep() or
kfree_rcu_mightsleep().

Use kfree_rcu_mightsleep() instead of kfree_rcu() if using Kernel-6.5 or
newer.

Bug 4276500

Change-Id: I5f948dd0d658cf4875a2e0010818f7dde856e55c
Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2978720
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-14 20:44:03 -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
Shardar Mohammed
4be2dd36bb nvidia-oot: remove module * from class_create()
Remove the module pointer from the class_create() based
on following change in core kernel

======
driver core: class: remove module * from class_create()

The module pointer in class_create() never actually did anything, and it
shouldn't have been requred to be set as a parameter even if it did
something.  So just remove it and fix up all callers of the function in
the kernel tree at the same time.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
=====

Bug 4276500

Change-Id: Ifa0a92a282151ce12dc4a48f4f4b5b9499d3fbd8
Signed-off-by: Shardar Mohammed <smohammed@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2976600
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-09-08 18:09:50 -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
Mainak Sen
420b84b69d drm/tegra: Stop channel DMA during suspend
When channels are kept open over a suspend cycle, we need to
re-initialize CDMA after resume.

Bug 4133027

Change-Id: I9a2737b377a9ffb37e5f98703b7928bfceab58e3
Signed-off-by: Mainak Sen <msen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2963164
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-08-17 20:43:47 -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