video: tegra: nvmap: Remove VPR resize code

Remove VPR resize code from nvmap as VPR resize support is deprecated
from K5.10+.

Bug 4479027

Change-Id: I93daecaa86ebffb2aee09836cd3faa5211e574a0
Signed-off-by: Yash Bhatt <ybhatt@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3112223
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
This commit is contained in:
Yash Bhatt
2024-04-09 14:19:20 +00:00
committed by mobile promotions
parent 6200c05e7d
commit 1eb5fc3ad7
8 changed files with 4 additions and 103 deletions

View File

@@ -91,9 +91,6 @@ NVMAP_CONFIG_LOADABLE_MODULE := n
# Config for enabling PROCRANK functionality # Config for enabling PROCRANK functionality
NVMAP_CONFIG_PROCRANK := y 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 # Config for enabling few debugfs which would impact the NvMap performance
# There are few debugfs which would impact NvMap performance. # There are few debugfs which would impact NvMap performance.
# Disable this when perf regression is observed. # Disable this when perf regression is observed.
@@ -121,10 +118,6 @@ NVMAP_CONFIG_VIDMEM_CARVEOUT := n
# Enable/Disable configs based upon the kernel version # Enable/Disable configs based upon the kernel version
# Specify the values which are different from the default values # 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+ # For 5.10+
NVMAP_CONFIG_LOADABLE_MODULE := y NVMAP_CONFIG_LOADABLE_MODULE := y
NVMAP_CONFIG_PROCRANK := n NVMAP_CONFIG_PROCRANK := n
@@ -135,7 +128,6 @@ endif
NVMAP_CONFIG_SCIIPC := y NVMAP_CONFIG_SCIIPC := y
# For OOT build # For OOT build
NVMAP_CONFIG_UPSTREAM_KERNEL := y NVMAP_CONFIG_UPSTREAM_KERNEL := y
endif
ifeq ($(CONFIG_DMABUF_DEFERRED_UNMAPPING),y) ifeq ($(CONFIG_DMABUF_DEFERRED_UNMAPPING),y)
NVMAP_CONFIG_DMABUF_DEFERRED_UNMAPPING := y NVMAP_CONFIG_DMABUF_DEFERRED_UNMAPPING := y
endif endif
@@ -180,10 +172,6 @@ ifeq ($(NVMAP_CONFIG_SCIIPC),y)
ccflags-y += -DNVMAP_CONFIG_SCIIPC ccflags-y += -DNVMAP_CONFIG_SCIIPC
endif #NVMAP_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) ifeq ($(NVMAP_CONFIG_LOADABLE_MODULE),y)
ccflags-y += -DNVMAP_LOADABLE_MODULE ccflags-y += -DNVMAP_LOADABLE_MODULE
endif #NVMAP_CONFIG_LOADABLE_MODULE endif #NVMAP_CONFIG_LOADABLE_MODULE

View File

@@ -390,7 +390,7 @@ static long nvmap_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
break; break;
case NVMAP_IOC_VPR_FLOOR_SIZE: case NVMAP_IOC_VPR_FLOOR_SIZE:
err = nvmap_ioctl_vpr_floor_size(filp, uarg); err = 0;
break; break;
case NVMAP_IOC_FREE: case NVMAP_IOC_FREE:

View File

@@ -125,22 +125,6 @@ static phys_addr_t nvmap_alloc_mem(struct nvmap_heap *h, size_t len,
} }
} }
if (!dma_mapping_error(dev, pa)) { 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", dev_dbg(dev, "Allocated addr (%pa) len(%zu)\n",
&pa, len); &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)) { if (dma_mapping_error(dev, dev_base)) {
dev_err(dev, "failed to alloc mem of size (%zu)\n", dev_err(dev, "failed to alloc mem of size (%zu)\n",
len); 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; goto fail_dma_alloc;
} }
@@ -402,18 +377,7 @@ struct nvmap_heap *nvmap_heap_create(struct device *parent,
h->dma_dev = co->dma_dev; h->dma_dev = co->dma_dev;
if (co->cma_dev) { if (co->cma_dev) {
#ifdef CONFIG_DMA_CMA #ifndef 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
pr_err("invalid resize config for carveout %s\n", pr_err("invalid resize config for carveout %s\n",
co->name); co->name);
goto fail; goto fail;

View File

@@ -44,22 +44,6 @@ struct device __weak tegra_vpr_cma_dev;
static struct platform_device *pdev; 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[] = { const struct of_device_id nvmap_of_ids[] = {
{ .compatible = "nvidia,carveouts" }, { .compatible = "nvidia,carveouts" },
{ .compatible = "nvidia,carveouts-t18x" }, { .compatible = "nvidia,carveouts-t18x" },
@@ -76,9 +60,6 @@ static struct nvmap_platform_carveout nvmap_carveouts[] = {
.size = 0, .size = 0,
.dma_dev = &tegra_generic_dev, .dma_dev = &tegra_generic_dev,
.cma_dev = &tegra_generic_cma_dev, .cma_dev = &tegra_generic_cma_dev,
#ifdef NVMAP_CONFIG_VPR_RESIZE
.dma_info = &generic_dma_info,
#endif
.numa_node_id = 0, .numa_node_id = 0,
}, },
[1] = { [1] = {
@@ -88,9 +69,6 @@ static struct nvmap_platform_carveout nvmap_carveouts[] = {
.size = 0, .size = 0,
.dma_dev = &tegra_vpr_dev, .dma_dev = &tegra_vpr_dev,
.cma_dev = &tegra_vpr_cma_dev, .cma_dev = &tegra_vpr_cma_dev,
#ifdef NVMAP_CONFIG_VPR_RESIZE
.dma_info = &vpr_dma_info,
#endif
.enable_static_dma_map = true, .enable_static_dma_map = true,
.numa_node_id = 0, .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", pr_err("%s :dma coherent mem declare fail %pa,%zu,err:%d\n",
co->name, &co->base, co->size, err); co->name, &co->base, co->size, err);
} else { } 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; co->init_done = true;
} }
return err; return err;

View File

@@ -294,19 +294,6 @@ int nvmap_ioctl_alloc_ivm(struct file *filp, void __user *arg)
return err; 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) int nvmap_ioctl_create(struct file *filp, unsigned int cmd, void __user *arg)
{ {
struct nvmap_create_handle op; struct nvmap_create_handle op;

View File

@@ -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_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_free(struct file *filp, unsigned long arg);
int nvmap_ioctl_create(struct file *filp, unsigned int cmd, void __user *arg); int nvmap_ioctl_create(struct file *filp, unsigned int cmd, void __user *arg);

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* 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 * structure declarations for nvmem and nvmap user-space ioctls
*/ */
@@ -84,7 +84,6 @@ struct nvmap_platform_carveout {
bool resize; bool resize;
struct device *dma_dev; struct device *dma_dev;
struct device dev; struct device dev;
struct dma_declare_info *dma_info;
bool is_ivm; bool is_ivm;
unsigned int peer; unsigned int peer;
unsigned int vmid; unsigned int vmid;

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* 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 #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_generic_dev;
extern struct device tegra_vpr_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_bct_strapping(void);
u32 tegra_get_fuse_opt_subrevision(void); u32 tegra_get_fuse_opt_subrevision(void);