GVM User Suite
User tools for the GVM open source project.
Functions
api.c File Reference
#include <gpu/nvidia/resman/api.h>
#include <gpu/nvidia/resman/classes.h>
#include <gpu/nvidia/resman/ioctl.h>
#include <gpu/nvidia/resman/types.h>
#include <gpu/nvidia/resources.h>
#include <gpu/mdev.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
Include dependency graph for api.c:

Go to the source code of this file.

Functions

uint8_t rm_version_check (int ctl_fd, uint8_t ignore_version, const char *version)
 Version check for the RM API. More...
 
struct NvResourcerm_alloc_res (int fd, struct NvResource *parent, uint32_t object, uint32_t rm_class, void *data)
 Allocates a Node for a resource. More...
 
uint8_t rm_free_res (int fd, struct NvResource *object)
 Frees a Node for a Resource. More...
 
void rm_free_tree (int fd, struct NvResource *root)
 Frees a resource tree for the system. More...
 
void * rm_ctrl_res (int fd, uint32_t client, uint32_t device, uint32_t command, void *data, uint32_t size)
 Control resource command. More...
 
uint8_t rm_alloc_os_event (int fd, uint32_t client_id, uint32_t device_id)
 Allocates an Operating System Event. More...
 

Function Documentation

◆ rm_alloc_os_event()

uint8_t rm_alloc_os_event ( int  fd,
uint32_t  client_id,
uint32_t  device_id 
)

Allocates an Operating System Event.

Todo:
Proper logging if a failure occurs.

Definition at line 208 of file api.c.

Here is the caller graph for this function:

◆ rm_alloc_res()

struct NvResource* rm_alloc_res ( int  fd,
struct NvResource parent,
uint32_t  object,
uint32_t  rm_class,
void *  data 
)

Allocates a Node for a resource.

Possible Failures:

Invalid File Descriptor - Occurs when fd is -1.

Incorrect File Descriptor - Occurs when fd is an incorrect descriptor.

Todo:
Inform user of status error if there is an error.

Definition at line 65 of file api.c.

Here is the caller graph for this function:

◆ rm_ctrl_res()

void* rm_ctrl_res ( int  fd,
uint32_t  client,
uint32_t  device,
uint32_t  command,
void *  data,
uint32_t  size 
)

Control resource command.

Possible Failures:

Invalid File Descriptor - Occurs when fd is -1.

Incorrect File Descriptor - Occurs when the fd is an incorrect file descriptor.

RM Failure - Occurs when incorrect information is placed.

Todo:
Update to use proper logging mechanism (ERROR).

Definition at line 164 of file api.c.

Here is the caller graph for this function:

◆ rm_free_res()

uint8_t rm_free_res ( int  fd,
struct NvResource object 
)

Frees a Node for a Resource.

Possible Failures:

Invalid File Descriptor - Occurs when fd is -1.

Incorrect File Descriptor - Occurs when the fd is an incorrect file descriptor.

Definition at line 124 of file api.c.

Here is the caller graph for this function:

◆ rm_free_tree()

void rm_free_tree ( int  fd,
struct NvResource root 
)

Frees a resource tree for the system.

This is a mechanism by which we can free an entire tree.

Side Effect:
RM Side Effect: Deallocates an object with a specific root in the RM Core.
Parameters
fd- File for deallocating the device on.
root- Root we are deallocating from.

Definition at line 138 of file api.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rm_version_check()

uint8_t rm_version_check ( int  ctl_fd,
uint8_t  ignore_version,
const char *  version 
)

Version check for the RM API.

Possible Failures:

Invalid File Descriptor - This occurs when ctl_fd is -1.

Invalid RM Version - This will occur when there is a mismatch on the driver and the user suite.

Seg Fault - This occurs if version is not pointing to NULL but is pointing to a previously allocated memory address.

Definition at line 39 of file api.c.

Here is the caller graph for this function: