diff --git a/drivers/video/tegra/nvmap/Makefile b/drivers/video/tegra/nvmap/Makefile index d27e44fe..100c97c4 100644 --- a/drivers/video/tegra/nvmap/Makefile +++ b/drivers/video/tegra/nvmap/Makefile @@ -7,6 +7,12 @@ subdir-ccflags-y += -Werror include $(srctree.nvidia-oot)/drivers/video/tegra/nvmap/Makefile.memory.configs +# If the kernel enables CONFIG_GENERIC_IOREMAP, +# then pass this flag for building NVMAP. +ifdef CONFIG_GENERIC_IOREMAP +ccflags-y += -DCONFIG_GENERIC_IOREMAP +endif + ifeq ($(NVMAP_CONFIG), y) # Build NvMap only when NVMAP_CONFIG is set to y nvmap-y := nvmap_core.o \ diff --git a/drivers/video/tegra/nvmap/nvmap_cache.c b/drivers/video/tegra/nvmap/nvmap_cache.c index aa56b61e..937f508c 100644 --- a/drivers/video/tegra/nvmap/nvmap_cache.c +++ b/drivers/video/tegra/nvmap/nvmap_cache.c @@ -147,7 +147,7 @@ int nvmap_cache_maint_phys_range(unsigned int op, phys_addr_t pstart, phys_addr_t next = (loop + PAGE_SIZE) & PAGE_MASK; void *base; next = min(next, pend); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if defined(CONFIG_GENERIC_IOREMAP) io_addr = ioremap_prot(loop, PAGE_SIZE, pgprot_val(PAGE_KERNEL)); #else io_addr = __ioremap(loop, PAGE_SIZE, PG_PROT_KERNEL); diff --git a/drivers/video/tegra/nvmap/nvmap_core.c b/drivers/video/tegra/nvmap/nvmap_core.c index e54e429f..c91d26a6 100644 --- a/drivers/video/tegra/nvmap/nvmap_core.c +++ b/drivers/video/tegra/nvmap/nvmap_core.c @@ -200,7 +200,7 @@ void *__nvmap_mmap(struct nvmap_handle *h) vaddr = vmap(pages, nr_pages, VM_MAP, prot); } else { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if defined(CONFIG_GENERIC_IOREMAP) vaddr = ioremap_prot(h->carveout->base, adj_size, pgprot_val(prot)); #else vaddr = (__force void *)__ioremap(h->carveout->base, adj_size,