MODS Online IST SMC support

Summary: This change adds support in mods kernel
driver to send messages to ATF using SMC interface in
order to fetch the Online IST test results.

JIRA TM-206

Change-Id: Iafa397287d7af63d77c51308345a9dc93d3a922f
Signed-off-by: Anshul Goel <ansgoel@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2630148
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Anshul Goel
2021-11-22 22:27:11 +00:00
committed by Laxman Dewangan
parent c9052a874f
commit aa915e1412
5 changed files with 65 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ mods-$(CONFIG_PCI) += mods_pci.o
mods-$(CONFIG_ACPI) += mods_acpi.o mods-$(CONFIG_ACPI) += mods_acpi.o
mods-$(CONFIG_DMA_SHARED_BUFFER) += mods_dmabuf.o mods-$(CONFIG_DMA_SHARED_BUFFER) += mods_dmabuf.o
mods-$(CONFIG_ARCH_TEGRA) += mods_smmu_drv.o mods-$(CONFIG_ARCH_TEGRA) += mods_smmu_drv.o
mods-$(CONFIG_ARCH_TEGRA) += mods_oist.o
mods-$(CONFIG_DMA_ENGINE) += mods_dma.o mods-$(CONFIG_DMA_ENGINE) += mods_dma.o
mods-$(CONFIG_DEBUG_FS) += mods_debugfs.o mods-$(CONFIG_DEBUG_FS) += mods_debugfs.o
mods-$(CONFIG_TEGRA_DC) += mods_tegradc.o mods-$(CONFIG_TEGRA_DC) += mods_tegradc.o

View File

@@ -2,7 +2,7 @@
/* /*
* mods_internal.h - This file is part of NVIDIA MODS kernel driver. * mods_internal.h - This file is part of NVIDIA MODS kernel driver.
* *
* Copyright (c) 2008-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2008-2022, NVIDIA CORPORATION. All rights reserved.
* *
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or * NVIDIA MODS kernel driver is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License, * modify it under the terms of the GNU General Public License,
@@ -637,6 +637,10 @@ int esc_mods_dma_free_coherent(struct mods_client *client,
int esc_mods_dma_copy_to_user(struct mods_client *client, int esc_mods_dma_copy_to_user(struct mods_client *client,
struct MODS_DMA_COPY_TO_USER *p); struct MODS_DMA_COPY_TO_USER *p);
/* oist */
int esc_mods_oist_status(struct mods_client *client,
struct MODS_TEGRA_OIST_STATUS *p);
#ifdef CONFIG_DMA_ENGINE #ifdef CONFIG_DMA_ENGINE
int esc_mods_dma_request_channel(struct mods_client *client, int esc_mods_dma_request_channel(struct mods_client *client,
struct MODS_DMA_HANDLE *p); struct MODS_DMA_HANDLE *p);

View File

@@ -2,7 +2,7 @@
/* /*
* mods_krnl.c - This file is part of NVIDIA MODS kernel driver. * mods_krnl.c - This file is part of NVIDIA MODS kernel driver.
* *
* Copyright (c) 2008-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2008-2022, NVIDIA CORPORATION. All rights reserved.
* *
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or * NVIDIA MODS kernel driver is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License, * modify it under the terms of the GNU General Public License,
@@ -2546,6 +2546,11 @@ static long mods_krnl_ioctl(struct file *fp,
MODS_IOCTL(MODS_ESC_SEND_TZ_MSG, MODS_IOCTL(MODS_ESC_SEND_TZ_MSG,
esc_mods_send_trustzone_msg, MODS_TZ_PARAMS); esc_mods_send_trustzone_msg, MODS_TZ_PARAMS);
break; break;
case MODS_ESC_OIST_STATUS:
MODS_IOCTL(MODS_ESC_OIST_STATUS,
esc_mods_oist_status, MODS_TEGRA_OIST_STATUS);
break;
#endif #endif
case MODS_ESC_ACQUIRE_ACCESS_TOKEN: case MODS_ESC_ACQUIRE_ACCESS_TOKEN:

View File

@@ -0,0 +1,36 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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 "mods_internal.h"
#include <linux/arm-smccc.h>
#define SMCCC_VERSION 0x80000000
int esc_mods_oist_status(struct mods_client *client,
struct MODS_TEGRA_OIST_STATUS *p)
{
int ret = 0;
struct arm_smccc_res res = { 0 };
if (p->smc_func_id == SMCCC_VERSION) {
// For SMC version, We are only reading res.a0 value, not a1,a2,a3
arm_smccc_1_1_smc(p->smc_func_id, res.a0, &res);
p->smc_status = res.a0;
} else {
arm_smccc_1_1_smc(p->smc_func_id, p->a1, p->a2, &res);
p->smc_status = res.a1;
}
return ret;
}

View File

@@ -2,7 +2,7 @@
/* /*
* mods.h - This file is part of NVIDIA MODS kernel driver. * mods.h - This file is part of NVIDIA MODS kernel driver.
* *
* Copyright (c) 2008-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2008-2022, NVIDIA CORPORATION. All rights reserved.
* *
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or * NVIDIA MODS kernel driver is free software: you can redistribute it and/or
* modify it under the terms of the GNU General Public License, * modify it under the terms of the GNU General Public License,
@@ -1795,6 +1795,21 @@ struct MODS_TZ_PARAMS {
int status; int status;
}; };
/* Used by MODS_ESC_OIST_STATUS ioctl.
*
* Available only on Tegra.
*/
struct MODS_TEGRA_OIST_STATUS {
/* IN */
__u64 smc_func_id;
/* IN */
__u64 a1;
/* IN */
__u64 a2;
/* OUT */
__u64 smc_status;
};
#define MODS_IOMMU_MAP_CONTIGUOUS 1 #define MODS_IOMMU_MAP_CONTIGUOUS 1
#pragma pack(pop) #pragma pack(pop)
@@ -1995,5 +2010,6 @@ struct MODS_TZ_PARAMS {
#define MODS_ESC_BPMP_SET_PCIE_STATE MODSIO(W, 136, MODS_SET_PCIE_STATE) #define MODS_ESC_BPMP_SET_PCIE_STATE MODSIO(W, 136, MODS_SET_PCIE_STATE)
#define MODS_ESC_BPMP_INIT_PCIE_EP_PLL MODSIO(W, 137, MODS_INIT_PCIE_EP_PLL) #define MODS_ESC_BPMP_INIT_PCIE_EP_PLL MODSIO(W, 137, MODS_INIT_PCIE_EP_PLL)
#define MODS_ESC_SEND_TZ_MSG MODSIO(WR, 139, MODS_TZ_PARAMS) #define MODS_ESC_SEND_TZ_MSG MODSIO(WR, 139, MODS_TZ_PARAMS)
#define MODS_ESC_OIST_STATUS MODSIO(WR, 140, MODS_TEGRA_OIST_STATUS)
#endif /* _UAPI_MODS_H_ */ #endif /* _UAPI_MODS_H_ */