Determine configurable aperture size from BIOS file

Thanks for sharing the outline of nvram editing know-how. I didn’t have time to dive in, but the mini-guide has very good tips. Anyway, nvram editing looks like something from “Don’t try this at home” series

At the moment, flashing with the linked bios led to non booting blank screen with a white dash ( connected to the onboard Intel Graphics) .

msi igpu error.jpg



Connected to a discrete GPU, at first I managed to enter bios, but afterwards fails with “ ERROR: Insufficient PCI Resources Detected”.

msi gpu error.jpg



Removing the battery and shorting the jumper, didn’t fix the issue. Now, I’m leaving the battery out for a few hours, hoping to solve the issue.

@eurodomenii - Yes, that is part of the “Don’t try this at home” series, unless you have a flash programmer and know how to recover and are ready in advance
Very sorry to see the above!!! This may be due to the byte I mentioned may need changed still, but I expected it would just load the other hidden NVRAM backup if the one we edited failed to load due to that byte, that is how it generally works.
I didn’t expect brick like that, or I would have went ahead and set it before I sent and included that info as well

Can you enter M-Flash from there? If yes, reflash stock BIOS for now. And, if you want to try again let me know and I will edit that byte I mentioned and you can try again.
Other than that, the only thing I can think of is sometimes that PEI volume edit needs done differently Generally how I mentioned is fine, so that is why I gave that method.
I suppose it could also be the padding edit, since that is a general backup of current applied data, but since we edit all at once I think this one doesn’t matter. I bet it’s either the byte I mentioned (NVRAM State), or the PEI volume edit needs done other way.

If you can’t get into M-Flash, see if you can boot to DOS on USB. If you can, then copy all contents from DOS FPT folder to root of your DOS bootable USB and then flash your original FPT BIOS region dump via >> FPT.exe -bios -f biosreg.bin

Also, it may help with the PCI resources error to use a cheap/small PCIE card instead, or a PCI graphics card if you have

Fortunately, I got this working again.
MFlash didn’t work in the first place, I used to from DOS USB bootable stick AMI Firmware Update Utility 2.38.

With modded Bios onboard Graphics failed, and only one time manage to boot from external GPU, before “ ERROR: Insufficient PCI Resources Detected” reappeared.

After resetting bios again, boot from USB and rebuild stock bios. Now working again Onboard Graphics. I realized that, even after the very first modded bios, only with default values, IGD wasn’t working. After the latest hack, even with GU failed.

@eurodomenii - Nice!!

I just replied to your PM, before I noticed you replied here! I’m glad you were able to get it back going again!

I will redo the mod tonight with less edits, IF this one fails too. Here is same BIOS as I sent before, but with that NVRAM State change I mentioned
http://s000.tinyupload.com/index.php?fil…785432314955162

What? Where do you say integrated graphics started failing? Maybe I shouldn’t have built on top of your previous edits then??? Are you using UEFITool 25, or 26?

Anyway, if this fails too, recover and then I will go back and redo all edits myself on stock BIOS. For this, please flash stock BIOS (or how you are now I guess), and make me a new stock dump with FPT, that way I have untouched stock BIOS as my base.
Then I will make you a BIOS with this disabled in all areas + one with less of the NVRAM changes too, to see if maybe some of that is causing issue (as I mentioned, maybe that padding one, or method used on last GUID one)

I have to run now, will be back in about 7-8 hours

I’ve worked with UEFi Tool 26. Now I’am away from comp, cannot do ftp. But the last stock BIOS, fully working, is https://download.msi.com/bos_exe/mb/7C00v15.zip . I guess you can start from there.

V26 may be part of the issue here, may also be why one of your previous edits didn’t work too. Sorry, I just assumed you were using v25, and didn’t check the stock BIOS vs the mods you sent me.
Let me know if you test the BIOS above and it fails too, then I will work on this more. No rush from me, whenever you are back near this system.

Please send me your original FPT dumped BIOSregion file, before you edited anything. With this I can check everything (and now, due to below comments, I will also remake your first two edits myself, so you can test and reconfirm those edits do not make the change)

