[pve-devel] applied: [PATCH qemu-server v2 1/2] automatically add 'uuid' parameter when passing through NVIDIA vGPU

DERUMIER, Alexandre Alexandre.DERUMIER at groupe-cyllene.com
Wed Aug 17 00:57:47 CEST 2022


Hi,
sorry to be late,
I  justh ave tested this patch, this is working fine with an nvidia 
quadro P2200

(gui improvement is ok too)

Le 12/08/22 à 14:04, Wolfgang Bumiller a écrit :
> applied this one, left out patch 2 after some off-list discussion
>
> On Fri, Aug 12, 2022 at 11:29:49AM +0200, Dominik Csapak wrote:
>> When passing through an NVIDIA vGPU via mediated devices, their
>> software needs the qemu process to have the 'uuid' parameter set to the
>> one of the vGPU. Since it's currently not possible to pass through multiple
>> vGPUs to one VM (seems to be an NVIDIA driver limitation at the moment),
>> we don't have to take care about that.
>>
>> Sadly, the place we do this, it does not show up in 'qm showcmd' as we
>> don't (want to) query the pci devices in that case, and then we don't
>> have a way of knowing if it's an NVIDIA card or not. But since this
>> is informational with QEMU anyway, i'd say we can ignore that.
>>
>> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
>> ---
>>   PVE/QemuServer.pm     | 9 ++++++++-
>>   PVE/QemuServer/PCI.pm | 4 +++-
>>   2 files changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
>> index 7d9cf22..c706653 100644
>> --- a/PVE/QemuServer.pm
>> +++ b/PVE/QemuServer.pm
>> @@ -5594,12 +5594,19 @@ sub vm_start_nolock {
>>       PVE::QemuServer::PCI::reserve_pci_usage($pci_id_list, $vmid, $start_timeout);
>>   
>>       eval {
>> +	my $uuid;
>>   	for my $id (sort keys %$pci_devices) {
>>   	    my $d = $pci_devices->{$id};
>>   	    for my $dev ($d->{pciid}->@*) {
>> -		PVE::QemuServer::PCI::prepare_pci_device($vmid, $dev->{id}, $id, $d->{mdev});
>> +		my $info = PVE::QemuServer::PCI::prepare_pci_device($vmid, $dev->{id}, $id, $d->{mdev});
>> +
>> +		# nvidia grid needs the uuid of the mdev as qemu parameter
>> +		if ($d->{mdev} && !defined($uuid) && $info->{vendor} eq '10de') {
>> +		    $uuid = PVE::QemuServer::PCI::generate_mdev_uuid($vmid, $id);
>> +		}
>>   	    }
>>   	}
>> +	push @$cmd, '-uuid', $uuid if defined($uuid);
>>       };
>>       if (my $err = $@) {
>>   	eval { PVE::QemuServer::PCI::remove_pci_reservation($pci_id_list) };
>> diff --git a/PVE/QemuServer/PCI.pm b/PVE/QemuServer/PCI.pm
>> index 23fe508..3d0e70e 100644
>> --- a/PVE/QemuServer/PCI.pm
>> +++ b/PVE/QemuServer/PCI.pm
>> @@ -253,7 +253,7 @@ sub get_pci_addr_map {
>>       return $pci_addr_map;
>>   }
>>   
>> -my sub generate_mdev_uuid {
>> +sub generate_mdev_uuid {
>>       my ($vmid, $index) = @_;
>>       return sprintf("%08d-0000-0000-0000-%012d", $index, $vmid);
>>   }
>> @@ -514,6 +514,8 @@ sub prepare_pci_device {
>>   	die "can't reset PCI device '$pciid'\n"
>>   	    if $info->{has_fl_reset} && !PVE::SysFSTools::pci_dev_reset($info);
>>       }
>> +
>> +    return $info;
>>   }
>>   
>>   my $RUNDIR = '/run/qemu-server';
>> -- 
>> 2.30.2
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://antiphishing.cetsi.fr/proxy/v3?i=SXhidDdiNE5weDlFTk1JSNLbEhnZz0r5xBqHo4FRwGw&r=MDl4M3AxU2RhSHpiVVJtMCSRIuBWP0MkbUjJ6GlgifyacKKqSZKspIsU9TEo6BbAsvT3b6rPVY4h-jFc7ynSsw&f=ZmttOUJBaHM0cVJhc0pLb7wCBKCwQBbVKZco1R6kyD6TKeVHMsDU0aWnpDb0rpOe-IAuBpS0N9wZvCfoM2C-1Q&u=https%3A//lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel&k=AKCY
>



More information about the pve-devel mailing list