Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
This gist will show you how to tune your Intel-based Skylake, Kabylake and beyond Integrated Graphics Core for performance and reliability through GuC and HuC firmware usage on Linux.

Tuning Intel Skylake and beyond for optimal performance and feature level support on Linux:

Note that on Skylake, Kabylake (and the now cancelled "Broxton") SKUs, functionality such as power saving, GPU scheduling and HDMI audio have been moved onto binary-only firmware, and as such, the GuC and the HuC blobs must be loaded at run-time to access this functionality.

Enabling GuC and HuC on Skylake and above requires a few extra parameters be passed to the kernel before boot.

Instructions provided for both Fedora and Ubuntu (including Debian):

Note that the firmware for these GPUs is often packaged by your distributor, and as such, you can confirm the firmware blob's availability by running:

1. On Fedora:

rpm -ql linux-firmware | fgrep i915

Sample output:

/usr/lib/firmware/i915 
/usr/lib/firmware/i915/bxt_dmc_ver1_07.bin 
/usr/lib/firmware/i915/kbl_dmc_ver1.bin
/usr/lib/firmware/i915/kbl_dmc_ver1_01.bin 
/usr/lib/firmware/i915/skl_dmc_ver1_23.bin 
/usr/lib/firmware/i915/skl_guc_ver1.bin 
/usr/lib/firmware/i915/skl_guc_ver4.bin 
/usr/lib/firmware/i915/skl_guc_ver6.bin 
/usr/lib/firmware/i915/skl_guc_ver6_1.bin 
/usr/share/doc/linux-firmware/LICENSE.i915

2. On Ubuntu:

dpkg -L linux-firmware | fgrep i915

It may be wise to install the linux-firmware-nonfree package as it may contain extra firmware blobs on Ubuntu releases prior to 16.04LTS. Don't install this on 16.04LTS and above.

Now, to the real meat:

GUC loading on Skylake and above:

Add this to the kernel boot parameters on /etc/default/grub:

intel_pstate=skylake_hwp 

The intel_pstate=skylake_hwp option enables Intel's Hardware P-States, known commonly by the marketing moniker "SpeedShift". Note that Intel's IOMMU for VT-d (enabled in the kernel by passing intel_iommu=on to the kernel boot options) cannot be used together with frame buffer compression (i915.enable_fbc=1 argument passed to the i915). Frame Buffer Compression will be disabled automatically to prevent screen tearing in this case.

Then, update grub on Fedora:

(Run commands as root):

For EFI boot (More common):

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

And if you're still booting up in legacy BIOS mode on an MBR-style partitioning scheme or with CSM enabled on Fedora for whatever reason:

grub2-mkconfig -o /boot/grub2/grub.cfg

On Ubuntu:

Simply run:

update-grub

Then reboot.

Your Skylake processor graphics will work just fine.

You can also add this to: /etc/modprobe.d/i915.conf

In the following syntax:

options i915.enable_guc_loading=1 i915.enable_guc_submission=1

Other safe options to pass are enable_rc6=1, enable_fbc=1, enable_psr=1, disable_power_well=0 and semaphores=1

Reference:

See modinfo output for i915 for available GuC options:

modinfo i915 | grep guc

Further notes:

A list of all options along with short descriptions and default values can be generated with the following command:

$ modinfo -p i915

To check which options are currently enabled, run:

# systool -m i915 -av

You will note that many options default to -1, resulting in per-chip power-saving defaults. It is however possible to configure more aggressive powersaving by using module options. Warning: Diverting from the defaults will mark the kernel as tainted from Linux 3.18 onwards. This basically implies using other options than the per-chip defaults is considered experimental and not supported by the developers.

The following set of options should be generally safe to enable:

/etc/modprobe.d/i915.conf

options i915.enable_rc6=1 i915.enable_fbc=1 i915.semaphores=1

RC6 sleep modes (enable_rc6):

You can experiment with higher values for enable_rc6, but your GPU may not support them or the activation of the other options:

