Commit Graph

230 Commits

Author SHA1 Message Date
Ivan Raul Guadarrama
fab00a954b drm/tegra: vic: Update FW code section size
Increase the size of the code section by 256 bytes.

Jira EGFX-16888

Change-Id: I86d8d32ebd7ffd25270bf3f4ab25f08244fe940d
Signed-off-by: Ivan Raul Guadarrama <iguadarrama@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3370316
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2025-07-24 10:20:35 +00:00
Mainak Sen
f0404e50f6 drm: tegra: Disable TEGRA_SYNCPT_INCR IOCTL for T264 platform
Conditionally disabled the legacy TEGRA_SYNCPT_INCR IOCTL for T264
platforms since it's no longer needed. This IOCTL is superseded by the
newer TEGRA_SYNCPOINT_INCREMENT IOCTL which provides better functionality
and follows the modern API design.

The conditional compilation helps reduce the attack surface on T264
platforms by removing legacy code paths that aren't needed.

Use CONFIG_ARCH_TEGRA_264_SOC as the proper platform-specific flag
to identify T264 platforms, as this is the standard architecture flag
used throughout the codebase.

This change affects:
1. The IOCTL definition in the tegra_drm_ioctls table
2. The IOCTL handler function implementation

This improves code cleanliness by removing unnecessary legacy code
on newer platforms while maintaining backward compatibility for
older platforms that might depend on this IOCTL.

Bug 5060574

Change-Id: Idd21d69ebd992f976770016b5805f7d6af89c88d
Signed-off-by: Mainak Sen <msen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3342657
Reviewed-by: Sourab Gupta <sourabg@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:19 +00:00
Jon Hunter
22336de810 drm/tegra: Update to Linux v6.15-rc3
Update the Tegra DRM to align with Linux v6.15-rc3. In Linux v6.15-rc3,
the arguments of the 'mode_valid' function pointer of the
drm_connector_helper_funcs structure and the 'atomic_async_check'
function pointer of the drm_plane_helper_funcs structure were updated.
Add conftest tests to detect these updates and make the necessary
changes to the Tegra DRM driver.

JIRA LINQPJ14-47

Change-Id: Id1c8db95390f02258952da78af3dd6ff5acfa631
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3333838
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:18 +00:00
Jon Hunter
3ad90175d1 drm/tegra: Update to Linux v6.14
Update Tegra DRM to align with Linux v6.14. The 'drm_client_setup.h' was
moved from the directory 'include/drm/' to 'include/drm/clients' and use
conftest to detect where it is located.

JIRA LINQPJ14-47

Change-Id: I1f1df6da4400e74d2f97926710ac0ddd5e6413e6
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3333837
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:17 +00:00
Jon Hunter
540737a228 drm/tegra: Update to Linux v6.13
Update the Tegra DRM driver to align with Linux v6.13. A function
pointer 'fbdev_probe' was added to the drm_driver structure in Linux
v6.13 and so use conftest to detect this and make the necessary changes
to the Tegra DRM driver.

JIRA LINQPJ14-47

Change-Id: I0120fe9f13bc39446ce4e0a8827eb5d8b42a082c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3333836
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:17 +00:00
Jon Hunter
6be033ba85 drm/tegra: Update to Linux v6.12
Update Tegra DRM to align with Linux v6.12. The output.c driver was
updated to use the 'drm_edid_connector_add_modes()' function that was
first added in Linux v6.3. Use conftest to detect the presence of the
drm_edid_connector_add_modes() function and make the necessary changes
to the driver.

JIRA LINQPJ14-47

Change-Id: I0ff45ef0ada2f2c2353c1ba579c06ae06122727c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3333835
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:17 +00:00
Jon Hunter
13834d4e13 drm/tegra: Update to Linux v6.8
Update the Tegra DRM driver to align with the upstream Linux v6.8 kernel
preserving all the downstream changes that still need to be upstreamed.

JIRA LINQPJ14-47

