mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
nvsciipc: Add nvsciipc_ioctl_get_db_by_idx
- Added nvsciipc_ioctl_get_db_by_idx to retrieve the endpoint DB entry using index JIRA: NVIPC-2818 Change-Id: I5651cf29b11dad0ff505f5f497a896572b893e94 Signed-off-by: Suneel Kumar Pemmineti <spemmineti@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3297838 Reviewed-by: Simon Je <sje@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
Jon Hunter
parent
789e70d35e
commit
63a1d3e6e0
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2019-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -306,6 +306,37 @@ exit:
|
||||
}
|
||||
#endif /* DEBUG_AUTH_API */
|
||||
|
||||
static int nvsciipc_ioctl_get_db_by_idx(struct nvsciipc *ctx, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
struct nvsciipc_get_db_by_idx get_db;
|
||||
|
||||
if ((ctx->num_eps == 0) || (ctx->set_db_f != true)) {
|
||||
ERR("%s[%d] need to set endpoint database first\n", __func__,
|
||||
get_current()->pid);
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
if (copy_from_user(&get_db, (void __user *)arg, _IOC_SIZE(cmd))) {
|
||||
ERR("%s : copy_from_user failed\n", __func__);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (get_db.idx >= ctx->num_eps) {
|
||||
INFO("%s : no entry (0x%x)\n", __func__, get_db.idx);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
get_db.entry = *ctx->db[get_db.idx];
|
||||
|
||||
if (copy_to_user((void __user *)arg, &get_db, _IOC_SIZE(cmd))) {
|
||||
ERR("%s : copy_to_user failed\n", __func__);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nvsciipc_ioctl_get_db_by_name(struct nvsciipc *ctx, unsigned int cmd,
|
||||
unsigned long arg)
|
||||
{
|
||||
@@ -619,6 +650,9 @@ static long nvsciipc_dev_ioctl(struct file *filp, unsigned int cmd,
|
||||
case NVSCIIPC_IOCTL_GET_DB_BY_VUID:
|
||||
ret = nvsciipc_ioctl_get_db_by_vuid(ctx, cmd, arg);
|
||||
break;
|
||||
case NVSCIIPC_IOCTL_GET_DB_BY_IDX:
|
||||
ret = nvsciipc_ioctl_get_db_by_idx(ctx, cmd, arg);
|
||||
break;
|
||||
case NVSCIIPC_IOCTL_GET_DB_SIZE:
|
||||
ret = nvsciipc_ioctl_get_dbsize(ctx, cmd, arg);
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* SPDX-FileCopyrightText: Copyright (c) 2019-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __NVSCIIPC_IOCTL_H__
|
||||
@@ -56,6 +56,11 @@ struct nvsciipc_get_db_by_vuid {
|
||||
uint32_t idx;
|
||||
};
|
||||
|
||||
struct nvsciipc_get_db_by_idx {
|
||||
struct nvsciipc_config_entry entry;
|
||||
uint32_t idx;
|
||||
};
|
||||
|
||||
/* for userspace level test, debugging purpose only */
|
||||
struct nvsciipc_validate_auth_token {
|
||||
uint32_t auth_token;
|
||||
@@ -104,6 +109,9 @@ struct nvsciipc_map_vuid {
|
||||
#define NVSCIIPC_IOCTL_GET_VMID \
|
||||
_IOWR(NVSCIIPC_IOCTL_MAGIC, 8, uint32_t)
|
||||
|
||||
#define NVSCIIPC_IOCTL_NUMBER_MAX 8
|
||||
#define NVSCIIPC_IOCTL_GET_DB_BY_IDX \
|
||||
_IOWR(NVSCIIPC_IOCTL_MAGIC, 9, struct nvsciipc_get_db_by_idx)
|
||||
|
||||
#define NVSCIIPC_IOCTL_NUMBER_MAX 9
|
||||
|
||||
#endif /* __NVSCIIPC_IOCTL_H__ */
|
||||
|
||||
Reference in New Issue
Block a user