User:0xdc/Drafts/Configure Intel GPU Aperture Size via hidden UEFI settings
This guide is for Intel GPU users who want to use GVT-g to virtualise their GPU in VMs, but need to increase the GPU's aperture size to support more virtual graphics cards and/or larger resolutions.
Check CPU/chipset support
First, check that your computer is compatible. It must support hardware virtualisation (in this guide, specifically KVM) and Vt-d/VFIO. Most importantly, your CPU must be supported in the driver.
Check current settings
root #
lspci -v -s 00.02.0
Memory at 4000000000 (64-bit, prefetchable) [size=256M]
...Download your BIOS
From your computer manufacturer's website, download a copy of the BIOS update package.
UEFITool
qmake and other Qt libraries may be required.
user $
git clone https://github.com/LongSoft/UEFITool
user $
(cd UEFITool; qmake && make -j$(nproc))
user $
./UEFITool/UEFITool &
Extract your BIOS update file until you get a readable binary file that UEFITool can use. Once opened, open the Find window and search for the text "Aperture Size". Double click the first match from the log at the bottom of the window. Right-click the highlighted section and "Extract as-is".
ifrextract
user $
git clone https://github.com/LongSoft/Universal-IFR-Extractor
user $
cmake -B Universal-IFR-Extractor/build -G Ninja Universal-IFR-Extractor
user $
ninja -C Universal-IFR-Extractor/build
user $
cp Universal-IFR-Extractor/build/ifrextract .
With the extracted image section, pass the filename to ifrextract:
user $
./ifrextract section.bin setup.txt
In the setup.txt file, search for the "Aperture Size" option.
user $
sed '/One Of: Aperture Size/,/End One/!d' setup.txt
0x79534 One Of: Aperture Size, VarStoreInfo (VarOffset/VarName): 0x44, VarStore: 0x2, QuestionId: 0x2A0, Size: 1, Min: 0x0, Max 0xF, Step: 0x0 {05 91 72 13 73 13 A0 02 02 00 44 00 10 10 00 0F 00} 0x79545 Default: DefaultId: 0x0, Value (Other) {5B 85 00 00 08} 0x7954A Value {5A 82} 0x7954C 64 Bit Unsigned Int: 0x1 {45 0A 01 00 00 00 00 00 00 00} 0x79556 End {29 02} 0x79558 End {29 02} 0x7955A One Of Option: 128MB, Value (8 bit): 0x0 {09 07 74 13 00 00 00} 0x79561 One Of Option: 256MB, Value (8 bit): 0x1 {09 07 75 13 00 00 01} 0x79568 One Of Option: 512MB, Value (8 bit): 0x3 {09 07 76 13 00 00 03} 0x7956F One Of Option: 1024MB, Value (8 bit): 0x7 {09 07 77 13 00 00 07} 0x79576 One Of Option: 2048MB, Value (8 bit): 0xF {09 07 78 13 00 00 0F} 0x7957D End One Of {29 02}
In this example, the offset is 0x44, the VarStoreId is 0x2 and the aperture size values can be one of 0x0, 0x1, 0x3, 0x7, and 0xF.
To find out the name of the VarStore:
user $
grep -a 'VarStoreId: 0x2' setup.txt
0x711A9 VarStoreEFI: VarStoreId: 0x2 [72C5E28C-7783-43A1-8767-FAD73FCCAFA4], Attrubutes: 7, Size: 28F, Name: SaSetup {26 22 02 00 8C E2 C5 72 83 77 A1 43 87 67 FA D7 3F CC AF A4 07 00 00 00 8F 02 53 61 53 65 74 75 70 00}
In this case, VarStoreId: 0x2 has the name SaSetup.
Download or compile the modified GRUB UEFI shell that has the ability to edit hidden settings, and add it to your UEFI bootloader (e.g. efibootmgr).
https://github.com/datasone/grub-mod-setup_var
root #
wget -P $(bootctl --print-esp-path) https://github.com/datasone/grub-mod-setup_var/releases/download/1.3/modGRUBShell.efi
root #
efibootmgr -L modGRUBshell -d /dev/... -p 1 -l '\modGRUBshell.efi'
Reboot into the shell.
In the shell, run the command, replacing your values:
setup_var_cv | SaSetup | 0x44 | 0x1 | 0xF |
---|---|---|---|---|
name of VarStore | offset | size | value |
root #
# Check current setting
root #
setup_var_cv SaSetup 0x44 0x1
root #
# Set new value
root #
setup_var_cv SaSetup 0x44 0x1 0xF
root #
# Verify that the value has changed
root #
setup_var_cv SaSetup 0x44 0x1
Reboot, then re-verify the aperture size from the OS.