Change-Id: If0a9149bcfa2fd6276ac8100933abc3d532a5ddc
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3333320
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:17 +00:00
Jon Hunter
8a28999d28 drm/tegra: Drop kernel version checks
Drop the kernel version checks from Tegra DRM because these are only
needed for pre-Linux v6.x kernels and these are no longer supported.

JIRA LINQPJ14-47

Change-Id: Ie5190eec6f3e37b477ae2ad84f2ef2f3ed9c3d8a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3333319
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:17 +00:00
Vamsee Vardhan Thummala
15f9feb564 drm/tegra: Remove PM from virtual engine
Remove power management functionality from virtual engine driver
as it's no longer needed. This includes suspend/resume operations
and PM ops structure. The driver now relies on system's default
power management behavior.

Jira HOSTX-5933

Change-Id: I092bfa8e2a01345e149ff2c04ed526a0aa7a0944
Signed-off-by: Vamsee Vardhan Thummala <vthummala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3322473
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:17 +00:00
praagarwal
4651a49da8 drm/tegra: address INT30-C cert violations
add integer overflow checks with error handling

Jira HOSTX-5889

Change-Id: Ib31763ab073c2f9b13e2f54fd3c006d977215941
Signed-off-by: Prateek Agarwal <praagarwal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3301055
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:16 +00:00
Mainak Sen
37189ffbdd drm/tegra: Deprecate Legacy DRM IOCTLs
*. TEGRA_OPEN_CHANNEL
*. TEGRA_CLOSE_CHANNEL
*. TEGRA_SYNCPT_WAIT
*. TEGRA_SYNCPT_READ

Jira HOSTX-5843

Change-Id: If1a047c5fdf86a60074e31e92eaef3397f4dce01
Signed-off-by: Mainak Sen <msen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3315044
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:16 +00:00
Mainak Sen
7c0ab66c2a drm/tegra: Disable power mode change
Compile out Power mode change related functionality
under CONFIG_TEGRA_HOST1X_POWERMODE_CONTROL flag.
This flag is currently disabled in 7.0 release
and expected to enabled in 7.2 release.

Jira HOSTX-5933

Change-Id: I7f35c67950e8684927bfdbd99c716cfaa580cb19
Signed-off-by: Mainak Sen <msen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3311122
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Vamsee Vardhan Thummala <vthummala@nvidia.com>
Reviewed-by: Leslin Varghese <lvarghese@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Raghavendra Vishnu Kumar <rvk@nvidia.com>
2025-07-24 10:19:16 +00:00
Mainak Sen
db0d9da92f drm/tegra: Fix Engine timestamp shift factor
In Orin and previous chipsets, engine timestamp counter
runs 32 times faster than CNTVCT register, so the actual
timestamp is obtained by right shifting with factor of 5.
In Thor onwards, this shift is not required is for VIC engine.

Jira HOSTX-5905

Change-Id: I69980fdfcf50b15db99b1fbad522aecd571a0f17
Signed-off-by: Mainak Sen <msen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3306825
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:15 +00:00
Santosh BS
71c53e0ff0 drm/tegra: set CONFIG_TEGRA_DRM_NATIVE_DIS for emb-linux
Set export variable and build config flag, CONFIG_TEGRA_DRM_NATIVE_DIS,
based on emb-linux platform identifier flag NV_OOT_NVHOST_NATIVE_DIS.

Jira HOSTX-5885

Change-Id: I43d3c08a8494fb25524e4b4a91eb2eb68b3526f2
Signed-off-by: Santosh BS <santoshb@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3297034
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2025-07-24 10:19:15 +00:00
Jon Hunter
2a4ac9e68f drm/tegra: Fix build for Linux v6.14
In Linux v6.14, the 'date' field was removed from the 'drm_driver'
structure. Add a test to conftest to detect this and update the Tegra
DRM driver accordingly.

Jira LINQPJ14-6

