Many radeon card stopped working due to linux-libre patches being reverted

Projekt:Trisquel
Version:9.0
Komponente:Kernel/drivers
Kategorie:Fehlerbericht
Priorität:normal
Zugewiesen:Ark74
Status:closed
Beschreibung

Hi,

Long time ago, the radeon driver worked in Linux without the nonfree firmware, and at some point it stopped working because of code like that:

if (!rdev->me_fw) {
        r = r100_cp_init_microcode(rdev);
        if (r) {
                DRM_ERROR("Failed to load firmware!\n");
                return r;
        }
}
Here if the firmware loading fails, this code returns the error which make the .probe() fails, so the radeon driver fails to load.

The solution to that has been to upstream patches in linux-libre to not return the error if loading the firmware fails. Here's the code that does that in deblob-5.4 in the scripts/v5.4-gnu branch of linux-libre git:

# Something like this might work on other radeon cards too.  If you
# have such cards, please give it a try, and report back either way,
# so that we can make more cards work, or at least add comments so
# that others don't waste their time trying them again.  See
# https://libreplanet.org/wiki/Group:Hardware/research/gpu/radeon
clean_sed '
/r = r600_init_microcode(rdev);/,/}/ s,return r;,/*(DEBLOBBED)*/,
' drivers/gpu/drm/radeon/r600.c 'enable blobless activation'
clean_sed '
/r = r600_init_microcode(rdev);/,/}/ s,return r;,/*(DEBLOBBED)*/,
' drivers/gpu/drm/radeon/evergreen.c 'enable blobless activation'
clean_sed '
/r = r600_init_microcode(rdev);/,/}/ s,return r;,/*(DEBLOBBED)*/,
' drivers/gpu/drm/radeon/rv770.c 'enable blobless activation'
clean_sed '
/r = ni_init_microcode(rdev);/,/}/ s,return r;,/*(DEBLOBBED)*/,
' drivers/gpu/drm/radeon/ni.c 'enable blobless activation'
Here not all GPUs were added because linux-libre requires people to test the patch on the concerned hardware before accepting the patch, and I don't have all radeon GPUs, and I've also no amdgpu compatible GPU.

The issue is that in make-linux in the nabia branch of trisquel-package-helpers we have:

PRESERVEDIRS='
[...]
drivers/gpu/drm/radeon
[...]
'
TMPDIR=$(mktemp -d preserve-XXXX)
PRESERVE=$(grep '^+++' $DATA/silent-accept-firmware.patch | /bin/sed 's/+++ //; s/\t.*//;' | cut -d/ -f2- | sort -u )
for FILE in $PRESERVE; do
  cp $FILE $TMPDIR --parents -a
done
for DIR in $PRESERVEDIRS; do
  cp $DIR $TMPDIR --parents -a
done
sh $DATA/deblob-5.4
echo "Reverting deblobbing for files patched by silent-accept-firmware"
cp $TMPDIR/* . -av
[...]
I've no idea how it applies silent-accept-firmware.patch but it clearly reverts the changes for the files in this patch and so it also reverts the changes to make the radeon driver work without the nonfree firmwares.

And I've tested it for real on an AMD netbook and before in Trisquel 9 the radeon driver worked fine, and after the upgrade to Trisquel 10 it doesn't work anymore. After looking at /etc/apt/sources.list and /etc/apt/sources.list.d I didn't see any traces of Jxself's linux-libre repository, so it probably used the stock Trisquel kernel before the upgrade.

Why this is important?

Without the radeon driver, we are limited to drivers like vesa or efifb.

The display of this AMD netbook (a Toshiba N550D) has a resolution of 1024x600, and it works in 1024x600 with the Radeon driver and without it, there is only 800x600 available, so some websites probably don't work well anymore with it. In addition with the radeon driver it supports multiple displays (you can use the internal display and HDMI and configure these with the GUI tools to do that for instance or with xrandr).

More details

There is more background information on the issue in the following Libreplanet page: https://libreplanet.org/wiki/Group:Hardware/research/gpu/radeon .

I added the information there as it's an (FSDG compliant) distro neutral wiki that can be edited easily (people that are not FSF members can easily create an FSF account to edit it).

PS: There is no Trisquel 10 in version when selecting a version for this bugreport. To be clear this bugreport applies to Trisquel 10.

Mi, 03/09/2022 - 04:09
Zugewiesen zu:anonymous» Ark74
Status:active» fixed

Trisquel has it's policy on how far should the distro go in terms of dealing with users devices, specially on a very limited list of devices.
Quote:
""
The Linux-Libre deblob script that is used to make the Trisquel kernel packages disables all functionality related to loading nonfree firmware blobs. Even if the user chooses to install the blob files, these would still not be loaded and the driver would not activate.
An alternative solution is to preserve the loading functionality and remove the *advertisment* to the user of the blob filenames when these fail to be loaded, as to not imply that those files are recommended in any way, so the driver would just print "failed to load firmware" or equivalent. This allows the user to use the driver if they so decide.

This method is done by a patch (silent-accept-firmware.patch) that removes all the instances where the blob filenames are printed to the user (via kernel logs), and a section on the package helper that takes care of preventing the deblob script from acting on the files modified by the patch.
This is done manually, for individual drivers (usually those for very common devices). It needs to be reviewed on any new major release, checking that no new lines were added to the upstream driver in where it prints the blob filename on the log. Printing the blob filename on success operations (that is, when the blob file is present) is acceptable. If in doubt, all instances of printing the blob filenames should be removed.
""

The change requested for this issue at drivers/gpu/drm/radeon/ni.c has been applied and now such driver gets the same treatment as for the rest of linux-libre files.

The change will be delivered on the 5.4.0-104.118+10.0trisquel10 update.

Best regards

Fr, 03/11/2022 - 03:38

Updates for,
- 5.8 - 5.8.0-63.71~20.04.1+10.0trisquel5
- 5.13 - 5.13.0-35.40~20.04.1+10.0trisquel3

Will fix the issue on their respective branches.
Regards.

Fr, 04/07/2023 - 14:55
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.