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

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Jul 5 10:33:46 CEST 2024


Am 06/06/2024 um 11:21 schrieb Dominik Csapak:
> 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) = @_;

Which config is this? As is its IMO a bit to opaque. I even thought first
that this is the VM config, or well the config of a specific VM PCI
passthrough property, which I would not have liked much as that would add
a coupling, or maybe better said, hidden cyclic dependency between
guest-common and qemu-server.

Naming this such that it's clearer what config we're talking about here
would help to avoid such thought digressions, at least me.

Maybe `$global_mapping_cfg` or `$cluster_mapping_cfg` (as we do not really
use the term "global" much IIRC).

>  
>      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
>  





More information about the pve-devel mailing list