30 static const char SIGN[128] = {
31 0x47, 0xab, 0x8d, 0x39, 0xb3, 0xaf, 0xd0, 0x2c, 0x79, 0x6f, 0xd0, 0xc7, 0x7a, 0x78, 0x84, 0x68,
32 0xf0, 0x9b, 0x69, 0xe8, 0xb6, 0xc2, 0xc5, 0x05, 0x59, 0x97, 0xf2, 0x0f, 0x77, 0x3a, 0x94, 0x91,
33 0x92, 0x56, 0x2d, 0xf0, 0x4f, 0xae, 0xa6, 0x4d, 0xcc, 0x51, 0x32, 0x17, 0xe5, 0xda, 0xf0, 0x94,
34 0x42, 0x93, 0x51, 0x05, 0x49, 0xe9, 0x61, 0xfd, 0x22, 0x24, 0x6c, 0x8f, 0x88, 0xe3, 0x16, 0x63,
35 0x91, 0x04, 0x20, 0x6a, 0xea, 0x27, 0xc4, 0xe7, 0x11, 0xfc, 0x88, 0x24, 0xb9, 0xaa, 0x1b, 0x85,
36 0xc5, 0x1a, 0x48, 0x7f, 0x99, 0xf4, 0x8e, 0xda, 0x55, 0x2b, 0x4a, 0xfe, 0x48, 0x79, 0x75, 0x78,
37 0x48, 0x16, 0x02, 0x0f, 0x22, 0xc2, 0x9d, 0x20, 0xfa, 0xbb, 0x21, 0x39, 0x56, 0x78, 0xd8, 0x80,
38 0x96, 0x5c, 0x5c, 0xe4, 0x7c, 0xad, 0x87, 0x24, 0x20, 0x70, 0xad, 0x63, 0x84, 0x96, 0x92, 0x3f
44 return ((client + gpu_id) << 8) | (handle & ((1 << 8) - 1));
64 for (
int i = 0; i < 32 && probed_ids.
gpu_ids[i] != 0xFFFFFFFF; ++i) {
80 attach_ids.
gpu_ids[1] = 0xFFFFFFFF;
89 uint32_t sub_dev_alloc = 0;
119 "Created gpu: 0x%.8X (0x%.4X, 0x%.4X, 0x%.4X, 0x%.4X)\n",
133 for (
int i = 0; i < 32 && ret.
gpus[i] != NULL; ++i) {
135 "Destroyed gpu: 0x%.8X (0x%.4X, 0x%.4X, 0x%.4X, 0x%.4X)\n",
163 for (
int i = 0; i < 32 && mgr->
gpus[i] != NULL; ++i) {
165 "Destroyed gpu: 0x%.8X (0x%.4X, 0x%.4X, 0x%.4X, 0x%.4X)\n",
192 for (
int i = 0; i < 32 && mgr->
gpus[i] != NULL; ++i) {
194 struct Gpu *ggpu = gpu->
gpu;
197 for (
size_t j = 0; j < gpu_size && !valid; ++j) {
198 struct Gpu req_gpu = limited[j];
201 (req_gpu.
domain == 0xFFFFFFFF ||
203 (req_gpu.
bus == 0xFFFFFFFF ||
204 req_gpu.
bus == ggpu->
bus) &&
205 (req_gpu.
slot == 0xFFFFFFFF ||
221 if (!valid && limited != NULL && gpu_size > 0)
224 for (
size_t j = 0; j < mdev_size; ++j) {
233 strcpy(mdev.
pact,
"NVIDIA-vComputeServer,9.0;Quadro-Virtual-DWS,5.0");
236 if (request.
disp != NULL) {
251 request.
v_dev_id == 0xFFFFFFFFFFFFFFFF ?
255 request.
p_dev_id == 0xFFFFFFFFFFFFFFFF ?
269 for (
int i = 0; i < 32 && mgr->
gpus[i] != NULL; ++i) {
void * rm_ctrl_res(int fd, uint32_t client, uint32_t device, uint32_t command, void *data, uint32_t size)
Control resource command.
void rm_free_tree(int fd, struct NvResource *root)
Frees a resource tree for the system.
#define RM_CTRL(fd, res, cmd, data)
Controls a RM Resource.
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.
int nv_open_dev(uint16_t minor)
Opens a traditional NVIDIA device.
void register_nv_mgr_mdevs(struct NvMdev *mgr)
Registers mdevs on the OS.
void create_nv_mgr_mdevs(struct NvMdev *mgr, struct Gpu *limited, size_t gpu_size, struct MDevRequest *requested, size_t mdev_size)
Creates necessary mediated devices on GPUs.
struct NvMdev create_nv_mgr()
Creates a NVIDIA manager object.
void free_nv_mgr(struct NvMdev *mgr)
Deletes a NVIDIA manager object.
static const char SIGN[128]
Hardcoded signature.
static uint32_t compose_manager_id(uint32_t client, uint32_t gpu_id, uint32_t handle)
Inline function to create device ids.
#define NV0000_GET_PCI_INFO
Command for rm control res to get pci info for the gpu id.
#define NV0000_GET_GPU_INFO
Command to get the GPU Info.
#define NV0000_ATTACH_IDS
Command to attach a gpu id to the driver.
#define NV0000_GET_PROBED_IDS
Command for rm control res to get a list of all probed ids.
#define NV0080_CLASS
Command to allocate a Nv0080 device.
#define NV2080_CLASS
Command to allocate a Nv2080 device.
#define NV2080_GET_BUS_PCI_INFO
Command to get the BUS PCI info.
#define NVA081_REG_MDEV
Command for rm control res to register mdevs.
#define NVA081_CLASS
Command to allocate a NvA081 device.
#define NVA081_ADD_MDEV
Command for rm control res to add a mdev to the list of mdevs.
uint32_t sub_dev_id
Sub device ID.
uint32_t dev_id
Device ID.
uint32_t identifier
Identifier for the GPU.
uint32_t device_id
Device id for the PCI device.
uint32_t slot
Slot for the PCI device.
uint32_t sub_vendor_id
Sub vendor id for the PCI device.
uint32_t bus
Bus for the PCI device.
uint32_t sub_device_id
Sub device id for the PCI device.
uint32_t vendor_id
Vendor id for the PCI device.
uint32_t function
Function for the PCI device.
uint32_t domain
Domain for the PCI device.
Mediated Device Request Structure.
uint32_t map_vid_size
Mappable video size (IN MEGABYTES).
const char * name
Name of the GPU.
uint8_t ecc_support
If the Mediated GPU has ECC supported.
uint32_t bar1_len
Bar 1 Length.
uint8_t multi_mdev
If multiple mdevs supported.
uint32_t max_inst
Max number of mediated GPUs.
uint64_t v_dev_id
Virtual device id.
uint32_t fb_res
Frame buffer reserved (IN MEGABYTES).
uint64_t p_dev_id
Physical device id.
uint32_t fb_len
Frame buffer length (IN MEGABYTES).
uint32_t num
Number of the mdev.
const char * gpu_class
GPU Class structure.
struct VirtDisplay * disp
Virtual display structure.
Attaches the following ids to the GPU driver.
uint32_t gpu_ids[32]
List of GPU Ids to attach.
Gets GPU specific information.
uint32_t gpu_id
GPU Id to get the information from.
uint32_t dev_inst
Device instance for the GPU.
Gets the PCI info for a given gpu.
uint16_t bus
Bus for the GPU.
uint32_t gpu_id
GPU Id to get PCI info from.
uint32_t domain
Domain for the GPU.
uint16_t slot
Slot for the GPU.
Gets a list of all probed Ids.
uint32_t gpu_ids[32]
GPU IDs available.
uint32_t hClientShare
Client share flag.
uint32_t deviceId
Device ID.
Control Mechanism for the NVIDIA GPU.
struct NvResource * sdev
Subdevice.
uint32_t device
Device id for controlling the physical gpu.
uint32_t sub_device
Sub device id.
struct Gpu * gpu
GPU structure corresponding to the GPU.
int ctl_fd
Control Nvidia control file description.
uint32_t mdev_config
Configurator for mdev devices.
uint32_t root
Initial client.
int dev_fd
Device Nvidia file descriptor.
struct NvResource * mdev
Mdev device.
struct NvResource * dev
Device.
Structure for managing the mediated stack.
int fd
Control file descriptor.
struct NvMdevGpu * gpus[32]
Available GPUs.
struct NvResource * res
Resource tree.
void * class_info
Class info for the resource.
uint32_t object
Object of the resource.
Creates an MDev Config to be sent into the RM core.
uint32_t gpu_instance_size
uint32_t frl_config
Frame rate limiter.
uint32_t max_res_y
Max resolution Y.
uint32_t frl_enable
If we use the frame rate limiter.
uint32_t max_res_x
Max resolution X.
uint32_t num_heads
Number of monitor heads.