From 51ef39c2ab98e4ca6baeb4386d40fe237580a6dd Mon Sep 17 00:00:00 2001 From: Abhijit Date: Tue, 2 Jul 2019 17:52:39 +0530 Subject: [PATCH 1/6] drivers: misc: Add nvsciipc kernel module This patch adds nvsciipc kernel driver. At present its only use is to support NvSciIpc secure buffer sharing use case across processes. JIRA ESLC-4105 Change-Id: Ib2889d7c0c7a3928ad1e84c8dd58f3aa287c6185 Signed-off-by: Abhijit Reviewed-on: https://git-master.nvidia.com/r/2146877 GVS: Gerrit_Virtual_Submit Reviewed-by: Sachin Nikam Reviewed-by: Sandeep Trasi Reviewed-by: Puneet Saxena Reviewed-by: mobile promotions Tested-by: mobile promotions --- include/linux/nvscierror.h | 220 ++++++++++++++++++++++++++++ include/linux/nvsciipc_interface.h | 68 +++++++++ include/uapi/linux/nvsciipc_ioctl.h | 76 ++++++++++ 3 files changed, 364 insertions(+) create mode 100644 include/linux/nvscierror.h create mode 100644 include/linux/nvsciipc_interface.h create mode 100644 include/uapi/linux/nvsciipc_ioctl.h diff --git a/include/linux/nvscierror.h b/include/linux/nvscierror.h new file mode 100644 index 00000000..9e1140c5 --- /dev/null +++ b/include/linux/nvscierror.h @@ -0,0 +1,220 @@ +/* + * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * + * NVIDIA Corporation and its licensors retain all intellectual property + * and proprietary rights in and to this software, related documentation + * and any modifications thereto. Any use, reproduction, disclosure or + * distribution of this software and related documentation without an express + * license agreement from NVIDIA Corporation is strictly prohibited. + */ + +/* + * @file + * + * NVIDIA Software Communications Interface (SCI): Error Handling + * + * @b Description: This file declares error codes for NvSci APIs. + */ + +#ifndef INCLUDED_NVSCI_ERROR_H +#define INCLUDED_NVSCI_ERROR_H + +/** + * @defgroup NvSciError SCI Error Handling + * + * Contains error code enumeration and helper macros. + * + * @ingroup nvsci_top + * @{ + */ + +/** + * @brief Return/error codes for all NvSci functions. + * + * This enumeration contains unique return/error codes to identify the + * source of a failure. Some errors have direct correspondence to standard + * errno.h codes, indicated [IN BRACKETS], and may result from failures in + * lower level system calls. Others indicate failures specific to misuse + * of NvSci library function. + */ +typedef enum NvSciErrorRec { + /* Range 0x00000000 - 0x00FFFFFF : Common errors + * This range is used for errors common to all NvSci libraries. + */ + + /** [EOK] No error */ + NvSciError_Success = 0x00000000, + + /** Unidentified error with no additional info */ + NvSciError_Unknown = 0x00000001, + + /* Generic errors */ + /** [ENOSYS] Feature is not implemented */ + NvSciError_NotImplemented = 0x00000010, + /** [ENOTSUP] Feature is not supported */ + NvSciError_NotSupported = 0x00000011, + /** [EACCES] Access to resource denied */ + NvSciError_AccessDenied = 0x00000020, + /** [EPERM] No permission to perform operation */ + NvSciError_NotPermitted = 0x00000021, + /** Resource is in wrong state to perform operation */ + NvSciError_InvalidState = 0x00000022, + /** Requested operation is not legal */ + NvSciError_InvalidOperation = 0x00000023, + /** Required resource is not initialized */ + NvSciError_NotInitialized = 0x00000024, + /** [ENOMEM] Not enough memory */ + NvSciError_InsufficientMemory = 0x00000030, + /** Not enough (non-memory) resources */ + NvSciError_InsufficientResource = 0x00000031, + /** Resource failed */ + NvSciError_ResourceError = 0x00000032, + + /* Function parameter errors */ + /** [EINVAL] Invalid parameter value */ + NvSciError_BadParameter = 0x00000100, + /** [EFAULT] Invalid address */ + NvSciError_BadAddress = 0x00000101, + /** [E2BIG] Parameter list too long */ + NvSciError_TooBig = 0x00000102, + /** [EOVERFLOW] Value too large for data type */ + NvSciError_Overflow = 0x00000103, + + /* Timing/temporary errors */ + /** [ETIMEDOUT] Operation timed out*/ + NvSciError_Timeout = 0x00000200, + /** [EAGAIN] Resource unavailable. Try again. */ + NvSciError_TryItAgain = 0x00000201, + /** [EBUSY] Resource is busy */ + NvSciError_Busy = 0x00000202, + /** [EINTR] An interrupt ocurred */ + NvSciError_InterruptedCall = 0x00000203, + + /* Device errors */ + /** [ENODEV] No such device */ + NvSciError_NoSuchDevice = 0x00001000, + /** [ENOSPC] No space left on device */ + NvSciError_NoSpace = 0x00001001, + /** [ENXIO] No such device or address */ + NvSciError_NoSuchDevAddr = 0x00001002, + /** [EIO] Input/output error */ + NvSciError_IO = 0x00001003, + /** [ENOTTY] Inappropriate I/O control operation */ + NvSciError_InvalidIoctlNum = 0x00001004, + + /* File system errors */ + /** [ENOENT] No such file or directory*/ + NvSciError_NoSuchEntry = 0x00001100, + /** [EBADF] Bad file descriptor */ + NvSciError_BadFileDesc = 0x00001101, + /** [EBADFSYS] Corrupted file system detected */ + NvSciError_CorruptedFileSys = 0x00001102, + /** [EEXIST] File already exists */ + NvSciError_FileExists = 0x00001103, + /** [EISDIR] File is a directory */ + NvSciError_IsDirectory = 0x00001104, + /** [EROFS] Read-only file system */ + NvSciError_ReadOnlyFileSys = 0x00001105, + /** [ETXTBSY] Text file is busy */ + NvSciError_TextFileBusy = 0x00001106, + /** [ENAMETOOLONG] File name is too long */ + NvSciError_FileNameTooLong = 0x00001107, + /** [EFBIG] File is too large */ + NvSciError_FileTooBig = 0x00001108, + /** [ELOOP] Too many levels of symbolic links */ + NvSciError_TooManySymbolLinks = 0x00001109, + /** [EMFILE] Too many open files in process*/ + NvSciError_TooManyOpenFiles = 0x0000110A, + /** [ENFILE] Too many open files in system */ + NvSciError_FileTableOverflow = 0x0000110B, + /** End of file reached */ + NvSciError_EndOfFile = 0x0000110C, + + + /* Communication errors */ + /** [ECONNRESET] Connection was closed or lost */ + NvSciError_ConnectionReset = 0x00001200, + /** [EALREADY] Pending connection is already in progress */ + NvSciError_AlreadyInProgress = 0x00001201, + /** [ENODATA] No message data available */ + NvSciError_NoData = 0x00001202, + /** [ENOMSG] No message of the desired type available*/ + NvSciError_NoDesiredMessage = 0x00001203, + /** [EMSGSIZE] Message is too large */ + NvSciError_MessageSize = 0x00001204, + /** [ENOREMOTE] Remote node doesn't exist */ + NvSciError_NoRemote = 0x00001205, + + /* Process/thread errors */ + /** [ESRCH] No such process */ + NvSciError_NoSuchProcess = 0x00002000, + + /* Mutex errors */ + /** [ENOTRECOVERABLE] Mutex damaged by previous owner's death */ + NvSciError_MutexNotRecoverable = 0x00002100, + /** [EOWNERDEAD] Previous owner died while holding mutex */ + NvSciError_LockOwnerDead = 0x00002101, + /** [EDEADLK] Taking ownership would cause deadlock */ + NvSciError_ResourceDeadlock = 0x00002102, + + /* NvSci attribute list errors */ + /** Could not reconcile attributes */ + NvSciError_ReconciliationFailed = 0x00010100, + /** Could not validate attributes */ + NvSciError_AttrListValidationFailed = 0x00010101, + + /** End of range for common error codes */ + NvSciError_CommonEnd = 0x00FFFFFF, + + + /* Range 0x01000000 - 0x01FFFFFF : NvSciBuf errors */ + /** Unidentified NvSciBuf error with no additional info */ + NvSciError_NvSciBufUnknown = 0x01000000, + /** End of range for NvSciBuf errors */ + NvSciError_NvSciBufEnd = 0x01FFFFFF, + + + /* Range 0x02000000 - 0x02FFFFFF : NvSciSync errors */ + /** Unidentified NvSciSync error with no additional info */ + NvSciError_NvSciSyncUnknown = 0x02000000, + /** Unsupported configuration */ + NvSciError_UnsupportedConfig = 0x02000001, + /** Provided fence is cleared */ + NvSciError_ClearedFence = 0x02000002, + /* End of range for NvScSync errors */ + NvSciError_NvSciSyncEnd = 0x02FFFFFF, + + + /* Range 0x03000000 - 0x03FFFFFF : NvSciStream errors */ + /** Unidentified NvSciStream error with no additional info */ + NvSciError_NvSciStreamUnknown = 0x03000000, + /** Internal stream resource failure occurred */ + NvSciError_StreamInternalError = 0x30000001, + /** Operation requires stream be fully connected */ + NvSciError_StreamNotConnected = 0x30000200, + /** No stream packet available */ + NvSciError_NoStreamPacket = 0x30001000, + /** End of range for NvSciStream errors */ + NvSciError_NvSciStreamEnd = 0x03FFFFFF, + + + /* Range 0x04000000 - 0x04FFFFFF : NvSciIpc errors */ + /** Unidentified NvSciIpc error with no additional info */ + NvSciError_NvSciIpcUnknown = 0x04000000, + /** End of range for NvSciIpc errors */ + NvSciError_NvSciIpcEnd = 0x04FFFFFF, + + + /* Range 0x05000000 - 0x05FFFFFF : NvSciEvent errors */ + /** Unidentified NvSciEvent error with no additional info */ + NvSciError_NvSciEventUnknown = 0x05000000, + /** End of range for NvSciEvent errors */ + NvSciError_NvSciEventEnd = 0x05FFFFFF, + +} NvSciError; + +/* + * @} + */ + +#endif /* INCLUDED_NVSCI_ERROR_H */ diff --git a/include/linux/nvsciipc_interface.h b/include/linux/nvsciipc_interface.h new file mode 100644 index 00000000..2a968d0a --- /dev/null +++ b/include/linux/nvsciipc_interface.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2019, 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. + */ + +#ifndef __NVSCIIPC_INTERFACE_H__ +#define __NVSCIIPC_INTERFACE_H__ + +/** Invalid VUID definition */ +#define NVSCIIPC_ENDPOINT_VUID_INVALID 0U +/** Invalid authentication token definition */ +#define NVSCIIPC_ENDPOINT_AUTHTOKEN_INVALID 0U +/** current self SOC ID */ +#define NVSCIIPC_SELF_SOCID 0xFFFFFFFFU +/** current self VM ID */ +#define NVSCIIPC_SELF_VMID 0xFFFFFFFFU + +/** + * @brief Handle to the IPC endpoint. + */ +typedef uint64_t NvSciIpcEndpoint; + + +/** + * @brief VUID(VM unique ID) of the IPC endpoint. + */ +typedef uint64_t NvSciIpcEndpointVuid; + +/** + * @brief authentication token of the IPC endpoint. + */ +typedef uint64_t NvSciIpcEndpointAuthToken; + +/** + * @brief Defines topology ID of the IPC endpoint. + */ +typedef struct { + /*! Holds SOC ID */ + uint32_t SocId; + /*! Holds VMID */ + uint32_t VmId; +} NvSciIpcTopoId; + +/**********************************************************************/ +/*********************** Function Definitions *************************/ +/**********************************************************************/ +NvSciError NvSciIpcEndpointGetAuthToken(NvSciIpcEndpoint handle, + NvSciIpcEndpointAuthToken *authToken); + +NvSciError NvSciIpcEndpointValidateAuthTokenLinuxCurrent( + NvSciIpcEndpointAuthToken authToken, + NvSciIpcEndpointVuid *localUserVuid); + +NvSciError NvSciIpcEndpointMapVuid(NvSciIpcEndpointVuid localUserVuid, + NvSciIpcTopoId *peerTopoId, NvSciIpcEndpointVuid *peerUserVuid); + +NvSciError NvSciIpcEndpointGetVuid(NvSciIpcEndpoint handle, + NvSciIpcEndpointVuid *vuid); + +#endif /* __NVSCIIPC_INTERFACE_H__ */ diff --git a/include/uapi/linux/nvsciipc_ioctl.h b/include/uapi/linux/nvsciipc_ioctl.h new file mode 100644 index 00000000..2e11e62b --- /dev/null +++ b/include/uapi/linux/nvsciipc_ioctl.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * + * This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of NVIDIA CORPORATION nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __NVSCIIPC_IOCTL_H__ +#define __NVSCIIPC_IOCTL_H__ + +#include + +#define NVSCIIPC_MAX_EP_NAME 32 + +struct nvsciipc_config_entry { + /* endpoint name */ + char ep_name[NVSCIIPC_MAX_EP_NAME]; + /* node name for shm/sem */ + char dev_name[NVSCIIPC_MAX_EP_NAME]; + uint32_t backend; /* backend type */ + uint32_t nframes; /* frame count */ + uint32_t frame_size; /* frame size */ + /* ep id for inter-Proc/Thread + * queue id for inter-VM + * dev id for inter-Chip + */ + uint32_t id; + uint64_t vuid; /* VM-wide unique id */ +}; + +struct nvsciipc_db { + int num_eps; + struct nvsciipc_config_entry **entry; +}; + +struct nvsciipc_get_vuid { + char ep_name[NVSCIIPC_MAX_EP_NAME]; + uint64_t vuid; +}; + +/* IOCTL magic number - seen available in ioctl-number.txt*/ +#define NVSCIIPC_IOCTL_MAGIC 0xC3 + +#define NVSCIIPC_IOCTL_SET_DB \ + _IOW(NVSCIIPC_IOCTL_MAGIC, 1, struct nvsciipc_db) + +#define NVSCIIPC_IOCTL_GET_VUID \ + _IOWR(NVSCIIPC_IOCTL_MAGIC, 2, struct nvsciipc_get_vuid) + +#define NVSCIIPC_IOCTL_NUMBER_MAX 2 + +#endif /* __NVSCIIPC_IOCTL_H__ */ From dadb881df54fcb5be841e47f675bb61313e8e475 Mon Sep 17 00:00:00 2001 From: Suresh Venkatachalam Date: Tue, 14 Dec 2021 07:40:19 +0000 Subject: [PATCH 2/6] misc: nvsciipc: increase endpt name max size to 64 Increase the endpoint name max size from 32 to 64 Increase the devname max size from 32 to 64 Bug 3437754 Change-Id: Iaa0eef040fe8ad1ebca7309c0abd94a80f5fe42e Signed-off-by: Suresh Venkatachalam Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2641680 Reviewed-by: Sachin Nikam Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- include/uapi/linux/nvsciipc_ioctl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/nvsciipc_ioctl.h b/include/uapi/linux/nvsciipc_ioctl.h index 2e11e62b..7ed1c8ec 100644 --- a/include/uapi/linux/nvsciipc_ioctl.h +++ b/include/uapi/linux/nvsciipc_ioctl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. @@ -34,7 +34,7 @@ #include -#define NVSCIIPC_MAX_EP_NAME 32 +#define NVSCIIPC_MAX_EP_NAME 64 struct nvsciipc_config_entry { /* endpoint name */ From ef59a0da4de2cccef88e143517e233732f1e644e Mon Sep 17 00:00:00 2001 From: joshuac Date: Wed, 3 Aug 2022 19:03:02 +0900 Subject: [PATCH 3/6] misc: nvsciipc: update to support x86 build Added missing fs.h to fix build error. Added debug info for root user only. Added alternative header path for x86 build. Fixed NvSciIpcEndpointMapVuid() API. remove mutex except for SET_DB IOCTL (lockless for read operation). Added more ioctl commands. - NVSCIIPC_IOCTL_GET_DB_BY_NAME - NVSCIIPC_IOCTL_GET_DB_BY_VUID JIRA NVIPC-227 Change-Id: I95fc6f9fff36c9c1df999b11109236b1b3481d62 Signed-off-by: joshuac Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2755193 Reviewed-by: Kurt Yi GVS: Gerrit_Virtual_Submit --- include/uapi/linux/nvsciipc_ioctl.h | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/nvsciipc_ioctl.h b/include/uapi/linux/nvsciipc_ioctl.h index 7ed1c8ec..3cdc3c18 100644 --- a/include/uapi/linux/nvsciipc_ioctl.h +++ b/include/uapi/linux/nvsciipc_ioctl.h @@ -34,7 +34,9 @@ #include -#define NVSCIIPC_MAX_EP_NAME 64 +#define NVSCIIPC_MAX_EP_NAME 64U +#define NVSCIIPC_MAX_RDMA_NAME 64U +#define NVSCIIPC_MAX_IP_NAME 16U struct nvsciipc_config_entry { /* endpoint name */ @@ -50,6 +52,11 @@ struct nvsciipc_config_entry { */ uint32_t id; uint64_t vuid; /* VM-wide unique id */ + char rdma_dev_name[NVSCIIPC_MAX_RDMA_NAME]; + char remote_ip[NVSCIIPC_MAX_IP_NAME]; + uint32_t remote_port; + uint32_t local_port; + uint32_t reserved; }; struct nvsciipc_db { @@ -62,6 +69,18 @@ struct nvsciipc_get_vuid { uint64_t vuid; }; +struct nvsciipc_get_db_by_name { + char ep_name[NVSCIIPC_MAX_EP_NAME]; + struct nvsciipc_config_entry entry; + uint32_t idx; +}; + +struct nvsciipc_get_db_by_vuid { + uint64_t vuid; + struct nvsciipc_config_entry entry; + uint32_t idx; +}; + /* IOCTL magic number - seen available in ioctl-number.txt*/ #define NVSCIIPC_IOCTL_MAGIC 0xC3 @@ -71,6 +90,12 @@ struct nvsciipc_get_vuid { #define NVSCIIPC_IOCTL_GET_VUID \ _IOWR(NVSCIIPC_IOCTL_MAGIC, 2, struct nvsciipc_get_vuid) -#define NVSCIIPC_IOCTL_NUMBER_MAX 2 +#define NVSCIIPC_IOCTL_GET_DB_BY_NAME \ + _IOWR(NVSCIIPC_IOCTL_MAGIC, 3, struct nvsciipc_get_db_by_name) + +#define NVSCIIPC_IOCTL_GET_DB_BY_VUID \ + _IOWR(NVSCIIPC_IOCTL_MAGIC, 4, struct nvsciipc_get_db_by_vuid) + +#define NVSCIIPC_IOCTL_NUMBER_MAX 4 #endif /* __NVSCIIPC_IOCTL_H__ */ From 9766afdf511ad310a9d28beaf0f31fdb296ac600 Mon Sep 17 00:00:00 2001 From: Joshua Cha Date: Thu, 25 Aug 2022 01:21:35 +0900 Subject: [PATCH 4/6] misc: nvsciipc: support Inter-VM in auth APIs 1) nvsciipc KMD * use IVC KMD to query peer VMID (ivc_cdev_get_peer_vmid). * Support Inter-VM in NvSciIpcEndpointMapVuid(). * Added debugging ioctl cmds to debug in userspace level - validate auth token - map vuid * Add peer_vmid to config entry and endpoint DB. * Add IOCTL_GET_DB_SIZE cmd to return DB entry count 2) IVC KMD (ivc-cdev) * Add ivc_cdev_get_peer_vmid() to return peer_vmid of qid. * Add IOCTL_GET_VMID to return guest VM ID JIRA NVIPC-390 JIRA NVIPC-394 Change-Id: I14634fd2d17c4a28b09b9a3f9f2d42c9169e0dfb Signed-off-by: Joshua Cha Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2766220 Reviewed-by: Simon Je Reviewed-by: Kurt Yi Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert GVS: Gerrit_Virtual_Submit --- include/uapi/linux/nvsciipc_ioctl.h | 36 ++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/include/uapi/linux/nvsciipc_ioctl.h b/include/uapi/linux/nvsciipc_ioctl.h index 3cdc3c18..1581530f 100644 --- a/include/uapi/linux/nvsciipc_ioctl.h +++ b/include/uapi/linux/nvsciipc_ioctl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved. * * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. @@ -56,7 +56,7 @@ struct nvsciipc_config_entry { char remote_ip[NVSCIIPC_MAX_IP_NAME]; uint32_t remote_port; uint32_t local_port; - uint32_t reserved; + uint32_t peer_vmid; }; struct nvsciipc_db { @@ -81,6 +81,25 @@ struct nvsciipc_get_db_by_vuid { uint32_t idx; }; +/* for userspace level test, debugging purpose only */ +struct nvsciipc_validate_auth_token { + uint32_t auth_token; + uint64_t local_vuid; +}; + +/* NvSciIpcTopoId type */ +struct nvsciipc_topoid { + uint32_t socid; + uint32_t vmid; +}; + +/* for userspace level test, debugging purpose only */ +struct nvsciipc_map_vuid { + uint64_t vuid; + struct nvsciipc_topoid peer_topoid; + uint64_t peer_vuid; +}; + /* IOCTL magic number - seen available in ioctl-number.txt*/ #define NVSCIIPC_IOCTL_MAGIC 0xC3 @@ -96,6 +115,17 @@ struct nvsciipc_get_db_by_vuid { #define NVSCIIPC_IOCTL_GET_DB_BY_VUID \ _IOWR(NVSCIIPC_IOCTL_MAGIC, 4, struct nvsciipc_get_db_by_vuid) -#define NVSCIIPC_IOCTL_NUMBER_MAX 4 +#define NVSCIIPC_IOCTL_GET_DB_SIZE \ + _IOR(NVSCIIPC_IOCTL_MAGIC, 5, uint32_t) + +/* debugging purpose only */ +#define NVSCIIPC_IOCTL_VALIDATE_AUTH_TOKEN \ + _IOWR(NVSCIIPC_IOCTL_MAGIC, 6, struct nvsciipc_validate_auth_token) + +/* debugging purpose only */ +#define NVSCIIPC_IOCTL_MAP_VUID \ + _IOWR(NVSCIIPC_IOCTL_MAGIC, 7, struct nvsciipc_map_vuid) + +#define NVSCIIPC_IOCTL_NUMBER_MAX 7 #endif /* __NVSCIIPC_IOCTL_H__ */ From efcc11fc9cfc99d041e8a8e4d75aea15be722e0d Mon Sep 17 00:00:00 2001 From: Joshua Cha Date: Sat, 1 Oct 2022 02:53:16 +0900 Subject: [PATCH 5/6] misc: nvsciipc: add get vmid cmd Bug 3813532 Change-Id: I4caa286d4aff5f9d4361b1b34da9bf3257275add Signed-off-by: Joshua Cha Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2787605 Reviewed-by: svc-mobile-coverity Reviewed-by: Simon Je Reviewed-by: Kurt Yi GVS: Gerrit_Virtual_Submit --- include/uapi/linux/nvsciipc_ioctl.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/nvsciipc_ioctl.h b/include/uapi/linux/nvsciipc_ioctl.h index 1581530f..4e57aa02 100644 --- a/include/uapi/linux/nvsciipc_ioctl.h +++ b/include/uapi/linux/nvsciipc_ioctl.h @@ -126,6 +126,9 @@ struct nvsciipc_map_vuid { #define NVSCIIPC_IOCTL_MAP_VUID \ _IOWR(NVSCIIPC_IOCTL_MAGIC, 7, struct nvsciipc_map_vuid) -#define NVSCIIPC_IOCTL_NUMBER_MAX 7 +#define NVSCIIPC_IOCTL_GET_VMID \ + _IOWR(NVSCIIPC_IOCTL_MAGIC, 8, uint32_t) + +#define NVSCIIPC_IOCTL_NUMBER_MAX 8 #endif /* __NVSCIIPC_IOCTL_H__ */ From c6efef8f7414c008aa295dfd6b2db69a8ce29fdc Mon Sep 17 00:00:00 2001 From: Simon Je Date: Thu, 15 Dec 2022 11:53:31 +0900 Subject: [PATCH 6/6] drivers: misc: Fix license in nvscierror.h It is updated to be compatible with GPL license. bug 3871403 Change-Id: I5a6a05b405d8eaa166d0f83d287fccc443a91115 Signed-off-by: Simon Je Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2828259 Reviewed-by: svcacv Reviewed-by: Suresh Venkatachalam Reviewed-by: svc_kernel_abi Reviewed-by: Vipin Kumar GVS: Gerrit_Virtual_Submit --- include/linux/nvscierror.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/include/linux/nvscierror.h b/include/linux/nvscierror.h index 9e1140c5..10340a2c 100644 --- a/include/linux/nvscierror.h +++ b/include/linux/nvscierror.h @@ -1,11 +1,14 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * - * NVIDIA Corporation and its licensors retain all intellectual property - * and proprietary rights in and to this software, related documentation - * and any modifications thereto. Any use, reproduction, disclosure or - * distribution of this software and related documentation without an express - * license agreement from NVIDIA Corporation is strictly prohibited. + * 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. */ /*