Infosec Scribbles

July 20, 2018

Getting Intel GuC to work on Ubuntu

It turns out Intel GuC and HuC bits of the i915 driver don’t get loaded by default on Linux. Ubuntu kernel changes make it extra difficult to get them to load manually, so I wrote it down. This is how you get it to work.

Step 1: update-initramfs hooks

If you are on Ubuntu, follow advice from here. For other distros you may be able to skip this step.

Create /etc/initramfs-tools/hooks/i915_add_kbl_guc_ver9_14 and fill it with:

#!/bin/sh

PREREQ=""
prereqs()
{
   echo "$PREREQ"
}

case $1 in
prereqs)
   prereqs
   exit 0
   ;;
esac

. /usr/share/initramfs-tools/hook-functions
# Begin real processing below this line

copy_file firmware /lib/firmware/i915/kbl_guc_ver9_14.bin /lib/firmware/i915/kbl_guc_ver9_14.bin
exit 0

Make it executable and run:

sudo update-initramfs -k all -u
sudo update-grub

This will make sure that when you rebuild initramfs, the binary blob gets included.

Step 2: pass the right options to the i915 kernel module

Create /etc/modprobe.d/i915.conf and fill it with:

options i915 enable_fbc=1 semaphores=1 enable_guc_loading=1 enable_guc_submission=1

You can find more information as to why and how to find out the meaning of every option here. Kernels 4.16+ need a different set of options, which you will also find on that page.

Step 3: verification

Now you need to reboot and run dmesg | grep guc. If you see this, you succeeded:

[    2.842285] [drm] GuC submission enabled (firmware i915/kbl_guc_ver9_14.bin [version 9.14])

To be extra sure, you can check the following files:

  • /sys/kernel/debug/dri/1/i915_guc_load_status
  • /sys/kernel/debug/dri/1/i915_huc_load_status

fetch and load fields should read SUCCESS. If you got this right, enjoy that extra bit of diminishing returns in your integrated GPU performance!