Difference between revisions of "Enabling Navi 10 On Fedora 31"

From RCS Wiki
Jump to navigation Jump to search
(Copy config of currently running kernel (old code fails if more than one kernel is installed))
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[Category:Guides]]
 
=Purpose=
 
=Purpose=
 
This guide explains how to add enable Navi 10 based GPUs such as the AMD RX Radeon 5700 XT on Fedora 31.
 
This guide explains how to add enable Navi 10 based GPUs such as the AMD RX Radeon 5700 XT on Fedora 31.
Line 44: Line 45:
 
You may run 'pb-sos' to gather diagnostic data
 
You may run 'pb-sos' to gather diagnostic data
 
No password set, running as root. You may set a password in the System Configuration screen.
 
No password set, running as root. You may set a password in the System Configuration screen.
# nvram -p ibm,skiboot --update-config fast-reset=0
+
# <span style="font-weight: bold;">nvram -p ibm,skiboot --update-config fast-reset=0</span>
# nvram -p ibm,skiboot --print-config
+
# <span style="font-weight: bold;">nvram -p ibm,skiboot --print-config</span>
 
"ibm,skiboot" Partition
 
"ibm,skiboot" Partition
 
--------------------------
 
--------------------------
fast-reset=0
+
<span style="color:red;">fast-reset=0</span>
  
 
#  
 
#  
Line 58: Line 59:
 
Before building a custom kernel, the development tools must be installed
 
Before building a custom kernel, the development tools must be installed
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
sudo dnf install @development-tools
+
<span style="font-weight: bold;">sudo dnf install @development-tools</span>
 +
<span style="font-weight: bold;">sudo dnf install openssl-devel</span>
 
</pre>
 
</pre>
  
Line 64: Line 66:
 
An update kernel with the kernel patches applied must be created. This can be done following the below guide based on https://fedoraproject.org/wiki/Building_a_custom_kernel#Building_a_kernel_from_the_exploded_git_trees
 
An update kernel with the kernel patches applied must be created. This can be done following the below guide based on https://fedoraproject.org/wiki/Building_a_custom_kernel#Building_a_kernel_from_the_exploded_git_trees
  
First, checkout the kernel source code:
+
First, checkout the kernel source code. IN this case, we are using the kernel-5.5.0-0.rc1.git0.1.fc32 branch:
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
[user@bb ~]$ cd ~
+
[user@bb ~]$ <span style="font-weight: bold;">cd ~</span>
[user@bb ~]$ mkdir git
+
[user@bb ~]$ <span style="font-weight: bold;">mkdir git</span>
[user@bb ~]$ cd git
+
[user@bb ~]$ <span style="font-weight: bold;">cd git</span>
[user@bb git]$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git --depth 1 --branch kernel-5.5.0-0.rc1.git0.1.fc32
+
[user@bb git]$ <span style="font-weight: bold;">git clone git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git --depth 1 --branch <span style="color:red;">kernel-5.5.0-0.rc1.git2.1.fc32</span></span>
 
Cloning into 'fedora'...
 
Cloning into 'fedora'...
 
remote: Enumerating objects: 70582, done.
 
remote: Enumerating objects: 70582, done.
Line 99: Line 101:
 
Download and apply the kernel patches:
 
Download and apply the kernel patches:
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
[user@bb git]$ cd fedora/
+
[user@bb git]$ <span style="font-weight: bold;">cd fedora/</span>
[user@bb fedora]$ wget https://gitlab.freedesktop.org/drm/amd/uploads/f8c299fc4fd373a8cbc380f348204b61/0001-amdgpu-Prepare-DCN-floating-point-macros-for-generic.patch
+
[user@bb fedora]$ <span style="font-weight: bold;">wget https://gitlab.freedesktop.org/drm/amd/uploads/f8c299fc4fd373a8cbc380f348204b61/0001-amdgpu-Prepare-DCN-floating-point-macros-for-generic.patch</span>
[user@bb fedora]$ wget https://gitlab.freedesktop.org/drm/amd/uploads/7d194992837c8706ca5966b682d5680b/0002-amdgpu-Enable-initial-DCN-support-on-POWER.patch
+
[user@bb fedora]$ <span style="font-weight: bold;">wget https://gitlab.freedesktop.org/drm/amd/uploads/7d194992837c8706ca5966b682d5680b/0002-amdgpu-Enable-initial-DCN-support-on-POWER.patch</span>
[user@bb fedora]$ wget https://gitlab.freedesktop.org/drm/amd/uploads/86353afdb43409add84005cef8c5abc0/0003-amdgpu-Wrap-FPU-dependent-functions-in-dc20.patch
+
[user@bb fedora]$ <span style="font-weight: bold;">wget https://gitlab.freedesktop.org/drm/amd/uploads/86353afdb43409add84005cef8c5abc0/0003-amdgpu-Wrap-FPU-dependent-functions-in-dc20.patch</span>
[user@bb fedora]$ git am *.patch
+
[user@bb fedora]$ <span style="font-weight: bold;">git am *.patch</span>
 
