Commit Graph

16 Commits

Author SHA1 Message Date
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
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
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
Ashish Mhetre
3fdc3313ae drm/fusa-capture: Zero out dma_buf_map struct
UBSAN is reporting "invalid-load include/linux/dma-buf-map.h".
This is because non-boolean value loaded to bool variable is_iomem
of dma_buf_map struct. Zeroing out this struct at declaration time
make sure that there is no garbage value which will be non-boolean.

Bug 3994163

Change-Id: Ia3f0c738fa248d3096d945f08813b7bdbad233f7
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2869258
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-04-03 09:18:59 +00:00
Jon Hunter
572d5395cc drm/tegra: Fix build for Linux v6.3
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>
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
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
Thierry Reding
c8eb0cd6b2 drm/tegra: gem: Do not try to dereference ERR_PTR()
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
2023-04-03 09:18:59 +00:00
Jon Hunter
c88d7b49ed drm/tegra: Fix build for Linux v5.18
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
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
a6ff2bcf9e drm/tegra: Fix build for Linux-v5.16-rc1
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
2023-04-03 09:18:59 +00:00
Thierry Reding
1da27ee38f drm/tegra: Implement buffer object cache
This cache is used to avoid mapping and unmapping buffer objects
unnecessarily. Mappings are cached per client and stay hot until
the buffer object is destroyed.

Bug 200768479

Signed-off-by: Thierry Reding <treding@nvidia.com>
Change-Id: Ia2efe2b77b5043b665bae403d9eba4698e6a5228
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2596399
(cherry picked from commit d23156d94fa9499256e8082250e3bc02559f9c8d)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2620152
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@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
Thierry Reding
756aa327f1 drm/tegra: Implement correct DMA-BUF semantics
DMA-BUF requires that each device that accesses a DMA-BUF attaches to it
separately. To do so the host1x_bo_pin() and host1x_bo_unpin() functions
need to be reimplemented so that they can return a mapping, which either
represents an attachment or a map of the driver's own GEM object.

Bug 200768479

Signed-off-by: Thierry Reding <treding@nvidia.com>
Change-Id: Ia380b7dcc371ce47f5f35d44a60fbd6b4ab9d636
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2596398
(cherry picked from commit 28960586000fca025689edfd45645ab28e497bca)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2620137
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@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
636389b442 drm/tegra: Update to support v5.11
For Linux v5.11, there are a some changes to the DRM APIs that require
updates to the Tegra DRM driver. These are:
1. Commit 6619ccf1bb1d ("dma-buf: Use struct dma_buf_map in
   dma_buf_vmap() interfaces") changes to the dma_buf_vmap() and
   dma_buf_vunmap() APIs to pass a new parameter of type
   'struct dma_buf_map'.
2. Commit 351f950db4ab ("drm/atomic: Pass the full state to CRTC atomic
   enable/disable) and commit f6ebe9f9c923 ("drm/atomic: Pass the full
   state to CRTC atomic begin and flush") changes the structure type
   passed to APIs referenced by the commits.

Finally, commit dd311c6fe8af ("drm/tegra: Introduce GEM object
functions") update the Tegra DRM driver to use GEM object functions.

Update the Tegra DRM driver to support these updated APIs for
Linux v5.11+ and align with the latest changes.

Bug 200687525

Change-Id: I7b11c3f4c4f03afe23563a3de12170c7543c28fe
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2469985
Tested-by: mobile promotions <svcmobile_promotions@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
d088bfa37d drm/tegra: Update Tegra DRM to align with v5.10
Update the Tegra DRM driver to Linux v5.10 with the 'Host1x/Tegra UAPI'
series [0] applied. This driver is built as an external module for
testing and development with upstream Linux kernels.

[0] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=215770

Bug 3205478

Change-Id: I901aa45779e56cbbef6c58fd9d3bb50ea6bfd472
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2460064
Reviewed-by: Shanker Donthineni <sdonthineni@nvidia.com>
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
b8c2d943ed drm/tegra: Add upstream tegra-drm driver
Add the upstream tegra-drm driver with the 'Host1x/Tegra UAPI' series
[0] applied. This driver will be built as an external module for testing
and development with upstream Linux kernels.

The following modifications have been made to the series posted upstream
1. Update the Makefile to always build the driver as a module
2. Always enable the tegra_drm_ioctl_xxx in the tegra_drm_ioctls and
   remove the dependency on CONFIG_DRM_TEGRA_STAGING.
3. Rename the include/uapi/drm/tegra_drm.h to
   include/uapi/drm/tegra_drm_next.h to avoid conflicts with upstream
   headers when building as an external module.
5. Rename the module that is built to be tegra-drm-next.ko instead of
   tegra-drm.ko to avoid any depmod conflicts with the upstream driver.

[0] https://patchwork.ozlabs.org/project/linux-tegra/list/?series=215770

Bug 3156385

Change-Id: I19206f989325c9c6ff3c2b9301d964140d52234f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2435802
Tested-by: mobile promotions <svcmobile_promotions@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