[pve-devel] [PATCH guest-common v4 4/6] mapping: pci: check the mdev configuration on the device too

Dominik Csapak d.csapak at proxmox.com
Thu Jun 6 11:21:59 CEST 2024


but that lives int he 'global' part of the mapping config, not in a
specific mapping. To check that, add it to the relevant hashes here.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v3:
* leave $cfg optional

 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..1b2ac52 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, $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($cfg)) {
+	    $expected_props->{mdev} = $info->{mdev} ? 1 : 0;
+	    $configured_props->{mdev} = $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
 
-- 
2.39.2





More information about the pve-devel mailing list