The available enable_rc6 values are a bitmask with bit values RC6=1, RC6p=2, RC6pp=4[4] - where "RC6p" and "RC6pp" are lower power states.

To confirm the current running RC6 level, you can look in sysfs:

# cat /sys/class/drm/card0/power/rc6_enable

If the value read is a lower number than expected, the other RC6 level are probably not supported. Passing drm.debug=0xe to the kernel boot options will add DRM debugging information to the kernel log - possibly including a line like this:

[drm:sanitize_rc6_option] Adjusting RC6 mask to 1 (requested 7, valid 1)

Framebuffer compression (enable_fbc):

Framebuffer compression may be unreliable or unavailable on Intel GPU generations before Sandy Bridge (generation 6). This results in messages logged to the system journal similar to this one:

kernel: drm: not enough stolen space for compressed buffer, disabling.

Tear-free video:

With the SNA acceleration method enabled, tearing may be observed. To fix this, enable the "TearFree" option in the driver by adding the following line to your xorg.conf (or ideally, a sub-configuration file under xorg.conf.d) configuration file:

Option "TearFree" "true"

Debugging:

Simply inspect dmesg:

dmesg | grep drm

And also look at the output of:

journalctl -b -o short-monotonic -k

Screen corruption observed when waking up from suspend

This is often observed as font and screen corruption in GTK+ applications (missing glyphs after suspend/resume).

Should you experience missing font glyphs in GTK+ applications, the following workaround might help. Edit /etc/environment to add the following line:

/etc/environment
COGL_ATLAS_DEFAULT_BLIT_MODE=framebuffer

See this bug here for more details.

Thanks and regards,

Brainiarc7

This comment has been minimized.

Show comment Hide comment
@j0nny55555

j0nny55555 May 1, 2017

Which configuration file needs the tear free option?

Which configuration file needs the tear free option?

This comment has been minimized.

Show comment Hide comment
@Brainiarc7

Brainiarc7 May 19, 2017

The xorg.conf file. Updated to reflect that.

Owner

Brainiarc7 commented May 19, 2017

The xorg.conf file. Updated to reflect that.

This comment has been minimized.

Show comment Hide comment
@josedellabosca

josedellabosca Aug 2, 2017

Thanks for the info, now i have enabled guc and huc firmware in gentoo.
Do you happen to now why are disk unrecognized (kernel panic) if i set the gpu as modules in the kernel?

thanks

Thanks for the info, now i have enabled guc and huc firmware in gentoo.
Do you happen to now why are disk unrecognized (kernel panic) if i set the gpu as modules in the kernel?

thanks

This comment has been minimized.

Show comment Hide comment
@Brainiarc7

Brainiarc7 Aug 3, 2017

Hello @josedellabosca,

No.

It might be a bug in the kernel package you're running.

Owner

Brainiarc7 commented Aug 3, 2017

Hello @josedellabosca,

No.

It might be a bug in the kernel package you're running.

This comment has been minimized.

Show comment Hide comment
@pcordes

pcordes Aug 27, 2017

In recent kernels (for example 4.12), intel_pstate=skylake_hwp isn't listed as an option (https://github.com/torvalds/linux/blob/v4.12/Documentation/admin-guide/kernel-parameters.txt#L1604). Maybe it was removed, but that string doesn't appear in the source anywhere.

The pstate driver Just Works on my desktop (using hwp), and has since at least 4.10 (when I got this hardware) without using any options.

pcordes commented Aug 27, 2017

In recent kernels (for example 4.12), intel_pstate=skylake_hwp isn't listed as an option (https://github.com/torvalds/linux/blob/v4.12/Documentation/admin-guide/kernel-parameters.txt#L1604). Maybe it was removed, but that string doesn't appear in the source anywhere.

The pstate driver Just Works on my desktop (using hwp), and has since at least 4.10 (when I got this hardware) without using any options.

This comment has been minimized.

Show comment Hide comment
@pcordes

pcordes Aug 27, 2017

