From 357171fec5bbccea5bf911773186be4651ef2dda Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:16:01 +0100 Subject: [PATCH] Add Override File support and default support for Coral TPu --- .../dynamix.vm.manager/include/libvirt_helpers.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php index c0e5631c0..9575152c6 100644 --- a/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php +++ b/emhttp/plugins/dynamix.vm.manager/include/libvirt_helpers.php @@ -756,6 +756,15 @@ private static $encoding = 'UTF-8'; $arrWhitelistGPUClassIDregex = '/^(0001|03)/'; $arrWhitelistAudioClassIDregex = '/^(0403)/'; + # "System peripheral [0880]" "Global unichip corp. [1ac1]" "Coral Edge Tpu [089a]" -pff "Global unichip corp. [1ac1]" "Coral Edge Tpu [089a]" + # typeid productid + # file is csv typeid:productid + # + if (is_file("/boot/config/VMPCIOverride.cfg")) { + $arrWhiteListOverride = str_getcsv(file_get_contents("/boot/config/VMPCIOverride.cfg")) ; + } + $arrWhiteListOverride[] = "0880:089a" ; + $arrValidPCIDevices = []; exec("lspci -m -nn 2>/dev/null", $arrAllPCIDevices); @@ -770,6 +779,9 @@ private static $encoding = 'UTF-8'; $boolBlacklisted = true; } + $overrideCheck = "${arrMatch['typeid']}:${arrMatch['productid']}" ; + if (in_array($overrideCheck,$arrWhiteListOverride) ) $boolBlacklisted = false; + $strClass = 'other'; if (preg_match($arrWhitelistGPUClassIDregex, $arrMatch['typeid'])) { $strClass = 'vga';