mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-20 21:50:20 +00:00
pci: device reservation: allow one to only free a subset of IDs
Add an optional parameter to the helper that removes PCI reservations so that we can partially release IDs again. This will be necessary for NVIDIAs new sysfs api 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>
This commit is contained in:
parent
fc23c72a42
commit
d7fe48e9aa
@ -719,11 +719,12 @@ my $write_pci_reservation_unlocked = sub {
|
|||||||
|
|
||||||
# removes all PCI device reservations held by the `vmid`
|
# removes all PCI device reservations held by the `vmid`
|
||||||
sub remove_pci_reservation {
|
sub remove_pci_reservation {
|
||||||
my ($vmid) = @_;
|
my ($vmid, $pciids) = @_;
|
||||||
|
|
||||||
PVE::Tools::lock_file($PCIID_RESERVATION_LOCK, 2, sub {
|
PVE::Tools::lock_file($PCIID_RESERVATION_LOCK, 2, sub {
|
||||||
my $reservation_list = $parse_pci_reservation_unlocked->();
|
my $reservation_list = $parse_pci_reservation_unlocked->();
|
||||||
for my $id (keys %$reservation_list) {
|
for my $id (keys %$reservation_list) {
|
||||||
|
next if defined($pciids) && !grep { $_ eq $id } $pciids->@*;
|
||||||
my $reservation = $reservation_list->{$id};
|
my $reservation = $reservation_list->{$id};
|
||||||
next if $reservation->{vmid} != $vmid;
|
next if $reservation->{vmid} != $vmid;
|
||||||
delete $reservation_list->{$id};
|
delete $reservation_list->{$id};
|
||||||
|
Loading…
Reference in New Issue
Block a user