nvmap: Fix build for Linux v6.14

In Linux v6.14, the 'page_list' argument was dropped from the
__alloc_pages_bulk() function. Add a test to conftest to check for this
and update the NVMAP driver accordlingly to fix the build.

Jira LINQPJ14-6

Change-Id: Id3513890a9d948cb42abf7449d9fb3aa95edcf96
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3297065
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2025-01-14 12:27:44 +00:00
parent ab4ebfc4f7
commit cc09c0267d
3 changed files with 25 additions and 0 deletions

View File

@@ -172,8 +172,13 @@ static int handle_page_alloc(struct nvmap_client *client,
if (page_index < nr_page) {
int nid = h->numa_id == NUMA_NO_NODE ? numa_mem_id() : h->numa_id;
#if defined(NV__ALLOC_PAGES_BULK_HAS_NO_PAGE_LIST_ARG)
allocated = __alloc_pages_bulk(gfp, nid, NULL,
nr_page, pages);
#else
allocated = __alloc_pages_bulk(gfp, nid, NULL,
nr_page, NULL, pages);
#endif
}
for (i = allocated; i < nr_page; i++) {
pages[i] = nvmap_alloc_pages_exact(gfp, PAGE_SIZE,

View File

@@ -89,6 +89,7 @@ endef
#
NV_CONFTEST_FUNCTION_COMPILE_TESTS += __alloc_disk_node_has_lkclass_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += __alloc_pages_bulk_has_no_page_list_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += __assign_str_has_no_src_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += aperture_remove_all_conflicting_devices
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bin_attribute_struct_mmap_has_const_bin_attribute_arg

View File

@@ -6534,6 +6534,25 @@ compile_test() {
compile_check_conftest "$CODE" "NV___ALLOC_DISK_NODE_HAS_LKCLASS_ARG" "" "types"
;;
__alloc_pages_bulk_has_no_page_list_arg)
#
# Determine if the function __alloc_pages_bulk() has an 'page_list'
# argument.
#
# In Linux v6.14, commit c8b979530f27 ("mm: alloc_pages_bulk_noprof:
# drop page_list argument") removes the 'page_list' argument from
# __alloc_pages_bulk().
#
CODE="
#include <linux/gfp.h>
unsigned long confest_alloc_pages_bulk(gfp_t gfp, int nid, int nr_pages,
struct page **page_array) {
return __alloc_pages_bulk(gfp, nid, NULL, nr_pages, page_array);
}"
compile_check_conftest "$CODE" "NV__ALLOC_PAGES_BULK_HAS_NO_PAGE_LIST_ARG" "" "types" $1.log
;;
aperture_remove_all_conflicting_devices)
#
# Determine if the function aperture_remove_all_conflicting_devices()