summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2020-04-03 11:30:56 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2020-04-03 11:30:56 +0000
commit0842b8733385ba587ffdaf4ebb48ff329a8e0134 (patch)
tree8c8280f3edf53f1afe502e4183f75c9a536e53f5
parent543fa15d7f7b568d733fc35ce0062b507f5257ac (diff)
parent0e6adfea4a40da04a1864bdeed7e17450ce04df5 (diff)
downloadillumos-joyent-0842b8733385ba587ffdaf4ebb48ff329a8e0134.tar.gz
[illumos-gate merge]
commit 0e6adfea4a40da04a1864bdeed7e17450ce04df5 11976 Want CPU temperature sensors for Zen 2, Raven Ridge commit c0692105a8b350050833b89a3c492068ed009b09 11975 Update AMD CPUID for F17 M10,30,70 commit 9e88c82d66b3fb22f1b1f25cbc4632977358de62 12446 3KSTAT manual pages could be clearer about data life time
-rw-r--r--usr/src/man/man3kstat/kstat_chain_update.3kstat19
-rw-r--r--usr/src/man/man3kstat/kstat_lookup.3kstat22
-rw-r--r--usr/src/man/man7d/amdf17nbdf.7d4
-rw-r--r--usr/src/pkg/manifests/driver-cpu-sensor.mf7
-rw-r--r--usr/src/uts/i86pc/os/cpuid_subr.c66
-rw-r--r--usr/src/uts/intel/io/amdf17nbdf/amdf17nbdf.c31
-rw-r--r--usr/src/uts/intel/os/driver_aliases5
-rw-r--r--usr/src/uts/intel/sys/x86_archext.h18
8 files changed, 137 insertions, 35 deletions
diff --git a/usr/src/man/man3kstat/kstat_chain_update.3kstat b/usr/src/man/man3kstat/kstat_chain_update.3kstat
index 5a4a0656d3..012a4f3b08 100644
--- a/usr/src/man/man3kstat/kstat_chain_update.3kstat
+++ b/usr/src/man/man3kstat/kstat_chain_update.3kstat
@@ -7,7 +7,6 @@
.SH NAME
kstat_chain_update \- update the kstat header chain
.SH SYNOPSIS
-.LP
.nf
\fBcc\fR [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lkstat\fR [ \fIlibrary\fR\&.\|.\|.]
#include <kstat.h>
@@ -18,8 +17,6 @@ kstat_chain_update \- update the kstat header chain
.fi
.SH DESCRIPTION
-.sp
-.LP
The \fBkstat_chain_update()\fR function brings the user's kstat header chain in
sync with that of the kernel. The kstat chain is a linked list of kstat headers
(\fBkstat_t\fR's) pointed to by \fIkc\fR->\fBkc_chain\fR, which is initialized
@@ -27,7 +24,7 @@ by \fBkstat_open\fR(3KSTAT). This chain constitutes a list of all kstats
currently in the system.
.sp
.LP
-During normal operation, the kernel creates new kstats and delete old ones as
+During normal operation, the kernel creates new kstats and deletes old ones as
various device instances are added and removed, thereby causing the user's copy
of the kstat chain to become out of date. The \fBkstat_chain_update()\fR
function detects this condition by comparing the kernel's current kstat chain
@@ -37,15 +34,18 @@ user's KCID, \fIkc\fR->\fBkc_chain_id\fR. If the KCIDs match,
kstat headers from the user's kstat chain, adds any new ones, and sets
\fIkc\fR->\fBkc_chain_id\fR to the new KCID. All other kstat headers in the
user's kstat chain are unmodified.
-.SH RETURN VALUES
.sp
.LP
+Because of the deletion process, any \fBkstat_t\fR structures retrieved by the
+\fBkstat_lookup\fR(3KSTAT) function or data pointers obtained through the
+\fBkstat_data_lookup\fR(3KSTAT) function are invalidated by a call to
+\fRkstat_chain_update\fB(). New lookup calls must be made to obtain fresh
+structures after each chain update.
+.SH RETURN VALUES
Upon successful completion, \fBkstat_chain_update()\fR returns the new KCID if
the kstat chain has changed and 0 if it has not changed. Otherwise, it returns
\(mi1 and sets \fBerrno\fR to indicate the error.
.SH ERRORS
-.sp
-.LP
The \fBkstat_chain_update()\fR function will fail if:
.sp
.ne 2
@@ -84,7 +84,6 @@ The data for the given kstat was too large to be stored in the structure.
.RE
.SH FILES
-.sp
.ne 2
.na
\fB\fB/dev/kstat\fR\fR
@@ -94,8 +93,6 @@ kernel statistics driver
.RE
.SH ATTRIBUTES
-.sp
-.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -112,7 +109,5 @@ MT-Level Unsafe
.TE
.SH SEE ALSO
-.sp
-.LP
\fBkstat\fR(3KSTAT), \fBkstat_lookup\fR(3KSTAT), \fBkstat_open\fR(3KSTAT),
\fBkstat_read\fR(3KSTAT), \fBattributes\fR(5)
diff --git a/usr/src/man/man3kstat/kstat_lookup.3kstat b/usr/src/man/man3kstat/kstat_lookup.3kstat
index 3458f61f21..7a0f9880e7 100644
--- a/usr/src/man/man3kstat/kstat_lookup.3kstat
+++ b/usr/src/man/man3kstat/kstat_lookup.3kstat
@@ -3,11 +3,10 @@
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH KSTAT_LOOKUP 3KSTAT "Aug 3, 2004"
+.TH KSTAT_LOOKUP 3KSTAT "March 24, 2020"
.SH NAME
kstat_lookup, kstat_data_lookup \- find a kstat by name
.SH SYNOPSIS
-.LP
.nf
\fBcc\fR [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lkstat\fR [ \fIlibrary\fR\&.\|.\|.]
#include <kstat.h>
@@ -22,8 +21,6 @@ kstat_lookup, kstat_data_lookup \- find a kstat by name
.fi
.SH DESCRIPTION
-.sp
-.LP
The \fBkstat_lookup()\fR function traverses the kstat chain,
\fIkc\fR->\fBkc_chain\fR, searching for a kstat with the same \fIks_module\fR,
\fIks_instance\fR, and \fIks_name\fR fields; this triplet uniquely identifies a
@@ -37,9 +34,15 @@ The \fBkstat_data_lookup()\fR function searches the kstat's data section for
the record with the specified \fIname\fR. This operation is valid only for
those kstat types that have named data records: \fBKSTAT_TYPE_NAMED\fR and
\fBKSTAT_TYPE_TIMER\fR.
+.SS Lifetime
+The \fBkstat_t\fR structures and any associated data are owned by the library
+and the corresponding handle, \fIkc\fR. That is, two callers with same library
+handle will generally have the same memory returned to them, though this is not
+a guaranteed part of the interface. Callers should not modify or attempt to free
+the data associated with either. Calling the \fBkstat_chain_update\fR(3KSTAT) or
+\fBkstat_close\fR(3KSTAT) functions on the handle \fIkc\fR will cause the
+pointers returned from these functions with the same handle to be invalid.
.SH RETURN VALUES
-.sp
-.LP
The \fBkstat_lookup()\fR function returns a pointer to the requested kstat if
it is found. Otherwise it returns \fINULL\fR and sets \fBerrno\fR to indicate
the error.
@@ -49,8 +52,6 @@ The \fBkstat_data_lookup()\fR function returns a pointer to the requested data
record if it is found. Otherwise it returns \fINULL\fR and sets \fBerrno\fR to
indicate the error .
.SH ERRORS
-.sp
-.LP
The \fBkstat_lookup()\fR and \fBkstat_data_lookup()\fR functions will fail if:
.sp
.ne 2
@@ -72,7 +73,6 @@ The requested kstat could not be found.
.RE
.SH FILES
-.sp
.ne 2
.na
\fB\fB/dev/kstat\fR\fR
@@ -82,8 +82,6 @@ kernel statistics driver
.RE
.SH ATTRIBUTES
-.sp
-.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -100,7 +98,5 @@ MT-Level Unsafe
.TE
.SH SEE ALSO
-.sp
-.LP
\fBkstat\fR(3KSTAT), \fBkstat_chain_update\fR(3KSTAT),
\fBkstat_open\fR(3KSTAT), \fBkstat_read\fR(3KSTAT), \fBattributes\fR(5)
diff --git a/usr/src/man/man7d/amdf17nbdf.7d b/usr/src/man/man7d/amdf17nbdf.7d
index 739eab6c82..e6e6ce863d 100644
--- a/usr/src/man/man7d/amdf17nbdf.7d
+++ b/usr/src/man/man7d/amdf17nbdf.7d
@@ -11,7 +11,7 @@
.\"
.\" Copyright 2019, Joyent, Inc.
.\"
-.Dd March 20, 2019
+.Dd November 16, 2019
.Dt AMDF17NBDF 7D
.Os
.Sh NAME
@@ -24,7 +24,7 @@ The
.Nm
driver provides the system access to the Northbridge and Data Fabric
devices on AMD Family 17h
-.Pq Zen
+.Pq Zen, Zen+, and Zen 2
processors allowing the operating system to communicate with the system
management unit
.Pq SMU .
diff --git a/usr/src/pkg/manifests/driver-cpu-sensor.mf b/usr/src/pkg/manifests/driver-cpu-sensor.mf
index 5ce38d340f..4deea9570f 100644
--- a/usr/src/pkg/manifests/driver-cpu-sensor.mf
+++ b/usr/src/pkg/manifests/driver-cpu-sensor.mf
@@ -30,8 +30,13 @@ dir path=usr/lib/devfsadm/linkmod group=sys
dir path=usr/share/man
dir path=usr/share/man/man7d
driver name=amdf17nbdf \
+ alias=pci1022,1440,p \
alias=pci1022,1450,p \
- alias=pci1022,1460,p
+ alias=pci1022,1460,p \
+ alias=pci1022,1480,p \
+ alias=pci1022,1490,p \
+ alias=pci1022,15d0,p \
+ alias=pci1022,15e8,p
driver name=amdnbtemp \
alias=pci1022,1203,p \
alias=pci1022,1303,p \
diff --git a/usr/src/uts/i86pc/os/cpuid_subr.c b/usr/src/uts/i86pc/os/cpuid_subr.c
index c4230f6e07..6343051ef2 100644
--- a/usr/src/uts/i86pc/os/cpuid_subr.c
+++ b/usr/src/uts/i86pc/os/cpuid_subr.c
@@ -33,7 +33,7 @@
/*
* Copyright 2012 Jens Elkner <jel+illumos@cs.uni-magdeburg.de>
* Copyright 2012 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
- * Copyright 2018, Joyent, Inc.
+ * Copyright 2019 Joyent, Inc.
*/
/*
@@ -82,10 +82,13 @@
* 11 for family 0x16, models 00 - 0f
* 12 for family 0x16, models 30 - 3f
* 13 for family 0x17, models 00 - 0f
+ * 14 for family 0x17, models 10 - 1f
+ * 15 for family 0x17, models 30 - 3f
+ * 16 for family 0x17, models 70 - 7f
* Second index by (model & 0x3) for family 0fh,
* CPUID pkg bits (Fn8000_0001_EBX[31:28]) for later families.
*/
-static uint32_t amd_skts[14][8] = {
+static uint32_t amd_skts[17][8] = {
/*
* Family 0xf revisions B through E
*/
@@ -280,7 +283,7 @@ static uint32_t amd_skts[14][8] = {
},
/*
- * Family 0x17 models 00-0f
+ * Family 0x17 models 00-0f (Zen 1 - Naples, Ryzen)
*/
#define A_SKTS_13 13
{
@@ -294,6 +297,50 @@ static uint32_t amd_skts[14][8] = {
X86_SOCKET_SP3R2 /* 0b111 */
},
+ /*
+ * Family 0x17 models 10-1f (Zen 1 - APU: Raven Ridge)
+ */
+#define A_SKTS_14 14
+ {
+ X86_SOCKET_FP5, /* 0b000 */
+ X86_SOCKET_UNKNOWN, /* 0b001 */
+ X86_SOCKET_AM4, /* 0b010 */
+ X86_SOCKET_UNKNOWN, /* 0b011 */
+ X86_SOCKET_UNKNOWN, /* 0b100 */
+ X86_SOCKET_UNKNOWN, /* 0b101 */
+ X86_SOCKET_UNKNOWN, /* 0b110 */
+ X86_SOCKET_UNKNOWN /* 0b111 */
+ },
+
+ /*
+ * Family 0x17 models 30-3f (Zen 2 - Rome)
+ */
+#define A_SKTS_15 15
+ {
+ X86_SOCKET_UNKNOWN, /* 0b000 */
+ X86_SOCKET_UNKNOWN, /* 0b001 */
+ X86_SOCKET_UNKNOWN, /* 0b010 */
+ X86_SOCKET_UNKNOWN, /* 0b011 */
+ X86_SOCKET_SP3, /* 0b100 */
+ X86_SOCKET_UNKNOWN, /* 0b101 */
+ X86_SOCKET_UNKNOWN, /* 0b110 */
+ X86_SOCKET_SP3R2 /* 0b111 */
+ },
+
+ /*
+ * Family 0x17 models 70-7f (Zen 2 - Matisse)
+ */
+#define A_SKTS_16 16
+ {
+ X86_SOCKET_UNKNOWN, /* 0b000 */
+ X86_SOCKET_UNKNOWN, /* 0b001 */
+ X86_SOCKET_AM4, /* 0b010 */
+ X86_SOCKET_UNKNOWN, /* 0b011 */
+ X86_SOCKET_UNKNOWN, /* 0b100 */
+ X86_SOCKET_UNKNOWN, /* 0b101 */
+ X86_SOCKET_UNKNOWN, /* 0b110 */
+ X86_SOCKET_UNKNOWN /* 0b111 */
+ },
};
struct amd_sktmap_s {
@@ -332,6 +379,7 @@ static struct amd_sktmap_s amd_sktmap[X86_NUM_SOCKETS_AMD + 1] = {
{ X86_SOCKET_FT3B, "FT3b" },
{ X86_SOCKET_SP3, "SP3" },
{ X86_SOCKET_SP3R2, "SP3r2" },
+ { X86_SOCKET_FP5, "FP5" },
{ X86_SOCKET_UNKNOWN, "Unknown" }
};
@@ -487,6 +535,18 @@ static const struct amd_rev_mapent {
A_SKTS_13 },
{ 0x17, 0x01, 0x01, 0x1, 0x1, X86_CHIPREV_AMD_17_PiR_B2, "PiR-B2",
A_SKTS_13 },
+
+ { 0x17, 0x11, 0x11, 0x0, 0x0, X86_CHIPREV_AMD_17_RV_B0, "RV-B0",
+ A_SKTS_14 },
+ { 0x17, 0x11, 0x11, 0x1, 0x1, X86_CHIPREV_AMD_17_RV_B1, "RV-B1",
+ A_SKTS_14 },
+ { 0x17, 0x18, 0x18, 0x1, 0x1, X86_CHIPREV_AMD_17_PCO_B1, "PCO-B1",
+ A_SKTS_14 },
+
+ { 0x17, 0x30, 0x30, 0x0, 0x0, X86_CHIPREV_AMD_17_SSP_A0, "SSP-A0",
+ A_SKTS_15 },
+ { 0x17, 0x31, 0x31, 0x0, 0x0, X86_CHIPREV_AMD_17_SSP_B0, "SSP-B0",
+ A_SKTS_15 },
};
static void
diff --git a/usr/src/uts/intel/io/amdf17nbdf/amdf17nbdf.c b/usr/src/uts/intel/io/amdf17nbdf/amdf17nbdf.c
index 11bddfa515..b1191f8f9e 100644
--- a/usr/src/uts/intel/io/amdf17nbdf/amdf17nbdf.c
+++ b/usr/src/uts/intel/io/amdf17nbdf/amdf17nbdf.c
@@ -75,9 +75,9 @@
* value in the corresponding data fabric's AMDF17_DF_CFG_ADDR_CTL.
*
* This means that we can map a northbridge to a data fabric device and a data
- * fabric device to a die. Because these are 1:1 mappings, there is a transitive
- * relationship and therefore we know which northbridge is associated with which
- * processor die. This is summarized in the following image:
+ * fabric device to a die. Because these are generally 1:1 mappings, there is a
+ * transitive relationship and therefore we know which northbridge is associated
+ * with which processor die. This is summarized in the following image:
*
* +-------+ +----------------------------+ +--------------+
* | Die 0 | ---> | Data Fabric PCI BDF 0/18/0 |-------> | Northbridge |
@@ -93,6 +93,17 @@
* of the data fabric accurately models hardware. All of the BDF values are in
* hex.
*
+ * Starting with the Rome generation of processors (Family 17h Model 30-3Fh),
+ * AMD has multiple northbridges that exist on a given die. All of these
+ * northbridges share the same data fabric and system management network port.
+ * From our perspective this means that some of the northbridge devices will be
+ * redundant and that we will no longer have a 1:1 mapping between the
+ * northbridge and the data fabric devices. Every data fabric will have a
+ * northbridge, but not every northbridge will have a data fabric device mapped.
+ * Because we're always trying to map from a die to a northbridge and not the
+ * reverse, the fact that there are extra northbridge devices hanging around
+ * that we don't know about shouldn't be a problem.
+ *
* -------------------------------
* Attach and Detach Complications
* -------------------------------
@@ -246,6 +257,20 @@ static const amdf17nbdf_table_t amdf17nbdf_dev_map[] = {
/* Family 17h Ryzen, Epyc Models 00h-0fh (Zen uarch) */
{ 0x1450, AMD_NBDF_TYPE_NORTHBRIDGE },
{ 0x1460, AMD_NBDF_TYPE_DATA_FABRIC },
+ /* Family 17h Raven Ridge Models 10h-1fh (Zen uarch) */
+ { 0x15d0, AMD_NBDF_TYPE_NORTHBRIDGE },
+ { 0x15e8, AMD_NBDF_TYPE_DATA_FABRIC },
+ /* Family 17h Epyc Models 30h-3fh (Zen 2 uarch) */
+ { 0x1480, AMD_NBDF_TYPE_NORTHBRIDGE },
+ { 0x1490, AMD_NBDF_TYPE_DATA_FABRIC },
+ /*
+ * Family 17h Ryzen Models 70-7fh (Zen 2 uarch)
+ *
+ * While this family has its own PCI ID for the data fabric device, it
+ * shares the same northbridge ID as the Zen 2 EPYC models 30-3f --
+ * 0x1480.
+ */
+ { 0x1440, AMD_NBDF_TYPE_DATA_FABRIC },
{ PCI_EINVAL16 }
};
diff --git a/usr/src/uts/intel/os/driver_aliases b/usr/src/uts/intel/os/driver_aliases
index fdcac2292b..8f4c2f1bf2 100644
--- a/usr/src/uts/intel/os/driver_aliases
+++ b/usr/src/uts/intel/os/driver_aliases
@@ -67,8 +67,13 @@ amd64_gart "pci1022,1103"
amd8111s "pci1022,7462"
amd_iommu "pci1002,5a23"
amd_iommu "pci1022,11ff"
+amdf17nbdf "pci1022,1440,p"
amdf17nbdf "pci1022,1450,p"
amdf17nbdf "pci1022,1460,p"
+amdf17nbdf "pci1022,1480,p"
+amdf17nbdf "pci1022,1490,p"
+amdf17nbdf "pci1022,15d0,p"
+amdf17nbdf "pci1022,15e8,p"
amdnbtemp "pci1022,1203,p"
amdnbtemp "pci1022,1303,p"
amdnbtemp "pci1022,1403,p"
diff --git a/usr/src/uts/intel/sys/x86_archext.h b/usr/src/uts/intel/sys/x86_archext.h
index bbf8ed2c57..d0efa8c384 100644
--- a/usr/src/uts/intel/sys/x86_archext.h
+++ b/usr/src/uts/intel/sys/x86_archext.h
@@ -944,6 +944,21 @@ extern "C" {
#define X86_CHIPREV_AMD_17_PiR_B2 \
_X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x17, 0x0003)
+#define X86_CHIPREV_AMD_17_RV_B0 \
+ _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x17, 0x0004)
+
+#define X86_CHIPREV_AMD_17_RV_B1 \
+ _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x17, 0x0005)
+
+#define X86_CHIPREV_AMD_17_PCO_B1 \
+ _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x17, 0x0006)
+
+#define X86_CHIPREV_AMD_17_SSP_A0 \
+ _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x17, 0x0007)
+
+#define X86_CHIPREV_AMD_17_SSP_B0 \
+ _X86_CHIPREV_MKREV(X86_VENDOR_AMD, 0x17, 0x0008)
+
/*
* Various socket/package types, extended as the need to distinguish
* a new type arises. The top 8 byte identfies the vendor and the
@@ -998,7 +1013,8 @@ extern "C" {
#define X86_SOCKET_FT3B _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x1e)
#define X86_SOCKET_SP3 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x1f)
#define X86_SOCKET_SP3R2 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x20)
-#define X86_NUM_SOCKETS_AMD 0x21
+#define X86_SOCKET_FP5 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x21)
+#define X86_NUM_SOCKETS_AMD 0x22
/*