mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
misc: mods: Add support for AON invocation
- Enable MODS kernel driver ADSP APIs
- Updated CONFIG_TEGRA_NVADSP to MODS_HAS_TEGRA
- get_handle call is invoked for each API
- To avoid regression on parallel WAT testing
- Fork nvidia-oot from nvidia-kernel
- Firmware APIs do not support 5.1 version.
- Updating the same IOCTLs as its being used by AON and ADSP tests.
Bug 4149877
Change-Id: I0063f6610c078395ce9ce3f348bbab360e7dc676
Signed-off-by: sitalluri <sitalluri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3057290
Reviewed-by: Kuan Luo <kluo@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: John Lu <johlu@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: John Lu <johlu@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
6e9c85dd91
commit
121870b4aa
@@ -1,5 +1,5 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
# SPDX-FileCopyrightText: Copyright (c) 2017-2023, NVIDIA CORPORATION. All rights reserved.
|
||||
# SPDX-FileCopyrightText: Copyright (c) 2017-2024, NVIDIA CORPORATION. All rights reserved.
|
||||
|
||||
ifeq ($(origin srctree.nvidia), undefined)
|
||||
srctree.nvidia := $(srctree.nvidia-oot)
|
||||
@@ -28,7 +28,7 @@ mods-y += mods_krnl.o
|
||||
mods-y += mods_mem.o
|
||||
|
||||
mods-$(CONFIG_ACPI) += mods_acpi.o
|
||||
mods-$(CONFIG_TEGRA_NVADSP) += mods_adsp.o
|
||||
mods-$(CONFIG_ARCH_TEGRA) += mods_adsp.o
|
||||
mods-$(HAVE_ARM_FFA) += mods_arm_ffa.o
|
||||
mods-$(CONFIG_TEGRA_IVC) += mods_bpmpipc.o
|
||||
mods-$(CONFIG_COMMON_CLK) += mods_clock.o
|
||||
|
||||
@@ -1,37 +1,49 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved. */
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2014-2024, NVIDIA CORPORATION. All rights reserved. */
|
||||
|
||||
#include <linux/uaccess.h>
|
||||
#include "mods_internal.h"
|
||||
#include <linux/tegra_nvadsp.h>
|
||||
|
||||
int esc_mods_adsp_load(struct mods_client *client)
|
||||
int esc_mods_adsp_load(struct mods_client *client,
|
||||
struct MODS_ADSP_INIT_INFO *p)
|
||||
{
|
||||
return nvadsp_os_load();
|
||||
struct nvadsp_handle *handle = nvadsp_get_handle(p->node);
|
||||
|
||||
return handle->os_load(handle);
|
||||
}
|
||||
|
||||
int esc_mods_adsp_start(struct mods_client *client)
|
||||
int esc_mods_adsp_start(struct mods_client *client,
|
||||
struct MODS_ADSP_INIT_INFO *p)
|
||||
{
|
||||
return nvadsp_os_start();
|
||||
struct nvadsp_handle *handle = nvadsp_get_handle(p->node);
|
||||
|
||||
return handle->os_start(handle);
|
||||
}
|
||||
|
||||
int esc_mods_adsp_stop(struct mods_client *client)
|
||||
int esc_mods_adsp_stop(struct mods_client *client,
|
||||
struct MODS_ADSP_INIT_INFO *p)
|
||||
{
|
||||
return nvadsp_os_suspend();
|
||||
struct nvadsp_handle *handle = nvadsp_get_handle(p->node);
|
||||
|
||||
return handle->os_suspend(handle);
|
||||
}
|
||||
|
||||
int esc_mods_adsp_run_app(struct mods_client *client,
|
||||
struct MODS_ADSP_RUN_APP_INFO *p)
|
||||
{
|
||||
int rc = -1;
|
||||
int ret = 0;
|
||||
int max_retry = 3;
|
||||
int rcount = 0;
|
||||
nvadsp_app_handle_t handle;
|
||||
nvadsp_app_handle_t app_handle;
|
||||
nvadsp_app_info_t *p_app_info;
|
||||
nvadsp_app_args_t app_args;
|
||||
|
||||
handle = nvadsp_app_load(p->app_name, p->app_file_name);
|
||||
if (!handle) {
|
||||
struct nvadsp_handle *handle = nvadsp_get_handle(p->node);
|
||||
|
||||
app_handle = handle->app_load(handle, p->app_name, p->app_file_name);
|
||||
if (!app_handle) {
|
||||
cl_error("load adsp app fail");
|
||||
return -1;
|
||||
}
|
||||
@@ -39,24 +51,24 @@ int esc_mods_adsp_run_app(struct mods_client *client,
|
||||
if (p->argc > 0 && p->argc <= MODS_ADSP_APP_MAX_PARAM) {
|
||||
app_args.argc = p->argc;
|
||||
memcpy(app_args.argv, p->argv, p->argc * sizeof(__u32));
|
||||
p_app_info = nvadsp_app_init(handle, &app_args);
|
||||
p_app_info = handle->app_init(handle, app_handle, &app_args);
|
||||
} else
|
||||
p_app_info = nvadsp_app_init(handle, NULL);
|
||||
p_app_info = handle->app_init(handle, app_handle, NULL);
|
||||
|
||||
if (!p_app_info) {
|
||||
cl_error("init adsp app fail");
|
||||
nvadsp_app_unload(handle);
|
||||
handle->app_unload(handle, app_handle);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = nvadsp_app_start(p_app_info);
|
||||
rc = handle->app_start(handle, p_app_info);
|
||||
if (rc) {
|
||||
cl_error("start adsp app fail");
|
||||
goto failed;
|
||||
}
|
||||
|
||||
while (rcount++ < max_retry) {
|
||||
rc = wait_for_nvadsp_app_complete_timeout(p_app_info,
|
||||
rc = handle->wait_for_app_complete_timeout(handle, p_app_info,
|
||||
msecs_to_jiffies(p->timeout));
|
||||
if (rc == -ERESTARTSYS)
|
||||
continue;
|
||||
@@ -71,9 +83,15 @@ int esc_mods_adsp_run_app(struct mods_client *client,
|
||||
break;
|
||||
}
|
||||
|
||||
ret = p_app_info->return_status;
|
||||
if (ret < 0) {
|
||||
cl_error("Test failed, err=%d\n", ret);
|
||||
rc = -1;
|
||||
}
|
||||
|
||||
failed:
|
||||
nvadsp_app_deinit(p_app_info);
|
||||
nvadsp_app_unload(handle);
|
||||
handle->app_deinit(handle, p_app_info);
|
||||
handle->app_unload(handle, app_handle);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2008-2023, NVIDIA CORPORATION. All rights reserved. */
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2008-2024, NVIDIA CORPORATION. All rights reserved. */
|
||||
|
||||
#ifndef _MODS_INTERNAL_H_
|
||||
#define _MODS_INTERNAL_H_
|
||||
@@ -664,10 +664,13 @@ static inline int esc_mods_dmabuf_get_phys_addr(struct mods_client *client,
|
||||
{ return -EINVAL; }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TEGRA_NVADSP
|
||||
int esc_mods_adsp_load(struct mods_client *client);
|
||||
int esc_mods_adsp_start(struct mods_client *client);
|
||||
int esc_mods_adsp_stop(struct mods_client *client);
|
||||
#ifdef MODS_HAS_TEGRA
|
||||
int esc_mods_adsp_load(struct mods_client *client,
|
||||
struct MODS_ADSP_INIT_INFO *p);
|
||||
int esc_mods_adsp_start(struct mods_client *client,
|
||||
struct MODS_ADSP_INIT_INFO *p);
|
||||
int esc_mods_adsp_stop(struct mods_client *client,
|
||||
struct MODS_ADSP_INIT_INFO *p);
|
||||
int esc_mods_adsp_run_app(struct mods_client *client,
|
||||
struct MODS_ADSP_RUN_APP_INFO *p);
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2008-2023, NVIDIA CORPORATION. All rights reserved. */
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2008-2024, NVIDIA CORPORATION. All rights reserved. */
|
||||
|
||||
#include "mods_internal.h"
|
||||
|
||||
@@ -2721,20 +2721,23 @@ static long mods_krnl_ioctl(struct file *fp,
|
||||
MODS_DMABUF_GET_PHYSICAL_ADDRESS);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_TEGRA_NVADSP
|
||||
#ifdef MODS_HAS_TEGRA
|
||||
case MODS_ESC_ADSP_LOAD:
|
||||
MODS_IOCTL_VOID(MODS_ESC_ADSP_LOAD,
|
||||
esc_mods_adsp_load);
|
||||
MODS_IOCTL_NORETVAL(MODS_ESC_ADSP_LOAD,
|
||||
esc_mods_adsp_load,
|
||||
MODS_ADSP_INIT_INFO);
|
||||
break;
|
||||
|
||||
case MODS_ESC_ADSP_START:
|
||||
MODS_IOCTL_VOID(MODS_ESC_ADSP_START,
|
||||
esc_mods_adsp_start);
|
||||
MODS_IOCTL_NORETVAL(MODS_ESC_ADSP_START,
|
||||
esc_mods_adsp_start,
|
||||
MODS_ADSP_INIT_INFO);
|
||||
break;
|
||||
|
||||
case MODS_ESC_ADSP_STOP:
|
||||
MODS_IOCTL_VOID(MODS_ESC_ADSP_STOP,
|
||||
esc_mods_adsp_stop);
|
||||
MODS_IOCTL_NORETVAL(MODS_ESC_ADSP_STOP,
|
||||
esc_mods_adsp_stop,
|
||||
MODS_ADSP_INIT_INFO);
|
||||
break;
|
||||
|
||||
case MODS_ESC_ADSP_RUN_APP:
|
||||
|
||||
@@ -1557,13 +1557,20 @@ struct MODS_TEGRA_DC_SETUP_SD {
|
||||
#define MODS_ADSP_APP_NAME_SIZE 64
|
||||
#define MODS_ADSP_APP_MAX_PARAM 128
|
||||
|
||||
/* Used by MODS_ESC_ADSP_RUN_APP ioctl.
|
||||
/* Used by MODS_ESC_ADSP ioctl.
|
||||
*
|
||||
* Available only on Tegra.
|
||||
*/
|
||||
|
||||
struct MODS_ADSP_INIT_INFO {
|
||||
/* IN */
|
||||
char node[MODS_ADSP_APP_NAME_SIZE];
|
||||
};
|
||||
|
||||
struct MODS_ADSP_RUN_APP_INFO {
|
||||
char app_name[MODS_ADSP_APP_NAME_SIZE];
|
||||
char app_file_name[MODS_ADSP_APP_NAME_SIZE];
|
||||
char node[MODS_ADSP_APP_NAME_SIZE];
|
||||
__u32 argc;
|
||||
__u32 argv[MODS_ADSP_APP_MAX_PARAM];
|
||||
__u32 timeout;
|
||||
@@ -2068,9 +2075,9 @@ struct MODS_RESERVE_ALLOCATION {
|
||||
#define MODS_ESC_TEGRA_DC_SETUP_SD MODSIO(W, 48, MODS_TEGRA_DC_SETUP_SD)
|
||||
#define MODS_ESC_DMABUF_GET_PHYSICAL_ADDRESS MODSIO(WR, 49, \
|
||||
MODS_DMABUF_GET_PHYSICAL_ADDRESS)
|
||||
#define MODS_ESC_ADSP_LOAD _IO(MODS_IOC_MAGIC, 50)
|
||||
#define MODS_ESC_ADSP_START _IO(MODS_IOC_MAGIC, 51)
|
||||
#define MODS_ESC_ADSP_STOP _IO(MODS_IOC_MAGIC, 52)
|
||||
#define MODS_ESC_ADSP_LOAD MODSIO(W, 50, MODS_ADSP_INIT_INFO)
|
||||
#define MODS_ESC_ADSP_START MODSIO(W, 51, MODS_ADSP_INIT_INFO)
|
||||
#define MODS_ESC_ADSP_STOP MODSIO(W, 52, MODS_ADSP_INIT_INFO)
|
||||
#define MODS_ESC_ADSP_RUN_APP MODSIO(W, 53, MODS_ADSP_RUN_APP_INFO)
|
||||
/* Deprecated */
|
||||
#define MODS_ESC_PCI_GET_BAR_INFO MODSIO(WR, 54, MODS_PCI_GET_BAR_INFO)
|
||||
|
||||
Reference in New Issue
Block a user