summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2021-11-24 22:59:06 +0100
committerSimon Rettberg2021-11-24 22:59:06 +0100
commit80e4789c11c7659d738193333551a335bbb9a56b (patch)
tree455cc25a17988be130f8926cd50ab25976f93851
parent[eventlog] Add id45mb, add comment (diff)
downloadslx-admin-80e4789c11c7659d738193333551a335bbb9a56b.tar.gz
slx-admin-80e4789c11c7659d738193333551a335bbb9a56b.tar.xz
slx-admin-80e4789c11c7659d738193333551a335bbb9a56b.zip
[statistics] Support IOMMU for AMD
-rw-r--r--modules-available/statistics/inc/hardwareinfo.inc.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/modules-available/statistics/inc/hardwareinfo.inc.php b/modules-available/statistics/inc/hardwareinfo.inc.php
index 586b8124..ac92dd61 100644
--- a/modules-available/statistics/inc/hardwareinfo.inc.php
+++ b/modules-available/statistics/inc/hardwareinfo.inc.php
@@ -29,7 +29,7 @@ class HardwareInfo
$mac = Request::get('mac', '', 'string');
$mac = str_replace(':', '-', $mac);
}
- $res = Database::simpleQuery("SELECT machineuuid, lastseen FROM machine
+ $res = Database::simpleQuery("SELECT machineuuid, lastseen, cpumodel FROM machine
WHERE machineuuid = :uuid OR macaddr = :mac", ['uuid' => $uuid, 'mac' => $mac]);
$best = null;
foreach ($res as $row) {
@@ -60,7 +60,14 @@ class HardwareInfo
}
$kcl = '';
if ($gvt || !empty($passthrough)) {
- $kcl = '-iommu -intel_iommu iommu=pt intel_iommu=on'; // TODO AMD
+ if (strpos($best['cpumodel'], 'Intel') !== false) {
+ $kcl = '-iommu -intel_iommu iommu=pt intel_iommu=on';
+ } elseif (strpos($best['cpumodel'], 'AMD') !== false) {
+ $kcl = '-iommu -amd_iommu iommu=pt amd_iommu=on';
+ } else {
+ error_log("Cannot determine CPU manufacturer from " . $best['cpumodel']);
+ $kcl = '-iommu -intel_iommu iommu=pt intel_iommu=on -amd_iommu amd_iommu=on';
+ }
}
if (!empty($passthrough)) {
foreach (array_keys($slots) as $slot) {