Announcement

Collapse
No announcement yet.

Building amdgpu in the kernel instead of a module causing problems?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    If you build amdgpu as a module, it will be loaded and initialized from disk or from initramfs rather late.
    If you have amdgpu built-in, then it will be initialized very early, before your root filesystem is mounted.

    The firmware files are installed to disk from the distro firmware package, then integrated by the kernel build system into the kernel binary. You need to have the firmware package installed first before you can build the kernel that way.

    Comment


    • #12
      Originally posted by chithanh View Post
      If you build amdgpu as a module, it will be loaded and initialized from disk or from initramfs rather late.
      If you have amdgpu built-in, then it will be initialized very early, before your root filesystem is mounted.

      The firmware files are installed to disk from the distro firmware package, then integrated by the kernel build system into the kernel binary. You need to have the firmware package installed first before you can build the kernel that way.
      Right on. So to recap:

      Ubuntu - linux-firmware package
      Debian - firmware-amd-graphics package

      Then, for my machine since I have an RX 480 (POLARIS10), I needed to add:

      CONFIG_EXTRA_FIRMWARE="amdgpu/polaris10_ce_2.bin amdgpu/polaris10_ce.bin amdgpu/polaris10_k_smc.bin amdgpu/polaris10_mc.bin amdgpu/polaris10_me_2.bin amdgpu/polaris10_me.bin amdgpu/polaris10_mec2_2.bin amdgpu/polaris10_mec_2.bin amdgpu/polaris10_mec2.bin amdgpu/polaris10_mec.bin amdgpu/polaris10_pfp_2.bin amdgpu/polaris10_pfp.bin amdgpu/polaris10_rlc.bin amdgpu/polaris10_sdma1.bin amdgpu/polaris10_sdma.bin amdgpu/polaris10_smc.bin amdgpu/polaris10_smc_sk.bin amdgpu/polaris10_uvd.bin amdgpu/polaris10_vce.bin"

      and then everything worked well. If I don't add the above, the kernel still builds, but the built-in module misbehaves as mentioned in my OP, in case anyone is following along. Be sure to use the correct firmware files. (if you're using 470, 480, 570, 580, you'll need the same as me, POLARIS10)

      Thanks again, chithanh. Cheers.

      Comment


      • #13
        Originally posted by debianxfce View Post

        Make xconfig shows that the amdgpu driver is built-in, but in the .config file it is defined as module.

        Code:
        CONFIG_DRM_AMDGPU=m
        I am using the kernel of my distribution, so I have included most popular graphics and other drivers.
        Distro kernels almost always have such drivers as modules. What .config says is how your kernel is built. Your dmesg shows that amdgpu initializes late. In short, there is no indication that you have amdgpu built-in, in contrast to the thread starter.

        Comment


        • #14
          Originally posted by debianxfce View Post

          Make xconfig shows that the amdgpu driver is built-in, but in the .config file it is defined as module.

          Code:
          [email protected]:~/Downloads/staging/linux$ cat .config | grep AMDGPU
          CONFIG_DRM_AMDGPU=m
          CONFIG_DRM_AMDGPU_SI=y
          CONFIG_DRM_AMDGPU_CIK=y
          CONFIG_DRM_AMDGPU_USERPTR=y
          You seems to edit the .config file by hand or some other not smart tool.

          Code:
          #
          # Automatically generated file; DO NOT EDIT.
          # Linux/x86_64 4.18.0-rc1 Kernel Configuration
          #
          
          #
          # Compiler: gcc (Debian 8.1.0-12) 8.1.0
          #
          I am using the kernel of my distribution, so I have included most popular graphics and other drivers.
          What's the attachment to debian's kernel? Just because you run debian unstable, doesn't mean you need to a) run their kernel or b) be using the earliest RC of a kernel that's not even officially out yet. You should build both and compare dmesg outputs. While you're at it, build in the amdgpu module :P

          PS: make nconfig > make xconfig or make menuconfig and this is not up for debate.

          Comment


          • #15
            Thought of something if you want to give it a whirl, debianxfce: what happens if you add amdgpu to /etc/initramfs-tools/modules and then run update-initramfs and check dmesg after a reboot? Any difference to when it's loaded? Disclaimer: I am not responsible for any damage.

            Comment


            • #16
              What is the benefit of building amdgpu into the kernel instead of moduling it?

              Comment


              • #17
                Anyone end up having this issue on amdgpu (with suspend and/or hibernate) and fixing it?
                https://gitlab.freedesktop.org/drm/amd/-/issues/1230

                Comment


                • #18
                  Originally posted by make_adobe_on_Linux! View Post
                  Anyone end up having this issue on amdgpu (with suspend and/or hibernate) and fixing it?
                  https://gitlab.freedesktop.org/drm/amd/-/issues/1230
                  I have a Ryzen 2500U laptop, a Thinkpad E585 and (now) have no suspend issues, the machine suspends fine.
                  In my case I came to the conclusion that USB devices or USB modules prevented suspension. The virtualbox modules can also cause suspend problems.

                  Solution: I created a script named /usr/lib/systemd/system-sleep/custom-unload.sh
                  with the following content:


                  Code:
                  #!/bin/bash
                  #/usr/lib/systemd/system-sleep/custom-unload.sh
                  
                  
                  if [ "$1" = pre ] ; then
                  
                  sync
                  systemctl stop vboxdrv.service
                  rmmod usbhid
                  rmmod xhci_pci
                  rmmod xhci_hcd
                  rmmod ehci_pci
                  rmmod ehci_hcd
                  rmmod ohci_pci
                  rmmod ohci_hcd
                  rmmod usbcore
                  
                  fi
                  
                  
                  if [ "$1" = post ] ; then
                  
                  modprobe usbcore
                  modprobe ohci_pci
                  modprobe ohci_hcd
                  modprobe ehci_pci
                  modprobe ehci_hcd
                  modprobe xhci_pci
                  modprobe xhci_hcd
                  modprobe usbhid
                  sleep 1
                  
                  systemctl start vboxdrv.service &
                  
                  fi
                  IF you use a IDE hard drive you may also use this grub kernel parameter: libata.force=1:nohrst
                  If you only use NVME drives, you do not need this option.

                  I came to the conclusion, this had nothing to do with the CPU or amdgpu, on my machine it was a issue with usb and virtualbox modules.

                  Comment

                  Working...
                  X