From 57cd454c4229d7939fce74054c1e15b83d2fceba Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Tue, 11 Mar 2025 14:20:39 +0100 Subject: [PATCH] mapping: pci: check the mdev configuration on the device too but that lives int he 'global' part of the mapping config, not in a specific mapping. To check that, add it to the $configured_props from there. this requires all call sites to be adapted otherwise the check will always fail for devices that are capable of mediated devices Signed-off-by: Dominik Csapak Reviewed-by: Christoph Heiss Reviewed-by: Fiona Ebner Tested-by: Christoph Heiss --- src/PVE/Mapping/PCI.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/PVE/Mapping/PCI.pm b/src/PVE/Mapping/PCI.pm index aa56496..cdd73d9 100644 --- a/src/PVE/Mapping/PCI.pm +++ b/src/PVE/Mapping/PCI.pm @@ -131,7 +131,7 @@ sub options { # checks if the given config is valid for the current node sub assert_valid { - my ($name, $mapping) = @_; + my ($name, $mapping, $cluster_mapping_cfg) = @_; my @paths = split(';', $mapping->{path} // ''); @@ -161,6 +161,12 @@ sub assert_valid { my $configured_props = { $mapping->%{qw(id iommugroup subsystem-id)} }; + # check mdev from globabl mapping config, if that is given + if (defined($cluster_mapping_cfg)) { + $expected_props->{mdev} = $info->{mdev} ? 1 : 0; + $configured_props->{mdev} = $cluster_mapping_cfg->{mdev} ? 1 : 0; + } + for my $prop (sort keys $expected_props->%*) { next if $prop eq 'iommugroup' && $idx > 0; # check iommu only on the first device