Applying: amdgpu: Prepare DCN floating point macros for generic arch support
 
Applying: amdgpu: Prepare DCN floating point macros for generic arch support
 
Applying: amdgpu: Enable initial DCN support on POWER
 
Applying: amdgpu: Enable initial DCN support on POWER
 
Applying: amdgpu: Wrap FPU dependent functions in dc20
 
Applying: amdgpu: Wrap FPU dependent functions in dc20
[user@bb fedora]$ sed -i 's/.num_dsc = 5,//g' drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
+
[user@bb fedora]$ <span style="font-weight: bold;">sed -i 's/.num_dsc = 5,//g' drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c</span>
 
</pre>
 
</pre>
  
Configure the kernel, selecting the defaults and DCN_2_0 if prompted:
+
Configure the kernel, selecting the defaults and DCN2_0 if prompted:
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
[user@bb fedora]$ cp /boot/config-*.ppc64le .config
+
[user@bb fedora]$ <span style="font-weight: bold;">cp /boot/config-$(uname -r) .config</span>
[user@bb fedora]$ sed -i 's/CONFIG_DEBUG_INFO=y/# CONFIG_DEBUG_INFO is not set/g' .config
+
[user@bb fedora]$ <span style="font-weight: bold;"># cp /boot/config-*.ppc64le .config # this works only if you have exactly one installed kernel!</span>
[user@bb fedora]$ sed -i 's/CONFIG_DEBUG_INFO_BTF=y/# CONFIG_DEBUG_INFO_BTF is not set/g' .config
+
[user@bb fedora]$ <span style="font-weight: bold;">sed -i 's/CONFIG_DEBUG_INFO=y/# CONFIG_DEBUG_INFO is not set/g' .config</span>
[user@bb fedora]$ make oldconfig
+
[user@bb fedora]$ <span style="font-weight: bold;">sed -i 's/CONFIG_DEBUG_INFO_BTF=y/# CONFIG_DEBUG_INFO_BTF is not set/g' .config</span>
 +
[user@bb fedora]$ <span style="font-weight: bold;">make oldconfig</span>
 
   HOSTCC  scripts/basic/fixdep
 
   HOSTCC  scripts/basic/fixdep
 
   HOSTCC  scripts/kconfig/conf.o
 
   HOSTCC  scripts/kconfig/conf.o
Line 146: Line 149:
 
*
 
*
 
AMD DC - Enable new display engine (DRM_AMD_DC) [Y/n/?] y
 
AMD DC - Enable new display engine (DRM_AMD_DC) [Y/n/?] y
DCN 2.0 family (DRM_AMD_DC_DCN2_0) [Y/n/?] y
+
<span style="color:red;">DCN 2.0 family (DRM_AMD_DC_DCN2_0) [Y/n/?] y</span>
 
   DCN 2.1 family (DRM_AMD_DC_DCN2_1) [N/y/?] n
 
   DCN 2.1 family (DRM_AMD_DC_DCN2_1) [N/y/?] n
 
   DSC support (DRM_AMD_DC_DSC_SUPPORT) [N/y/?] n
 
   DSC support (DRM_AMD_DC_DSC_SUPPORT) [N/y/?] n
Line 155: Line 158:
 
Build the kernel
 
Build the kernel
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
[user@bb fedora]$ make -j`nproc`
+
[user@bb fedora]$ <span style="font-weight: bold;">make -j`nproc`</span>
 
...
 
...
 
</pre>
 
</pre>
Line 161: Line 164:
 
Installing the kernel
 
Installing the kernel
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
[user@bb fedora]$ sudo make INSTALL_MOD_STRIP=1 -j`nproc` modules_install
+
[user@bb fedora]$ <span style="font-weight: bold;">sudo make INSTALL_MOD_STRIP=1 -j`nproc` modules_install</span>
 
[sudo] password for user: ****
 
[sudo] password for user: ****
 
...
 
...
Line 169: Line 172:
 
   DEPMOD  5.5.0-rc1+
 
   DEPMOD  5.5.0-rc1+
 
Warning: modules_install: missing 'System.map' file. Skipping depmod.
 
