ReBAR Support

Same on 12th gen.

1 Like

Although an option to enable ReBAR support isn’t available in the BIOS menu, it is supported by the BIOS. On 12th gen I got it enabled by using GitHub - datasone/setup_var.efi: UEFI command-line tool for read/write access of variables to change the hidden option from auto to enabled.

setup_var 0x42B 0x1 -n SaSetup
3 Likes

@Iwan_Timmer nice! Would you mind explaining a bit further:

  • How you got setup_var.efi to run on the Framework.
  • How to eventually revert the option to its original value.

Thank you!

Also, the following quote should be respected:

Use this tool with extreme caution as accessing wrong varstore or variable may completely brick your computer!

So, until we understand what exactly these parameters do, when to set them, when not to, how to revert and how to debug I wouldn’t want to fiddle around with these.

2 Likes

@Iwan_Timmer do you know what the command is for 11th gen?

1 Like

For 11th gen, the command should be:

setup_var.efi 0x431 0x1 -n SaSetup

The idea is taken from https//ristovski.github.io/posts/inside-insydeh2o, but instead of dumping the BIOS I’ve download the EFI Bios update zip which contains a ~34 MB file called hx20_capsule_3.10.bin or firmware.cap. This file can be opened in GitHub - LongSoft/UEFITool: UEFI firmware image viewer and editor Using this tool you can extract the PE Image Section of a DXE Driver called DriverSampleDxe and having the text SetupUtility. After dumping this file you can use GitHub - LongSoft/IFRExtractor-RS: Rust utility to extract UEFI IFR data into human-readable text to extract a list of text files containing definitions of the BIOS setup menu including the hidden menu’s and options. For example in one of the text files you will find for 12th gen:

		OneOf Prompt: "PCIE Resizable BAR Support", Help: "Enable/Disable PCIE Resizable BAR Support", QuestionFlags: 0x10, QuestionId: 0x444, VarStoreId: 0x2, VarOffset: 0x42B, Flags: 0x10, Size: 8, Min: 0x0, Max: 0x2, Step: 0x0
			OneOfOption Option: "Auto" Value: 2, Default, MfgDefault
			OneOfOption Option: "Enabled" Value: 1
			OneOfOption Option: "Disabled" Value: 0
		End 

The VarStoreId is a reference to a VarStoreEFI definition in the top of the text file

VarStoreEfi Guid: 72C5E28C-7783-43A1-8767-FAD73FCCAFA4, VarStoreId: 0x2, Attributes: 0x7, Size: 0x578, Name: "SaSetup"

So based on this information you know you have to change byte 0x42B (VarOffset) to the value 1 in SaSetup (Name of VarStoreEfi) to set ReBAR support from Auto (default) to Enabled. To change it back you have set it back to 2. Notice on 11th gen you can only disable or enable ReBAR support.

For changing the values I use setup_var.efi which you can run from within an EFI shell but there are also patches for Grub to add the setup_var command.

@Iwan_Timmer thank you for the very detailed explainer!

I guess my only remaining question is: how to do that exactly? How to run an “EFI shell”? Google is not very helpful…

@Kieran_Levin since ReBAR is apparently supported, can we have the BIOS option in the next update?

AFAIK that’s a big feature for eGPU users.

1 Like

The thing I don’t understand is … if it’s by default on auto, does that not mean it should work?

Maybe we’re looking for a kernel parameter which forces ReBAR for Linux?

Sorry, I’m new to eGPUs and ReBAR, so this may be a stupid question.

@Iwan_Timmer After you set that value did GPU-Z show “Resizable BAR enabled in BIOS” as “Yes”? I did it with a slightly different combination of software but ultimately I changed the value to 1 and GPU-Z still shows “Resizable BAR enabled in BIOS” as “No”

1 Like

If I try to open the 12th gen 3.06 firmware.cap, it says Invalid UEFI volume. Anything else I need?