On my Skylake i7-6700k, I'm getting

[drm:i915_gem_init_stolen [i915]] *ERROR* conflict detected with stolen region: [0x00000000c0000000 - 0x00000000c8000000]

in my kernel log, with i915 options all at their default settings. (Linux 4.12.8-2-ARCH, but I've seen this on 4.10 and 11). My firmware blobs are the latest versions.

Am I missing out on any performance here? Linux drm loads the DMC 1.26 firmware, but I guess GuC may not even be enabled by default?

pcordes commented Aug 27, 2017

On my Skylake i7-6700k, I'm getting

[drm:i915_gem_init_stolen [i915]] *ERROR* conflict detected with stolen region: [0x00000000c0000000 - 0x00000000c8000000]

in my kernel log, with i915 options all at their default settings. (Linux 4.12.8-2-ARCH, but I've seen this on 4.10 and 11). My firmware blobs are the latest versions.

Am I missing out on any performance here? Linux drm loads the DMC 1.26 firmware, but I guess GuC may not even be enabled by default?

This comment has been minimized.

Show comment Hide comment
@Brainiarc7

Brainiarc7 Aug 29, 2017

So, according to commit 023f807989f4d6a076258f4efe6d1da0d7aaeb29
Author: Daniel Vetter daniel.vetter@ffwll.ch
Date: Wed Jul 19 12:00:43 2017 +0200

drm/i915: More stolen quirking 

The regression you're seeing should be fixed.

You may want to run the latest Xorg and Mesa stack on your host. If you're on Ubuntu, run the xorg-edgers PPA and the Oibaf PPA.

Since you seem to be on Arch, keep your host machine up to date. By default, Arch runs the latest and greatest mesa stack available.

Owner

Brainiarc7 commented Aug 29, 2017

So, according to commit 023f807989f4d6a076258f4efe6d1da0d7aaeb29
Author: Daniel Vetter daniel.vetter@ffwll.ch
Date: Wed Jul 19 12:00:43 2017 +0200

drm/i915: More stolen quirking 

The regression you're seeing should be fixed.

You may want to run the latest Xorg and Mesa stack on your host. If you're on Ubuntu, run the xorg-edgers PPA and the Oibaf PPA.

Since you seem to be on Arch, keep your host machine up to date. By default, Arch runs the latest and greatest mesa stack available.

This comment has been minimized.

Show comment Hide comment
@GrayJack

GrayJack Nov 22, 2017

Do i need to something else to these parameter to take place? I rebooted and they didn't take place.
I'm in an Manjaro install

Do i need to something else to these parameter to take place? I rebooted and they didn't take place.
I'm in an Manjaro install

This comment has been minimized.

Show comment Hide comment
@Brainiarc7

Brainiarc7 Nov 27, 2017

Hello @GrayJack,

What kernel version are you running?
And what's the output of lspci ?

Owner

Brainiarc7 commented Nov 27, 2017

Hello @GrayJack,

What kernel version are you running?
And what's the output of lspci ?

This comment has been minimized.

Show comment Hide comment
@GrayJack

GrayJack Jan 17, 2018

I'm running the 4.14.13 right now
lspci:
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 02) 00:02.0 VGA compatible controller: Intel Corporation HD Graphics 620 (rev 02) 00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model 00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21) 00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21) 00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21) 00:17.0 SATA controller: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode] (rev 21) 00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #1 (rev f1) 00:1c.1 PCI bridge: Intel Corporation Device 9d11 (rev f1) 00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1) 00:1f.0 ISA bridge: Intel Corporation Sunrise Point-LP LPC Controller (rev 21) 00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21) 00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21) 00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21) 01:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTL8411B PCI Express Card Reader (rev 01) 01:00.1 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 12) 02:00.0 Network controller: Intel Corporation Wireless 3165 (rev 81) 03:00.0 Non-Volatile memory controller: Device 1987:5007 (rev 01)

