qemu-server/PVE/QemuServer
Dominik Csapak 48ada6982f pci: mdev: adapt to NVIDIA's modern interface with kernel >= 6.8
Since kernel 6.8, NVIDIAs vGPU driver does not use the generic mdev
interface anymore, since they relied on a feature there which is not
available anymore. IIUC the kernel [0] recommends drivers to implement
their own device specific features since putting all in the generic one
does not make sense.

They now have an 'nvidia' folder in the device sysfs path, which
contains the files `creatable_vgpu_types`/`current_vgpu_type` to
control the virtual functions model, and then the whole virtual function
has to be passed through (although without resetting and changing to the
vfio-pci driver).

This patch implements changes so that from a config perspective, it
still is an mediated device, and we map the functionality iff the device
has no mediated devices but the new NVIDIAs sysfsapi and the model name
is 'nvidia-<..>'

It behaves a bit different than mdevs and normal pci passthrough, as we
have to choose the correct device immediately since it's bound to the
pciid, but we must not bind the device to vfio-pci as the NVIDIA driver
implements this functionality itself.

When cleaning up, we iterate over all reserved devices (since for a
mapping we can't know at this point which was chosen besides looking at
the reservations) and reset the vgpu model to '0', so it frees up the
reservation from NVIDIAs side. (We also do that in a loop, since it's
not always immediately ready after QEMU closes)

A general problem (but that was previously also the case) is that a
showcmd (for a not running guest) reserves the pciids, which might block
an execution of a different real vm. This is now a bit more problematic
as we (temporarily) set the vgpu type then.

0: https://docs.kernel.org/driver-api/vfio-pci-device-specific-driver-acceptance.html

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by: Christoph Heiss <c.heiss@proxmox.com>
Reviewed-by: Christoph Heiss <c.heiss@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-24 18:43:52 +02:00
..
Agent.pm tree wide cleanup of s/return undef/return/ 2020-10-16 16:20:05 +02:00
CGroup.pm fix #5528: override cgroup methods to call systemd via dbus 2024-07-23 08:05:53 +02:00
Cloudinit.pm fix 4493: cloud-init: fix generated Windows config 2024-07-30 19:49:28 +02:00
CPUConfig.pm cpu config: fix get_cpu_bitness always reverting to default cpu type 2024-04-24 11:37:28 +02:00
Drive.pm drive: tpm: fix default version in schema 2024-07-01 10:37:48 +02:00
Helpers.pm vm start: set higher timeout if using PCI passthrough 2023-10-06 18:12:07 +02:00
ImportDisk.pm disk import: warn when fallback is used instead of requested format 2024-03-14 14:01:12 +01:00
Machine.pm move helper to check running QEMU version out of the 'Machine' module 2024-07-30 21:19:51 +02:00
Makefile introduce QMPHelpers module 2023-09-18 17:08:48 +02:00
Memory.pm add memory parser 2023-09-18 17:08:48 +02:00
Monitor.pm monitor: allow passing timeout for a HMP command 2024-06-11 13:56:44 +02:00
OVF.pm fix typos in user-visible strings 2024-10-24 13:15:06 +02:00
PCI.pm pci: mdev: adapt to NVIDIA's modern interface with kernel >= 6.8 2024-10-24 18:43:52 +02:00
QMPHelpers.pm move helper to check running QEMU version out of the 'Machine' module 2024-07-30 21:19:51 +02:00
USB.pm fix typos in user-visible strings 2024-10-24 13:15:06 +02:00