From 45992044df63a8201d92ff1dea0d034036a39590 Mon Sep 17 00:00:00 2001 From: Joshua Cha Date: Wed, 19 Apr 2023 20:50:38 +0900 Subject: [PATCH] misc: nvsciipc: add error log to OOT driver Add log for DB update. Add log for endpoint entry lookup failure and DB access failure. Bug 4052130 Bug 4074668 Bug 4074515 Change-Id: I8c8fb29fd7a4c4abd14b0c5d6d65f9a36d7a3d85 Signed-off-by: Joshua Cha Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2890654 Reviewed-by: svcacv Reviewed-by: Kurt Yi Reviewed-by: Priyanshu Sharma Tested-by: Priyanshu Sharma GVS: Gerrit_Virtual_Submit (cherry picked from commit b3dde6d13dd2ae774ab6227a88b6539f39dbb010) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2890779 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/misc/nvsciipc/nvsciipc.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/misc/nvsciipc/nvsciipc.c b/drivers/misc/nvsciipc/nvsciipc.c index 2304685c..3c9daff8 100644 --- a/drivers/misc/nvsciipc/nvsciipc.c +++ b/drivers/misc/nvsciipc/nvsciipc.c @@ -226,7 +226,8 @@ static int nvsciipc_ioctl_validate_auth_token(struct nvsciipc *ctx, int32_t ret = 0; if ((ctx->num_eps == 0) || (ctx->set_db_f != true)) { - ERR("need to set endpoint database first\n"); + ERR("%s[%d] need to set endpoint database first\n", __func__, + get_current()->pid); ret = -EPERM; goto exit; } @@ -263,7 +264,8 @@ static int nvsciipc_ioctl_map_vuid(struct nvsciipc *ctx, unsigned int cmd, int32_t ret = 0; if ((ctx->num_eps == 0) || (ctx->set_db_f != true)) { - ERR("need to set endpoint database first\n"); + ERR("%s[%d] need to set endpoint database first\n", __func__, + get_current()->pid); ret = -EPERM; goto exit; } @@ -300,7 +302,8 @@ static int nvsciipc_ioctl_get_db_by_name(struct nvsciipc *ctx, unsigned int cmd, int i; if ((ctx->num_eps == 0) || (ctx->set_db_f != true)) { - ERR("need to set endpoint database first\n"); + ERR("%s[%d] need to set endpoint database first\n", __func__, + get_current()->pid); return -EPERM; } @@ -320,6 +323,7 @@ static int nvsciipc_ioctl_get_db_by_name(struct nvsciipc *ctx, unsigned int cmd, } if (i == ctx->num_eps) { + INFO("%s: no entry (%s)\n", __func__, get_db.ep_name); return -ENOENT; } else if (copy_to_user((void __user *)arg, &get_db, _IOC_SIZE(cmd))) { @@ -337,7 +341,8 @@ static int nvsciipc_ioctl_get_db_by_vuid(struct nvsciipc *ctx, unsigned int cmd, int i; if ((ctx->num_eps == 0) || (ctx->set_db_f != true)) { - ERR("need to set endpoint database first\n"); + ERR("%s[%d] need to set endpoint database first\n", __func__, + get_current()->pid); return -EPERM; } @@ -356,6 +361,7 @@ static int nvsciipc_ioctl_get_db_by_vuid(struct nvsciipc *ctx, unsigned int cmd, } if (i == ctx->num_eps) { + INFO("%s: no entry (0x%llx)\n", __func__, get_db.vuid); return -ENOENT; } else if (copy_to_user((void __user *)arg, &get_db, _IOC_SIZE(cmd))) { @@ -373,7 +379,8 @@ static int nvsciipc_ioctl_get_vuid(struct nvsciipc *ctx, unsigned int cmd, int i; if ((ctx->num_eps == 0) || (ctx->set_db_f != true)) { - ERR("need to set endpoint database first\n"); + ERR("%s[%d] need to set endpoint database first\n", __func__, + get_current()->pid); return -EPERM; } @@ -392,6 +399,7 @@ static int nvsciipc_ioctl_get_vuid(struct nvsciipc *ctx, unsigned int cmd, } if (i == ctx->num_eps) { + INFO("%s: no entry (%s)\n", __func__, get_vuid.ep_name); return -ENOENT; } else if (copy_to_user((void __user *)arg, &get_vuid, _IOC_SIZE(cmd))) { @@ -410,6 +418,8 @@ static int nvsciipc_ioctl_set_db(struct nvsciipc *ctx, unsigned int cmd, int ret = 0; int i; + INFO("set_db start\n"); + #if defined(CONFIG_ANDROID) if ((current_cred()->uid.val != SYSTEM_GID) && (current_cred()->uid.val != 0)) { @@ -511,6 +521,8 @@ static int nvsciipc_ioctl_set_db(struct nvsciipc *ctx, unsigned int cmd, ctx->set_db_f = true; + INFO("set_db done\n"); + return ret; ptr_error: @@ -540,7 +552,8 @@ static int nvsciipc_ioctl_get_dbsize(struct nvsciipc *ctx, unsigned int cmd, int32_t ret = 0; if (ctx->set_db_f != true) { - ERR("need to set endpoint database first\n"); + ERR("%s[%d] need to set endpoint database first\n", __func__, + get_current()->pid); ret = -EPERM; goto exit; } @@ -635,7 +648,8 @@ static ssize_t nvsciipc_dbg_read(struct file *filp, char __user *buf, } if (ctx->set_db_f != true) { - ERR("need to set endpoint database first\n"); + ERR("%s[%d] need to set endpoint database first\n", __func__, + get_current()->pid); return -EPERM; }