I'm running the 4.14.13 right now
lspci:
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 02) 00:02.0 VGA compatible controller: Intel Corporation HD Graphics 620 (rev 02) 00:08.0 System peripheral: Intel Corporation Xeon E3-1200 v5/v6 / E3-1500 v5 / 6th/7th Gen Core Processor Gaussian Mixture Model 00:14.0 USB controller: Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21) 00:14.2 Signal processing controller: Intel Corporation Sunrise Point-LP Thermal subsystem (rev 21) 00:16.0 Communication controller: Intel Corporation Sunrise Point-LP CSME HECI #1 (rev 21) 00:17.0 SATA controller: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode] (rev 21) 00:1c.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #1 (rev f1) 00:1c.1 PCI bridge: Intel Corporation Device 9d11 (rev f1) 00:1d.0 PCI bridge: Intel Corporation Sunrise Point-LP PCI Express Root Port #9 (rev f1) 00:1f.0 ISA bridge: Intel Corporation Sunrise Point-LP LPC Controller (rev 21) 00:1f.2 Memory controller: Intel Corporation Sunrise Point-LP PMC (rev 21) 00:1f.3 Audio device: Intel Corporation Sunrise Point-LP HD Audio (rev 21) 00:1f.4 SMBus: Intel Corporation Sunrise Point-LP SMBus (rev 21) 01:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTL8411B PCI Express Card Reader (rev 01) 01:00.1 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 12) 02:00.0 Network controller: Intel Corporation Wireless 3165 (rev 81) 03:00.0 Non-Volatile memory controller: Device 1987:5007 (rev 01)

This comment has been minimized.

Show comment Hide comment
@skhilko

skhilko Feb 19, 2018

Thanks for the great guide! According to this article https://www.pcworld.com/article/3173618/linux/kaby-lake-is-unleashed-with-kernel-410.html intel_pstate should not be needed since Linux 4.10

skhilko commented Feb 19, 2018

Thanks for the great guide! According to this article https://www.pcworld.com/article/3173618/linux/kaby-lake-is-unleashed-with-kernel-410.html intel_pstate should not be needed since Linux 4.10

This comment has been minimized.

Show comment Hide comment
@vinzent

vinzent Feb 27, 2018

options i915.enable_guc_loading=1 i915.enable_guc_submission=1

needed to be

options i915 enable_guc_loading=1 enable_guc_submission=1

and the initramfs had to be rebuilt (dracut --force on Fedora)

now cat /sys/kernel/debug/dri/0/i915_guc_load_status finally shows that FW is loaded.

vinzent commented Feb 27, 2018

options i915.enable_guc_loading=1 i915.enable_guc_submission=1

needed to be

options i915 enable_guc_loading=1 enable_guc_submission=1

and the initramfs had to be rebuilt (dracut --force on Fedora)

now cat /sys/kernel/debug/dri/0/i915_guc_load_status finally shows that FW is loaded.

This comment has been minimized.

Show comment Hide comment
@snorchel

snorchel Mar 21, 2018

Hello,
great guide! It seems that you know what you are talking about. I came to this guide, because I have been searching for solutions of my problem a lot. Maybe you could help me.
Background:
System: Host: lunex Kernel: 4.15.11-041511-generic x86_64 bits: 64 Desktop: Gnome 3.26.2 Distro: Ubuntu 17.10

Machine:   Device: laptop System: Dell product: Inspiron 5379 serial: N/A
           Mobo: Dell model: 09NT72 v: A00 serial: N/A UEFI [Legacy]: Dell v: 1.6.0 date: 01/31/2018
Battery    BAT0: charge: 29.7 Wh 74.4% condition: 39.9/42.0 Wh (95%)
CPU:       Quad core Intel Core i7-8550U (-HT-MCP-) cache: 8192 KB
           clock speeds: max: 4000 MHz 1: 770 MHz 2: 759 MHz 3: 753 MHz 4: 853 MHz 5: 754 MHz 6: 737 MHz
           7: 763 MHz 8: 793 MHz
