video: tegra: nvmap: Cleanup NVMAP_IOC_SET_TAG_LABEL ioctl

NvRmMemSetAllocationTagLabel is not being used by any of clients. Also,
this API does not have any SHR or JAMA requirement. Hence we are
removing support for this API on linux to have a cleaner and uniform
ICD. Remove the corresponding ioctl code from nvmap.

Bug 4980808

Change-Id: I74676e07b2c617ad6554b4538ce27ab52176e5b9
Signed-off-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3288404
Reviewed-by: N V S Abhishek <nabhishek@nvidia.com>
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Ketan Patil
2025-01-22 12:56:20 +00:00
committed by Jon Hunter
parent 3aa403fa33
commit cd0e863f07
5 changed files with 4 additions and 126 deletions

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* SPDX-FileCopyrightText: Copyright (c) 2011-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2011-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* User-space interface to nvmap
*/
@@ -443,10 +443,6 @@ static long nvmap_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
"Use the pair NVMAP_IOC_GET_FD/FROM_FD.\n");
break;
case NVMAP_IOC_SET_TAG_LABEL:
err = nvmap_ioctl_set_tag_label(filp, uarg);
break;
case NVMAP_IOC_GET_AVAILABLE_HEAPS:
err = nvmap_ioctl_get_available_heaps(filp, uarg);
break;

View File

@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* SPDX-FileCopyrightText: Copyright (c) 2010-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
/* SPDX-FileCopyrightText: Copyright (c) 2010-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
#ifndef __NVMAP_DEV_INT_H
#define __NVMAP_DEV_INT_H
@@ -37,8 +37,6 @@ int nvmap_ioctl_rw_handle(struct file *filp, int is_read, void __user *arg,
int nvmap_ioctl_gup_test(struct file *filp, void __user *arg);
int nvmap_ioctl_set_tag_label(struct file *filp, void __user *arg);
int nvmap_ioctl_get_available_heaps(struct file *filp, void __user *arg);
int nvmap_ioctl_get_handle_parameters(struct file *filp, void __user *arg);
@@ -54,11 +52,4 @@ int nvmap_ioctl_query_heap_params_numa(struct file *filp, void __user *arg);
int nvmap_ioctl_dup_handle(struct file *filp, void __user *arg);
int nvmap_ioctl_get_fd_from_list(struct file *filp, void __user *arg);
int nvmap_define_tag(struct nvmap_device *dev, u32 tag,
const char __user *name, u32 len);
int nvmap_remove_tag(struct nvmap_device *dev, u32 tag);
unsigned int nvmap_get_tag_maxlen(void);
#endif /* __NVMAP_DEV_INT_H */

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* SPDX-FileCopyrightText: Copyright (c) 2011-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (c) 2011-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* User-space interface to nvmap
*/
@@ -865,29 +865,6 @@ exit:
return err;
}
int nvmap_ioctl_set_tag_label(struct file *filp, void __user *arg)
{
struct nvmap_set_tag_label op;
struct nvmap_device *dev = nvmap_dev;
int err;
unsigned int nvmap_tag_label_maxlen = 0;
if (copy_from_user(&op, arg, sizeof(op)))
return -EFAULT;
nvmap_tag_label_maxlen = nvmap_get_tag_maxlen();
if (op.len > nvmap_tag_label_maxlen)
op.len = nvmap_tag_label_maxlen;
if (op.len)
err = nvmap_define_tag(dev, op.tag,
(const char __user *)op.addr, op.len);
else
err = nvmap_remove_tag(dev, op.tag);
return err;
}
int nvmap_ioctl_get_available_heaps(struct file *filp, void __user *arg)
{
struct nvmap_available_heaps op;

View File

@@ -21,11 +21,6 @@ struct nvmap_tag_entry {
u32 tag;
};
unsigned int nvmap_get_tag_maxlen(void)
{
return 63 - sizeof(struct nvmap_tag_entry);
}
static struct nvmap_tag_entry *nvmap_search_tag_entry(struct rb_root *root, u32 tag)
{
struct rb_node *node = root->rb_node; /* top of the tree */
@@ -44,77 +39,6 @@ static struct nvmap_tag_entry *nvmap_search_tag_entry(struct rb_root *root, u32
return NULL;
}
static void nvmap_insert_tag_entry(struct rb_root *root,
struct nvmap_tag_entry *new)
{
struct rb_node **link = &root->rb_node;
struct rb_node *parent = NULL;
struct nvmap_tag_entry *entry;
u32 tag = new->tag;
/* Go to the bottom of the tree */
while (*link) {
parent = *link;
entry = rb_entry(parent, struct nvmap_tag_entry, node);
if (entry->tag > tag)
link = &parent->rb_left;
else
link = &parent->rb_right;
}
/* Put the new node there */
rb_link_node(&new->node, parent, link);
rb_insert_color(&new->node, root);
}
int nvmap_define_tag(struct nvmap_device *dev, u32 tag,
const char __user *name, u32 len)
{
struct nvmap_tag_entry *new;
struct nvmap_tag_entry *old;
new = kzalloc(sizeof(struct nvmap_tag_entry) + len + 1, GFP_KERNEL);
if (new == NULL)
return -ENOMEM;
if (copy_from_user(new + 1, name, len)) {
kfree(new);
return -EFAULT;
}
new->tag = tag;
mutex_lock(&dev->tags_lock);
old = nvmap_search_tag_entry(&dev->tags, tag);
if (old) {
rb_replace_node(&old->node, &new->node, &dev->tags);
kfree(old);
} else {
nvmap_insert_tag_entry(&dev->tags, new);
}
mutex_unlock(&dev->tags_lock);
return 0;
}
int nvmap_remove_tag(struct nvmap_device *dev, u32 tag)
{
struct nvmap_tag_entry *old;
mutex_lock(&dev->tags_lock);
old = nvmap_search_tag_entry(&dev->tags, tag);
if (old){
rb_erase(&old->node, &dev->tags);
kfree(old);
}
mutex_unlock(&dev->tags_lock);
return 0;
}
/* must hold tag_lock */
char *__nvmap_tag_name(struct nvmap_device *dev, u32 tag)
{

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2009-2024, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2009-2025, NVIDIA CORPORATION. All rights reserved.
*
* structure declarations for nvmem and nvmap user-space ioctls
*/
@@ -194,13 +194,6 @@ struct nvmap_debugfs_handles_entry {
__u64 mapped_size;
};
struct nvmap_set_tag_label {
__u32 tag;
__u32 len; /* in: label length
out: number of characters copied */
__u64 addr; /* in: pointer to label or NULL to remove */
};
struct nvmap_available_heaps {
__u64 heaps; /* heaps bitmask */
};
@@ -327,9 +320,6 @@ struct nvmap_fd_for_range_from_list {
#define NVMAP_IOC_GUP_TEST _IOWR(NVMAP_IOC_MAGIC, 23, struct nvmap_gup_test)
/* Define a label for allocation tag */
#define NVMAP_IOC_SET_TAG_LABEL _IOW(NVMAP_IOC_MAGIC, 24, struct nvmap_set_tag_label)
#define NVMAP_IOC_GET_AVAILABLE_HEAPS \
_IOR(NVMAP_IOC_MAGIC, 25, struct nvmap_available_heaps)