On some Intel devices BIOS firmware does not properly reserve memory (called "stolen memory") for the GPU. If the stolen memory is claimed by the OS, functions that depend on stolen memory (like frame buffer compression) can't be used.
A function called pci_early_quirks that is called before the virtual memory system is started was added. In Linux, this PCI early quirks function iterates through all PCI slots to check for any device that require quirks. While this more generic solution is preferable I only ported the Intel graphics specific parts because I think my implementation would be too similar to Linux GPL'd solution after looking at the Linux code too much.
The code regarding Intel graphics stolen memory was ported from Linux. In the case of Intel graphics stolen memory this pci_early_quirks will read the stolen memory base and size from registers and reserve it in phys_avail (if not already reserved). The values are also stored in global variables that is later read by linuxkpi_gplv2. Linuxkpi stores these values in a Linux-specific structure that is read by the drm driver.
Relevant linuxkpi code is here:
- For now, only amd64 arch is supported since that is the only arch supported by the new drm drivers.
- Not sure if I put declarations in the correct headers so please feel free to suggest if there's a better alternative (same goes for all code).
- I was told that Intel GPUs are always located on 0:2:0 so these values are hard coded for now.
UPDATE: phys_avail code moved to separate review.