mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
video: tegra: nvmap: Add DT based API disabling support
There are debug/duplicate APIs like NvRmMemGetIVCId, NvRmMemHandleFromIVCId, NvRmMemWrite etc. which don't have corresponding requirements in DriveOS 7.0 Linux NSR. We have taken sign-off from the stakeholders to confirm that they are not using these APIs in T264 Linux Prod NSR variant. But some of them are using these APIs in dev-nsr and did not agree to remove it from dev-nsr, L4T, HOS etc. Hence we need to make sure that they do not accidentally start using these APIs. Hence add following DT based disabling support. - Add disable-debug-support property in tegra-carveouts DT node in T264 prod nsr dts. - Parse this DT node in nvmap and if the above property is present then BUG_ON in the ioctl functions corresponding to these APIs. Bug 4980348 Change-Id: Icdd5aadf3197d0649b61d285f433fa65ea69e806 Signed-off-by: Ketan Patil <ketanp@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3298507 Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com> Reviewed-by: Ashish Mhetre <amhetre@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com>
This commit is contained in:
@@ -549,6 +549,23 @@ exit:
|
|||||||
return memory_available;
|
return memory_available;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read disable-debug-support property from tegra-carveouts DT node.
|
||||||
|
* If the property is present then don't support any extra APIs other than
|
||||||
|
* the APIs mentioned in ICD, by doing BUG_ON in the corresponding ioctls.
|
||||||
|
* So it is necessary to be present in the DT of the respective builds
|
||||||
|
* (e.g. Prod NSR Build).
|
||||||
|
*/
|
||||||
|
static void nvmap_support_debug_apis(struct platform_device *pdev, struct nvmap_device *dev)
|
||||||
|
{
|
||||||
|
struct device_node *np = pdev->dev.of_node;
|
||||||
|
|
||||||
|
if (of_property_read_bool(np, "disable-debug-support"))
|
||||||
|
dev->support_debug_features = 0;
|
||||||
|
else
|
||||||
|
dev->support_debug_features = 1;
|
||||||
|
}
|
||||||
|
|
||||||
int __init nvmap_probe(struct platform_device *pdev)
|
int __init nvmap_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct nvmap_platform_data *plat;
|
struct nvmap_platform_data *plat;
|
||||||
@@ -653,6 +670,8 @@ int __init nvmap_probe(struct platform_device *pdev)
|
|||||||
dev->dev_user.name);
|
dev->dev_user.name);
|
||||||
goto fail_sci_ipc;
|
goto fail_sci_ipc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void)nvmap_support_debug_apis(pdev, dev);
|
||||||
goto finish;
|
goto finish;
|
||||||
fail_sci_ipc:
|
fail_sci_ipc:
|
||||||
nvmap_sci_ipc_exit();
|
nvmap_sci_ipc_exit();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
/* SPDX-FileCopyrightText: Copyright (c) 2009-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
|
/* SPDX-FileCopyrightText: Copyright (c) 2009-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
|
||||||
|
|
||||||
#ifndef __NVMAP_DEV_H
|
#ifndef __NVMAP_DEV_H
|
||||||
#define __NVMAP_DEV_H
|
#define __NVMAP_DEV_H
|
||||||
@@ -109,6 +109,7 @@ struct nvmap_device {
|
|||||||
struct rb_root device_names;
|
struct rb_root device_names;
|
||||||
#endif /* NVMAP_CONFIG_DEBUG_MAPS */
|
#endif /* NVMAP_CONFIG_DEBUG_MAPS */
|
||||||
u64 serial_id_counter; /* This is global counter common across different client processes */
|
u64 serial_id_counter; /* This is global counter common across different client processes */
|
||||||
|
bool support_debug_features;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NVMAP_TAG_TRACE(x, ...) \
|
#define NVMAP_TAG_TRACE(x, ...) \
|
||||||
|
|||||||
@@ -658,6 +658,8 @@ int nvmap_ioctl_get_ivcid(struct file *filp, void __user *arg)
|
|||||||
struct nvmap_create_handle op;
|
struct nvmap_create_handle op;
|
||||||
struct nvmap_handle *h = NULL;
|
struct nvmap_handle *h = NULL;
|
||||||
|
|
||||||
|
BUG_ON(nvmap_dev->support_debug_features == 0);
|
||||||
|
|
||||||
if (copy_from_user(&op, arg, sizeof(op)))
|
if (copy_from_user(&op, arg, sizeof(op)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
@@ -712,6 +714,8 @@ int nvmap_ioctl_create_from_ivc(struct file *filp, void __user *arg)
|
|||||||
unsigned int peer;
|
unsigned int peer;
|
||||||
struct nvmap_heap_block *block = NULL;
|
struct nvmap_heap_block *block = NULL;
|
||||||
|
|
||||||
|
BUG_ON(nvmap_dev->support_debug_features == 0);
|
||||||
|
|
||||||
/* First create a new handle and then fake carveout allocation */
|
/* First create a new handle and then fake carveout allocation */
|
||||||
if (copy_from_user(&op, arg, sizeof(op)))
|
if (copy_from_user(&op, arg, sizeof(op)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|||||||
Reference in New Issue
Block a user