From a530fa20f87722e4c8d5bb5686a84a7886a3a475 Mon Sep 17 00:00:00 2001 From: Ketan Patil Date: Fri, 17 Oct 2025 16:27:54 +0000 Subject: [PATCH] video: tegra: nvmap: Define nth_page In Linux v6.18, commit 84efbefa26df ("mm: remove nth_page()") removes the nth_page macro and this breaks the build for NVMAP. Define the nth_page macro if it is not defined in the kernel to fix the build. Bug 5566555 Bug 5215421 Change-Id: Iaa6bcd2204e4c1ab59516bb7353a71f3ec6e19c4 Signed-off-by: Jon Hunter Signed-off-by: Ketan Patil Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3449760 (cherry picked from commit c0db792d335d8525821d3aac16e64506e84bf4c2) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3475136 GVS: buildbot_gerritrpt Reviewed-by: Brad Griffis --- drivers/video/tegra/nvmap/nvmap_alloc.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/video/tegra/nvmap/nvmap_alloc.h b/drivers/video/tegra/nvmap/nvmap_alloc.h index cec9f5ed..0ce0449a 100644 --- a/drivers/video/tegra/nvmap/nvmap_alloc.h +++ b/drivers/video/tegra/nvmap/nvmap_alloc.h @@ -22,6 +22,14 @@ #define NVMAP_IVM_ALIGNMENT (SZ_32K) #define NVMAP_IVM_INVALID_PEER (-1) +#ifndef nth_page +#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) +#define nth_page(page, n) pfn_to_page(page_to_pfn((page)) + (n)) +#else +#define nth_page(page, n) ((page) + (n)) +#endif /* CONFIG_SPARSEMEM && !CONFIG_SPARSEMEM_VMEMMAP */ +#endif /* nth_page */ + struct nvmap_heap; struct debugfs_info; struct nvmap_carveout_node;