Change-Id: Ia3024321f12f8448d382deba996407f9d3232567
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3297069
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:15 +00:00
Santosh BS
df285efd88 drm/tegra: move debug support under CONFIG_DEBUG_FS
Move debug specific code portions in virt.c under CONFIG_DEBUG_FS
config.

Jira HOSTX-5885

Change-Id: Icd90deb7c556ce100c0ee61d69719bde902514d5
Signed-off-by: Santosh BS <santoshb@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3295412
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:15 +00:00
Santosh BS
ebe01a47a3 drm/tegra: move tegra iommu domain support under CONFIG_TEGRA_IOMMU_SMMU
Tegra iommu domain is used in legacy chips (<= T210).
Move the related codes under CONFIG_TEGRA_IOMMU_SMMU accordingly.

Jira HOSTX-5833

Change-Id: I1e1e1dab33935b8881b905574ee006bbe8fc61d9
Signed-off-by: Santosh BS <santoshb@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3293445
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:14 +00:00
Mikko Perttunen
92ed8780d2 drm/tegra: Add new syncpoint increment IOCTL
Add new syncpoint increment IOCTL in line with the new channel/
syncpoint IOCTLs, that only allows incrementing owned syncpoints.

Change-Id: Ieed11e1ba840da31ecfe7029051bfa61b88cd2b5
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3284407
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Santosh BS <santoshb@nvidia.com>
2025-07-24 10:19:14 +00:00
Mikko Perttunen
48e383a1b9 drm/tegra: Add option for explicit syncpoint free
Add kernel module parameter to enable a mode where syncpoints
must be freed explicitly (using the free IOCTL) or they will be
left dangling. This ensures that, for particularly locked down
configurations, a syncpoint will be forever left in an expected
state even if the process owning it dies -- for example another
process will not be able to allocate it.

Change-Id: I2f350c710775a296c70910df21e95737a36c6a45
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3284405
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Santosh BS <santoshb@nvidia.com>
2025-07-24 10:19:14 +00:00
Santosh BS
91751dfb74 drm/tegra: move disply related code under CONFIG_DRM_TEGRA_HAVE_DISPLAY
As Tegra DRM driver display support is not needed for recent chips,
move the related codes under CONFIG_DRM_TEGRA_HAVE_DISPLAY and enable
that flag based on legacy chip configs accordingly.

Jira HOSTX-5833

Change-Id: Iddf884f5abdfe2500e7195778bc77f9423acc2d3
Signed-off-by: Santosh BS <santoshb@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3292246
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:14 +00:00
Santosh BS
b5acbd1bfc drm/tegra: syncpoint base support for chips <= t186
As syncpoint base feature is not supported from T194 onwards,
moving the related ioctl handling under CONFIG_HOST1X_HAVE_SYNCPT_BASE
accordingly.

Jira HOSTX-5833

