AMDGPU Support
Denis 'GNUtoo' Carikli
GNUtoo at cyberdimension.org
Tue Apr 26 22:27:58 UTC 2022
On Tue, 26 Apr 2022 21:39:06 +0100
Morris Zuss <morris at vlen.org> wrote:
> Hi all,
Hi,
Thanks a lot for the test/work!!!
This looks really promising.
> Currently I'm doing everything on Parabola, the kernel used is
> 5.10.89, on a BIOS/GPT setup with LVM on LUKS.
The following code in your patch:
> clean_sed '
> /r = gfx_v8_0_init_microcode(adev);/,/}/ s,return r;,/*(DEBLOBBED)*/,
> ' drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 'enable blobless activation'
Will patch this code[1]:
> r = gfx_v8_0_init_microcode(adev);
> if (r) {
> DRM_ERROR("Failed to load gfx firmware!\n");
> return r;
> }
So if it failed at this location without your patch, it would print
"Failed to load gfx firmware!\n".
Since your patch basically removes the "return r;", it would need to
print that too if it reached that point.
Since I didn't see that message in your kernel log, we now we know it
fails before that.
There is a method to fix that.
For now it's better if you remove your clean_sed patch (to re-add it
later if needed).
In your log we have in order of apparition:
> 0000:07:00.0: Missing Free firmware (non-Free firmware loading is
> disabled)
Here this print probably comes from request_firmware somehow, so we can
ignore it. The request_firmware that makes that log is probably the one
mentioned right below.
> amdgpu: mc: Failed to load firmware "/*(DEBLOBBED)*/"
This is the first error we need to fix.
In drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c we have the following code
(reformated a bit for this mail):
> static int gmc_v8_0_init_microcode(struct amdgpu_device *adev)
> {
> [...]
> snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mc.bin",
> chip_name);
> err = request_firmware(&adev->gmc.fw, fw_name, adev->dev);
> if (err)
> goto out;
> err = amdgpu_ucode_validate(adev->gmc.fw);
>
> out:
> if (err) {
> pr_err("mc: Failed to load firmware \"%s\"\n",
> fw_name);
> release_firmware(adev->gmc.fw);
> adev->gmc.fw = NULL;
> }
> return err;
> }
So we clearly have the "mc: failed to load firmware" here. And I didn't
find it in other places where it would apply to your GPU.
And here we can simply use the same kind of patch you did but we
need to replace 'gfx' by 'gmc' to target that code in
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c:
> r = gmc_v8_0_init_microcode(adev);
> if (r) {
> DRM_ERROR("Failed to load mc firmware!\n");
> return r;
> }
Then you need to retry and look at the log to see if there are still
errors, and there will probably be more errors, so you will need to fix
in the same way, that is:
- find the first real error
- patch the code
Your GPU has several processors, and for now many of them require
nonfree firmwares, so there may be several parts in the code where
the amdgpu driver needs to be patched.
As for testing it might be best if you manage to disable somehow the
login screen (it can been done with systemctl disable lightdm or
systemctl disable gdm and by rebooting after that).
This way you can manage to load the amdgpu driver in a console without
having the Xorg drivers interfering.
This is important since Xorg drivers for more recent AMD/ATI GPUs
(the ones that lack 2D acceleration hardware) don't work out of the
box[2] and need minor tweaks to work well.
References:
-----------
[1] I've used linux-libre 5.10.112 source from Guix, so the code may be
slightly different for you.
[2]https://libreplanet.org/wiki/Group:Hardware/research/gpu/radeon#Status_in_the_Xorg_radeon_driver
Denis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://www.fsfla.org/pipermail/linux-libre/attachments/20220427/8684a2db/attachment.sig>
More information about the linux-libre
mailing list