Graphics:  Card: Intel UHD Graphics 620
           Display Server: x11 (X.Org 1.19.5 ) driver: i915 Resolution: 1920x1080@60.00hz, 2048x1080@60.00hz
           OpenGL: renderer: Mesa DRI Intel UHD Graphics 620 (Kabylake GT2) version: 4.5 Mesa 17.3.6 - padoka PPA
Audio:     Card Intel Sunrise Point-LP HD Audio driver: snd_hda_intel Sound: ALSA v: k4.15.11-041511-generic
Network:   Card: Intel Wireless 3165 driver: iwlwifi
           IF: wlp1s0 state: up mac: 44:03:2c:d8:69:a9
Drives:    HDD Total Size: 512.1GB (33.3% used)
           ID-1: /dev/sda model: LITEON_CV3 size: 512.1GB
Partition: ID-1: / size: 469G used: 159G (36%) fs: ext4 dev: /dev/sda1
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 47.0C mobo: N/A
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 312 Uptime: 9 min Memory: 2028.0/15655.7MB Client: Shell (bash) inxi: 2.3.37

The problem is, when i connect external monitor trough HDMI, it gives me only 2048x1080, but monitor is 2560x1440. Tried different cables, monitors, different solutions on web, none of that worked for me.
I'm on Ubuntu 17.10, but tried other distributions - same. On windows it works fine.

Maybe somebody here could point me to the solution.
Thanks a lot.

Hello,
great guide! It seems that you know what you are talking about. I came to this guide, because I have been searching for solutions of my problem a lot. Maybe you could help me.
Background:
System: Host: lunex Kernel: 4.15.11-041511-generic x86_64 bits: 64 Desktop: Gnome 3.26.2 Distro: Ubuntu 17.10

Machine:   Device: laptop System: Dell product: Inspiron 5379 serial: N/A
           Mobo: Dell model: 09NT72 v: A00 serial: N/A UEFI [Legacy]: Dell v: 1.6.0 date: 01/31/2018
Battery    BAT0: charge: 29.7 Wh 74.4% condition: 39.9/42.0 Wh (95%)
CPU:       Quad core Intel Core i7-8550U (-HT-MCP-) cache: 8192 KB
           clock speeds: max: 4000 MHz 1: 770 MHz 2: 759 MHz 3: 753 MHz 4: 853 MHz 5: 754 MHz 6: 737 MHz
           7: 763 MHz 8: 793 MHz
Graphics:  Card: Intel UHD Graphics 620
           Display Server: x11 (X.Org 1.19.5 ) driver: i915 Resolution: 1920x1080@60.00hz, 2048x1080@60.00hz
           OpenGL: renderer: Mesa DRI Intel UHD Graphics 620 (Kabylake GT2) version: 4.5 Mesa 17.3.6 - padoka PPA
Audio:     Card Intel Sunrise Point-LP HD Audio driver: snd_hda_intel Sound: ALSA v: k4.15.11-041511-generic
Network:   Card: Intel Wireless 3165 driver: iwlwifi
           IF: wlp1s0 state: up mac: 44:03:2c:d8:69:a9
Drives:    HDD Total Size: 512.1GB (33.3% used)
           ID-1: /dev/sda model: LITEON_CV3 size: 512.1GB
Partition: ID-1: / size: 469G used: 159G (36%) fs: ext4 dev: /dev/sda1
RAID:      No RAID devices: /proc/mdstat, md_mod kernel module present
Sensors:   System Temperatures: cpu: 47.0C mobo: N/A
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 312 Uptime: 9 min Memory: 2028.0/15655.7MB Client: Shell (bash) inxi: 2.3.37

The problem is, when i connect external monitor trough HDMI, it gives me only 2048x1080, but monitor is 2560x1440. Tried different cables, monitors, different solutions on web, none of that worked for me.
I'm on Ubuntu 17.10, but tried other distributions - same. On windows it works fine.

Maybe somebody here could point me to the solution.
Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment