On 2020-07-15 02:59, [email protected] wrote:
As I said, I just glanced at the documentation to create the patched
version of =linux-libre=, but I already downloaded the source for
=5.7.8= and the deblobbing scripts. If you have specific instructions
based on the log outputs that I am sending, let me know.

** Finding the right card

#+begin_SRC bash :results raw :wrap example
  gunzip -c ./lspci-5.7.8.log.gz | grep -i vga
#+end_SRC

#+RESULTS:
#+begin_example
03:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series] [1002:15dd] (rev c4)
#+end_example

If I run dmesg with linux-libre 5.4.48 (LTS), I also found that
#+begin_EXAMPLE
  ...
  [    1.523096] [drm] add ip block number 2 <vega10_ih>
  [    1.523097] [drm] add ip block number 3 <psp>
  [    1.523098] [drm] add ip block number 4 <gfx_v9_0>
  ...
#+end_EXAMPLE

According to https://wiki.freedesktop.org/xorg/RadeonFeature/#decoderringforengineeringvsmarketingnames, I would then conclude that my graphics card is

#+begin_EXAMPLE
GFX9 VEGA10, VEGA12, VEGA20, RAVEN, RENOIR 6 12 4.x 16384 16384 GCN
#+end_EXAMPLE

All that seems to agree with the source files:
#+begin_SRC bash :dir linux-5.7/drivers/gpu/drm/amd/amdgpu :var gpuname="raven" :results raw :wrap example
  find . -type f -exec grep -nH -e "$gpuname" \{\} +
#+end_SRC

#+RESULTS:
#+begin_example
./amdgpu_device.c:1519:                 chip_name = "raven2";
./amdgpu_device.c:1523:                 chip_name = "raven";
./gfx_v9_0.c:1208:static bool is_raven_kicker(struct amdgpu_device *adev)
./gfx_v9_0.c:1228:                  ((!is_raven_kicker(adev) &&
./gfx_v9_0.c:1349: else if (!strcmp(chip_name, "raven") && (amdgpu_pm_load_smu_firmware(adev, &smu_version) == 0) &&
./gfx_v9_0.c:1564:                      chip_name = "raven2";
./gfx_v9_0.c:1568:                      chip_name = "raven";
./gfx_v9_0.c:6780: adev->gds.gds_compute_max_wave_id = 0x77; /* raven2 */ ./gfx_v9_0.c:6782: adev->gds.gds_compute_max_wave_id = 0x15f; /* raven1 */
./soc15.c:566:  /* original raven doesn't have full asic reset */
./psp_v10_0.c:55:                       chip_name = "raven2";
./psp_v10_0.c:59:                       chip_name = "raven";
./sdma_v4_0.c:555:                      chip_name = "raven2";
./sdma_v4_0.c:559:                      chip_name = "raven";
#+end_example

#+begin_SRC bash :dir linux-5.7/drivers/gpu/drm/amd/amdgpu :var gpuname="raven" look4="_init_microcode" :results raw :wrap example
  while IFS= read src_file; do
      grep -nH -e "$look4" "$src_file"
  done < <(find . -type f -exec grep -l -e "$gpuname" \{\} +)
#+end_SRC

#+RESULTS:
#+begin_example
./gfx_v9_0.c:1545:static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
./gfx_v9_0.c:2228:      r = gfx_v9_0_init_microcode(adev);
./psp_v10_0.c:42:static int psp_v10_0_init_microcode(struct psp_context *psp)
./psp_v10_0.c:372:      .init_microcode = psp_v10_0_init_microcode,
./sdma_v4_0.c~:522: * sdma_v4_0_init_microcode - load ucode images from disk ./sdma_v4_0.c~:533:static int sdma_v4_0_init_microcode(struct amdgpu_device *adev)
./sdma_v4_0.c~:1763:    r = sdma_v4_0_init_microcode(adev);
./gfx_v9_0.c~:1545:static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
./gfx_v9_0.c~:2228:     r = gfx_v9_0_init_microcode(adev);
./sdma_v4_0.c:522: * sdma_v4_0_init_microcode - load ucode images from disk ./sdma_v4_0.c:533:static int sdma_v4_0_init_microcode(struct amdgpu_device *adev)
./sdma_v4_0.c:1763:     r = sdma_v4_0_init_microcode(adev);
#+end_example

** Patching sources

The result of my modifications would be
#+begin_SRC diff :file 011-deblob-amdgpu-raven.patch
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 2020-05-31 20:44:41.000000000 -0500 +++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 2020-07-15 09:22:24.389674167 -0500
  @@ -1763,5 +1763,5 @@
      r = sdma_v4_0_init_microcode(adev);
      if (r) {
          DRM_ERROR("Failed to load sdma firmware!\n");
  -             return r;
  +             /*(DEBLOBBED)*/;
      }

      /* TODO: Page queue breaks driver reload under SRIOV */
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 2020-05-31 20:44:41.000000000 -0500 +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 2020-07-15 09:21:29.699675376 -0500
  @@ -2228,5 +2228,5 @@
      r = gfx_v9_0_init_microcode(adev);
      if (r) {
          DRM_ERROR("Failed to load gfx firmware!\n");
  -             return r;
  +             /*(DEBLOBBED)*/;
      }

      r = adev->gfx.rlc.funcs->init(adev);
#+end_SRC

#+begin_SRC diff :file deblob-amdgpu-raven.patch
  --- a/deblob-5.7      2020-07-09 05:53:15.000000000 -0500
  +++ b/deblob-5.7      2020-07-15 11:53:29.529473809 -0500
  @@ -177,7 +177,7 @@
      :
         else
      die $1 does not contain matches for $2
  -      fi
  +      fi
         return 0
       fi
       ;;
  @@ -947,6 +947,12 @@
   /r = si_init_microcode(rdev);/,/}/ s,return r;,/*(DEBLOBBED)*/,
   ' drivers/gpu/drm/radeon/si.c 'enable blobless activation'
   clean_sed '
  +/r = gfx_v9_0_init_microcode(adev);/,/}/ s,return r;,/*(DEBLOBBED)*/,
  +' drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 'enable blobless activation'
  +clean_sed '
+/r = sdma_v4_0_init_microcode(adev);;/,/}/ s,return r;,/*(DEBLOBBED)*/,
  +' drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 'enable blobless activation'
  +clean_sed '
   /if (!rdev->mc_fw) {/,/}/ s,return -EINVAL;,/*(DEBLOBBED)*/,
   ' drivers/gpu/drm/radeon/si.c 'enable blobless activation'
   reject_firmware drivers/gpu/drm/radeon/cik.c
#+end_SRC

** Testing with =modprobe= failed

May be I did not conpile correctly, but I added =011-deblob-amdgpu-raven.patch= and the corresponding sha512sum to the PKGBUILD for =linux-libre= (from Parabola GNU/Linux). After compilation and installation in the partition where I have SystemD, I tried to =moprobe amdgpu= and not only does the screen go blank, but the keyboard becomes unresponsive

-------------------------------------------------
This free account was provided by VFEmail.net - report spam to [email protected]

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the 
NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features! 15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  
--- a/deblob-5.7	2020-07-09 05:53:15.000000000 -0500
+++ b/deblob-5.7	2020-07-15 11:53:29.529473809 -0500
@@ -177,7 +177,7 @@
 	:
       else
 	die $1 does not contain matches for $2
-      fi
+      fi
       return 0
     fi
     ;;
@@ -947,6 +947,12 @@
 /r = si_init_microcode(rdev);/,/}/ s,return r;,/*(DEBLOBBED)*/,
 ' drivers/gpu/drm/radeon/si.c 'enable blobless activation'
 clean_sed '
+/r = gfx_v9_0_init_microcode(adev);/,/}/ s,return r;,/*(DEBLOBBED)*/,
+' drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 'enable blobless activation'
+clean_sed '
+/r = sdma_v4_0_init_microcode(adev);;/,/}/ s,return r;,/*(DEBLOBBED)*/,
+' drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 'enable blobless activation'
+clean_sed '
 /if (!rdev->mc_fw) {/,/}/ s,return -EINVAL;,/*(DEBLOBBED)*/,
 ' drivers/gpu/drm/radeon/si.c 'enable blobless activation'
 reject_firmware drivers/gpu/drm/radeon/cik.c
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c	2020-05-31 20:44:41.000000000 -0500
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c	2020-07-15 09:22:24.389674167 -0500
@@ -1763,5 +1763,5 @@
 	r = sdma_v4_0_init_microcode(adev);
 	if (r) {
 		DRM_ERROR("Failed to load sdma firmware!\n");
-		return r;
+		/*(DEBLOBBED)*/;
 	}

 	/* TODO: Page queue breaks driver reload under SRIOV */
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c	2020-05-31 20:44:41.000000000 -0500
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c	2020-07-15 09:21:29.699675376 -0500
@@ -2228,5 +2228,5 @@
 	r = gfx_v9_0_init_microcode(adev);
 	if (r) {
 		DRM_ERROR("Failed to load gfx firmware!\n");
-		return r;
+		/*(DEBLOBBED)*/;
 	}

 	r = adev->gfx.rlc.funcs->init(adev);
_______________________________________________
linux-libre mailing list
[email protected]
http://www.fsfla.org/cgi-bin/mailman/listinfo/linux-libre

Reply via email to