Warning: modules_install: missing 'System.map' file. Skipping depmod.
[user@bb fedora]$ sudo make INSTALL_MOD_STRIP=1 -j`nproc` install
+
[user@bb fedora]$ <span style="font-weight: bold;">sudo make INSTALL_MOD_STRIP=1 -j`nproc` install</span>
 
   LDS    arch/powerpc/boot/zImage.lds
 
   LDS    arch/powerpc/boot/zImage.lds
 
   WRAP    arch/powerpc/boot/zImage.pseries
 
   WRAP    arch/powerpc/boot/zImage.pseries
Line 187: Line 190:
 
== Locate the entry id ==
 
== Locate the entry id ==
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
[user@bb ~]$ sudo grep "menuentry 'Fedora (<span style="color:red;">5.5.0-rc1+</span>)" /boot/grub2/grub.cfg | cut -d "=" -f2 | cut -d " " -f1
+
[user@bb ~]$ <span style="font-weight: bold;">sudo grep "menuentry 'Fedora (<span style="color:red;">5.5.0-rc1+</span>)" /boot/grub2/grub.cfg | cut -d "=" -f2 | cut -d " " -f1</span>
 
<span style="color:red;">03d8a2f6d3e946e896b45faac2a97657-5.5.0-rc1+</span>
 
<span style="color:red;">03d8a2f6d3e946e896b45faac2a97657-5.5.0-rc1+</span>
 
</pre>
 
</pre>
Line 194: Line 197:
 
The /boot/grub2/grubenv file must be updated. (Replace the text in red as appropriate.)
 
The /boot/grub2/grubenv file must be updated. (Replace the text in red as appropriate.)
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
 
<pre<includeonly></includeonly> class="plainlinks" style="background:black; color:RGB(187,187,187); border:2px #ddd inset; padding:4px; overflow:auto; margin:1px; max-height:{{{height|30em}}}; _height:{{{height|30em}}};font-size:10pt;{{{textstyle|}}}">
[user@bb ~]$ sudo sed -i 's/saved_entry=.*/saved_entry=<span style="color:red;">03d8a2f6d3e946e896b45faac2a97657-5.5.0-rc1+</span>/g' /boot/grub2/grubenv
+
[user@bb ~]$ <span style="font-weight: bold;">sudo sed -i 's/saved_entry=.*/saved_entry=<span style="color:red;">03d8a2f6d3e946e896b45faac2a97657-5.5.0-rc1+</span>/g' /boot/grub2/grubenv</span>
[user@bb ~]$ sudo cat /boot/grub2/grubenv
+
[user@bb ~]$ <span style="font-weight: bold;">sudo cat /boot/grub2/grubenv</span>
 
# GRUB Environment Block
 
# GRUB Environment Block
 
saved_entry=<span style="color:red;">03d8a2f6d3e946e896b45faac2a97657-5.5.0-rc1+</span>
 
saved_entry=<span style="color:red;">03d8a2f6d3e946e896b45faac2a97657-5.5.0-rc1+</span>

Latest revision as of 17:38, 31 January 2020

Purpose

This guide explains how to add enable Navi 10 based GPUs such as the AMD RX Radeon 5700 XT on Fedora 31.

Background

Linux kernel versions up to and including 5.5 do not support display output when using Navi based cards. A set of kernel patches have been developed ot enable display support. To enable the display the kernel must be recompiled.

Preparations

Disabling fast-reset

AMD GPUs can only have firmware loaded once between resets. This causes issues when the fast-reset support is enabled. Before continuing with this guide, please disable fast-reset by rebooting to petitboot.

First, exit to the shell in petitboot.

Next, update the nvram configuration using nvram -p ibm,skiboot --update-config fast-reset=0

To confirm that the variable was updated, use nvram -p ibm,skiboot --print-config

Exit and boot back in to Fedora.

Installing the Development Tools

Before building a custom kernel, the development tools must be installed

Compiling The Kernel

An update kernel with the kernel patches applied must be created. This can be done following the below guide based on https://fedoraproject.org/wiki/Building_a_custom_kernel#Building_a_kernel_from_the_exploded_git_trees

First, checkout the kernel source code. IN this case, we are using the kernel-5.5.0-0.rc1.git0.1.fc32 branch:

Download and apply the kernel patches:

Configure the kernel, selecting the defaults and DCN2_0 if prompted:

Build the kernel

Installing the kernel

At this point, the new kernel has been installed and can be booted. However, the kernel will not be selected as the default and should only be done once it's confirmed working.

Defaulting to the new Kernel

Before the patched kernel will be automatically booted, the grub configuration file must be changed.

Locate the entry id

Update the default kernel

The /boot/grub2/grubenv file must be updated. (Replace the text in red as appropriate.)

Configuring The Display

Before continuing, X11 must be configured to use the Navi card instead of the built-in AST device. This must be done by following steps one and two of Troubleshooting/GPU#Workaround_2:_Select_desired_GPU_at_runtime