nvmap: Remove dma_buf_ops flag cache_sgt_mapping

The dma_buf_ops flag 'cache_sgt_mapping' has been removed in Linux
v6.16. Although NVMAP has its own caching and so it should be possible
to simply drop this flag, some tests are failing. For now add a test to
conftest to detect if this flag is present and update the NVMAP driver
accordingly.

Bug 5215421

Change-Id: I382d5c62fd550254d387abd1a21e5a1c5cda3a6e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3384177
(cherry picked from commit 326b31912bf1da7de0a5340826ec1fdaf084c11e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3461885
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2025-04-10 13:52:53 +01:00
committed by mobile promotions
parent e004561637
commit 50c387ecf9
3 changed files with 19 additions and 1 deletions

View File

@@ -489,8 +489,9 @@ static struct dma_buf_ops nvmap_dma_buf_ops = {
.mmap = nvmap_dmabuf_mmap, .mmap = nvmap_dmabuf_mmap,
.vmap = nvmap_dmabuf_vmap, .vmap = nvmap_dmabuf_vmap,
.vunmap = nvmap_dmabuf_vunmap, .vunmap = nvmap_dmabuf_vunmap,
#if defined(NV_DMA_BUF_OPS_HAS_CACHE_SGT_MAPPING)
.cache_sgt_mapping = true, .cache_sgt_mapping = true,
#endif
}; };
static char dmabuf_name[] = "nvmap_dmabuf"; static char dmabuf_name[] = "nvmap_dmabuf";

View File

@@ -123,6 +123,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_spi_alloc_host
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_tegra_core_dev_init_opp_table_common NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_tegra_core_dev_init_opp_table_common
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register
NV_CONFTEST_FUNCTION_COMPILE_TESTS += disk_check_media_change NV_CONFTEST_FUNCTION_COMPILE_TESTS += disk_check_media_change
NV_CONFTEST_FUNCTION_COMPILE_TESTS += dma_buf_ops_has_cache_sgt_mapping
NV_CONFTEST_FUNCTION_COMPILE_TESTS += dma_slave_config_struct_has_slave_id NV_CONFTEST_FUNCTION_COMPILE_TESTS += dma_slave_config_struct_has_slave_id
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_connector_helper_funcs_struct_mode_valid_has_const_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_connector_helper_funcs_struct_mode_valid_has_const_arg

View File

@@ -7131,6 +7131,22 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DISK_CHECK_MEDIA_CHANGE_PRESENT" "" "functions" compile_check_conftest "$CODE" "NV_DISK_CHECK_MEDIA_CHANGE_PRESENT" "" "functions"
;; ;;
dma_buf_ops_has_cache_sgt_mapping)
#
# Determine if the 'dma_buf_ops' structure has 'cache_sgt_mapping' member.
#
# In Linux v6.16, commit b72f66f22c0e ("dma-buf: drop caching of sg_tables")
# removed the 'cache_sgt_mapping' member from the 'dma_buf_ops' structure.
#
CODE="
#include <linux/dma-buf.h>
int conftest_dma_buf_ops_has_cache_sgt_mapping(void) {
return offsetof(struct dma_buf_ops, cache_sgt_mapping);
}"
compile_check_conftest "$CODE" "NV_DMA_BUF_OPS_HAS_CACHE_SGT_MAPPING" "" "types"
;;
dma_slave_config_struct_has_slave_id) dma_slave_config_struct_has_slave_id)
# #
# Determine if 'struct dma_slave_config' has the 'slave_id' member. # Determine if 'struct dma_slave_config' has the 'slave_id' member.