# Ryzen + B450 + Radeon RX 550 - kernel panic



## WCSN (Mar 24, 2020)

*Hardware*: AMD Ryzen 5 3600 (6 core 12 thr),  mboard Asrock B450 Pro (last BIOS 3.90) RAM DDR4-3000 32Gb (16x2) (ADATA) и Radeon RX 550 (MSI)
*OS*: FreeBSD 12.1-p3
amdgpu 19.1.0_1
mesa-dri-18.3.2_10
drm-fbsd12.0-kmod-4.16.g20200221
drm-kmod-g20190710

"pkg upgrade" from "FreeBSD-latest" pkg-repository

Install new copy FreeBSD. I have strange situation.
Before I have AMD Phenom 64 1100Т (6 core) - all wokk very good without problem
New system: change cpu mb ram. Video card have "old".
If I load kernel modules manual:  amdgpu (kldload) and starts Xorg (KDE5) work all normal and good.
If I load kernel modules automatik from loader.conf and rc.conf - a have kernel panic or var2 (see var 2 down)

I make from last pkg and ports (mesa, drm-kmod, xf86-video-amdgpu) not differents - situation repeat
Different "old" system and "new" system only in UEFI - "old" system have classic BIOS.
*Var1*: manual load modules
`# kldstat
Id Refs Address                Size Name
1   92 0xffffffff80200000  2448f20 kernel
2    1 0xffffffff82649000   3a99a8 zfs.ko
3    2 0xffffffff829f3000     a5b8 opensolaris.ko
4    1 0xffffffff829fe000     71f8 ums.ko
5    1 0xffffffff82a06000     e1d8 aesni.ko
6    1 0xffffffff82a15000    994a8 linux64.ko
7    5 0xffffffff82aaf000     9698 linux_common.ko
8    1 0xffffffff82ab9000    1e8a0 geom_eli.ko
9    1 0xffffffff82ad8000    b7bd8 linux.ko
10    2 0xffffffff82b90000    56b30 pf.ko
11    1 0xffffffff835fa000     1aa0 fdescfs.ko
12    1 0xffffffff835fc000     494c linprocfs.ko
13    1 0xffffffff83601000     1eae linsysfs.ko
14    1 0xffffffff83603000     88d8 tmpfs.ko
55    2 0xffffffff8360c000     3000 libiconv.ko
16    1 0xffffffff8360f000     1f5e libmchain.ko
17    1 0xffffffff83611000      1ae msdosfs_iconv.ko
18    1 0xffffffff83612000     2a30 sem.ko
19    1 0xffffffff83615000     2b88 acpi_video.ko
20    1 0xffffffff83618000     fcf0 fuse.ko
21    1 0xffffffff83628000     2668 intpm.ko
22    1 0xffffffff8362b000      b50 smbus.ko
23    1 0xffffffff8362c000     1420 ulpt.ko
24    1 0xffffffff8362e000     18a0 uhid.ko
25    1 0xffffffff83630000     1aa0 wmt.ko
26    1 0xffffffff83632000      970 pflog.ko
27    1 0xffffffff83633000     47b0 autofs.ko
28    1 0xffffffff83638000     b0cc iscsi.ko
29    1 0xffffffff83644000    1ba00 ng_btsocket.ko
30    1 0xffffffff83660000      9c0 ng_bluetooth.ko
31    1 0xffffffff83661000     9e30 netgraph.ko

Id Refs Address                Size Name
1  150 0xffffffff80200000  2448f20 kernel
2    1 0xffffffff82649000   3a99a8 zfs.ko
3    2 0xffffffff829f3000     a5b8 opensolaris.ko
4    1 0xffffffff829fe000     71f8 ums.ko
5    1 0xffffffff82a06000     e1d8 aesni.ko
6    1 0xffffffff82a15000    994a8 linux64.ko
7    5 0xffffffff82aaf000     9698 linux_common.ko
8    1 0xffffffff82ab9000    1e8a0 geom_eli.ko
9    1 0xffffffff82ad8000    b7bd8 linux.ko
10    2 0xffffffff82b90000    56b30 pf.ko
11    1 0xffffffff835fa000     1aa0 fdescfs.ko
12    1 0xffffffff835fc000     494c linprocfs.ko
13    1 0xffffffff83601000     1eae linsysfs.ko
14    1 0xffffffff83603000     88d8 tmpfs.ko
15    2 0xffffffff8360c000     3000 libiconv.ko
16    1 0xffffffff8360f000     1f5e libmchain.ko
17    1 0xffffffff83611000      1ae msdosfs_iconv.ko
18    1 0xffffffff83612000     2a30 sem.ko
19    1 0xffffffff83615000     2b88 acpi_video.ko
20    1 0xffffffff83618000     fcf0 fuse.ko
21    1 0xffffffff83628000     2668 intpm.ko
22    1 0xffffffff8362b000      b50 smbus.ko
23    1 0xffffffff8362c000     1420 ulpt.ko
24    1 0xffffffff8362e000     18a0 uhid.ko
25    1 0xffffffff83630000     1aa0 wmt.ko
26    1 0xffffffff83632000      970 pflog.ko
27    1 0xffffffff83633000     47b0 autofs.ko
28    1 0xffffffff83638000     b0cc iscsi.ko
29    1 0xffffffff83644000    1ba00 ng_btsocket.ko
30    1 0xffffffff83660000      9c0 ng_bluetooth.ko
31    1 0xffffffff83661000     9e30 netgraph.ko
32    1 0xffffffff8366b000   24fea4 amdgpu.ko
33    2 0xffffffff838bb000    763b0 drm.ko
34    5 0xffffffff83932000    10eb0 linuxkpi.ko
35    4 0xffffffff83943000    12f30 linuxkpi_gplv2.ko
36    2 0xffffffff83956000      6d0 debugfs.ko
37    1 0xffffffff83957000     f121 ttm.ko
38    1 0xffffffff83967000     80db amdgpu_polaris12_mc_bin.ko
39    1 0xffffffff83970000     4421 amdgpu_polaris12_pfp_2_bin.ko
40    1 0xffffffff83975000     441f amdgpu_polaris12_me_2_bin.ko
41    1 0xffffffff8397a000     241f amdgpu_polaris12_ce_2_bin.ko
42    1 0xffffffff8397d000     429d amdgpu_polaris12_rlc_bin.ko
43    1 0xffffffff83982000    40431 amdgpu_polaris12_mec_2_bin.ko
44    1 0xffffffff839c3000    40433 amdgpu_polaris12_mec2_2_bin.ko
45    1 0xffffffff83a04000     331f amdgpu_polaris12_sdma_bin.ko
46    1 0xffffffff83a08000     3321 amdgpu_polaris12_sdma1_bin.ko
47    1 0xffffffff83a0c000    5bbfd amdgpu_polaris12_uvd_bin.ko
48    1 0xffffffff83a68000    28d1d amdgpu_polaris12_vce_bin.ko
49    1 0xffffffff83a91000    1fedd amdgpu_polaris12_smc_bin.ko

syslog

<6>[drm] UVD and UVD ENC initialized successfully.
<6>[drm] VCE initialized successfully.
<6>[drm] fb mappable at 0xE0568000
<6>[drm] vram apper at 0xE0000000
<6>[drm] size 8294400
<6>[drm] fb depth is 24
<6>[drm]    pitch is 7680
VT: Replacing driver "efifb" with new "fb".
start FB_INFO:
type=11 height=1080 width=1920 depth=32
cmsize=16 size=8294400
pbase=0xe0568000 vbase=0xfffff800e0568000
name=drmn0 flags=0x0 stride=7680 bpp=32
cmap[0]=0 cmap[1]=ba0000 cmap[2]=ba00 cmap[3]=ba5e00
end FB_INFO
drmn0: fb0: amdgpudrmfb frame buffer device
i_size_write unimplemented
<6>[drm] Initialized amdgpu 3.23.0 20150101 for drmn0 on minor 0`

*Var2*: Automatic load and Error!

`# kldstat
Id Refs Address                Size Name
1  134 0xffffffff80200000  2448f20 kernel
2    2 0xffffffff82649000    56b30 pf.ko
3    1 0xffffffff826a0000   3a99a8 zfs.ko
4    2 0xffffffff82a4a000     a5b8 opensolaris.ko
5    1 0xffffffff82a56000     71f8 ums.ko
6    1 0xffffffff82a5e000    b7bd8 linux.ko
7    5 0xffffffff82b16000     9698 linux_common.ko
8    1 0xffffffff82b20000    994a8 linux64.ko
9    1 0xffffffff82bba000     e1d8 aesni.ko
10    1 0xffffffff82bc9000    1e8a0 geom_eli.ko
11    1 0xffffffff835fa000     1aa0 fdescfs.ko
12    1 0xffffffff835fc000     494c linprocfs.ko
13    1 0xffffffff83601000     1eae linsysfs.ko
14    1 0xffffffff83603000     88d8 tmpfs.ko
15    1 0xffffffff8360c000   24fea4 amdgpu.ko
16    2 0xffffffff8385c000    763b0 drm.ko
17    5 0xffffffff838d3000    10eb0 linuxkpi.ko
18    4 0xffffffff838e4000    12f30 linuxkpi_gplv2.ko
19    2 0xffffffff838f7000      6d0 debugfs.ko
20    1 0xffffffff838f8000     f121 ttm.ko
21    1 0xffffffff83908000     80db amdgpu_polaris12_mc_bin.ko
22    1 0xffffffff83911000     4421 amdgpu_polaris12_pfp_2_bin.ko
23    1 0xffffffff83916000     441f amdgpu_polaris12_me_2_bin.ko
24    1 0xffffffff8391b000     241f amdgpu_polaris12_ce_2_bin.ko
25    1 0xffffffff8391e000     429d amdgpu_polaris12_rlc_bin.ko
26    1 0xffffffff83923000    40431 amdgpu_polaris12_mec_2_bin.ko
27    1 0xffffffff83964000    40433 amdgpu_polaris12_mec2_2_bin.ko
28    1 0xffffffff839a5000     331f amdgpu_polaris12_sdma_bin.ko
29    1 0xffffffff839a9000     3321 amdgpu_polaris12_sdma1_bin.ko
30    1 0xffffffff839ad000    5bbfd amdgpu_polaris12_uvd_bin.ko
31    1 0xffffffff83a09000    28d1d amdgpu_polaris12_vce_bin.ko
32    1 0xffffffff83a32000    1fedd amdgpu_polaris12_smc_bin.ko
33    1 0xffffffff83a52000     2668 intpm.ko
34    1 0xffffffff83a55000      b50 smbus.ko
35    1 0xffffffff83a56000     1420 ulpt.ko
36    1 0xffffffff83a58000     18a0 uhid.ko
37    1 0xffffffff83a5a000     1aa0 wmt.ko
38    1 0xffffffff83a5c000      970 pflog.ko
39    1 0xffffffff83a5d000     47b0 autofs.ko
40    1 0xffffffff83a62000     b0cc iscsi.ko
41    1 0xffffffff83a6e000    1ba00 ng_btsocket.ko
42    1 0xffffffff83a8a000      9c0 ng_bluetooth.ko
43    1 0xffffffff83a8b000     9e30 netgraph.ko

drmn0: successfully loaded firmware image with name: amdgpu/polaris12_smc.bin
[drm:gfx_v8_0_ring_test_ring] amdgpu: ring 0 test failed (scratch(0xC040)=0xCAFEDEAD)
[drm:amdgpu_device_ip_init] hw_init of IP block <gfx_v8_0> failed -22
drmn0: amdgpu_device_ip_init failed
drmn0: 0xfffff80005c8e800 unpin not necessary
drmn0: 0xfffff80005c69000 unpin not necessary
[TTM] Finalizing pool allocator
[TTM] Zone  kernel: Used memory at exit: 0 kiB
[TTM] Zone   dma32: Used memory at exit: 0 kiB
<6>[drm] amdgpu: ttm finalized
drmn0: Fatal error during GPU init
<6>[drm] amdgpu: finishing device.
device_attach: drmn0 attach returned 22`

?????


----------



## Raffeale (Mar 26, 2020)

is there another amdgpu.ko in /boot/kernel/ directory? if it is, just delete it .
and you can run kldstat -v to get module detail with module directory; 
just put kld_list="amdgpu" , do not need put others in loader.conf


----------



## WCSN (Mar 26, 2020)

No... /boot/kernel not have "amdgpu".
"kldstat -v" say it:
37    1 0xffffffff83649000   250464 amdgpu.ko (/boot/modules/amdgpu.ko)

I make experiment: install clean new freebsd - only base freebsd. Install xf86-video-amdgpu, mesa-dri (+mesa-libs), drm-kmod (+drm-fbsd12.0.-kmod). I get result too again. Now load X and KDE manualy: login to console, kldload amdgpu, servce sddm start.
I getting normal work desktop - full normal work. This situation very strange for my... I think "env's" from console give good(s) effects?..

Thanks for you answer.


----------



## Raffeale (Mar 27, 2020)

look at this post,try to install drm5.0 amdgpu driver https://forums.freebsd.org/threads/...for-freebsd-12-1-tutorial-for-beginner.73901/


----------



## WCSN (Mar 27, 2020)

Goooooooooooooood!
When I not find this before?... It simple... I'm oldest...

This dead problem:
1. download https://github.com/FreeBSDDesktop/kms-drm/tree/drm-v5.0-fbsd12.1
I download zip (can use git or svn too) from link: https://codeload.github.com/FreeBSDDesktop/kms-drm/zip/drm-v5.0-fbsd12.1
2. pkg install mesa-dri mesa-libs xf86-video-amdgpu (I use FreeBSD latest not quiarterly)
3. unpack kms-drm-drm-v5.0-fbsd12.1.zip
4 make install
5. Make instruction from start message: https://forums.freebsd.org/threads/...for-freebsd-12-1-tutorial-for-beginner.73901/
6. place string /etc/rc.conf  kld_list="amdgpu" and sddm_enable="Yes" (or you dm)
7 pkg lock drm-kmod (for do not upgrade from "pkg upgrade" - wait official packages from pkg an ports)
8. reboot

*Raffeale, very big thanks for info!!!*


----------



## Raffeale (Mar 27, 2020)

You are welcome


----------

