diff --git a/drivers/video/tegra/nvmap/Makefile.memory.configs b/drivers/video/tegra/nvmap/Makefile.memory.configs index 30e3ced0..be013f78 100644 --- a/drivers/video/tegra/nvmap/Makefile.memory.configs +++ b/drivers/video/tegra/nvmap/Makefile.memory.configs @@ -91,9 +91,6 @@ NVMAP_CONFIG_LOADABLE_MODULE := n # Config for enabling PROCRANK functionality NVMAP_CONFIG_PROCRANK := y -# Config for enabling VPR resize functionality -NVMAP_CONFIG_VPR_RESIZE := n - # Config for enabling few debugfs which would impact the NvMap performance # There are few debugfs which would impact NvMap performance. # Disable this when perf regression is observed. @@ -121,10 +118,6 @@ NVMAP_CONFIG_VIDMEM_CARVEOUT := n # Enable/Disable configs based upon the kernel version # Specify the values which are different from the default values -ifdef CONFIG_TEGRA_VPR -# For 4.9 -NVMAP_CONFIG_VPR_RESIZE := y -else # For 5.10+ NVMAP_CONFIG_LOADABLE_MODULE := y NVMAP_CONFIG_PROCRANK := n @@ -135,7 +128,6 @@ endif NVMAP_CONFIG_SCIIPC := y # For OOT build NVMAP_CONFIG_UPSTREAM_KERNEL := y -endif ifeq ($(CONFIG_DMABUF_DEFERRED_UNMAPPING),y) NVMAP_CONFIG_DMABUF_DEFERRED_UNMAPPING := y endif @@ -180,10 +172,6 @@ ifeq ($(NVMAP_CONFIG_SCIIPC),y) ccflags-y += -DNVMAP_CONFIG_SCIIPC endif #NVMAP_CONFIG_SCIIPC -ifeq ($(NVMAP_CONFIG_VPR_RESIZE),y) -ccflags-y += -DNVMAP_CONFIG_VPR_RESIZE -endif #NVMAP_CONFIG_VPR_RESIZE - ifeq ($(NVMAP_CONFIG_LOADABLE_MODULE),y) ccflags-y += -DNVMAP_LOADABLE_MODULE endif #NVMAP_CONFIG_LOADABLE_MODULE diff --git a/drivers/video/tegra/nvmap/nvmap_dev.c b/drivers/video/tegra/nvmap/nvmap_dev.c index ef04850e..f904c83b 100644 --- a/drivers/video/tegra/nvmap/nvmap_dev.c +++ b/drivers/video/tegra/nvmap/nvmap_dev.c @@ -390,7 +390,7 @@ static long nvmap_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) break; case NVMAP_IOC_VPR_FLOOR_SIZE: - err = nvmap_ioctl_vpr_floor_size(filp, uarg); + err = 0; break; case NVMAP_IOC_FREE: diff --git a/drivers/video/tegra/nvmap/nvmap_heap.c b/drivers/video/tegra/nvmap/nvmap_heap.c index f1aa252f..d2515eb0 100644 --- a/drivers/video/tegra/nvmap/nvmap_heap.c +++ b/drivers/video/tegra/nvmap/nvmap_heap.c @@ -125,22 +125,6 @@ static phys_addr_t nvmap_alloc_mem(struct nvmap_heap *h, size_t len, } } if (!dma_mapping_error(dev, pa)) { -#ifdef NVMAP_CONFIG_VPR_RESIZE - int ret; - - dev_dbg(dev, "Allocated addr (%pa) len(%zu)\n", - &pa, len); - if (!dma_is_coherent_dev(dev) && h->cma_dev) { - ret = nvmap_cache_maint_phys_range( - NVMAP_CACHE_OP_WB, pa, pa + len, - true, true); - if (!ret) - return pa; - - dev_err(dev, "cache WB on (%pa, %zu) failed\n", - &pa, len); - } -#endif dev_dbg(dev, "Allocated addr (%pa) len(%zu)\n", &pa, len); } @@ -223,15 +207,6 @@ static struct nvmap_heap_block *do_heap_alloc(struct nvmap_heap *heap, if (dma_mapping_error(dev, dev_base)) { dev_err(dev, "failed to alloc mem of size (%zu)\n", len); -#ifdef NVMAP_CONFIG_VPR_RESIZE - if (dma_is_coherent_dev(dev)) { - struct dma_coherent_stats stats; - - dma_get_coherent_stats(dev, &stats); - dev_err(dev, "used:%zu,curr_size:%zu max:%zu\n", - stats.used, stats.size, stats.max); - } -#endif goto fail_dma_alloc; } @@ -402,18 +377,7 @@ struct nvmap_heap *nvmap_heap_create(struct device *parent, h->dma_dev = co->dma_dev; if (co->cma_dev) { -#ifdef CONFIG_DMA_CMA -#ifdef NVMAP_CONFIG_VPR_RESIZE - struct dma_contiguous_stats stats; - - if (dma_get_contiguous_stats(co->cma_dev, &stats)) - goto fail; - - base = stats.base; - len = stats.size; - h->cma_dev = co->cma_dev; -#endif -#else +#ifndef CONFIG_DMA_CMA pr_err("invalid resize config for carveout %s\n", co->name); goto fail; diff --git a/drivers/video/tegra/nvmap/nvmap_init.c b/drivers/video/tegra/nvmap/nvmap_init.c index cf208024..0e6333f6 100644 --- a/drivers/video/tegra/nvmap/nvmap_init.c +++ b/drivers/video/tegra/nvmap/nvmap_init.c @@ -44,22 +44,6 @@ struct device __weak tegra_vpr_cma_dev; static struct platform_device *pdev; -#ifdef NVMAP_CONFIG_VPR_RESIZE -struct dma_resize_notifier_ops __weak vpr_dev_ops; - -static struct dma_declare_info generic_dma_info = { - .name = "generic", - .size = 0, - .notifier.ops = NULL, -}; - -static struct dma_declare_info vpr_dma_info = { - .name = "vpr", - .size = SZ_32M, - .notifier.ops = &vpr_dev_ops, -}; -#endif - const struct of_device_id nvmap_of_ids[] = { { .compatible = "nvidia,carveouts" }, { .compatible = "nvidia,carveouts-t18x" }, @@ -76,9 +60,6 @@ static struct nvmap_platform_carveout nvmap_carveouts[] = { .size = 0, .dma_dev = &tegra_generic_dev, .cma_dev = &tegra_generic_cma_dev, -#ifdef NVMAP_CONFIG_VPR_RESIZE - .dma_info = &generic_dma_info, -#endif .numa_node_id = 0, }, [1] = { @@ -88,9 +69,6 @@ static struct nvmap_platform_carveout nvmap_carveouts[] = { .size = 0, .dma_dev = &tegra_vpr_dev, .cma_dev = &tegra_vpr_cma_dev, -#ifdef NVMAP_CONFIG_VPR_RESIZE - .dma_info = &vpr_dma_info, -#endif .enable_static_dma_map = true, .numa_node_id = 0, }, @@ -760,16 +738,6 @@ static int __init nvmap_co_device_init(struct reserved_mem *rmem, pr_err("%s :dma coherent mem declare fail %pa,%zu,err:%d\n", co->name, &co->base, co->size, err); } else { -#ifdef NVMAP_CONFIG_VPR_RESIZE - - co->dma_info->cma_dev = co->cma_dev; - err = dma_declare_coherent_resizable_cma_memory( - co->dma_dev, co->dma_info); - if (err) - pr_err("%s coherent memory declaration failed\n", - co->name); - else -#endif co->init_done = true; } return err; diff --git a/drivers/video/tegra/nvmap/nvmap_ioctl.c b/drivers/video/tegra/nvmap/nvmap_ioctl.c index 352f5fde..234d92e7 100644 --- a/drivers/video/tegra/nvmap/nvmap_ioctl.c +++ b/drivers/video/tegra/nvmap/nvmap_ioctl.c @@ -294,19 +294,6 @@ int nvmap_ioctl_alloc_ivm(struct file *filp, void __user *arg) return err; } -int nvmap_ioctl_vpr_floor_size(struct file *filp, void __user *arg) -{ - int err=0; - u32 floor_size; - - if (copy_from_user(&floor_size, arg, sizeof(floor_size))) - return -EFAULT; -#ifdef NVMAP_CONFIG_VPR_RESIZE - err = dma_set_resizable_heap_floor_size(&tegra_vpr_dev, floor_size); -#endif - return err; -} - int nvmap_ioctl_create(struct file *filp, unsigned int cmd, void __user *arg) { struct nvmap_create_handle op; diff --git a/drivers/video/tegra/nvmap/nvmap_ioctl.h b/drivers/video/tegra/nvmap/nvmap_ioctl.h index 3aaa291e..a42bfd69 100644 --- a/drivers/video/tegra/nvmap/nvmap_ioctl.h +++ b/drivers/video/tegra/nvmap/nvmap_ioctl.h @@ -25,8 +25,6 @@ int nvmap_ioctl_alloc_kind(struct file *filp, void __user *arg); int nvmap_ioctl_alloc_ivm(struct file *filp, void __user *arg); -int nvmap_ioctl_vpr_floor_size(struct file *filp, void __user *arg); - int nvmap_ioctl_free(struct file *filp, unsigned long arg); int nvmap_ioctl_create(struct file *filp, unsigned int cmd, void __user *arg); diff --git a/include/linux/nvmap.h b/include/linux/nvmap.h index fdff8e60..3ae4ed05 100644 --- a/include/linux/nvmap.h +++ b/include/linux/nvmap.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2009-2023, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2009-2024, NVIDIA CORPORATION. All rights reserved. * * structure declarations for nvmem and nvmap user-space ioctls */ @@ -84,7 +84,6 @@ struct nvmap_platform_carveout { bool resize; struct device *dma_dev; struct device dev; - struct dma_declare_info *dma_info; bool is_ivm; unsigned int peer; unsigned int vmid; diff --git a/include/linux/platform/tegra/common.h b/include/linux/platform/tegra/common.h index 1a5016c3..22a2202e 100644 --- a/include/linux/platform/tegra/common.h +++ b/include/linux/platform/tegra/common.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #ifndef __MACH_TEGRA_COMMON_H @@ -29,9 +29,6 @@ extern int tegra_with_secure_firmware; extern struct device tegra_generic_dev; extern struct device tegra_vpr_dev; -#ifdef CONFIG_TEGRA_VPR -extern struct dma_resize_notifier_ops vpr_dev_ops; -#endif u32 tegra_get_bct_strapping(void); u32 tegra_get_fuse_opt_subrevision(void);