Commit Graph

57 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
d5391a25ab 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
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-14 02:07:24 -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
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
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
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
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
Johnny Liu
57ec58a831 drm/tegra: Add module dependency with tegra_wmark
Add module dependency between drm and tegra_wmark. The drm clients are
the users of tegra_wmark governor exploiting the actmon hardware to
perform DFS.

Bug 200493763
Bug 4077910
Bug 4074193
Bug 3788919

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I2e790d6a5969635c18cb3023c72e8a1fcd5f8e63
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2900081
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-05-09 22:27:41 -07:00
Jon Hunter
5dad8295a6 gpu: host1x: Fix build for Linux v6.3
Upstream Linux commit ("1369459b2e21 iommu: Add a gfp parameter to
iommu_map()") adds a new parameter to the iommu_map function and this
breaks building the host1x driver with Linux v6.3.

Upstream Linux commit 2a81ada32f0e ("driver core: make struct
bus_type.uevent() take a const *") updates the uevent function pointer
type to make the device structure const which also breaks building the
host1x driver with Linux v6.3.

Address both of these issues to fix building the host1x driver with
Linux v6.3.

Bug 4014315

Change-Id: Ibd27f5e8442cc6970bcaac0dcfb9fc262860aee9
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2867136
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 09:18:59 +00:00
Mikko Perttunen
f6df3cee62 drm/tegra: Add function for accessing user syncpoints from kernel
Add a kernel API allowing other drivers to convert syncpoints
allocated by userspace to respective kernel 'struct host1x_syncpt'
objects while verifying the syncpoint's ownership.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I4368e7405d401bfe57bbd8315f69465effb16330
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2817764
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 09:18:59 +00:00
Mikko Perttunen
93006031b9 drm/tegra: Support virtualized engines
Support engines that are not owned by NvHost Server.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I3d3c8b153e1e5c92bcf6d9e1439c20fba3b9767f
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2811838
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
ef6b32711f drm/tegra: Fix OFA support
When the OFA driver was added for Tegra234, the driver was not added to
the list of drivers registered by the Tegra DRM driver. This is breaking
support for Tegra DRM. Add the OFA driver to the lists of driver to fix
Tegra DRM support.

Bug 3819719
Bug 3845104

Change-Id: I023f2abe38f9249680358170e0bdd85547e0c4ba
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2797758
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 09:18:59 +00:00
Mikko Perttunen
a9bb2f825b drm/tegra: Add OFA support
Add support for the optical flow accelerator. Implementation is the
same as for other Falcons except that we omit some legacy things
since the engine only exists from T234 onwards, and the addition
of having to initialize the OFA's safety RAM before boot.

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I9612e82a116cc76be492a0c533afce67c42f6a2c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2784964
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 09:18:59 +00:00
Mikko Perttunen
59a24174d4 drm/tegra: Add NVENC/NVJPG support on Tegra234
Add NVENC/NVJPG support on Tegra234. These work similarly to the
ones on Tegra194, so no big changes.

Bug 3778105

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I4a4b12d5625f927c69a6dc1c6b6bade1bca7b171
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2771770
(cherry picked from commit ee6576a1493dae1ddc5c8dc3b415d0987f670390)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2759062
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2023-04-03 09:18:59 +00:00
Mikko Perttunen
2e8de96526 drm/tegra: Add code for booting RISC-V based engines
Add helper code for booting RISC-V based engines where firmware is
located in a carveout.

Bug 3778105

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I36eda4774838fc73098bcf2eff8c3f1983c82465
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2771768
(cherry picked from commit cc6935ec1dc1e6557f5e0a7d53ef9f0c3ff12fb3)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2759060
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
437bb539be drm/tegra: Update to Linux v6.0-rc5
Update the Tegra-DRM driver to align with the latest upstream driver
from Linux v6.0-rc5.

Bug 3767126

Change-Id: Iaadc3b6a616b327fea5dab9acfba9c1d174557d3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2776688
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 09:18:59 +00:00
Mikko Perttunen
429e344bea drm/tegra: vic: Add Tegra234 support
Add Tegra234 support for VIC. It is backwards compatible with
Tegra194.

Bug 3724727

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I4421906847f7097bfbde1d3cb1191ab6c2fd58e0
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2745965
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Brad Griffis <bgriffis@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
57b7756289 drm/tegra: Update to Linux v5.19-rc1
Update the Tegra DRM driver to align with the latest upstream Tegra DRM
driver from Linux v5.19-rc1.

Bug 3724727

Change-Id: I5dc54eee6cd2c5c62832e1844cd3df59fcabe976
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2739541
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
1980c277ea drm/tegra: Drop support for pre-Linux v5.14 kernels
Drop support for Linux kernel earlier than v5.14 for the Tegra DRM
driver.

Bug 3724727

Change-Id: Id6467ed9abdfae8e134ea2e6f38540b1b6be88a8
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2739539
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2023-04-03 09:18:59 +00:00
Mikko Perttunen
381919e9c3 drm/tegra: Add support for secondary syncpoint
Add support for secondary (non-job tracking) syncpoint used for
NVENC slice encoding.

Bug 3589873

Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I80204c23486dd476c6b67a3897934f301833c7f5
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2729281
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
43cafba95d drm/tegra: Fix support for Linux v5.10
When compiling the Tegra DRM driver for Linux v5.10 it is currently
failing and the following errors are seen ...

 tegra/dc.c: In function 'tegra_crtc_atomic_begin':
 tegra/dc.c:2278:43: error: 'state' undeclared (first use in this function)
  tegra_crtc_update_memory_bandwidth(crtc, state, true);
                                             ^~~~~
 tegra/dc.c:2524:18: error: initialization from incompatible pointer type
 [-Werror=incompatible-pointer-types]
  .atomic_check = tegra_crtc_atomic_check,
                  ^~~~~~~~~~~~~~~~~~~~~~~

Upstream commit 04d5d5df9df7 ("drm/tegra: dc: Support memory bandwidth
management") added support for memory bandwidth and so disable this for
Linux kernel prior to v5.11 due to incompatibilty with these earlier
versions.

JIRA LS-410

Change-Id: Ic130a6e37cef597772b62be192f154a2681fe157
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2668675
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Mikko Perttunen
02b028d02a drm/tegra: Merge upstream changes
Merge upstream changes from linux-next, including merged version
of new UAPI.

Change-Id: I4f591d39e51ac6ab6877a0bd428adf166eca3c55
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2653095
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
96b2a8c5ea drm/tegra: Add support for NVENC and NVJPG
Add support for the Host1x NVENC and NVJPG engines.

JIRA LS-411

Change-Id: Ied1c64c17d337e571512c053ef9552642faa430c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2490297
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
19d4c20727 drm/tegra: Fix build for Linux v5.15 with CONFIG_DRM_LEGACY disabled
Upstream commit c1736b9008cb ("drm: IRQ midlayer is now legacy") moved
the 'irq_enabled' member of struct drm_device under CONFIG_DRM_LEGACY.
When compiling Linux v5.15 without CONFIG_DRM_LEGACY enabled, compiling
the Tegra DRM driver now fails because the 'irq_enabled' member is not
defined.

Upstream commit 14746211570b ("drm/tegra: Don't set struct
drm_device.irq_enabled") has now removed the setting of the
'irq_enabled' variable from the Tegra DRM driver and so fix this by
only setting this variable for kernels prior to Linux v5.15.

Change-Id: I27907494e6ca0c5c7f8bedc80eca4395428d4e1a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2613510
(cherry picked from commit 1e4600fca6b4027e6f1dc6b8dcc28fc1c8c8767e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2620155
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
b7661d82c8 drm/tegra: Fix support for Linux v5.14
Upstream commit be4306ad928f ("drm/tegra: Don't set allow_fb_modifiers
explicitly") removed the setting of drm->mode_config.allow_fb_modifiers
from the Tegra DRM driver because this is now set by the core. However,
because this is still being set in the Tegra DRM out-of-tree module it
generates a WARNING on boot. Fix this by not setting
drm->mode_config.allow_fb_modifiers for Linux kernels v5.14 and greater.

Upstream commit 6cba3fe43341 ("drm/dp: Add backpointer to drm_device in
drm_dp_aux") added a backpointer that if missing generates another
WARNING on boot so fix this by ensuring the backpointer is populated for
Linux v5.14 kernels and greater.

Bug 200780535

Change-Id: I6092f09cf35f636c4cde0801526fdeab7a26daed
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2602684
(cherry picked from commit e3910b7d43971d7c72ab71b24fab3a234473f8d0)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2604802
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
4b104ab7c5 drm/tegra: Fix compilation for Linux v5.15
Commit 97c9bfe3f660 ("drm/aperture: Pass DRM driver structure instead
of driver name") updated the function drm_aperture_remove_framebuffers()
so that callers need to pass a DRM driver structure instead of a name.
This is causing the compilation of out-of-tree Tegra DRM driver to fail
for Linux v5.15 kernels. Update the out-of-tree Tegra DRM driver as
necessary to support v5.15 kernels.

Change-Id: I3cf5ce75032651a64115452b4ac1fd1e54d83f11
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2588211
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Jon Hunter
6875b1f69e drm/tegra: Fix compilation for Linux v5.14
Commit 6848c291a54f ("drm/aperture: Convert drivers to aperture
interfaces") converted various drm_fb_helper_xxx functions to
drm_aperture_xxx functions for Linux v5.14. This breaks the compilation
of the out-of-tree Tegra DRM module and so fix this by updating the
out-of-tree module as necessary.

JIRA LS-115

Change-Id: Ice68b5f9ac6aded268ea4bb6db273d505db29af4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2554714
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00
Thierry Reding
98a160c54a UPSTREAM: drm/tegra: dc: Parameterize maximum resolution
Tegra186 and later support a higher maximum resolution than earlier
chips, so make sure to reflect that in the mode configuration.

Change-Id: I76e948f301c366f9e86f77ecadc545dbe81bd3fe
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545941
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
2023-04-03 09:18:59 +00:00