diff options
Diffstat (limited to 'modules-available/statistics/inc/hardwareinfo.inc.php')
-rw-r--r-- | modules-available/statistics/inc/hardwareinfo.inc.php | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/modules-available/statistics/inc/hardwareinfo.inc.php b/modules-available/statistics/inc/hardwareinfo.inc.php index 90b8975b..5f1a4372 100644 --- a/modules-available/statistics/inc/hardwareinfo.inc.php +++ b/modules-available/statistics/inc/hardwareinfo.inc.php @@ -44,14 +44,18 @@ class HardwareInfo $hw->addWhere(true, '@PASSTHROUGH', 'IN', ['GPU', 'GVT']); $hw->addColumn(true, 'vendor'); $hw->addColumn(true, 'device'); + $hw->addColumn(false, 'slot'); $res = $hw->query(); $passthrough = []; + $slots = []; $gvt = false; foreach ($res as $row) { if ($row['@PASSTHROUGH'] === 'GVT') { $gvt = true; } else { - $passthrough[] = $row['vendor'] . ':' . $row['device']; + $passthrough[$row['vendor'] . ':' . $row['device']] = 1; + error_log('Passthouorgh: ' . $row['vendor'] . ':' . $row['device']); + $slots[preg_replace('/\.[0-9]+$/', '', $row['slot'])] = 1; } } $kcl = ''; @@ -59,7 +63,18 @@ class HardwareInfo $kcl = '-iommu -intel_iommu iommu=pt intel_iommu=on'; // TODO AMD } if (!empty($passthrough)) { - $kcl .= ' vfio-pci.ids=' . implode(',', $passthrough); + foreach (array_keys($slots) as $slot) { + error_log('Querying slot ' . $slot); + $hw = new HardwareQuery(self::PCI_DEVICE, $best['machineuuid'], true); + $hw->addWhere(false, 'slot', 'LIKE', $slot . '.%'); + $hw->addColumn(true, 'vendor'); + $hw->addColumn(true, 'device'); + foreach ($hw->query() as $row) { + $passthrough[$row['vendor'] . ':' . $row['device']] = 1; + error_log('Extra PT: ' . $row['vendor'] . ':' . $row['device']); + } + } + $kcl .= ' vfio-pci.ids=' . implode(',', array_keys($passthrough)); } if ($gvt) { $kcl .= ' i915.enable_gvt=1'; |