From 21a60d1ca1fa60a60299f3918612a605f1f79b86 Mon Sep 17 00:00:00 2001 From: Viswanath L Date: Mon, 3 Jul 2023 18:50:33 +0000 Subject: [PATCH] nvadsp: Load apps only if msgq is initialized Load static apps only if shared memory is provisioned and ADSP firmware has initialized message queue. Bug 4164138 Bug 3682950 Change-Id: I86a9292d8d5f2949595c9a701f0565a9644f3d9a Signed-off-by: Viswanath L Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2930212 (cherry picked from commit 396b05637869ab2f49e8f3b3358fb9298ba96ae5) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2971982 Reviewed-by: Sharad Gupta GVS: Gerrit_Virtual_Submit --- drivers/platform/tegra/nvadsp/app.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/platform/tegra/nvadsp/app.c b/drivers/platform/tegra/nvadsp/app.c index 3cfb5f37..6b725495 100644 --- a/drivers/platform/tegra/nvadsp/app.c +++ b/drivers/platform/tegra/nvadsp/app.c @@ -1,19 +1,6 @@ -/* - * run_app.c - * - * ADSP OS App management - * - * Copyright (C) 2014-2022, NVIDIA Corporation. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * +// SPDX-License-Identifier: GPL-2.0-only +/** + * Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved. */ #include @@ -972,11 +959,15 @@ int load_adsp_static_apps(void) pdev = priv.pdev; dev = &pdev->dev; drv_data = platform_get_drvdata(pdev); + shared_mem = drv_data->shared_adsp_os_data; + if (!shared_mem) + return 0; + msg_pool = &shared_mem->app_shared_msg_pool; msgq_recv = &msg_pool->app_loader_recv_message.msgq; - while (1) { + while (msgq_recv->size) { union app_complete_status_message message = { }; struct adsp_static_app_data *data; struct adsp_shared_app *shared_app;