@eurodomenii ** Edit, I checked vs stock, and already not a good sign, lucky for you that your first two edits didn’t brick, but a non-UEFI padding file at end of BIOS has been removed in both edits you sent (due to v26 edit)
That may or may not be why your first two edits failed, but I would redo those tests again with proper edited BIOS. (all edits I did now need redone as well, at least with this last volume replaced and then re-edited again)
Sorry I didn’t check this before!

*** Edit 2 - @eurodomenii - Here, please test this BIOS, flash using M-Flash only (DO NOT FPT flash this)
This is stock BIOS with setup edit and AMITSE/SetupData edit only. This has stock BIOS name.extension, leave that way and put on USB then go to M-Flash and select this file (don’t get it mixed up with stock BIOS)
http://s000.tinyupload.com/index.php?fil…672786129837301

After flash, clear CMOS, then boot to BIOS and load optimized defaults, then save/exit and reboot back to BIOS to make any other changes you need, then boot to OS and check aperture size

If that fails, instead of risking testing the NVRAM changes again, since it would require really 2-4 more test and possible some messed up BIOS during those test, this may be better solution
I could just modify the BIOS for you to make the section containing this setting visible, then direct change of setting in BIOS would be properly and easily applied by you directly.

I’ve followed the exact steps flashing with bios from #13 ( including cmos clearing) . This time, it was a clean flash, without any issues with onboard graphics or dedicated gpu. But, aperture size didn’t change. It seems that nvrams edits are still required.

@eurodomenii - Thanks, good to see no issues at least. MSI is such a pain! I hoped M-Flash would clear NVRAM and only use what the now new defaults were, but I guess not.
Here, now please test this one, same way, after M-Flash, shut down and clear CMOS, then boot to BIOS and load optimal defaults, save and reboot back to BIOS to make any other changes you need, then boot to OS and check aperture.
This has previous changes + Main NVRAM edited + internal NVRAM above AMITSE, these are only ones that do not carry risk of causing issue like you ran into on first NVRAM edit we did.
http://s000.tinyupload.com/index.php?fil…879892503123866

If these does not work, I will just make you BIOS with “Chipset” menu added inside of the OC section at top, replacing a currently invisible to you informational submenu (Memory PatchID, just gives info about memory’s stored details)
I replace this exact item often for users, usually with the hidden Advanced menu instead, and am currently doing same for another user right here with MSI Z390 too - MSI Z390 MEG ACE BIOS REQUEST
Both of you guys BIOS I am doing same edit for and will wrap up tonight.

Ohh! There is also this method, if above BIOS fails, do this and it should work 100% I forgot, we usually use this to unlock BIOS Lock or SMI lock to reflash BIOS via FPT, but you can change any setting as long as variable # isn’t too high
Read this guide I made, you can start at step #6, because Ive gathered info you need and will note it out below
[GUIDE] Grub Fix Intel FPT Error 280 or 368 - BIOS Lock Asus/Other Mod BIOS Flash

Rename your .efi file to >> Shell.efi (please confirm this, by going to your exit page, and highlighting the UEFI: Built in EFI Shell and it should tell you name of file in help text)
Or, you may need to do it this way, since Shell it probably launches is not grub which we want - Alt boot to grub when no exit to EFI on exit page - [Help needed] Hidden Advanced menu Bios HP Z1 J52_0274.BIN (2)
Grub is not same as Shell, you need to use and boot to the .efi file in the guide above (there will be no white+yellow text, that is shell, grub will say grub at top and all text is white)

Variable to change (Aperture) >> 0x968 (Hmmm, that is a high number, this method may not work )

At grub prompt, type the following followed by enter (case sensitive) >> setup_var 0x968 0xF
It will spit back 0x0F once it changes it, but that is OK/Same.
Then reboot to OS and check aperture


M-Flash is not working ( I already mentioned before : " MFlash didn’t work in the first place, I used to from DOS USB bootable stick AMI Firmware Update Utility 2.38." ). Refuses to see USB, just fails in the first place. I read other users stories about this. So, it’s possible that the modified bios would be ok, but there are legacy nvram values… Also, i recall that this utility clear nvram entries. I should recheck when I run it again.


