Building the Tegra DRM driver is failing due to changes made by the
following upstream commits:
1. Commit 650f2dc97053 ("gpiolib: of: remove
[devm_]gpiod_get_from_of_node() APIs")
2. Commit 6c80a93be62d ("drm/fb-helper: Initialize fb-helper's preferred
BPP in prepare function")
3. Commit bc292ab00f6c ("(HEAD) mm: introduce vma->vm_flags wrapper
functions")
Address the above to fix building the driver for Linux v6.3.
Bug 4014315
Change-Id: Ic5242291295b84dd13e8ef651533077444ac62d2
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2867137
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>
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>
Linux v6.2 makes the following changes in the DRM subsystem ...
1. Commit 7c99616e3fe7 ("drm: Remove drm_mode_config::fb_base") removes
the fb_base member from the drm_mode_config structure.
2. Commit 9877d8f6bc37 ("drm/fb_helper: Rename field fbdev to info in
struct drm_fb_helper") renames the 'fbdev' field of the drm_fb_helper
structure to 'info'.
3. Commit 7fd50bc39d12 ("drm/fb-helper: Rename drm_fb_helper_alloc_fbi()
to use _info postfix") renames the function drm_fb_helper_alloc_fbi()
to drm_fb_helper_alloc_info().
4. Commit afb0ff78c13c ("drm/fb-helper: Rename drm_fb_helper_unregister_fbi() to
use _info postfix") renames the function
drm_fb_helper_unregister_fbi() to drm_fb_helper_unregister_info().
Update the Tegra DRM out-of-tree module as necessary to fix the build
for Linux v6.2.
Bug 3936429
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I501cb1d5dc772bc86b357f536431b76427e4888e
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2841023
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
On Tegra234, engines that are programmed through Host1x channels can
be attached to either the NISO0 or NISO1 SMMU. Because of that, when
selecting a context device to use with an engine, we need to select
one that is also attached to the same SMMU.
Add a parameter to host1x_memory_context_alloc to specify which device
we are allocating a context for, and use it to pick an appropriate
context device.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Change-Id: I32af312c85164b72c14409d816d3b50ad5c7bfe5
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2811836
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Currently all fences have a 30 second timeout to ensure they are
cleaned up if the fence never completes otherwise. However, this
one size fits all solution doesn't actually fit in every case,
such as syncpoint waiting where we want to be able to have timeouts
longer than 30 seconds. As such, we want to be able to give control
over fence cancellation to the caller (and maybe eventually get rid
of the internal timeout altogether).
Here we add this cancellation mechanism by essentially adding a
function for entering the timeout path by function call, and changing
the syncpoint wait function to use it.
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: I4600544afe21efdd3f7d06362bd124130ddec3db
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2786637
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
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>
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>
Implement the get_streamid_offset and can_use_memory_ctx callbacks
required for supporting context isolation. Since old firmware on VIC
cannot support context isolation without hacks that we don't want to
implement, check the firmware binary to see if context isolation
should be enabled.
Bug 3724727
Change-Id: Ie4c952987f2a5ae660257194b43c18829ac707c4
For engines that support context isolation, allocate a context when
opening a channel, and set up stream ID offset and context fields
when submitting a job.
As of this commit, the stream ID offset and fallback stream ID
are not used when context isolation is disabled. However, with
upcoming patches that enable a full featured job opcode sequence,
these will be necessary.
Bug 3724727
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Ic57b04d8240ef19a1b82361e5ca8d07119f08652
NVDEC's TRANSCFG register is at a different offset than VIC.
This becomes a problem now when context isolation is enabled and
the reset value of the register is no longer sufficient.
Bug 3724727
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
Change-Id: Ic83043dcc49a3739fe310cfb5b143b42d9aa259b
When mapping the DMA-BUF attachment fails, map->sgt will be an ERR_PTR-
encoded error code and the cleanup code would try to free that memory,
which obviously would fail.
Zero out that pointer after extracting the error code when this happens
so that kfree() can do the right thing.
Bug 3706991
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Change-Id: I6870559061cb91fb6ff01bc458a816f56ce8b978
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2744243
(cherry picked from commit 9d625d7f7fa2f1769c6f7f856b4ca7562ccba1e6)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2744600
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit
Upstream Linux commits da68386d9edb ("drm: Rename dp/ to display/") and
644edf52b630 ("drm/display: Move SCDC helpers into display-helper
library") moved some of the DRM headers and this is causing the out of
tree Tegra DRM driver build to fail with Linux v5.19. Fix this by
correcting the include paths for Linux v5.19.
Bug 3680147
Change-Id: Ic9b7a9d16da11e487ace4d09ffbff6ae4466e002
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2728509
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
Building the Tegra DRM out-of-tree module with Linux v5.18-rc1 is
currently failing because of two changes which are ...
1. Upstream commit 5b529e8d9c38 ("drm/dp: Move public DisplayPort
headers into dp/") moves the location of the header drm_dp_helper.h.
Fix this by updating the location for Linux v5.18 onwards.
2. Upstream commit 7938f4218168 ("dma-buf-map: Rename to iosys-map")
renames 'struct dma_buf_map' to 'struct iosys_map' and so fix this
by using the appropriate structure name depending on kernel version.
Bug 3598986
Change-Id: Ib6c3326d42fb5e6c74bc74f4d16b136b903ff1b2
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2693912
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
The link_status array was not large enough to read the Adjust Request
Post Cursor2 register, so remove the common helper function to avoid
an OOB read, found with a -Warray-bounds build:
drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_get_adjust_request_post_cursor':
drivers/gpu/drm/drm_dp_helper.c:59:27: error: array subscript 10 is outside array bounds of 'const u8[6]' {aka 'const unsigned char[6]'} [-Werror=array-bounds]
59 | return link_status[r - DP_LANE0_1_STATUS];
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/drm_dp_helper.c:147:51: note: while referencing 'link_status'
147 | u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE],
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Replace the only user of the helper with an open-coded fetch and decode,
similar to drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c.
Change-Id: Ifd759369437783a9aa0cc2da5748d2235196b434
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org
Fixes: 79465e0ffeb9 ("drm/dp: Add helper to get post-cursor adjustments")
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://lore.kernel.org/r/20220105173507.2420910-1-keescook@chromium.org
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/+/2693871
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
Commit 72c23bd789f4 ("drm/tegra: Ensure BOs are not freed before
display is updated") added a workaround to fix a race condition when
freeing BOs. A proper fix has been created for the BO caching for
host1x that has been submitted upstream and so revert commit
72c23bd789f4.
Bug 3556250
Change-Id: Ie47e734393770a1390acff20ee133576a335f38f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2693868
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
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
Occasionally, there are cases where the BO is being freed before the
display has been updated to use the next BO. If the SMMU is enabled this
causes SMMU faults to occur.
This problem occurs when the vertical blanking interrupt occurs at the
same time the BO used by the display is updated. In this case, the
interrupt handler, tegra_dc_irq(), is called to handle the vertial
blanking interrupt, which in turn calls drm_crtc_handle_vblank() to
discard the previous BO. However, the programming of the display
controller did not actually complete before the vertical blanking
and the display is still using the previous BO. Hence, the display
continues to use the prevoius BO which is then freed.
Fix this by disabling the vertical blanking interrupt during the time
where the display is updated and then in the Tegra interrupt handler
ensure that we only handle interrupts that are currently enabled.
Finally, before calling drm_crtc_handle_vblank() in the interrupt
handler, check that the programming of the display controller has
completed and it is safe to release the BO.
JIRA LS-128
Change-Id: I1c9523f2b0a3ea406d651c2d1988e452d412e204
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2660852
Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit
Building the Tegra DRM out-of-tree module against the current upstream
mainline kernel is failing and errors such as the following are seen.
ERROR: modpost: module tegra-drm-next uses symbol dma_buf_detach from
namespace DMA_BUF, but does not import it.
ERROR: modpost: module tegra-drm-next uses symbol dma_buf_vunmap from
namespace DMA_BUF, but does not import it.
ERROR: modpost: module tegra-drm-next uses symbol dma_buf_put from
namespace DMA_BUF, but does not import it.
Following upstream commit 16b0314aa746 ("dma-buf: move dma-buf symbols
into the DMA_BUF module namespace"), it is now necessary to import the
DMA_BUF module namespace into the Tegra DRM driver to fix this.
Change-Id: I9dbd0e3c97b3ccf09982fdb72ef8a9a715d873de
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2621643
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
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