Change-Id: Idb5188039ef22e8d27e0a5ddf06a1c447fb323d3
Signed-off-by: Santosh BS <santoshb@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3292251
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:14 +00:00
Jon Hunter
00ab7abbb6 gpu/drm: tegra: Fix support for Linux v6.12
In Linux v6.12, commit 641bb4394f40 ("fs: move FMODE_UNSIGNED_OFFSET to
fop_flags") moves the setting of the FMODE_UNSIGNED_OFFSET into the
various drivers and renames this flag. This change is causing various
tests to fail because opening the DRM device is failing.

Use the presence of the new FOP_UNSIGNED_OFFSET flag in the kernel to
determine if we need to set this flag in the Tegra DRM driver.

Bug 4876974

Change-Id: Ie72a9340187b1c206f0cda6d7e3dab44d603a41c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3269063
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:12 +00:00
Jon Hunter
13e35c27dd drm/tegra: Backport fbdev updates
The following upstream commits have been back-ported to the out-of-tree
Tegra DRM driver to align with upstream to help pull in the latest
updates from upstream.

Changes from Linux v6.2:
 7ad4384d53c6 drm/tegra: Add missing clk_disable_unprepare() in
              tegra_dc_probe()

Changes from Linux v6.3:
 3fb1f62f80a1 drm/fb-helper: Remove drm_fb_helper_unprepare() from
              drm_fb_helper_fini()

Changes from Linux v6.4:
 71ec16f45ef8 drm/tegra: Implement fbdev emulation as in-kernel client
 25dda38e0b07 drm/tegra: Initialize fbdev DRM client
 1ac45068af9d drm/tegra: Hide fbdev support behind config option
 08263e91f260 drm/tegra: Removed fb from struct tegra_fbdev
 434434608a91 drm/tegra: Remove struct tegra_fbdev
 dc06f4a495df drm/tegra: Include <linux/i2c.h>
 f68b63ebc433 drm/tegra: Include <linux/of.h>
 437405403ab4 drm/tegra: rgb: Make tegra_dc_rgb_remove() return void

The changes have been back-ported to ensure that they build for all
kernel versions supported and utilise conftest as necessary to handle
kernel differences.

Bug 4876974

Change-Id: I6c8403325a7b4874f3ad1c6a0b1f662c1494c397
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3267798
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2025-07-24 10:19:11 +00:00
Jon Hunter
6f788dbe13 drm/tegra: Fix build for Linux v6.12
In Linux v6.12, commit 446d0f4849b1 ("drm: Remove struct
drm_mode_config_funcs.output_poll_changed") removes
'output_poll_changed' function pointer from 'drm_mode_config_funcs'
structure and commit b5757a5be2fa ("drm: Remove struct
drm_driver.lastclose") removes 'lastclose' from the 'drm_driver'
structure. This is breaking build the Tegra DRM out-of-tree driver for
Linux v6.12.

Fix this by partially back-porting commit 71ec16f45ef8 ("drm/tegra:
Implement fbdev emulation as in-kernel client") from Linux v6.4 which
removed the use of the 'output_poll_changed' and 'lastclose' function
pointers from the Tegra DRM driver. Note that it is safe to partially
back-port this for now because we don't use the frame-buffer support in
the Tegra DRM driver for Tegra234+ devices.

To keep the Tegra DRM out-of-tree driver aligned with upstream, the
remaining parts of commit '71ec16f45ef8' will be back-ported in another
change that will be part of a bigger change to align the frame-buffer
support with the upstream driver. For now just fix the build for Linux
v6.12.

Bug 4876974

Change-Id: Idc9b1c198c067ccb59f1337866154c9a8f0a5623
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3267797
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2025-07-24 10:19:11 +00:00
Santosh BS
d32b4667a5 drm/tegra: move legacy chip support under config option
- Update Makefile to build the legacy chip related
  files only when any of the below configs are set.
  CONFIG_ARCH_TEGRA_2x_SOC
  CONFIG_ARCH_TEGRA_3x_SOC
  CONFIG_ARCH_TEGRA_114_SOC
  CONFIG_ARCH_TEGRA_124_SOC
  CONFIG_ARCH_TEGRA_132_SOC
  CONFIG_ARCH_TEGRA_210_SOC
  CONFIG_ARCH_TEGRA_186_SOC
  CONFIG_ARCH_TEGRA_194_SOC

- Update drm.c/.h to build legacy chip specific
  code portions for the respective configs accordingly.

Jira HOSTX-5727

Signed-off-by: Santosh BS <santoshb@nvidia.com>
Change-Id: I3d2235923011073d82dcfe6b1fd6618ae70d37bb
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3253132
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:11 +00:00
Jon Hunter
ff48ee63b1 drivers: Fix MODULE_IMPORT_NS for Linux v6.13
In Linux v6.13, commit cdd30ebb1b9f ("module: Convert symbol namespace
to string literal") updated the MODULE_IMPORT_NS macro to take a string
literal as an argument in Linux v6.13. Use conftest to detect if
MODULE_IMPORT_NS takes a string literal as an argument and update the
various drivers accordingly.

Bug 4991705

Change-Id: I8f34860648965dc2334e2916d5404522510778ff
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3263798
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:11 +00:00
Jon Hunter
a8777837dd drm/tegra: Fix aperture support for Linux v6.13
In Linux v6.13, commit 689274a56c0c ("drm: Remove DRM aperture helpers")
removed the DRM aperture helper functions and drivers should simply use
the existing video helpers. Update the Tegra DRM driver to use
aperture_remove_all_conflicting_devices() if available to align with
upstream.

Bug 4991705

Change-Id: Ie4b78a4ea519ffcaaf972417ec2cbe7c436eb808
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3261694
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2025-07-24 10:19:11 +00:00
Jon Hunter
ed9db43d54 drivers: gpu: Fix IOMMU support for Linux v6.13
In Linux v6.13, commit f6440fcc9c7b ("iommu: Remove
iommu_domain_alloc()") removed iommu_domain_alloc() and was replaced by
iommu_paging_domain_alloc(). Use conftest to detect if the function
iommu_paging_domain_alloc() is supported by the kernel and update the
Tegra DRM and Host1x drivers accordingly.

Bug 4991705

Change-Id: I86221d96232396fdb6bdccf40c412e029881c513
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3261695
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:11 +00:00
Jon Hunter
eb7a615b59 drm/tegra: Fix genpd support for Linux v6.13
In Linux v6.13, commit d6caca30a548 ("OPP: Drop redundant
*_opp_attach|detach_genpd()") removed devm_pm_opp_attach_genpd(). This
has been replaced by devm_pm_domain_attach_list(). Use conftest to
detect the presence of devm_pm_domain_attach_list() and update the Tegra
DRM driver accordingly.

Bug 4991705

Change-Id: I5a3bd258d3fce5b09fd4ba84adad166e4cf47cfb
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3261693
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
2025-07-24 10:19:11 +00:00
Mikko Perttunen
5f7d8f89c6 drm/tegra: Add syncpoint memory export interface
Add a userspace interface for providing access to the memory syncpoint
shim through dma-buf file descriptors. Applications can pass references
to syncpoints to other devices that only support memory semaphores to
facilitate synchronization with syncpoints.

Only syncpoints allocated through the DRM file descriptor ("owned" by
the application) can be exported read-write. All syncpoints can be
exported read-only.

Jira HOSTX-5722
Bug 4919132

Change-Id: I4f5c007b7f9ba65780c418b4e22c5f59a11ef84d
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3252026
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:10 +00:00
Jon Hunter
5a77eeb8a3 drm/tegra: Remove 'unaligned.h' header
In Linux v6.12, commit 5f60d5f6bbc1 ("move asm/unaligned.h to
linux/unaligned.h") moved the 'unaligned.h' header file. The
'unaligned.h' is not needed by the Tegra DRM RISC-V driver and so remove
this header.

Bug 4876974

Change-Id: If5993d6ea8291557de6fd41e4f55552bae45505b
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3252432
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:10 +00:00
Santosh BS
75509a244a drm/tegra: move native engine support under config option
- Update makefile to skip building native engine specific
  files when CONFIG_TEGRA_DRM_NATIVE_DIS is set
- Update drm.c to skip native engine platform drivers
  when CONFIG_TEGRA_DRM_NATIVE_DIS is set

Jira HOSTX-5705

Signed-off-by: Santosh BS <santoshb@nvidia.com>
Change-Id: I86e1db76ea8712165a57cb3b0188c251c56da513
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3248092
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2025-07-24 10:19:10 +00:00
Mikko Perttunen
e71627a4e5 drm/tegra: vic: Fix CRC enable for T264
The change to write the INTF_CRC_CFG register was inadvertently
left out. Correct this.

Bug 4809300

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I208da56d03e90e72ce26dffe7bef1cdeab95fab6
2025-07-24 10:19:09 +00:00
Mikko Perttunen
6cf81885cf CRC enable for Tegra264
Change-Id: I9f38b199c36a0baf600a68e9dfd344440abe7fa0
2025-07-24 10:19:09 +00:00
vasukis
7789bd9c0a tegra: hwpm: VIC: HWPM-NvHost Profiling support
Add support to profile NvHost IPs on various chips
by HWPM module.

Bug 4170421
DOS-SHR-7966

Signed-off-by: vasukis <vasukis@nvidia.com>
Change-Id: I42ac3b5fa79d7b6f97e66098cb84277cda2aff4d
2025-07-24 10:19:09 +00:00
Santosh BS
021bbbedb0 drm/tegra: nvhost virtualisation support for t264
Add compatibility string for virtualised nodes

Bug 4587237
Jira HOSTX-5297

Change-Id: I53ff8b03989f4001dee73dc2d3d64ba60a0e3ae3
Signed-off-by: Santosh BS <santoshb@nvidia.com>
2025-07-24 10:19:09 +00:00
Santosh BS
26b1cb4a82 drm/tegra: nvhost support for t264
- VIC RISC-V EB boot support
- Programming sequence modification needed for Thor
- Reloc block linear addressing not needed for t264

Bug 4132685

Signed-off-by: Santosh BS <santoshb@nvidia.com>
Change-Id: I8ad47cce31cfd06020e33d3457a0d674a11e4d49
2025-07-24 10:19:09 +00:00
Jon Hunter
f01227d4ea drivers: Drop inline from driver remove wrapper
The driver remove function is a function pointer and therefore, it does
not make sense to define the function as an 'inline'. Update the
coccinelle script and drivers to remove the inline statement.

Bug 4749580

Change-Id: Ia03691b75c4edffe609f27468b911a92a5ddbd68
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3233980
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:08 +00:00
Mainak Sen
7afa86700c drm/tegra: Add sysfs to trigger SOC power mode change.
For Sentry Mode SHR, Host1x client engine clock needs to configured
to a lower rate or clock-gated. a new IVC comand is added to send
power mode change notification to NvHost Server to perform the clock
rate update.

Jira HOSTX-5373

Change-Id: I9039c5243d5fd40f1da2f11e4449ea2e9b0dfc42
Signed-off-by: Mainak Sen <msen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3181703
(cherry picked from commit dab7c0e0537cf1c18697f69fe9eba8a150b2245a)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3220776
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Raghavendra Vishnu Kumar <rvk@nvidia.com>
Reviewed-by: Sourab Gupta <sourabg@nvidia.com>
2025-07-24 10:19:07 +00:00
Mikko Perttunen
e594972dd7 drm/tegra: virt: Fix nvenc usage measurement
Communication with BPMP attempted to use 'msenc' as engine name.
Correct this to use 'nvenc' while keeping userspace debugfs directory
as 'msenc'.

Bug 4559545

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I4fef852dd3312c763c5845bf8b43fac082863bad
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3141443
(cherry picked from commit f2543128b14fb5df7764df7bfa3456bf0df4f945)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3193472
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-08-15 16:57:04 -07:00
Jon Hunter
951b2423a8 drivers: Fix platform_driver remove for Linux v6.11
In Linux v6.11, the 'platform_driver' structure 'remove' callback was
updated to return void instead of 'int'. Update all the impacted drivers
as necessary to fix this.

Bug 4749580

Change-Id: I3bb5c549777f7ccad0e3f870373fdd25726ad7ed
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3182878
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Tested-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-08-11 17:20:34 -07:00
Mikko Perttunen
ec4681358b drm/tegra: nvdec: Enable SLCG/PG
Add register writes to enable second level clock gating /
power gating. For now only for Tegra234.

Bug 4475968

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Ie2e3b6d375bb6b7772b71999df81d73bea7ad550
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3116201
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-07-30 08:52:07 -07:00
Jon Hunter
cb8b9f5a53 drivers: Fix missing vmalloc.h for Linux v6.10
Upstream commit 690da22dbfa8 ("asm-generic/io.h: kill vmalloc.h
dependency") removed the vmalloc.h header file from io.h and this breaks
building various drivers with the latest -next kernels. Fix this
by ensuring vmalloc.h is included and in most cases slab is not actually
needed and so remove this where possible. Note that it is fine to make
this change for all current supported kernels.

Bug 4593750

Change-Id: I003d1302bda226d356467e6ede99949b2716940a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3141984
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
2024-05-22 09:19:24 -07:00
Mikko Perttunen
8d8699b29e drm/tegra: Enable CRC generation on multimedia engines
Enable CRC generation feature on VIC, OFA, and NVENC where
possible. Whether CRC generation can be enabled depends on
whether the engine's SEC register aperture is writable, based
on platform configuration.

The firewall configuration is for now determined in a hacky
way using ioremap, pending design decisions on how to do it
in a cleaner way.

Bug 4273775

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Ia7507f4cce2b49703328d5dfdd74aaac8cff8153
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3120662
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-04-27 09:00:32 -07:00
Mikko Perttunen
4f69d815e6 drm/tegra: ofa: Only enable safety RAM if specified
Fix OFA boot sequence to only enable safety RAM if the configuration
specifies doing so.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Id427dee5cfcda036b3f71b89e5d11a4a842964f1
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3103404
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
2024-03-26 00:30:19 -07:00
Mikko Perttunen
6025535763 drm/tegra: Enable job timestamping for NVJPG
NVJPG firmware now supports timestamping, so enable use of it.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I5a21f51e29ac19a95d36bb435dc884a440095ac2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3070327
Reviewed-by: Satvik Raj Gupta <satvikrajg@nvidia.com>
Tested-by: Satvik Raj Gupta <satvikrajg@nvidia.com>
2024-03-18 23:36:31 -07:00
Mikko Perttunen
c2d209f066 drm/tegra: gem: Don't attach dma-bufs when not needed
The dma-buf import code currently attaches and maps all imported
dma-bufs to the drm device to get their sgt for mapping to the
directly managed IOMMU domain.

In many cases, like for newer chips (Tegra186+), the directly
managed IOMMU domain is, however, not used. Mapping to the drm
device can also cause issues e.g. with swiotlb since it is not
a real device.

To improve the situation, only attach and map imported dma-bufs
when required.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: If73cc4e9419a2eebf67269eadb34050986f73077
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3090413
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-15 13:05:54 -07:00
Mikko Perttunen
a050b8203b drm/tegra: gem: Open code drm_prime_gem_destroy
Since we aren't using drm_gem_prime_import(_dev), for clarity don't
use the corresponding destroy function either.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I024a78a6378d0fa6f0134958904122b8d201d99c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3090412
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Santosh BS <santoshb@nvidia.com>
2024-03-15 13:05:49 -07:00
Jon Hunter
eee13a1edb 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
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-24 05:24:02 -08:00
Mikko Perttunen
e062e9d49c gpu: host1x: Memory context stealing
Currently, each process holding an open TegraDRM channel reserves
for itself one of the limited number of hardware memory contexts.
Attempting to allocate a channel when all contexts are in use
results in failure.

While we cannot have more contexts than the hardware supports in
active use, idle channels don't necessarily need to have a backing
memory context. As such, in this patch, we add another layer
to allow hardware memory contexts to be "stolen away" by channels
that are in active use, from idle processes.

The way this is implemented, is by keeping track of memory
mappings on each abstracted memory context. If we need to
steal that memory context's backing hardware context, we unmap
everything from it and give it away. When that abstracted
memory context is needed again (re-activated), we attempt
to allocate or steal another hardware context and re-map
the previously unmapped buffers.

Unfortunately, this means additional overhead and unpredictability
at submit time. Submit can fail if we cannot re-allocate a
backing memory context. Future work includes a provision for
un-stealable backing hardware memory contexts for processes
requiring more determinism, as well as optimization and cosmetic
improvements.

Bug 4403250
Bug 4399310

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I3d13e3476f1bff3c4757152254496cddaaafd76a
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3058905
Reviewed-by: Santosh BS <santoshb@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-16 03:04:44 -08:00