[pve-devel] [PATCH common 2/2] SysFSTools: lscpi: move mdev and iommugroup check outside of verbose
Dominik Csapak
d.csapak at proxmox.com
Tue Aug 6 14:21:59 CEST 2024
they should not be expensive (only reading/file checking in sysfs; the
parsed vendor/id names are not required) so we should include them
always.
We need at least the mdev part later at a point where we're not
interested in the rest of the verbose mode.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
best viewed with -w
src/PVE/SysFSTools.pm | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/PVE/SysFSTools.pm b/src/PVE/SysFSTools.pm
index 25b2f31..0bde6d7 100644
--- a/src/PVE/SysFSTools.pm
+++ b/src/PVE/SysFSTools.pm
@@ -103,21 +103,21 @@ sub lspci {
return;
}
- if ($verbose) {
- $res->{iommugroup} = -1;
- if (-e "$devdir/iommu_group") {
- my ($iommugroup) = (readlink("$devdir/iommu_group") =~ m/\/(\d+)$/);
- $res->{iommugroup} = int($iommugroup);
- }
+ $res->{iommugroup} = -1;
+ if (-e "$devdir/iommu_group") {
+ my ($iommugroup) = (readlink("$devdir/iommu_group") =~ m/\/(\d+)$/);
+ $res->{iommugroup} = int($iommugroup);
+ }
- if (-d "$devdir/mdev_supported_types") {
- $res->{mdev} = 1;
- } elsif (-d "$devdir/nvidia") {
- # nvidia driver for kernel 6.8 or higher
- $res->{mdev} = 1; # for api compatibility
- $res->{nvidia} = 1;
- }
+ if (-d "$devdir/mdev_supported_types") {
+ $res->{mdev} = 1;
+ } elsif (-d "$devdir/nvidia") {
+ # nvidia driver for kernel 6.8 or higher
+ $res->{mdev} = 1; # for api compatibility
+ $res->{nvidia} = 1;
+ }
+ if ($verbose) {
my $device_hash = $ids->{$vendor}->{devices}->{$device} // {};
my $sub_vendor = file_read_firstline("$devdir/subsystem_vendor");
--
2.39.2
More information about the pve-devel
mailing list