GVM User Suite
User tools for the GVM open source project.
resources.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 2666680 Ontario Inc.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  */
19 #ifndef GPU_NVIDIA_RESOURCES_H
20 #define GPU_NVIDIA_RESOURCES_H
21 
22 #include <gpu/mdev.h>
23 
24 #include <stdint.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
39 struct NvResource {
40  int fd;
43  uint32_t client;
44  uint32_t parent;
45  uint32_t object;
46  uint32_t rm_class;
47  void *class_info;
48  struct NvResource* next;
49  struct NvResource* child;
50 };
51 
56 struct NvMdevGpu {
57  int ctl_fd;
58  int dev_fd;
59  int mdev_fd;
60  struct Gpu* gpu;
61  uint32_t root;
62  uint32_t device;
63  uint32_t sub_device;
64  uint32_t mdev_config;
65  struct NvResource* dev;
66  struct NvResource* sdev;
67  struct NvResource* mdev;
68 };
69 
74 struct NvMdev {
75  int fd;
76  struct NvMdevGpu* gpus[32];
77  struct NvResource* res;
78 };
79 
80 #ifdef __cplusplus
81 };
82 #endif
83 
84 #endif
GPU Base Structure.
Definition: mdev.h:33
Control Mechanism for the NVIDIA GPU.
Definition: resources.h:56
struct NvResource * sdev
Subdevice.
Definition: resources.h:66
uint32_t device
Device id for controlling the physical gpu.
Definition: resources.h:62
uint32_t sub_device
Sub device id.
Definition: resources.h:63
struct Gpu * gpu
GPU structure corresponding to the GPU.
Definition: resources.h:60
int mdev_fd
Mdev file descriptor.
Definition: resources.h:59
int ctl_fd
Control Nvidia control file description.
Definition: resources.h:57
uint32_t mdev_config
Configurator for mdev devices.
Definition: resources.h:64
uint32_t root
Initial client.
Definition: resources.h:61
int dev_fd
Device Nvidia file descriptor.
Definition: resources.h:58
struct NvResource * mdev
Mdev device.
Definition: resources.h:67
struct NvResource * dev
Device.
Definition: resources.h:65
Structure for managing the mediated stack.
Definition: resources.h:74
int fd
Control file descriptor.
Definition: resources.h:75
struct NvMdevGpu * gpus[32]
Available GPUs.
Definition: resources.h:76
struct NvResource * res
Resource tree.
Definition: resources.h:77
Resource for managing NVIDIA kernel module objects.
Definition: resources.h:39
struct NvResource * next
Next child on the level.
Definition: resources.h:48
void * class_info
Class info for the resource.
Definition: resources.h:47
uint32_t rm_class
Class of the resource.
Definition: resources.h:46
uint32_t client
All resources require a client/root.
Definition: resources.h:43
uint32_t parent
Parent of the resource.
Definition: resources.h:44
struct NvResource * child
Child of the resource.
Definition: resources.h:49
uint32_t object
Object of the resource.
Definition: resources.h:45