NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release

Detailed Description

Common constants, error codes, and enumerations shared across all NvLog components.

Provide client with an interface to control logging as follows:

Data Structures

struct  NvLogCmd_t
 Structure type for NvLog logging control command. More...
 

Macros

#define NVLOG_LLC_PID_FOR_GLOBAL   (-1)
 Special PID for global log level control. More...
 
#define NVLOG_DEFAULT_VM_LOG_LEVEL   (NVOS_LOG_SEVERITY_INFO)
 
#define EOK   (0)
 
#define NVLOG_USE_DEFAULT_TIMEOUT   (0)
 Pass as timeout_ms to NvLog_Control() to use the default IPC command timeout (NVLOG_IPC_TIMEOUT_US = 1 second). More...
 
#define NVLOG_DT_NODE   "/nvlog_gos"
 
#define NVLOG_DT_STATUS   "status"
 
#define NVLOG_DT_IVC_CLIENT_EP_NAME   "ivc_client_ep_name"
 
#define NVLOG_SIGTERM   (15)
 
#define NVLOG_SIGABRT   (6)
 
#define NVLOG_SIGINT   (2)
 
#define NVLOG_VM_LOGGING_DISABLE   (0xFFU)
 

Enumerations

enum  NvLogLevel {
  NVLOG_LEVEL_SHUTDOWN = NVOS_LOG_SEVERITY_SHUTDOWN,
  NVLOG_LEVEL_CRITICAL = NVOS_LOG_SEVERITY_CRITICAL,
  NVLOG_LEVEL_ERROR = NVOS_LOG_SEVERITY_ERROR,
  NVLOG_LEVEL_WARNING = NVOS_LOG_SEVERITY_WARNING,
  NVLOG_LEVEL_NOTICE = NVOS_LOG_SEVERITY_NOTICE,
  NVLOG_LEVEL_INFO = NVOS_LOG_SEVERITY_INFO,
  NVLOG_LEVEL_DEBUG = NVOS_LOG_SEVERITY_DEBUG1,
  NVLOG_LEVEL_LOG_DISABLE = NVLOG_VM_LOGGING_DISABLE
}
 Enum for NvLog log levels. More...
 
enum  NvLogError {
  NVLOG_SUCCESS = 0,
  NVLOG_ERROR_INVALID_PARAM,
  NVLOG_ERROR_MUTEX_FAILED,
  NVLOG_ERROR_NOT_INITIALIZED,
  NVLOG_ERROR_ALREADY_INITIALIZED,
  NVLOG_ERROR_DT_FAILED,
  NVLOG_ERROR_IPC_FAILED,
  NVLOG_ERROR_IPC_TIMEOUT,
  NVLOG_ERROR_CMD_FAILED,
  NVLOG_ERROR_IVC_NOT_READY
}
 Enum for NvLog error codes. More...
 
enum  NvLogAction {
  NVLOG_ACTION_DISABLE = 0U,
  NVLOG_ACTION_ENABLE = 1U,
  NVLOG_ACTION_FLUSH = 2U,
  NVLOG_ACTION_SET_LOG_LEVEL = 3U,
  NVLOG_ACTION_MAX = 4U
}
 Enum for NvLog control actions. More...
 
enum  NvLogTarget {
  NVLOG_TARGET_NVLOG_SERVER = 0U,
  NVLOG_TARGET_VM0 = 1U,
  NVLOG_TARGET_VM1 = 2U,
  NVLOG_TARGET_VM2 = 3U,
  NVLOG_TARGET_HVRTOS_NS = 4U,
  NVLOG_TARGET_FSI = 5U,
  NVLOG_TARGET_OESP = 6U,
  NVLOG_TARGET_DCE = 7U,
  NVLOG_TARGET_DLA = 8U,
  NVLOG_TARGET_PVA = 9U,
  NVLOG_TARGET_RCE = 10U,
  NVLOG_TARGET_MAX = 11U
}
 Enum for NvLog targets. More...
 

Functions

NvLogError NvLog_Open (void)
 Opens and initializes the NvLog library. More...
 
NvLogError NvLog_Control (NvLogCmd_t *cmd, int32_t timeout_ms)
 Controls logging operations. More...
 
NvLogError NvLog_Close (void)
 Closes the NvLog library. More...
 

Macro Definition Documentation

◆ EOK

#define EOK   (0)

Definition at line 39 of file nvlog_common_defs.h.

◆ NVLOG_DEFAULT_VM_LOG_LEVEL

#define NVLOG_DEFAULT_VM_LOG_LEVEL   (NVOS_LOG_SEVERITY_INFO)

