Bug 249864 - [amdtemp] does not recognize AMD Ryzen 9 4900H
Summary: [amdtemp] does not recognize AMD Ryzen 9 4900H
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-24 19:45 UTC by florian.millet
Modified: 2021-03-04 15:15 UTC (History)
1 user (show)

See Also:


Attachments
dmesg CPU info (1.73 KB, text/plain)
2020-09-24 19:45 UTC, florian.millet
no flags Details
devinfo -v output (12.80 KB, text/plain)
2020-09-24 19:46 UTC, florian.millet
no flags Details
pciconf -lv output (9.70 KB, text/plain)
2020-09-24 19:46 UTC, florian.millet
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description florian.millet 2020-09-24 19:45:20 UTC
Created attachment 218258 [details]
dmesg CPU info

Hello everyone,

It would seems that FreeBSD amdtemp driver does not yet recognize AMD Ryzen 9 4900H processor. 
When doing a sysctl dev.cpu.0 on a FreeBSD current at svn revision r365451 it shows :

dev.cpu.0.cx_method: C1/hlt C2/io C3/io
dev.cpu.0.cx_usage_counters: 817664 0 0
dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% last 433us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/2/400 C3/3/350
dev.cpu.0.freq_levels: 3300/4021 1700/1615 1400/1277
dev.cpu.0.freq: 3300
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=ACPI0007 _UID=1 _CID=none
dev.cpu.0.%location: handle=\_SB_.PLTF.P000
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU

There is no temperature reported, No dev.cpu.*.temperature sysctl are present while amdtemp is loaded.
I assume all 3rd gen Ryzen processors are in the same boat.
This is on a Asus TUF A17 Notebook.
Comment 1 florian.millet 2020-09-24 19:46:10 UTC
Created attachment 218259 [details]
devinfo -v output
Comment 2 florian.millet 2020-09-24 19:46:35 UTC
Created attachment 218260 [details]
pciconf -lv output
Comment 3 Conrad Meyer freebsd_committer freebsd_triage 2020-09-24 20:12:53 UTC
Please try this patch and see if it attaches on your system.  We support desktop Zen 2 (3rd gen ryzen), but Renoir (APU form) is a bit different.

https://people.freebsd.org/~cem/amdtemp-renoir.0.patch
Comment 4 florian.millet 2020-09-25 03:42:46 UTC
I can confirm that after applying your patch temperature is available :

laptop# sysctl dev.cpu | grep temperature
dev.cpu.15.temperature: 55.0C
dev.cpu.14.temperature: 55.0C
dev.cpu.13.temperature: 55.0C
dev.cpu.12.temperature: 55.0C
dev.cpu.11.temperature: 55.0C
dev.cpu.10.temperature: 55.0C
dev.cpu.9.temperature: 55.0C
dev.cpu.8.temperature: 55.0C
dev.cpu.7.temperature: 55.0C
dev.cpu.6.temperature: 55.0C
dev.cpu.5.temperature: 55.0C
dev.cpu.4.temperature: 55.0C
dev.cpu.3.temperature: 55.0C
dev.cpu.2.temperature: 55.0C
dev.cpu.1.temperature: 55.0C
dev.cpu.0.temperature: 55.0C
laptop#

Thank you for the very quick answer !
Comment 5 Conrad Meyer freebsd_committer freebsd_triage 2020-09-25 04:10:16 UTC
No problem, thanks for trying it out!
Comment 6 commit-hook freebsd_committer freebsd_triage 2020-09-25 04:16:35 UTC
A commit references this bug:

Author: cem
Date: Fri Sep 25 04:16:29 UTC 2020
New revision: 366136
URL: https://svnweb.freebsd.org/changeset/base/366136

Log:
  amdtemp(4), amdsmn(4): Attach to Ryzen 4000 APU (Zen 2, "Renoir")

  PR:		249864
  Reported by:	Florian Millet <florian.millet AT laposte.net>
  Tested by:	Florian Millet

Changes:
  head/sys/dev/amdsmn/amdsmn.c
  head/sys/dev/amdtemp/amdtemp.c
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-03-04 15:15:09 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=89f349bab6d6e6176704b83bd0ec358f9689a6cf

commit 89f349bab6d6e6176704b83bd0ec358f9689a6cf
Author:     Conrad Meyer <cem@FreeBSD.org>
AuthorDate: 2020-09-25 04:16:28 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2021-03-04 15:10:39 +0000

    amdtemp(4), amdsmn(4): Attach to Ryzen 4000 APU (Zen 2, "Renoir")

    PR:             249864
    Reported by:    Florian Millet <florian.millet AT laposte.net>
    Tested by:      Florian Millet

    (cherry picked from commit 5b505170794dfaae633294aaf178bd797b7a1b11)

 sys/dev/amdsmn/amdsmn.c   | 9 ++++++++-
 sys/dev/amdtemp/amdtemp.c | 2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)