Unfortunately, this fails with “ ERROR: Insufficient PCI Resources Detected”.

Ahh!!! No good! Did you miss this? >> "flash using M-Flash only (DO NOT FPT flash this)"
As I mentioned at post #13 ONLY flash those BIOS with M-Flash, why did you not stop there and tell me again??? At least you didn’t use FPT, so there’s that

Please explain, why M-Flash isn’t working, do you mean you can’t even use M-Flash with stock BIOS on USB?
If not, then something in your process is flawed probably. USB should be MBR initialized, FAT32 formatted, and BIOS should be named as stock and on root of USB (not in any folders).
Also, smaller USB the better, and should probably be only 2.0 too, but not sure if there is issues with 3.0 USB w/ M-Flash or not

Thanks for test result though, this means one of those NVRAM edits is the culprit of this issue (or a conflict with the others we didn’t edit this time), I’ll go back and recheck those and see if I can find any issue.
Here, one more similar to test, since your not using M-Flash, this is previous setup/Amitse/Setupdata edit + full stock NVRAM in both areas (edited) instead of your dumped NVRAM
If this fails with PCI resource error too, then one of those others must also need edited (but possibly not all, not worth more time trying to test to find out one by one, will just put time toward BIOS edit that I know will work instead)
http://s000.tinyupload.com/index.php?fil…742392664147821

See if you can get the boot to grub going, if you can then you can likely change there. If not, and above BIOS fails too, then wait and I will wrap up that proper BIOS menu edit I mentioned.

* Edit - Sorry, I forgot to ask, where did you get this AMI Firmware Update tool 2.38? Is this AFU, and 2.38? If yes, that is VERY VERY old version and should not be used at all for flashing BIOS on modern motherboards.
I assume it can’t be that, I don’t think AFU 2.x would work on BIOS like this. Current AFU would be 5.x

