Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177873736
D61828.1795485232.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
5 KB
Referenced Files
None
Subscribers
None
D61828.1795485232.diff
View Options
diff --git a/share/man/man4/amdtemp.4 b/share/man/man4/amdtemp.4
--- a/share/man/man4/amdtemp.4
+++ b/share/man/man4/amdtemp.4
@@ -23,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd September 5, 2017
+.Dd November 20, 2026
.Dt AMDTEMP 4
.Os
.Sh NAME
@@ -51,7 +51,7 @@
driver provides support for the on-die digital thermal sensor present
in
.Tn AMD
-Family 0Fh, 10h, 11h, 12h, 14h, 15h, 16h, and 17h processors.
+Family 0Fh, 10h, 11h, 12h, 14h, 15h, 16h, 17h, 19h, and 1Ah processors.
.Pp
For Family 0Fh processors, the
.Nm
@@ -62,13 +62,18 @@
in the corresponding CPU device's sysctl tree, displaying the maximum
temperature of the two sensors located in each CPU core.
.Pp
-For Family 10h, 11h, 12h, 14h, 15h, 16h, and 17h processors, the driver reports
-each package's temperature through a sysctl node, named
+For Family 10h, 11h, 12h, 14h, 15h, 16h, 17h, 19h, and 1Ah processors,
+the driver reports each package's temperature through a sysctl node, named
.Va dev.amdtemp.%d.core0.sensor0 .
The driver also creates
.Va dev.cpu.%d.temperature
in the corresponding CPU device's sysctl tree, displaying the temperature
of the shared sensor located in each CPU package.
+.Pp
+On Family 17h, 19h, and 1Ah processors, the driver also reports the
+temperature of each core complex die (CCD) through sysctl nodes named
+.Va dev.amdtemp.%d.ccd%d .
+Only CCDs with a valid reading get a node.
.Sh SYSCTL VARIABLES
The following variable is available as both
.Xr sysctl 8
diff --git a/sys/dev/amdtemp/amdtemp.c b/sys/dev/amdtemp/amdtemp.c
--- a/sys/dev/amdtemp/amdtemp.c
+++ b/sys/dev/amdtemp/amdtemp.c
@@ -73,7 +73,11 @@
CCD10,
CCD11,
CCD12,
- CCD_MAX = CCD12,
+ CCD13,
+ CCD14,
+ CCD15,
+ CCD16,
+ CCD_MAX = CCD16,
NUM_CCDS = CCD_MAX - CCD_BASE + 1,
} amdsensor_t;
@@ -198,6 +202,7 @@
#define AMDTEMP_ZEN4_10H_CCD_TMP_BASE 0x59b00
#define AMDTEMP_ZEN4_CCD_TMP_BASE 0x59b08
+#define AMDTEMP_ZEN5_00H_CCD_TMP_BASE 0x599f0
/*
* AMD temperature range adjustment, in deciKelvins (i.e., 49.0 Celsius).
@@ -897,6 +902,7 @@
_Static_assert((int)NUM_CCDS >= 8, "");
break;
case 0x10 ... 0x1f: /* Zen4 EPYC "Genoa" */
+ case 0xa0 ... 0xaf: /* Zen4c EPYC "Bergamo", "Siena" */
sc->sc_temp_base = AMDTEMP_ZEN4_10H_CCD_TMP_BASE;
maxreg = 12;
_Static_assert((int)NUM_CCDS >= 12, "");
@@ -924,7 +930,12 @@
uint32_t maxreg;
switch (model) {
- case 0x00 ... 0x2f: /* Zen5 EPYC "Turin" */
+ case 0x00 ... 0x1f: /* Zen5 EPYC "Turin" */
+ sc->sc_temp_base = AMDTEMP_ZEN5_00H_CCD_TMP_BASE;
+ maxreg = 16;
+ _Static_assert((int)NUM_CCDS >= 16, "");
+ break;
+ case 0x20 ... 0x2f: /* Zen5 Ryzen "Strix Point" */
case 0x40 ... 0x4f: /* Zen5 Ryzen "Granite Ridge" */
case 0x60 ... 0x7f: /* ??? */
sc->sc_temp_base = AMDTEMP_ZEN4_CCD_TMP_BASE;
diff --git a/tests/sys/arch/amd64/Makefile b/tests/sys/arch/amd64/Makefile
--- a/tests/sys/arch/amd64/Makefile
+++ b/tests/sys/arch/amd64/Makefile
@@ -3,6 +3,8 @@
PLAIN_TESTS_C+= int0x80
PLAIN_TESTS_C+= ptrace-sce-tamper
+ATF_TESTS_C+= amdtemp_test
+
BINDIR= ${TESTSDIR}
.include <bsd.test.mk>
diff --git a/tests/sys/arch/amd64/amdtemp_test.c b/tests/sys/arch/amd64/amdtemp_test.c
new file mode 100644
--- /dev/null
+++ b/tests/sys/arch/amd64/amdtemp_test.c
@@ -0,0 +1,108 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 Advanced Micro Devices, Inc.
+ */
+
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+#include <machine/cpufunc.h>
+#include <machine/specialreg.h>
+
+#include <atf-c.h>
+#include <stdio.h>
+#include <string.h>
+
+/*
+ * Number of CCD temperature registers amdtemp(4) probes for a given
+ * family and model, or 0 if it probes none.
+ */
+static int
+max_ccds(u_int family, u_int model)
+{
+ switch (family) {
+ case 0x17:
+ switch (model) {
+ case 0x00 ... 0x2f:
+ return (4);
+ case 0x30 ... 0x3f:
+ case 0x60 ... 0x7f:
+ case 0x90 ... 0x9f:
+ return (8);
+ }
+ break;
+ case 0x19:
+ switch (model) {
+ case 0x00 ... 0x0f:
+ case 0x20 ... 0x2f:
+ case 0x40 ... 0x7f:
+ return (8);
+ case 0x10 ... 0x1f:
+ case 0xa0 ... 0xaf:
+ return (12);
+ }
+ break;
+ case 0x1a:
+ switch (model) {
+ case 0x00 ... 0x1f:
+ return (16);
+ case 0x20 ... 0x2f:
+ case 0x40 ... 0x4f:
+ case 0x60 ... 0x7f:
+ return (8);
+ }
+ break;
+ }
+ return (0);
+}
+
+ATF_TC_WITHOUT_HEAD(ccd_sensors);
+ATF_TC_BODY(ccd_sensors, tc)
+{
+ char name[32], vendor[13];
+ u_int regs[4], family, model;
+ size_t len;
+ int i, max, n, val;
+
+ do_cpuid(0, regs);
+ memcpy(vendor, ®s[1], 4);
+ memcpy(vendor + 4, ®s[3], 4);
+ memcpy(vendor + 8, ®s[2], 4);
+ vendor[12] = '\0';
+ if (strcmp(vendor, AMD_VENDOR_ID) != 0)
+ atf_tc_skip("not an AMD CPU");
+ do_cpuid(1, regs);
+ family = CPUID_TO_FAMILY(regs[0]);
+ model = CPUID_TO_MODEL(regs[0]);
+ max = max_ccds(family, model);
+ if (max == 0)
+ atf_tc_skip("no CCD sensors on family %02xh model %02xh",
+ family, model);
+ len = sizeof(val);
+ if (sysctlbyname("dev.amdtemp.0.core0.sensor0", &val, &len, NULL,
+ 0) != 0)
+ atf_tc_skip("amdtemp(4) is not attached");
+
+ n = 0;
+ for (i = 0; i < 32; i++) {
+ snprintf(name, sizeof(name), "dev.amdtemp.0.ccd%d", i);
+ len = sizeof(val);
+ if (sysctlbyname(name, &val, &len, NULL, 0) != 0)
+ continue;
+ n++;
+ ATF_CHECK_MSG(i < max, "%s: family %02xh model %02xh has at "
+ "most %d CCDs", name, family, model, max);
+ /* deciKelvin, 0C to 125C */
+ ATF_CHECK_MSG(val >= 2732 && val <= 3982, "%s: %d dK",
+ name, val);
+ }
+ ATF_CHECK_MSG(n > 0, "no CCD sensors on family %02xh model %02xh",
+ family, model);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, ccd_sensors);
+ return (atf_no_error());
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 24, 1:53 AM (23 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41916413
Default Alt Text
D61828.1795485232.diff (5 KB)
Attached To
Mode
D61828: amdtemp: Support Zen 4c EPYC and fix the Zen 5 EPYC CCD sensors
Attached
Detach File
Event Timeline