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 <viswanathl@nvidia.com>
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 <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Viswanath L
2023-07-03 18:50:33 +00:00
committed by mobile promotions
parent 6815f07e8f
commit 21a60d1ca1

View File

@@ -1,19 +1,6 @@
/* // SPDX-License-Identifier: GPL-2.0-only
* run_app.c /**
* * Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved.
* 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.
*
*/ */
#include <linux/platform_device.h> #include <linux/platform_device.h>
@@ -972,11 +959,15 @@ int load_adsp_static_apps(void)
pdev = priv.pdev; pdev = priv.pdev;
dev = &pdev->dev; dev = &pdev->dev;
drv_data = platform_get_drvdata(pdev); drv_data = platform_get_drvdata(pdev);
shared_mem = drv_data->shared_adsp_os_data; shared_mem = drv_data->shared_adsp_os_data;
if (!shared_mem)
return 0;
msg_pool = &shared_mem->app_shared_msg_pool; msg_pool = &shared_mem->app_shared_msg_pool;
msgq_recv = &msg_pool->app_loader_recv_message.msgq; msgq_recv = &msg_pool->app_loader_recv_message.msgq;
while (1) { while (msgq_recv->size) {
union app_complete_status_message message = { }; union app_complete_status_message message = { };
struct adsp_static_app_data *data; struct adsp_static_app_data *data;
struct adsp_shared_app *shared_app; struct adsp_shared_app *shared_app;