** Edit 2 - @eurodomenii - You know what, I just thought of something! Maybe the choice of setting value we used here is the issue (all along and recently #15 BIOS too) and first edit methods I gave you with all those NVRAM edits is actually OK edit just that we can’t use 2048MB?
Maybe we need to use 1024MB only? I guess we’ll find out once I make you BIOS with full menu access for that section. If that is the case, then hopefully 1024MB will work for you still.

Watching this thread with interest, I have a Asus prime z370-a II that has the same limitation that I’d like to get past for the same reason. (GVT-g).

The 1024MB limit might be real, from this thread discussing citrix using GVT-g virtual GPUs:
https://discussions.citrix.com/topic/382…-graphics-p580/

"Setting the Aperture size higher than 1024MB is not supported and it does not increase the number of VMs which can be started on a host."

Not sure how accurate that is but its apparently written in the citrix docs. I know the other memory setting (DVMT) for the iGPU on my motherboard only goes up to 1024MB.

@BroccoliCheddar - I can make you unlocked BIOS easy, please make a thread and I will get an unlocked BIOS menu made for you. Or, can you already see the setting, just not choose amount you want? I see yours offers up to 4096MB
** And!! I see this note in you BIOS help string file for that setting >> Note : Above 4GB MMIO BIOS assignment is automatically enabled when selecting 2048MB aperture. To use this feature, please disable CSM Support.
So, maybe to use 2048, MMIO need changed too, on this board? At least now we know it’s related - I checked, and it’s disabled by default on this MSI board.
And for your board, if you can see and adjust it already, try again with CSM disabled and 2048 or 4096 selected.

I checked your BIOS and I can do menu unlock for you and just give you full access to the hidden advanced, then you can set directly and test

Thank you very much for the 1024MB notes, I do wonder if that is it! I think we shall soon find out, either if he’s able to change it with above info, or when I give him menu mod BIOS
DVMT I see sometimes is artificially limited by BIOS supression, but I do think too sometimes CPU can be deciding factor as well but I’m not 100% certain on that because majority of people I run into never use onboard GFX

I found this mod BIOS thread for a H170 board, once unlocked so user could choose 2048MB, it auto-reset back to 1024MB.
He also couldn’t even set 1024 or 512 and get into system, but I doubt that is limits on Z390, but we’ll never know until we know the actual cause of the limitation and can look it up (@ Intel CPU or chipset I assume)
https://www.bios-mods.com/forum/Thread-R…D-Aperture-Size

Seems like Here at second reply on Intel forum, this may also be tied to amount of system memory installed
https://forums.intel.com/s/question/0D50…?language=en_US

That wouldn’t be possible with the way we’re locking in 2048MB, so I can see how if this is a limitation due to CPU, chipset or whatever that it would fail and cause error when locked above the limit.
So this may indeed be the real issue from the jump on our first edits that showed the PCI resource error in BIOS.

@eurodomenii - I have mod BIOS ready, but would prefer you M-Flash the BIOS, otherwise I will walk you through making a FPT BIOS region dump and send me that, then I edit it instead and send it back for you to FPT flash.
Can you please try again using M-Flash as I mentioned above with stock BIOS, until you figure it out

Meantime, since you’ve already been flashing this kind of edit in a way you are familiar with, here is that same BIOS from #15, but with edits changed to 1024MB instead of 2048MB
http://s000.tinyupload.com/index.php?fil…308615130454335

@eurodomenii - Since this is all time sensitive stuff due to try-before-you-buy, here, in case you don’t want to mess with all I mentioned above. I’d prefer this get flashed via M-Flash, but it’s your board (trial)
This has full chipset menu now at top of OC section, so you can now set Aperture directly - https://ufile.io/ha6mpjrl

Sorry for the delayed answer. I’ve managed to work with M-Flash. The 1024MB-Test.7z from #19 worked like a charm. All other previous mods with 2048M failed with the same error: “ ERROR: Insufficient PCI Resources Detected”. So, indeed, 2048 was the culprit ( nice catch @Lost_N_BIOS ) I’ll be back with further details.
Update: The latest mod from #20, with configurable aperture size, works also. But, when trying to select from BIOS 2048, falls back in that very interface, to 1024.

@eurodomenii - It’s OK, and it’s good to hear back from you! Nice that you got M-Flash sorted out too, that is best way to flash when you can. I thought maybe it was the forced 2048 after that info from @BroccoliCheddar (Thanks man )
Also, very nice to see the unlock menu BIOS works for you, and you can set 1024MB there at least! So, now we know, very first BIOS edits worked OK, we just forced an impossible setting for this setup/BIOS/Chipset/CPU (whatever is causing the limit)

Can you test, CSM disabled, 2048 and manually change 4GB MMIO BIOS assignment to Enabled, it’s at Chipset >> System Agent (SA) Configuration (Root)? This way we’re sure it’s being set correctly to be using 2048 if at all possible.
Other than this, I am not sure what would limit some BIOS, chipset, CPU etc to have some boards/BIOS allow 4GB while others limited to 1GB? More research on your desired usage/reasoning may turn up answers.
Does 1024MB work for what you needed to do? What is the reason for needing this raised, are you forced to using onboard graphics, and if yes, can you link me to some discussions about this in your usages area so maybe I can find why some systems might be limited and others aren’t
Maybe then I could sort it out? If not, you may need to ask MSI Directly for a BIOS that would allow it (If they gave you, it would be hidden, but I could unhide again for you)

Once again, you’ve got a very good intuition. Before your message, I’ve already seen an warning message: “Select the Aperture Size Note: Above 4GB MMIO BIOS assignment is automatically enabled when selecting 2048MB aperture. To use this feature, please disable CSM Support.”


But, I couldn’t find how to disable CSM Support. In Settings/ Boot I’ve already had Boot mode select UEFI. This was confusing. Fortunately, this post https://forum-en.msi.com/index.php?topic=269698.0 has enlightened me: “ CSM = Asus
Windows 8.1/10 WHQL Support = MSI”
, which is very counterintuitive, it might be as well Linux.

Afterwards, finally, it’s possible to setup aperture size to 2048 ( Above 4GB MMIO BIOS becomes hidden and enabled) . Congrats for your tenacity, intuition and great work!

lspci -v | less

00:02.0 Display controller: Intel Corporation Device 3e98 (rev 02)
Subsystem: Micro-Star International Co., Ltd. [MSI] Device 7c00
Flags: bus master, fast devsel, latency 0, IRQ 135
Memory at 6013000000 (64-bit, non-prefetchable) [size=16M]
Memory at 4000000000 (64-bit, prefetchable) [size=2G]



ls /sys/bus/pci/devices/0000:00:02.0/mdev_supported_types
i915-GVTg_V5_1 i915-GVTg_V5_2 i915-GVTg_V5_4 i915-GVTg_V5_8

2GB aperture size is very relevant for creating more Intel GVT virtual machines ( see https://github.com/intel/gvt-linux/issue…mment-353817255 )
-------------------------------------

BTW, somehow off topic ( or actually, this was the initial name of this topic ), how can I determine, from the latest BIOS, if the motherboard has the aperture size configurable from interface, or hidden?

Analyzing https://www.msi.com/Motherboard/MAG-Z390M-MORTAR latest bios, obtained with extractor, I see that aperture size belongs to Form: Graphics Configuration, FormId: 0x274A {01 86 4A 27 14 0B}.

I was trying to follow the markup Suppress If {0A 82}/ End If {29 02}, but Aperture size seems to be in the visible part.

0x590AE One Of: Aperture Size, VarStoreInfo (VarOffset/VarName): 0x968, VarStore: 0x1, QuestionId: 0x2746, Size: 1, Min: 0x0, Max 0xF, Step: 0x0 {05 91 BF 0B C0 0B 46 27 01 00 68 09 14 10 00 0F 00}
0x590BF One Of Option: 128MB, Value (8 bit): 0x0 {09 07 C1 0B 00 00 00}
0x590C6 One Of Option: 256MB, Value (8 bit): 0x1 {09 07 C2 0B 00 00 01}
0x590CD One Of Option: 512MB, Value (8 bit): 0x3 {09 07 C3 0B 00 00 03}
0x590D4 One Of Option: 1024MB, Value (8 bit): 0x7 {09 07 C4 0B 00 00 07}
0x590DB One Of Option: 2048MB, Value (8 bit): 0xF (default) {09 07 C5 0B 30 00 0F}
0x590E2 End One Of {29 02}


Yet, you needed to modify the BIOS, in order to expose this setting. There’s a catch I’am missing!

BTW, the latest BIOS from https://www.asus.com/Motherboards/ROG-ST…/HelpDesk_BIOS/ (the motherboard that I’m planning to buy ) has the aperture size option hidden or visible?

@eurodomenii - Good you found CSM, yes, some BIOS just roll that all up into a Win8-10 or not type setting, while others have CSM and Windows type setting separately or only one or the others.

So, sweet, you got it enabled now to 2048MB, correct?? Sorry, I can’t tell, not familiar with Linux so the readout above looks alien to me (no 2048MB shown either, so makes me really lost )

On your second post (I’ll merge with first after typing this out). Do you mean can we tell if Aperture is a visible BIOS setting in other board BIOS, just by looking at BIOS?
If that is what you mean, no, I usually can’t tell, you’d have to look for board reviews and check the BIOS images and see. Luckily, most board review sites show plenty of BIOS images, but sadly sometimes not all is shown so would be hard to know for sure on ones where you don’t see it shown.
Maybe hunt down board owners on this forum, or others and ask them in a private message.

For your BIOS mod, the Aperture setting was not hidden, but the entire root menu it was inside of was hidden (Chipset). So you could tell in that way when looking at other BIOS, if you only see it within the root of a known missing from BIOS images section of the BIOS (such as chipset, which is often hidden)
Other times though it may only be in Advanced, and there is often a hidden advanced too, you can tell them apart by hidden one usually has many more submenus than the visible one.
On the Asus Strix Z390-E, I looked at BIOS and could not be sure. Location >> Advanced >> System Agent >> Graphics Config.
There is only one Advanced, and in those cases it’s usually visible but with some submenus hidden, so I had to check reviews for BIOS images
Here we see System Agent is visible - https://www.kitguru.net/wp-content/uploa…iew-UEFI-14.jpg

But, no reviews I found show inside System Agent. Anyway, if hidden I can modify this BIOS easily for you, much less hassle with Asus BIOS than MSI BIOS
I checked setup, it’s not suppressed, and due to that, if it’s not visible then it only takes one byte change to Access Level setting to make it visible.



Yes. 2048MB is available now. The bigger aperture size, the more virtual machine with high resolution are available. See printscreen or https://github.com/intel/gvt-linux/wiki/…vgpu-kvmgt-only.





Since I’ve returned the trial & test MSI mobo, now I’m looking forward to Asus Strix Z390-E, planning to buy in Jan 2020. Could you post a clarifying HxD printscreen, like in #5, regarding the byte change at Access Level, in order to make aperture size configuration visible? Hopefully, no more AMITSE/SetupData or NVRAM edits would be required in this case. 

Thanks!

@eurodomenii - Ahhh! You ended up sending this MSI board back? If so, at least we still have a known tested and working BIOS mod from it’s use in this thread for others now

For Aperture visibility in Asus Strix Z390-E Gaming BIOS 0805, with UEFITool 51-56, extract AMITSE/SetupData (BODY), then byte change is as shown below
Ignore “Default” info, it can be default show yes, and not suppressed, and still be hidden from user (due to however they program the “Default” itself)

Strix-Z390-E-Gaming0805-ApertureEdit.png



This assumes you can already see >> Advanced >> System Agent (SA) Configuration >> Graphics Configuration submenu, if not then that submenu will also need unsuppressed via “Setup PE32” (As-IS) edit as shown below
*Edit - @eurodomenii << See edit below, I missed some earlier!


The one directly below this sentence also need unsuppressed too, in order to unsuppress Graphics config, since it encompasses all three settings/menus here
then each individual one has it’s own suppression also (Well at least 4G decoding and graphics config do)
Suppress If {0A 82}
0x6E078 64 Bit Unsigned Int: 0x0 {45 8A 00 00 00 00 00 00 00 00} << Change to FF
0x6E082 64 Bit Unsigned Int: 0x1 {45 0A 01 00 00 00 00 00 00 00} << Change to FF
0x6E08C Equal {2F 02}
0x6E08E End {29 02}
0x6E090 Suppress If {0A 82}
0x6E092 QuestionId: 0x2747 equals value 0xF {12 06 47 27 0F 00}
0x6E098 One Of: Above 4G Decoding, VarStoreInfo (VarOffset/VarName): 0x949, VarStore: 0x1, QuestionId: 0x327, Size: 1, Min: 0x0, Max 0x1, Step: 0x0 {05 91 84 08 85 08 27 03 01 00 49 09 10 10 00 01 00} << Search this string in hex, above it will be edits above
0x6E0A9 One Of Option: Enabled, Value (8 bit): 0x1 {09 07 9C 00 00 00 01}
0x6E0B0 One Of Option: Disabled, Value (8 bit): 0x0 (default) {09 07 9D 00 30 00 00}
0x6E0B7 End One Of {29 02}
0x6E0B9 End If {29 02}
0x6E0BB Ref: Memory Configuration, VarStoreInfo (VarOffset/VarName): 0xFFFF, VarStore: 0x0, QuestionId: 0x328, FormId: 0x2748 {0F 0F 5E 04 5F 04 28 03 00 00 FF FF 00 48 27}
0x6E0CA Suppress If {0A 82}
0x6E0CC 64 Bit Unsigned Int: 0x1 {45 8A 01 00 00 00 00 00 00 00} << Change to FF
0x6E0D6 64 Bit Unsigned Int: 0x0 {45 0A 00 00 00 00 00 00 00 00} << Change to FF
0x6E0E0 Equal {2F 02}
0x6E0E2 End {29 02}
0x6E0E4 Ref: Graphics Configuration, VarStoreInfo (VarOffset/VarName): 0xFFFF, VarStore: 0x0, QuestionId: 0x329, FormId: 0x274A {0F 0F E7 05 E7 05 29 03 00 00 FF FF 00 4A 27} << Search this string in hex, above it will be edits above

Supress-Edit.png

Hi there, i have a same situation as mr. eurodomenii
Could you help me modifi my bios that help get 1024 Mb UmaVideoMemory