Definition at line 34 of file nvlog_cmd_type.h.

◆ NVLOG_DT_IVC_CLIENT_EP_NAME

#define NVLOG_DT_IVC_CLIENT_EP_NAME   "ivc_client_ep_name"

DT property name for IVC client endpoint

Definition at line 57 of file nvlog_common_defs.h.

◆ NVLOG_DT_NODE

#define NVLOG_DT_NODE   "/nvlog_gos"

DT node path for NvLog

Definition at line 51 of file nvlog_common_defs.h.

◆ NVLOG_DT_STATUS

#define NVLOG_DT_STATUS   "status"

DT property name for status

Definition at line 54 of file nvlog_common_defs.h.

◆ NVLOG_LLC_PID_FOR_GLOBAL

#define NVLOG_LLC_PID_FOR_GLOBAL   (-1)

Special PID for global log level control.

Definition at line 31 of file nvlog_cmd_type.h.

◆ NVLOG_SIGABRT

#define NVLOG_SIGABRT   (6)

Abort signal

Definition at line 68 of file nvlog_common_defs.h.

◆ NVLOG_SIGINT

#define NVLOG_SIGINT   (2)

Interrupt signal (Ctrl+C)

Definition at line 71 of file nvlog_common_defs.h.

◆ NVLOG_SIGTERM

#define NVLOG_SIGTERM   (15)

Termination signal

Definition at line 65 of file nvlog_common_defs.h.

◆ NVLOG_USE_DEFAULT_TIMEOUT

#define NVLOG_USE_DEFAULT_TIMEOUT   (0)

Pass as timeout_ms to NvLog_Control() to use the default IPC command timeout (NVLOG_IPC_TIMEOUT_US = 1 second).

Definition at line 43 of file nvlog_common_defs.h.

◆ NVLOG_VM_LOGGING_DISABLE

#define NVLOG_VM_LOGGING_DISABLE   (0xFFU)

VM logging is disabled

Definition at line 74 of file nvlog_common_defs.h.

Enumeration Type Documentation

◆ NvLogAction

Enum for NvLog control actions.

Action commands for logging control

Note
nvlog_server only supports DISABLE, ENABLE, and FLUSH
Enumerator
NVLOG_ACTION_DISABLE 

Disable logging.

NVLOG_ACTION_ENABLE 

Enable logging.

NVLOG_ACTION_FLUSH 

Flush logs.

NVLOG_ACTION_SET_LOG_LEVEL 

Set log level of a process.

NVLOG_ACTION_MAX 

Max enum for validation check.

Definition at line 113 of file nvlog_common_defs.h.

◆ NvLogError

enum NvLogError

Enum for NvLog error codes.

Common error codes used across GOS and server

Enumerator
NVLOG_SUCCESS 

Success.

NVLOG_ERROR_INVALID_PARAM 

Invalid Parameter.

NVLOG_ERROR_MUTEX_FAILED 

Mutex lock/unlock failure.

NVLOG_ERROR_NOT_INITIALIZED 

NvSciIpc channel is not initialized.

NVLOG_ERROR_ALREADY_INITIALIZED 

NvSciIpc channel is already initialized.

NVLOG_ERROR_DT_FAILED 

DT node/property for NvSciIpc endpoint is not found.

NVLOG_ERROR_IPC_FAILED 

NvSciIpc communication is failed.

NVLOG_ERROR_IPC_TIMEOUT 

NvSciIpc communication is failed due to timeout.

NVLOG_ERROR_CMD_FAILED 

Command is not successfully executed.

NVLOG_ERROR_IVC_NOT_READY 

NvSciIpc connection is not ready.

Definition at line 85 of file nvlog_common_defs.h.

◆ NvLogLevel

enum NvLogLevel

Enum for NvLog log levels.

These values are directly assigned from NVOS_LOG_SEVERITY_* definitions from nvos_s3_tegra_log.h to ensure 1:1 mapping across all logging layers without translation overhead.

Enumerator
NVLOG_LEVEL_SHUTDOWN 

Shutdown - System shutdown or fatal error.

NVLOG_LEVEL_CRITICAL 

Critical - Critical error condition.

NVLOG_LEVEL_ERROR 

Error - Error condition.

NVLOG_LEVEL_WARNING 

Warning - Warning condition.

NVLOG_LEVEL_NOTICE 

Notice - Normal but significant condition.

NVLOG_LEVEL_INFO 

Info - Informational message.

NVLOG_LEVEL_DEBUG 

Debug - Debug-level message.

NVLOG_LEVEL_LOG_DISABLE 

Log Disable (special value for global LLC at logging entity level)

Definition at line 43 of file nvlog_cmd_type.h.

◆ NvLogTarget

Enum for NvLog targets.

Target entities in the logging system

Enumerator
NVLOG_TARGET_NVLOG_SERVER 

Log Server.

NVLOG_TARGET_VM0 

Guest VM0

NVLOG_TARGET_VM1 

Guest VM1

NVLOG_TARGET_VM2 

Guest VM2

NVLOG_TARGET_HVRTOS_NS 

HVRTOS non-secure processes.

NVLOG_TARGET_FSI 

FSI Firmware.

NVLOG_TARGET_OESP 

OESP Firmware.

NVLOG_TARGET_DCE 

DCE Firmware.

NVLOG_TARGET_DLA 

DLA Firmware.

NVLOG_TARGET_PVA 

PVA Firmware.

NVLOG_TARGET_RCE 

RCE Firmware.

NVLOG_TARGET_MAX 

All targets.

Definition at line 130 of file nvlog_common_defs.h.

Function Documentation

◆ NvLog_Close()

NvLogError NvLog_Close ( void  )

Closes the NvLog library.

This function closes the NvSciIpc endpoint, de-initializes NvSciIpc, and cleans up all resources.

Return values
NVLOG_SUCCESSif successful, otherwise an error code
NVLOG_ERROR_NOT_INITIALIZEDNvSciIpc connection is not initialized
NVLOG_ERROR_IPC_FAILEDFail to close the established NvSciIpc connection
NVLOG_ERROR_MUTEX_FAILEDFail to lock or unlock a mutex
Precondition
This API must be called after NvLog_Open() is successful.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvLog_Control()

NvLogError NvLog_Control ( NvLogCmd_t *  cmd,
int32_t  timeout_ms 
)

Controls logging operations.

This function supports various logging control actions such as enabling or disabling logging, flushing logs, and setting log levels for specific entities.

Parameters
[in]cmdControl parameters specifying the action and parameters Clients must fill cmd structure according to cmd->action.
  • action = NVLOG_ACTION_ENABLE
    • No need to fill other members, they are ignored
  • action = NVLOG_ACTION_DISABLE
    • No need to fill other members, they are ignored
  • action = NVLOG_ACTION_FLUSH
    • No need to fill other members, they are ignored
  • action = NVLOG_ACTION_SET_LOG_LEVEL the following fields must be set:
    • cmd->target
      • Any logging entity ID defined in nvlog_entity_ids.h
    • cmd->level_control.pid
      • NVLOG_LLC_PID_FOR_GLOBAL for global LLC at entity level
      • any valid PID for process-level control
    • cmd->level_control.level
      • Any valid log level defined in NvLogLevel enum
[in]timeout_msTimeout in milliseconds for the operation. If NVLOG_USE_DEFAULT_TIMEOUT or negative, the default timeout (=500ms) will be used.
Return values
NVLOG_SUCCESSif successful, otherwise an error code
NVLOG_ERROR_INVALID_PARAMThe parameter is invalid
NVLOG_ERROR_NOT_INITIALIZEDNvSciIpc connection is not initialized
NVLOG_ERROR_IPC_TIMEOUTA command is not sent within the timeout_ms
NVLOG_ERROR_CMD_FAILEDA command is not successfully executed
NVLOG_ERROR_MUTEX_FAILEDFail to lock or unlock a mutex
Precondition
This API must be called after NvLog_Open() is successful.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: "NvSciIpcEndpoint"
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvLog_Open()

NvLogError NvLog_Open ( void  )

Opens and initializes the NvLog library.

This function initializes the NvSciIpc, retrieves the NvSciIpc endpoint name from the device tree, opens the NvSciIpc endpoint and establish NvSciIpc connection.

Return values
NVLOG_SUCCESSif successful, otherwise an error code
NVLOG_ERROR_NOT_INITIALIZEDNvSciIpc connection for logging control is not established due to NvSciIpc communication failure or an internal error
NVLOG_ERROR_IPC_TIMEOUTNvSciIpc connection for logging control is not established within a timeout
NVLOG_ERROR_ALREADY_INITIALIZEDNvSciIpc connection is already established
NVLOG_ERROR_DT_FAILEDFail to find an NvSciIpc endpoint in the device tree
NVLOG_ERROR_MUTEX_FAILEDFail to lock or unlock a mutex
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: "NvSciIpcEndpoint"
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: No
  • Maturity: GA