How to attach vGPU MDEV profile to VM or template

Hello everyone!

I am using GPU NVIDIA Tesla P40 on hypevisor ubuntu 24.04, frontend OpenNebula 6.10.0.
I want to config the hypervisor in order to use NVIDIA vGPU.
Due to GPUTesla P40 do not support SR-IOV, so i have used MDEV (Mediated devices) to virtualized GPU. However I am having a problem: i can Passthrough GPU to a VM but i can not attach Mediated devices to VM (the Mediated devices do not show in PCI Devices)

Here is Steps to reproduce:

Enable SR-IOV, IOMMU:

lsmod | grep vfio

nvidia_vgpu_vfio 118784 10
mdev 24576 1 nvidia_vgpu_vfio
kvm 1404928 2 nvidia_vgpu_vfio,kvm_intel
vfio_pci 16384 0
vfio_pci_core 86016 2 nvidia_vgpu_vfio,vfio_pci
irqbypass 12288 3 vfio_pci_core,nvidia_vgpu_vfio,kvm
vfio_iommu_type1 49152 0
vfio 69632 5 vfio_pci_core,nvidia_vgpu_vfio,vfio_iommu_type1,vfio_pci
iommufd 98304 1 vfio

lspci | grep NVIDIA

05:00.0 3D controller: NVIDIA Corporation GP102GL [Tesla P40] (rev a1)

Install mdevctl and check profile Tesla P40 and check profile generate:

mdevctl types

0000:05:00.0
.
.
.
nvidia-47
Available instances: 11
Device API: vfio-pci
Name: GRID P40-2Q
Description: num_heads=4, frl_config=60, framebuffer=2048M, max_resolution=7680x4320, max_instance=12
nvidia-48
Available instances: 0
Device API: vfio-pci
Name: GRID P40-3Q
Description: num_heads=4, frl_config=60, framebuffer=3072M, max_resolution=7680x4320, max_instance=8

Mdev creation:

Generate Mdev UUID’s:

echo “2a79cc29-8fe0-48ab-85f0-59d925c44cd1” > create

mdevctl define -a -u 2a79cc29-8fe0-48ab-85f0-59d925c44cd1

mdevctl list

2a79cc29-8fe0-48ab-85f0-59d925c44cd1 0000:05:00.0 nvidia-47 auto (defined)

/var/tmp/one/im/kvm-probes.d/host/system/pci.rb

]
PCI = [
TYPE = “10de:1b38:0302” ,
VENDOR = “10de” ,
VENDOR_NAME = “NVIDIA Corporation” ,
DEVICE = “1b38” ,
CLASS = “0302” ,
CLASS_NAME = “3D controller” ,
ADDRESS = “0000:05:00:0” ,
SHORT_ADDRESS = “05:00.0” ,
DOMAIN = “0000” ,
BUS = “05” ,
SLOT = “00” ,
FUNCTION = “0” ,
NUMA_NODE = “0” ,
DEVICE_NAME = “NVIDIA Corporation GP102GL [Tesla P40]”
]

Now, i can see that PCI device GPU NVIDIA when i attach pci device to VM but i can not use MDEV profile. Please help me to trouble shoot the issue. Thanks


Hi @Khang_Nguyen_Phuc

Please, take a look at this thread where another user explains how to configure vGPU using mdev. This should applly to your use case.