terminatorul / NvStrapsReBar

Resizable BAR for Turring GTX 1600 / RTX 2000 GPUs
MIT License
530 stars 12 forks source link
dxe gpu rebar uefi-modding

NvStrapsReBar

UEFI driver to enable and test Resizable BAR on Turing graphics cards (GTX 1600, RTX 2000).

This is a copy of the rather popular ReBarUEFI DXE driver. ReBarUEFI enables Resizable BAR for older motherboards and chipsets without ReBAR support from the manufacturer. NvStrapsReBar was created to test Resizable BAR support for GPUs from the RTX 2000 (and GTX 1600, Turing architecture) line. For the GTX 1000 cards (Pascal architecture) and older the tool can also enable a large BAR on the PCI bus, but it is fixed size and not resizable, so it is not the same as ReBAR. But then the NVIDIA driver for Windows shows a blue screen or resets the computer during boot if the BAR size has been changed. So GTX 1000 cards still can not enable ReBAR. The proprietary Linux driver does not crash, but does not pick up the new BAR size either (NVIDIA, could you please help fixing the Pascal driver ?)

Do I need to flash a new UEFI image on the motherboard, to enable ReBAR on the GPU ?

Yes, this is how it works for Turing GPUs (GTX 1600 / RTX 2000).

(some ideas to get it working without UEFI modding have circulated, but may not be technically possible and nothing is implemented.)

It's ususally the video BIOS (vBIOS) that should enable ReBAR, but the vBIOS is digitally signed (NVIDIA vBIOS is also encrypted) and can not be modified by modders and end-users (is locked-down). The motherboard UEFI image can also be signed or have integrity checks, but in general it is thankfully not as locked down, and users and UEFI modders often still have a way to modify it.

For older boards without ReBAR, adding ReBAR functionality depends on the Above 4G Decoding option in your UEFI setup, which must be turned on in advance, and CSM must be disabled.

Usage

Download latest release from the Releases page, or build the project using the build instructions. This should produce two files:

After download or build you need to go through the following steps:

Warning

image

Credits go to the bellow github users, as I integrated and coded their findings and results:

Working GPUs

Check issue https://github.com/terminatorul/NvStrapsReBar/issues/1 for a list of known working GPUs (and motherboards).

If you get Resizable BAR working on your Turing (or earlier) GPU, please post your system information on issue https://github.com/terminatorul/NvStrapsReBar/issues/1 here on github, in the below format

Use command nvidia-smi -q -d memory to check the new BAR size reported by the Windows/Linux driver.

It maybe easier and more informative to post GPU-Z screenshots with the main GPU page + ReBAR page, and CPU-X with the CPU page and motherboard page screenshots, plus the output from nvidia-smi command. If you needed to apply more changes to make ReBAR work, please post about them as well.

Updating UEFI image

You can download the latest release of NvStrapsReBar from the Releases page, or build the UEFI DXE driver and the Windows executable using the instructions on the building page.

The resulting NvStrapsReBar.ffs file needs to be included in the motherboard UEFI image (downloaded from the montherboard manufacturer), and the resulting image should be flashed onto the motherboard as if it were a new UEFI version for that board. See the original project ReBarUEFI for the instructions to update motherboard UEFI. Replace "ReBarUEFI.ffs" with "NvStrapsReBar.ffs" where appropriate.

So you will still have to check the README page from the original project:

for all the details and instructions on working with the UEFI image, and patching it if necessary (for older motherboards and chipsets).

Enable ReBAR and choose BAR size

After flashing the motherboard with the new UEFI image, you need to enable ReBAR in UEFI Setup. For older motherboards without ReBAR, enable "Above 4G Decoding" and disable CSM. Then you need to run NvStrapsReBar.exe as Administrator.

NvStrapsReBar.exe prompts you with a small text-based menu. You can configure 2 values for the BAR size with this tool:

Newer boards with ReBAR support from the manufacturer can auto-configure PCI BAR size, so you only need to set the GPU-side value for the BAR size. If not, you should try and experiment with both of them, as needed.

Warning

image

Most people should choose the first menu option and press E to Enable auto-settings BAR size for Turing GPUs. Depending on your board, you may need to also input P at the menu prompt, to choose Target PCI BAR size, and select value 64 (for the option to configure PCI BAR for selected GPUs only). Before quitting the menu, input S to save the changes you made to the EFI variable store, for the UEFI DXE driver to read them.

If you choose a GPU BAR size of 8 GiB for example, and a Target PCI BAR size of 4 GiB, you will get a 4 GiB BAR.

For older boards without ReBAR support from the manufacturer, you can select other values for Target PCI BAR size, to also configure other GPUs for example. Or to limit the BAR size to smaller values even if the GPU supports higher values. Depending on the motherboard UEFI, for some boards you may need to use lower values, to limit BAR size to 4 GB or 2GB for example. Even a 2 GB BAR size still gives you the benefits of Resizable BAR in most titles, and NVIDIA tends to use 1.5 GB as the default size in the Profile Inspector. There are exceptions to this 'though (for some titles that can still see improvements with the higher BAR sizes).

If later you want to make further changes in UEFI Setup, or hardware changes like adding a new GPU, you have to disable NvStrapsReBar first. Because NvStrapsReBar depends on the GPU BAR0 address allocated by system firmware, and that changes with UEFI Setup changes or with hardware changes.

Using large BAR sizes

Remember you need to use the Profile Inspector because it enables ReBAR per-application, and that overrides the global value reported by the PCI bus. There appears to be a fake site for the Profile Inspector, so always downloaded it from github, or use the link above.