Bug 278082 - AMD Ryzen 7 PRO 7840U's internal GPU not supported
Summary: AMD Ryzen 7 PRO 7840U's internal GPU not supported
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-x11 (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-31 21:07 UTC by Philipp Ost
Modified: 2024-04-02 05:39 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (x11)


Attachments
Transcript of kernel panic after 'kldload amdgpu' (4.47 KB, text/plain)
2024-03-31 21:07 UTC, Philipp Ost
no flags Details
FreeBSD 15 dmesg (12.30 KB, text/plain)
2024-03-31 21:08 UTC, Philipp Ost
no flags Details
Output of 'pciconf -lv' (9.60 KB, text/plain)
2024-03-31 21:09 UTC, Philipp Ost
no flags Details
Output of pkg info about all installed ports related to GPU (7.48 KB, text/plain)
2024-03-31 21:10 UTC, Philipp Ost
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Ost 2024-03-31 21:07:56 UTC
Created attachment 249605 [details]
Transcript of kernel panic after 'kldload amdgpu'

The integrated GPU on an AMD Ryzen 7 PRO 7840U seems not to be supported. The machine in question is a Lenovo Thinkpad P16s G2 (AMD; Type 21K9) running a recent version of FreeBSD 15:
FreeBSD perugia 15.0-CURRENT FreeBSD 15.0-CURRENT #0 main-n269029-a983cea4e9a8: Thu Mar 28 17:26:19 CET 2024     root@perugia:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

dmesg reports about the CPU as follows:
----8<----
CPU: AMD Ryzen 7 PRO 7840U w/ Radeon 780M Graphics   (3293.91-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0xa70f41  Family=0x19  Model=0x74  Stepping=1
---->8----

pciconf -lv reports about the graphics controller:
----8<----
vgapci0@pci0:100:0:0:   class=0x030000 rev=0xdd hdr=0x00 vendor=0x1002 device=0x15bf subvendor=0x17aa subdevice=0x50da
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Phoenix1'
    class      = display
    subclass   = VGA
---->8----

Loading amdgpu.ko from graphics/drm-515-kmod works fine, but none of the available firmware modules fits. Loading amdgpu.ko from graphics/drm-61-kmod causes a kernel panic (see attachments).

Prior to installing FreeBSD, this machine ran fine -- graphics included -- with Lubuntu 22.04.3.

This might be related to Bug 268394; the interim solution presented there unfortunately doesn't work in this case as we can't fit a dedicated graphics card.
Comment 1 Philipp Ost 2024-03-31 21:08:51 UTC
Created attachment 249606 [details]
FreeBSD 15 dmesg
Comment 2 Philipp Ost 2024-03-31 21:09:19 UTC
Created attachment 249607 [details]
Output of 'pciconf -lv'
Comment 3 Philipp Ost 2024-03-31 21:10:35 UTC
Created attachment 249608 [details]
Output of pkg info about all installed ports related to GPU
Comment 4 Emmanuel Vadot freebsd_committer freebsd_triage 2024-04-01 06:42:44 UTC
Looks like I forgot to add some flavors as depencencies for gpu-firmware-kmod meta-port, I'll fix this.
In the meantime can you test installing gpu-firmware-amd-kmod-gc-11-0-1 ?
You will probably have to install other packages too (some -dcn-XXX -psp-XXX variant).
Can you make a list of the needed package so we can patch fwget for your pciid ? (We need to do something like https://cgit.freebsd.org/src/tree/usr.sbin/fwget/pci/pci_video_amd#n138)

Thanks.
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-04-01 07:07:51 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e0e2edbb731bd49e90c5e4fc3a677438fa6b7333

commit e0e2edbb731bd49e90c5e4fc3a677438fa6b7333
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2024-04-01 06:59:00 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2024-04-01 07:07:02 +0000

    graphics/gpu-firmware-kmod: Add the GCN3 firmwares as depends

    PR:     278082
    Sponsored by:   Beckhoff Automation GmbH & Co. KG

 graphics/gpu-firmware-kmod/Makefile | 37 ++++++++++++++++++++++++++++++++++---
 1 file changed, 34 insertions(+), 3 deletions(-)
Comment 6 Philipp Ost 2024-04-01 20:26:16 UTC
(In reply to Emmanuel Vadot from comment #4)

Updating the gpu-firmware-kmod meta-port has fixed the issue. Loading amdgpu.ko from drm-61-kmod-6.1.69_2 does no longer panic the kernel.

kldstat now reports the following about graphics related modules:
----8<----
25    1 0xffffffff85200000   666878 amdgpu.ko
26    2 0xffffffff85867000    85090 drm.ko
27    1 0xffffffff851be000     22b8 iic.ko
28    2 0xffffffff851c1000     40e9 linuxkpi_video.ko
29    3 0xffffffff851c6000     7358 dmabuf.ko
30    3 0xffffffff851ce000     3378 lindebugfs.ko
31    1 0xffffffff851d2000     c338 ttm.ko
32    1 0xffffffff858ed000    48a60 amdgpu_gc_11_0_1_mes_2_bin.ko
33    1 0xffffffff85936000    3a890 amdgpu_gc_11_0_1_mes1_bin.ko
34    1 0xffffffff851df000     2ae0 amdgpu_psp_13_0_4_toc_bin.ko
35    1 0xffffffff85971000    446a0 amdgpu_psp_13_0_4_ta_bin.ko
36    1 0xffffffff859b6000    4ba00 amdgpu_dcn_3_1_4_dmcub_bin.ko
37    1 0xffffffff85a02000    225e0 amdgpu_gc_11_0_1_imu_bin.ko
38    1 0xffffffff85a25000    425e0 amdgpu_gc_11_0_1_pfp_bin.ko
39    1 0xffffffff85a68000    425e0 amdgpu_gc_11_0_1_me_bin.ko
40    1 0xffffffff85aab000    29430 amdgpu_gc_11_0_1_rlc_bin.ko
41    1 0xffffffff85ad5000    43a80 amdgpu_gc_11_0_1_mec_bin.ko
42    1 0xffffffff851e2000     a7e0 amdgpu_sdma_6_0_1_bin.ko
43    1 0xffffffff85b19000    5bb00 amdgpu_vcn_4_0_2_bin.ko
---->8----

Output of 'fwget -nv':
----8<----
 Trying to match device 0x8168 in class network and vendor realtek with pci_network_realtek
Trying to match device 0x1103 in class network and vendor qca with pci_network_qca
Trying to match device 0x15bf in class video and vendor amd with pci_video_amd
Needed firmware packages: 'wifi-firmware-ath11k-kmod'
---->8----

We were able to start a very bare-bones X session; getting that running properly is a different story. ;-)

Thanks!
Comment 7 Philipp Ost 2024-04-01 20:54:15 UTC
I just filed Bug 278115 to add the missing firmware packages to fwget.
Comment 8 Emmanuel Vadot freebsd_committer freebsd_triage 2024-04-02 05:39:36 UTC
Thanks, closing this PR then.