System and driver support for Resizable BAR

It is typical today for a discrete graphics processing unit (GPU) to have only a small portion of its frame buffer exposed over the PCI bus. For compatibility with 32 bit OSes, discrete GPUs typically claim a 256 MB I/O region for their frame buffers and this is how typical firmware configures them.

On GPUs that support a resizable base address register (BAR), Windows will renegotiate the size of a GPU's BAR after firmware initialization in Windows Display Driver Model (WDDM) v2 and later. For more information about resizable BAR, see the Resizable BAR Capability specification in the PCI SIG Specifications Library.

A GPU that supports resizable BAR must ensure that it can keep the display up and showing a static image during the reprogramming of the BAR. The display should not go blank and then back up during this process. It is important to have smooth transition between the firmware-displayed image, the boot loader image, and the first image generated by the kernel-mode driver. Note that no PCI transaction will occur toward the GPU while the renegotiation is taking place.

This renegotiation is mostly invisible to the kernel-mode driver. When the renegotiation is successful, the kernel-mode driver will observe that the GPU BAR has been resized to its maximum size to expose the entire VRAM of the discrete GPU.

Upon successful resizing, the kernel-mode driver should expose a single CPUVisible memory segment to the video memory manager. The video memory manager will map CPU virtual addresses directly to this range when the CPU need to access the content of the memory segment.