Bug 243406 - [amdtemp] does not recognize AMD Ryzen Threadripper 3970X (Zen 2)
Summary: [amdtemp] does not recognize AMD Ryzen Threadripper 3970X (Zen 2)
Status: Closed DUPLICATE of bug 239607
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.1-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs mailing list
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2020-01-17 08:54 UTC by Michael Lackner
Modified: 2020-01-17 17:03 UTC (History)
4 users (show)

See Also:


Attachments
output of "# pciconf -lv" (20.68 KB, text/plain)
2020-01-17 09:58 UTC, Michael Lackner
no flags Details
Output of "# devinfo -v" (29.17 KB, text/plain)
2020-01-17 09:59 UTC, Michael Lackner
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Lackner 2020-01-17 08:54:41 UTC
amdtemp does not recognize the AMD Ryzen Threadripper 3970X CPU on the TRX40 platform, and reports no temperatures for the chip. No dev.cpu.*.temperature OIDs are created after loading the module.

I have tried the driver with Zen 2 patches from base r350624 (amdtemp and amdsmn) as described in bug #239607 and re-installed both drivers from that source code, then loaded the newly compiled amdsmn and amdtemp.

The modules still won't provide any temperature information however.

The mainboard in my case is an ASRock TRX40 Taichi.
Comment 1 Michael Lackner 2020-01-17 09:58:53 UTC
Created attachment 210815 [details]
output of "# pciconf -lv"
Comment 2 Michael Lackner 2020-01-17 09:59:37 UTC
Created attachment 210816 [details]
Output of "# devinfo -v"
Comment 3 crest 2020-01-17 11:22:36 UTC
The driver support for Zen 2 hasn't been MFCed from 13-CURRENT. This is the patch I use to add support for the Ryzen 3600X in home server to amdtemp:

Index: sys/dev/amdsmn/amdsmn.c
===================================================================
--- sys/dev/amdsmn/amdsmn.c	(revision 356412)
+++ sys/dev/amdsmn/amdsmn.c	(working copy)
@@ -59,6 +59,7 @@
 #define	PCI_DEVICE_ID_AMD_15H_M60H_ROOT		0x1576
 #define	PCI_DEVICE_ID_AMD_17H_ROOT		0x1450
 #define	PCI_DEVICE_ID_AMD_17H_M10H_ROOT		0x15d0
+#define	PCI_DEVICE_ID_AMD_17H_M30H_ROOT		0x1480
 
 struct pciid;
 struct amdsmn_softc {
@@ -90,6 +91,12 @@
 		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
 		.amdsmn_data_reg = F17H_SMN_DATA_REG,
 	},
+	{
+		.amdsmn_vendorid = CPU_VENDOR_AMD,
+		.amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M30H_ROOT,
+		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+		.amdsmn_data_reg = F17H_SMN_DATA_REG,
+	},
 };
 
 /*
Index: sys/dev/amdtemp/amdtemp.c
===================================================================
--- sys/dev/amdtemp/amdtemp.c	(revision 356412)
+++ sys/dev/amdtemp/amdtemp.c	(working copy)
@@ -96,6 +96,7 @@
 #define	DEVICEID_AMD_MISC16_M30H	0x1583
 #define	DEVICEID_AMD_HOSTB17H_ROOT	0x1450
 #define	DEVICEID_AMD_HOSTB17H_M10H_ROOT	0x15d0
+#define	DEVICEID_AMD_HOSTB17H_M30H_ROOT	0x1480
 
 static const struct amdtemp_product {
 	uint16_t	amdtemp_vendorid;
@@ -118,6 +119,7 @@
 	{ VENDORID_AMD,	DEVICEID_AMD_MISC16_M30H, true },
 	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB17H_ROOT, false },
 	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB17H_M10H_ROOT, false },
+	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB17H_M30H_ROOT, false },
 };
 
 /*
Comment 4 crest 2020-01-17 11:22:55 UTC
The driver support for Zen 2 hasn't been MFCed from 13-CURRENT. This is the patch I use to add support for the Ryzen 3600X in home server to amdtemp:

Index: sys/dev/amdsmn/amdsmn.c
===================================================================
--- sys/dev/amdsmn/amdsmn.c	(revision 356412)
+++ sys/dev/amdsmn/amdsmn.c	(working copy)
@@ -59,6 +59,7 @@
 #define	PCI_DEVICE_ID_AMD_15H_M60H_ROOT		0x1576
 #define	PCI_DEVICE_ID_AMD_17H_ROOT		0x1450
 #define	PCI_DEVICE_ID_AMD_17H_M10H_ROOT		0x15d0
+#define	PCI_DEVICE_ID_AMD_17H_M30H_ROOT		0x1480
 
 struct pciid;
 struct amdsmn_softc {
@@ -90,6 +91,12 @@
 		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
 		.amdsmn_data_reg = F17H_SMN_DATA_REG,
 	},
+	{
+		.amdsmn_vendorid = CPU_VENDOR_AMD,
+		.amdsmn_deviceid = PCI_DEVICE_ID_AMD_17H_M30H_ROOT,
+		.amdsmn_addr_reg = F17H_SMN_ADDR_REG,
+		.amdsmn_data_reg = F17H_SMN_DATA_REG,
+	},
 };
 
 /*
Index: sys/dev/amdtemp/amdtemp.c
===================================================================
--- sys/dev/amdtemp/amdtemp.c	(revision 356412)
+++ sys/dev/amdtemp/amdtemp.c	(working copy)
@@ -96,6 +96,7 @@
 #define	DEVICEID_AMD_MISC16_M30H	0x1583
 #define	DEVICEID_AMD_HOSTB17H_ROOT	0x1450
 #define	DEVICEID_AMD_HOSTB17H_M10H_ROOT	0x15d0
+#define	DEVICEID_AMD_HOSTB17H_M30H_ROOT	0x1480
 
 static const struct amdtemp_product {
 	uint16_t	amdtemp_vendorid;
@@ -118,6 +119,7 @@
 	{ VENDORID_AMD,	DEVICEID_AMD_MISC16_M30H, true },
 	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB17H_ROOT, false },
 	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB17H_M10H_ROOT, false },
+	{ VENDORID_AMD,	DEVICEID_AMD_HOSTB17H_M30H_ROOT, false },
 };
 
 /*
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2020-01-17 12:35:40 UTC
Cc: latest committer to amdsmn.c in 13-CURRENT.
Comment 6 Michael Lackner 2020-01-17 12:47:28 UTC
Alright, this was a user mistake! I compiled the correctly patched source code, and installed the modules in /boot/modules/. It seems modules in /boot/kernel/ are  loaded first though, and I still had the old version in there.

So I loaded the old version. I corrected that and can now confirm that this works for Zen 2 Threadrippers as well, e.g.:

$ sysctl dev.cpu.62.temperature
dev.cpu.62.temperature: 84.6C
Comment 7 Ed Maste freebsd_committer 2020-01-17 16:19:22 UTC
Is this still not merged to stable/12 and stable/11 though?
Comment 8 Conrad Meyer freebsd_committer 2020-01-17 17:00:54 UTC
(In reply to Ed Maste from comment #7)
Correct, AFAIK.
Comment 9 Conrad Meyer freebsd_committer 2020-01-17 17:03:07 UTC
Actually, Mav MFC'd them to 12/11.  Maybe just not in 12.1.

*** This bug has been marked as a duplicate of bug 239607 ***