Also, if the default is ‘Auto’… then why is it not smart enough to know that that should mean enabled :wink:

@WolfgangBlub I used this to extract the part of the bios file with the rebar option: Releases · LongSoft/UEFITool · GitHub

Then I used this to convert it into human readable text files: Releases · LongSoft/IFRExtractor-RS · GitHub

Then I searched each text file for rebar and found the settings.

This is what i found in the 12th 3.06 bios:
0xE2E45: OneOf Prompt: “PCIE Resizable BAR Support”, Help: “Enable/Disable PCIE Resizable BAR Support”, QuestionFlags: 0x10, QuestionId: 0x7CA, VarStoreId: 0x2, VarOffset: 0x42B, Flags: 0x10, Size: 8, Min: 0x0, Max: 0x2, Step: 0x0 { 05 91 5D 14 5E 14 CA 07 02 00 2B 04 10 10 00 02 00 }
0xE2E56: OneOfOption Option: “Auto” Value: 2, Default, MfgDefault { 09 07 90 13 30 00 02 }
0xE2E5D: OneOfOption Option: “Enabled” Value: 1 { 09 07 91 13 00 00 01 }
0xE2E64: OneOfOption Option: “Disabled” Value: 0 { 09 07 92 13 00 00 00 }

In addition to what is in this thread I also used this post on Reddit: https://www.reddit.com/r/eGPU/comments/wx5g0f/my_adventure_in_the_attempt_of_enabling_rebar_on/

The person who posted that has the same result as me though, the option is set to enabled in the bios now but still says it is not in CPU-Z, I don’t know enough about how it works to have any idea why.

I just realized this with my Razer Core X and AMD RX 6600:

lspci -vvv gives me:

        Capabilities: [200 v1] Physical Resizable BAR
                BAR 0: current size: 8GB, supported: 256MB 512MB 1GB 2GB 4GB 8GB
                BAR 2: current size: 2MB, supported: 2MB 4MB 8MB 16MB 32MB 64MB 128MB 256MB

Notice how the BAR 0 is maximum, but the BAR 2 is minimum. I’ll investigate.

@Anachron is this before or after setting the ReBAR option in the BIOS?

That’s before,- I don’t really trust the modification just yet.

Is this expected?

Hi, with a Razer Core X and a Radeon 570 (MSI RX 570 ARMOR 8G OC), I’ve got this result :

Capabilities: [200 v1] Physical Resizable BAR
	BAR 0: current size: 8GB, supported: 256MB 512MB 1GB 2GB 4GB 8GB

No BAR 2 for me.

The BIOS is not patched.

OS : Ubuntu 22.10, mainline kernel 6.2.2

Just to add another data point: I’m on an 11th gen mainboard on bios 3.10 with an Intel ARC A770 GPU.

I applied the patch mentioned by @Lee_Holbrook (by running setup_var_cv SaSetup 0x431 1 0x01 ) and successfully activated ReBAR support on Manjaro Unstable with Linux 6.2.6. This gave a noticeable fps improvement and finally make Blender on a 4k monitor responsive.

lspci -vvv reports:

         Capabilities: [420 v1] Physical Resizable BAR
                BAR 2: current size: 16GB, supported: 256MB 512MB 1GB 2GB 4GB 8GB 16GB

I have been running it like this 5 days without any new instability. This method also seems to survive reboots.

1 Like

After the BIOS patch (intel 12th gen):

	Capabilities: [200 v1] Physical Resizable BAR
		BAR 0: current size: 32GB, supported: 256MB 512MB 1GB 2GB 4GB 8GB 16GB 32GB
		BAR 2: current size: 256MB, supported: 2MB 4MB 8MB 16MB 32MB 64MB 128MB 256MB

Update: ReBar is enabled as per GPU-Z

@Jean-Marc_Le_Roux thanks for the update!

What was it before? Was Bar 2 2MB?

I am not even sure yet what this Bar is used for.

Not sure. I just know it was disabled on Windows.