From 67e6b6c9981207d7d658f2ad2bf1c39b75c099c7 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 21 Sep 2021 16:52:06 +0200 Subject: [passthrough] New module for managing hardware passthrough for QEMU --- .../minilinux/inc/linuxbootentryhook.inc.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'modules-available/minilinux') diff --git a/modules-available/minilinux/inc/linuxbootentryhook.inc.php b/modules-available/minilinux/inc/linuxbootentryhook.inc.php index e57336f0..9e10bd6e 100644 --- a/modules-available/minilinux/inc/linuxbootentryhook.inc.php +++ b/modules-available/minilinux/inc/linuxbootentryhook.inc.php @@ -15,7 +15,7 @@ class LinuxBootEntryHook extends BootEntryHook return Dictionary::translateFileModule('minilinux', 'module', 'module_name', true); } - public function extraFields() + public function extraFields(): array { /* For translate module: * Dictionary::translate('ipxe-kcl-extra'); @@ -32,7 +32,7 @@ class LinuxBootEntryHook extends BootEntryHook /** * @return HookEntryGroup[] */ - protected function groupsInternal() + protected function groupsInternal(): array { /* * Dictionary::translate('default_boot_entry'); @@ -76,7 +76,7 @@ class LinuxBootEntryHook extends BootEntryHook * @param $localData * @return BootEntry the actual boot entry instance for given entry, false if invalid id */ - public function getBootEntryInternal($localData) + public function getBootEntryInternal($localData): BootEntry { $id = $localData['id']; if ($id === 'default') { // Special case @@ -125,7 +125,7 @@ class LinuxBootEntryHook extends BootEntryHook return BootEntry::newStandardBootEntry($bios, $efi, $arch); } - private function generateExecData($effectiveId, $remoteData, $localData) + private function generateExecData($effectiveId, $remoteData, $localData): ExecData { $exec = new ExecData(); // Defaults @@ -146,9 +146,7 @@ class LinuxBootEntryHook extends BootEntryHook if (!empty($localData['debug'])) { // Debug boot enabled $exec->commandLine = IPxe::modifyCommandLine($exec->commandLine, - isset($remoteData['debugCommandLineModifier']) - ? $remoteData['debugCommandLineModifier'] - : '-vga -quiet -splash -loglevel loglevel=7' + $remoteData['debugCommandLineModifier'] ?? '-vga -quiet -splash -loglevel loglevel=7' ); } // disable all CPU sidechannel attack mitigations etc. @@ -156,6 +154,14 @@ class LinuxBootEntryHook extends BootEntryHook $exec->commandLine = IPxe::modifyCommandLine($exec->commandLine, 'noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier mds=off mitigations=off'); } + // GVT, PCI Pass-thru etc. + if (Module::isAvailable('statistics')) { + $hwextra = HardwareInfo::getKclModifications(); + if (!empty($hwextra)) { + $exec->commandLine = IPxe::modifyCommandLine($exec->commandLine, $hwextra); + } + } + // User-supplied modifications if (!empty($localData['kcl-extra'])) { $exec->commandLine = IPxe::modifyCommandLine($exec->commandLine, $localData['kcl-extra']); } -- cgit v1.2.3-55-g7522