From afa4503565a3f5d1eb449c0d5ce423f9443c1084 Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Mon, 18 May 2026 08:43:27 +0100 Subject: [PATCH 1/2] only show igpu SRIOV if plugin installed. --- emhttp/plugins/dynamix/include/SriovHelpers.php | 5 +++-- emhttp/plugins/dynamix/include/SysDevs.php | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/emhttp/plugins/dynamix/include/SriovHelpers.php b/emhttp/plugins/dynamix/include/SriovHelpers.php index 5ad88aa7ac..1ea7fc0799 100644 --- a/emhttp/plugins/dynamix/include/SriovHelpers.php +++ b/emhttp/plugins/dynamix/include/SriovHelpers.php @@ -58,10 +58,10 @@ function getSriovInfoJson(bool $includeVfDetails = true): string { foreach ($paths as $totalvfFile) { $devdir = dirname($totalvfFile); $pci = basename($devdir); + $numVfsFile = "$devdir/sriov_numvfs"; $total_vfs = (int) @file_get_contents($totalvfFile); - $num_vfs = (int) @file_get_contents("$devdir/sriov_numvfs"); - + $num_vfs = (int) @file_get_contents($numVfsFile); // Driver/module detection $driver = $module = $vf_param = null; $driver_link = "$devdir/driver"; @@ -141,6 +141,7 @@ function getSriovInfoJson(bool $includeVfDetails = true): string { return json_encode($results, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); } +// Rebind VF to original or vfio-pci driver. function rebindVfDriver($vf, $sriov, $target = 'original') { $res = ['pci'=>$vf,'success'=>false,'error'=>null,'details'=>[]]; diff --git a/emhttp/plugins/dynamix/include/SysDevs.php b/emhttp/plugins/dynamix/include/SysDevs.php index 23b8e60c5c..df94b5ae03 100644 --- a/emhttp/plugins/dynamix/include/SysDevs.php +++ b/emhttp/plugins/dynamix/include/SysDevs.php @@ -387,7 +387,17 @@ function createIOMMUCheckBox($pciaddress,$vd,$iommu,$line) { break; } - if (array_key_exists($pciaddress,$sriov) && in_array(substr($sriov[$pciaddress]['class_id'],0,4),$allowedPCIClass)) { + static $i915SriovPluginInstalled = null; + if ($i915SriovPluginInstalled === null) { + $i915SriovPluginInstalled = is_file('/boot/config/plugins/i915-sriov.plg') + || is_file('/var/log/plugins/i915-sriov.plg'); + } + $isI915SriovPci = (substr($pciaddress, -7) === '00:02.0'); + $showI915SriovOptions = $i915SriovPluginInstalled && $isI915SriovPci; + + if ($showI915SriovOptions + && array_key_exists($pciaddress,$sriov) + && in_array(substr($sriov[$pciaddress]['class_id'],0,4),$allowedPCIClass)) { echo "