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

Dominik Csapak d.csapak at proxmox.com
Fri Apr 19 14:45:37 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 $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 <d.csapak at proxmox.com>
---
changes from v2:
* adapt to changes of previous patch
 src/PVE/Mapping/PCI.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Mapping/PCI.pm b/src/PVE/Mapping/PCI.pm
index ef1bd8d..b412c4d 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} // '');
 
@@ -151,6 +151,7 @@ sub assert_valid {
 	my $expected_props = {
 	    id => "$info->{vendor}:$info->{device}",
 	    iommugroup => $info->{iommugroup},
+	    mdev => $info->{mdev},
 	};
 
 	if (defined($info->{'subsystem_vendor'}) && defined($info->{'subsystem_device'})) {
@@ -158,6 +159,8 @@ sub assert_valid {
 	}
 
 	my $configured_props = { $mapping->%{qw(id iommugroup subsystem-id)} };
+	# check mdev from globabl mapping config
+	$configured_props->{mdev} = $cfg->{mdev};
 
 	my $merged = { %$expected_props, %$configured_props }; # just for the keys
 	for my $prop (sort keys %$merged) {
-- 
2.39.2





More information about the pve-devel mailing list