mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
Linux kernel has a default 32-bit segmentation boundary for any device that doesn't explicitly configure it. When nvgpu tries to allocate a larger memory > 4GB, iommu_dma_map_sg() function in the kernel will take this boundary into account and add an internal padding to the allocated IOVA space: |<---IOVA space 1--->|<---padding--->|<---IOVA space 2--->| When DMA reads/writes the memory using this discountinued IOVA space, it may end up with accessing the padding part, instead of the IOVA space 2. So this patch adds dma_set_seg_boundary() to nvgpu driver, by maximizing the segmentation boundary up to DMA_BIT_MASK to ensure a continued IOVA space. Bug 200558567 Change-Id: I979d56681dddca56f1b02fce83dc81147a6b0d82 Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2304150 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com> Reviewed-by: Puneet Saxena <puneets@nvidia.com> Reviewed-by: Chris Dragan <kdragan@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit