diff options
author | Uday Gupta <udayg@nvidia.com> | 2021-09-12 07:15:19 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2022-01-24 11:40:08 -0500 |
commit | 0b4dd54af468cc6a74f042c6ea93a2f4c9864a4e (patch) | |
tree | 5fce04974dbc34fe01a85b11e494524b355e4f98 | |
parent | 9ef60619cfb8d195715b798ac112cdd3d108da38 (diff) |
nvadsp: Add more error logs and fix crash
- Change adds more error logs in case of APP init failure.
- Also potentially fixes the crash issue
Bug 3374437
Bug 3498407
Change-Id: If6baf6e2e11250815cff4a6b8a2abe553e893e34
Signed-off-by: Uday Gupta <udayg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2593021
(cherry picked from commit b051fae2faffafbffed99b94914bbd9bc370240f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2658565
Reviewed-by: Dipesh Gandhi <dipeshg@nvidia.com>
Reviewed-by: Phoenix Jung <pjung@nvidia.com>
GVS: Gerrit_Virtual_Submit
-rw-r--r-- | drivers/platform/tegra/nvadsp/adsp_lpthread.c | 4 | ||||
-rw-r--r-- | drivers/platform/tegra/nvadsp/adspff.c | 4 | ||||
-rw-r--r-- | drivers/platform/tegra/nvadsp/app.c | 15 | ||||
-rw-r--r-- | drivers/platform/tegra/nvadsp/mailbox.c | 8 | ||||
-rw-r--r-- | sound/soc/tegra-virt-alt/tegra210_adsp_virt_alt.c | 12 |
5 files changed, 31 insertions, 12 deletions
diff --git a/drivers/platform/tegra/nvadsp/adsp_lpthread.c b/drivers/platform/tegra/nvadsp/adsp_lpthread.c index 8a827a298..e42ad7684 100644 --- a/drivers/platform/tegra/nvadsp/adsp_lpthread.c +++ b/drivers/platform/tegra/nvadsp/adsp_lpthread.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -69,7 +69,7 @@ int adsp_lpthread_init(bool is_adsp_suspended) | |||
69 | return -1; | 69 | return -1; |
70 | 70 | ||
71 | app_info = nvadsp_app_init(handle, NULL); | 71 | app_info = nvadsp_app_init(handle, NULL); |
72 | if (!app_info) { | 72 | if (IS_ERR_OR_NULL(app_info)) { |
73 | pr_err("unable to init app adsp_lpthread\n"); | 73 | pr_err("unable to init app adsp_lpthread\n"); |
74 | return -1; | 74 | return -1; |
75 | } | 75 | } |
diff --git a/drivers/platform/tegra/nvadsp/adspff.c b/drivers/platform/tegra/nvadsp/adspff.c index fc1ec5baf..64597c2a8 100644 --- a/drivers/platform/tegra/nvadsp/adspff.c +++ b/drivers/platform/tegra/nvadsp/adspff.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2016-2021, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -650,7 +650,7 @@ int adspff_init(struct platform_device *pdev) | |||
650 | return -1; | 650 | return -1; |
651 | 651 | ||
652 | app_info = nvadsp_app_init(handle, NULL); | 652 | app_info = nvadsp_app_init(handle, NULL); |
653 | if (!app_info) { | 653 | if (IS_ERR_OR_NULL(app_info)) { |
654 | pr_err("unable to init app adspff\n"); | 654 | pr_err("unable to init app adspff\n"); |
655 | return -1; | 655 | return -1; |
656 | } | 656 | } |
diff --git a/drivers/platform/tegra/nvadsp/app.c b/drivers/platform/tegra/nvadsp/app.c index 6fafdb80a..582ce14b5 100644 --- a/drivers/platform/tegra/nvadsp/app.c +++ b/drivers/platform/tegra/nvadsp/app.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * ADSP OS App management | 4 | * ADSP OS App management |
5 | * | 5 | * |
6 | * Copyright (C) 2014-2018, NVIDIA Corporation. All rights reserved. | 6 | * Copyright (C) 2014-2022, NVIDIA Corporation. All rights reserved. |
7 | * | 7 | * |
8 | * This software is licensed under the terms of the GNU General Public | 8 | * This software is licensed under the terms of the GNU General Public |
9 | * License version 2, as published by the Free Software Foundation, and | 9 | * License version 2, as published by the Free Software Foundation, and |
@@ -625,15 +625,21 @@ nvadsp_app_info_t __must_check *nvadsp_app_init(nvadsp_app_handle_t handle, | |||
625 | 625 | ||
626 | drv_data = platform_get_drvdata(priv.pdev); | 626 | drv_data = platform_get_drvdata(priv.pdev); |
627 | 627 | ||
628 | if (!drv_data->adsp_os_running) | 628 | if (!drv_data->adsp_os_running) { |
629 | pr_err("ADSP is not running\n"); | ||
629 | goto err; | 630 | goto err; |
631 | } | ||
630 | 632 | ||
631 | if (IS_ERR_OR_NULL(handle)) | 633 | if (IS_ERR_OR_NULL(handle)) { |
634 | pr_err("ADSP APP handle is NULL\n"); | ||
632 | goto err; | 635 | goto err; |
636 | } | ||
633 | 637 | ||
634 | message = kzalloc(sizeof(*message), GFP_KERNEL); | 638 | message = kzalloc(sizeof(*message), GFP_KERNEL); |
635 | if (!message) | 639 | if (!message) { |
640 | pr_err("Failed to allocate memory for ADSP msg\n"); | ||
636 | goto err; | 641 | goto err; |
642 | } | ||
637 | 643 | ||
638 | shared_mem = drv_data->shared_adsp_os_data; | 644 | shared_mem = drv_data->shared_adsp_os_data; |
639 | msg_pool = &shared_mem->app_shared_msg_pool; | 645 | msg_pool = &shared_mem->app_shared_msg_pool; |
@@ -642,6 +648,7 @@ nvadsp_app_info_t __must_check *nvadsp_app_init(nvadsp_app_handle_t handle, | |||
642 | 648 | ||
643 | app = create_app_instance(handle, args, &data->app_init, NULL, 0); | 649 | app = create_app_instance(handle, args, &data->app_init, NULL, 0); |
644 | if (IS_ERR_OR_NULL(app)) { | 650 | if (IS_ERR_OR_NULL(app)) { |
651 | pr_err("Failed to create APP instance\n"); | ||
645 | kfree(message); | 652 | kfree(message); |
646 | goto err; | 653 | goto err; |
647 | } | 654 | } |
diff --git a/drivers/platform/tegra/nvadsp/mailbox.c b/drivers/platform/tegra/nvadsp/mailbox.c index 3b197a6e1..94afbd43e 100644 --- a/drivers/platform/tegra/nvadsp/mailbox.c +++ b/drivers/platform/tegra/nvadsp/mailbox.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * ADSP mailbox manager | 2 | * ADSP mailbox manager |
3 | * | 3 | * |
4 | * Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -219,11 +219,13 @@ status_t nvadsp_mbox_send(struct nvadsp_mbox *mbox, uint32_t data, | |||
219 | int ret = 0; | 219 | int ret = 0; |
220 | 220 | ||
221 | if (!nvadsp_drv_data) { | 221 | if (!nvadsp_drv_data) { |
222 | pr_err("ADSP drv_data is NULL\n"); | ||
222 | ret = -ENOSYS; | 223 | ret = -ENOSYS; |
223 | goto out; | 224 | goto out; |
224 | } | 225 | } |
225 | 226 | ||
226 | if (!mbox) { | 227 | if (!mbox) { |
228 | pr_err("ADSP MBOX is NULL\n"); | ||
227 | ret = -EINVAL; | 229 | ret = -EINVAL; |
228 | goto out; | 230 | goto out; |
229 | } | 231 | } |
@@ -239,9 +241,11 @@ status_t nvadsp_mbox_send(struct nvadsp_mbox *mbox, uint32_t data, | |||
239 | &nvadsp_drv_data->hwmbox_send_queue.comp, | 241 | &nvadsp_drv_data->hwmbox_send_queue.comp, |
240 | msecs_to_jiffies(timeout)); | 242 | msecs_to_jiffies(timeout)); |
241 | if (ret) { | 243 | if (ret) { |
244 | pr_warn("ADSP HWMBOX send retry\n"); | ||
242 | block = false; | 245 | block = false; |
243 | goto retry; | 246 | goto retry; |
244 | } else { | 247 | } else { |
248 | pr_err("ADSP wait for completion timed out\n"); | ||
245 | ret = -ETIME; | 249 | ret = -ETIME; |
246 | goto out; | 250 | goto out; |
247 | } | 251 | } |
@@ -250,7 +254,7 @@ status_t nvadsp_mbox_send(struct nvadsp_mbox *mbox, uint32_t data, | |||
250 | data, ret); | 254 | data, ret); |
251 | } | 255 | } |
252 | } else if (ret) { | 256 | } else if (ret) { |
253 | pr_debug("Failed to enqueue data 0x%x. ret: %d\n", data, ret); | 257 | pr_warn("Failed to enqueue data 0x%x. ret: %d\n", data, ret); |
254 | goto out; | 258 | goto out; |
255 | } | 259 | } |
256 | out: | 260 | out: |
diff --git a/sound/soc/tegra-virt-alt/tegra210_adsp_virt_alt.c b/sound/soc/tegra-virt-alt/tegra210_adsp_virt_alt.c index eda9176a3..560cbf55b 100644 --- a/sound/soc/tegra-virt-alt/tegra210_adsp_virt_alt.c +++ b/sound/soc/tegra-virt-alt/tegra210_adsp_virt_alt.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * tegra210_adsp_virt_alt.c - Tegra ADSP audio driver | 2 | * tegra210_adsp_virt_alt.c - Tegra ADSP audio driver |
3 | * | 3 | * |
4 | * Author: Sumit Bhattacharya <sumitb@nvidia.com> | 4 | * Author: Sumit Bhattacharya <sumitb@nvidia.com> |
5 | * Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved. | 5 | * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
@@ -622,6 +622,12 @@ static int tegra210_adsp_send_connect_msg(struct tegra210_adsp_app *src, | |||
622 | { | 622 | { |
623 | apm_msg_t apm_msg; | 623 | apm_msg_t apm_msg; |
624 | 624 | ||
625 | if ((src == NULL) || (dst == NULL)) { | ||
626 | pr_err("%s: SRC = %p or DST = %p is NULL\n", | ||
627 | __func__, src, dst); | ||
628 | return -1; | ||
629 | } | ||
630 | |||
625 | apm_msg.msgq_msg.size = MSGQ_MSG_WSIZE(apm_fx_connect_params_t); | 631 | apm_msg.msgq_msg.size = MSGQ_MSG_WSIZE(apm_fx_connect_params_t); |
626 | apm_msg.msg.call_params.size = sizeof(apm_fx_connect_params_t); | 632 | apm_msg.msg.call_params.size = sizeof(apm_fx_connect_params_t); |
627 | apm_msg.msg.call_params.method = nvfx_apm_method_fx_connect; | 633 | apm_msg.msg.call_params.method = nvfx_apm_method_fx_connect; |
@@ -3195,8 +3201,10 @@ static int tegra210_adsp_mux_put(struct snd_kcontrol *kcontrol, | |||
3195 | uint32_t cur_val = 0; | 3201 | uint32_t cur_val = 0; |
3196 | int ret = 0; | 3202 | int ret = 0; |
3197 | 3203 | ||
3198 | if (!adsp->init_done) | 3204 | if (!adsp->init_done) { |
3205 | dev_err(adsp->dev, "%s ADSP not initialized\n", __func__); | ||
3199 | return -ENODEV; | 3206 | return -ENODEV; |
3207 | } | ||
3200 | 3208 | ||
3201 | if (e->reg >= TEGRA210_ADSP_VIRT_REG_MAX) | 3209 | if (e->reg >= TEGRA210_ADSP_VIRT_REG_MAX) |
3202 | return -EINVAL; | 3210 | return -EINVAL; |