diff options
-rw-r--r-- | usr/src/common/elfcap/elfcap.c | 8 | ||||
-rw-r--r-- | usr/src/common/elfcap/elfcap.h | 2 | ||||
-rw-r--r-- | usr/src/man/man7d/amdzen.7d | 46 | ||||
-rw-r--r-- | usr/src/pkg/manifests/driver-cpu-amd-zen.mf | 17 | ||||
-rw-r--r-- | usr/src/uts/common/sys/auxv_386.h | 4 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/cpuid.c | 55 | ||||
-rw-r--r-- | usr/src/uts/i86pc/os/cpuid_subr.c | 39 | ||||
-rw-r--r-- | usr/src/uts/intel/io/amdzen/amdzen.c | 16 | ||||
-rw-r--r-- | usr/src/uts/intel/os/driver_aliases | 8 | ||||
-rw-r--r-- | usr/src/uts/intel/sys/x86_archext.h | 7 |
10 files changed, 166 insertions, 36 deletions
diff --git a/usr/src/common/elfcap/elfcap.c b/usr/src/common/elfcap/elfcap.c index a5366da1ae..5a8a8cad67 100644 --- a/usr/src/common/elfcap/elfcap.c +++ b/usr/src/common/elfcap/elfcap.c @@ -415,6 +415,14 @@ static const elfcap_desc_t hw2_386[ELFCAP_NUM_HW2_386] = { { /* 0x04000000 */ AV_386_2_AVX512_VNNI, STRDESC("AV_386_2_AVX512_VNNI"), STRDESC("AVX512_VNNI"), STRDESC("avx512_vnni") + }, + { /* 0x08000000 */ + AV_386_2_VPCLMULQDQ, STRDESC("AV_386_2_VPCLMULQDQ"), + STRDESC("VPCLMULQDQ"), STRDESC("vpclmulqdq") + }, + { /* 0x10000000 */ + AV_386_2_VAES, STRDESC("AV_386_2_VAES"), + STRDESC("VAES"), STRDESC("vaes") } }; diff --git a/usr/src/common/elfcap/elfcap.h b/usr/src/common/elfcap/elfcap.h index 2a9d64f279..0dd442ee6b 100644 --- a/usr/src/common/elfcap/elfcap.h +++ b/usr/src/common/elfcap/elfcap.h @@ -115,7 +115,7 @@ typedef enum { #define ELFCAP_NUM_SF1 3 #define ELFCAP_NUM_HW1_SPARC 17 #define ELFCAP_NUM_HW1_386 32 -#define ELFCAP_NUM_HW2_386 27 +#define ELFCAP_NUM_HW2_386 29 /* diff --git a/usr/src/man/man7d/amdzen.7d b/usr/src/man/man7d/amdzen.7d index 171d36b0d6..7c24b7106a 100644 --- a/usr/src/man/man7d/amdzen.7d +++ b/usr/src/man/man7d/amdzen.7d @@ -11,7 +11,7 @@ .\" .\" Copyright 2020 Oxide Computer Company .\" -.Dd September 1, 2020 +.Dd September 26, 2020 .Dt AMDZEN 7D .Os .Sh NAME @@ -20,13 +20,29 @@ .Nd AMD Zen Nexus Driver .Sh DESCRIPTION The -.Sy amdzen -driver provides access to the AMD Zen, Zen+, and Zen 2 +.Nm +driver provides access to the Northbridge, Data Fabric, and System +Management Network +.Pq SMN +for a number of AMD processor lines, including AMD Ryzen CPUs and APUs, +ThreadRipper CPUs, and EPYC CPUs from the following families: +.Bl -bullet +.It +AMD Zen Naples, Summit Ridge, Whitehaven +.Pq Family 17h +.It +AMD Zen+ Colfax, Picasso, and Pinnacle Ridge .Pq Family 17h -processor families Northbridge, Data Fabric, and System Management Network -.Pq SMN . -This driver is a nexus driver and facilitates access to these devices -between various other devices such as +.It +AMD Zen 2 Castle Peak, Matisse, Rome, and Renoir +.Pq Family 17h +.It +AMD Zen 3 Milan and Vermeer +.Pq Family 19h +.El +.Pp +This driver is a nexus driver and facilitates access to the northbridge, +data fabric, and SMN between various other devices such as .Xr smntemp 7D . The various processor devices that make up the northbridge and data fabric have the @@ -36,6 +52,20 @@ The different devices are all amalgamated and a single uniform view is provided by the .Sy amdzen driver. +.Pp +The +.Nm +driver is a nexus driver that has the following children: +.Bl -tag -width "smntemp(7D)" +.It Xr smntemp 7D +Provides access to on-die temperature sensors. +.It Xr usmn 7D +Provides read access to the SMN. +This driver is intended for development purposes. +.It Xr zen_udf 7D +Provides read access to the data fabric. +This driver is intended for development purposes. +.El .Sh ARCHITECTURE The .Sy amdzen @@ -43,7 +73,7 @@ and .Sy amdzen_stub drivers are limited to .Sy x86 -platforms with AMD Family 17h processors. +platforms with AMD Family 17h and 19h processors. .Sh SEE ALSO .Xr smntemp 7D , .Xr usmn 7D , diff --git a/usr/src/pkg/manifests/driver-cpu-amd-zen.mf b/usr/src/pkg/manifests/driver-cpu-amd-zen.mf index df4adf3339..d0bb700cfb 100644 --- a/usr/src/pkg/manifests/driver-cpu-amd-zen.mf +++ b/usr/src/pkg/manifests/driver-cpu-amd-zen.mf @@ -27,15 +27,16 @@ dir path=usr/share/man dir path=usr/share/man/man7d driver name=amdzen # -# 1440-1447: f17h m70-7fh df +# 1440-1447: f17h m70-7fh, f19h m20-2f df # 1448-144f: f17h m60-6fh df # 1450: f17h m00-0f nb # 1460-1467: f17h m00-0f df -# 1480: f17h m30-3f/70-7f nb -# 1490-1497: f17h m30-3f nb +# 1480: f17h m30-3f/70-7f, f19h m00-0f, m20-2f nb +# 1490-1497: f17h m30-3f df # 15d0: f17h m10-m2f nb # 15e8-15ef: f17h m10-m2f df # 1630: f17h m60-6f nb +# 1650-1657: f19h m00-0f df # driver name=amdzen_stub \ alias=pci1022,1440,p \ @@ -81,7 +82,15 @@ driver name=amdzen_stub \ alias=pci1022,15ed,p \ alias=pci1022,15ee,p \ alias=pci1022,15ef,p \ - alias=pci1022,1630,p + alias=pci1022,1630,p \ + alias=pci1022,1650,p \ + alias=pci1022,1651,p \ + alias=pci1022,1652,p \ + alias=pci1022,1653,p \ + alias=pci1022,1654,p \ + alias=pci1022,1655,p \ + alias=pci1022,1656,p \ + alias=pci1022,1657,p file path=kernel/drv/$(ARCH64)/amdzen group=sys file path=kernel/drv/$(ARCH64)/amdzen_stub group=sys file path=kernel/drv/amdzen.conf group=sys diff --git a/usr/src/uts/common/sys/auxv_386.h b/usr/src/uts/common/sys/auxv_386.h index a1183b9c6b..3654474787 100644 --- a/usr/src/uts/common/sys/auxv_386.h +++ b/usr/src/uts/common/sys/auxv_386.h @@ -113,9 +113,11 @@ extern "C" { #define AV_386_2_MONITORX 0x01000000 /* MONITORX insns */ #define AV_386_2_CLZERO 0x02000000 /* CLZERO */ #define AV_386_2_AVX512_VNNI 0x04000000 /* AVX512_VNNI */ +#define AV_386_2_VPCLMULQDQ 0x08000000 /* VPCLMULQDQ */ +#define AV_386_2_VAES 0x10000000 /* VAES */ #define FMT_AV_386_2 \ - "\033avx512_vnni" \ + "\035vaes\034vpclmulqdq\033avx512_vnni" \ "\032clzero\031monitorx\030clwb\027clflushopt\026fsgsbase" \ "\025sha\024avx512_4fmaps\023avx512_4nniw\022avx512vpopcntdq" \ "\021avx512vbmi\020avx512vl\017avx512bw\016avx512cd" \ diff --git a/usr/src/uts/i86pc/os/cpuid.c b/usr/src/uts/i86pc/os/cpuid.c index ae450f1d9b..6f54dee7f9 100644 --- a/usr/src/uts/i86pc/os/cpuid.c +++ b/usr/src/uts/i86pc/os/cpuid.c @@ -1437,7 +1437,9 @@ static char *x86_feature_names[NUM_X86_FEATURES] = { "pkg_thermal", "tsx_ctrl", "taa_no", - "ppin" + "ppin", + "vaes", + "vpclmulqdq" }; boolean_t @@ -3595,6 +3597,8 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) ecp->cp_ebx &= ~CPUID_INTC_EBX_7_0_ALL_AVX512; ecp->cp_ecx &= ~CPUID_INTC_ECX_7_0_ALL_AVX512; ecp->cp_edx &= ~CPUID_INTC_EDX_7_0_ALL_AVX512; + ecp->cp_ecx &= ~CPUID_INTC_ECX_7_0_VAES; + ecp->cp_ecx &= ~CPUID_INTC_ECX_7_0_VPCLMULQDQ; } if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_SMEP) @@ -3622,10 +3626,17 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_CLFLUSHOPT) add_x86_feature(featureset, X86FSET_CLFLUSHOPT); - if (cpi->cpi_vendor == X86_VENDOR_Intel) { - if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_INVPCID) - add_x86_feature(featureset, X86FSET_INVPCID); + if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_INVPCID) + add_x86_feature(featureset, X86FSET_INVPCID); + + if (ecp->cp_ecx & CPUID_INTC_ECX_7_0_UMIP) + add_x86_feature(featureset, X86FSET_UMIP); + if (ecp->cp_ecx & CPUID_INTC_ECX_7_0_PKU) + add_x86_feature(featureset, X86FSET_PKU); + if (ecp->cp_ecx & CPUID_INTC_ECX_7_0_OSPKE) + add_x86_feature(featureset, X86FSET_OSPKE); + if (cpi->cpi_vendor == X86_VENDOR_Intel) { if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_MPX) add_x86_feature(featureset, X86FSET_MPX); @@ -3717,13 +3728,6 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) if (cpi->cpi_std[7].cp_ebx & CPUID_INTC_EBX_7_0_SHA) add_x86_feature(featureset, X86FSET_SHA); - if (cpi->cpi_std[7].cp_ecx & CPUID_INTC_ECX_7_0_UMIP) - add_x86_feature(featureset, X86FSET_UMIP); - if (cpi->cpi_std[7].cp_ecx & CPUID_INTC_ECX_7_0_PKU) - add_x86_feature(featureset, X86FSET_PKU); - if (cpi->cpi_std[7].cp_ecx & CPUID_INTC_ECX_7_0_OSPKE) - add_x86_feature(featureset, X86FSET_OSPKE); - if (cp->cp_ecx & CPUID_INTC_ECX_XSAVE) { add_x86_feature(featureset, X86FSET_XSAVE); @@ -3759,6 +3763,16 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) CPUID_INTC_EBX_7_0_AVX2) add_x86_feature(featureset, X86FSET_AVX2); + + if (cpi->cpi_std[7].cp_ecx & + CPUID_INTC_ECX_7_0_VAES) + add_x86_feature(featureset, + X86FSET_VAES); + + if (cpi->cpi_std[7].cp_ecx & + CPUID_INTC_ECX_7_0_VPCLMULQDQ) + add_x86_feature(featureset, + X86FSET_VPCLMULQDQ); } if (cpi->cpi_vendor == X86_VENDOR_Intel && @@ -3820,10 +3834,8 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) } } - if (cpi->cpi_vendor == X86_VENDOR_Intel) { - if (cp->cp_ecx & CPUID_INTC_ECX_PCID) { - add_x86_feature(featureset, X86FSET_PCID); - } + if (cp->cp_ecx & CPUID_INTC_ECX_PCID) { + add_x86_feature(featureset, X86FSET_PCID); } if (cp->cp_ecx & CPUID_INTC_ECX_X2APIC) { @@ -4492,6 +4504,10 @@ cpuid_pass2(cpu_t *cpu) X86FSET_AVX512NNIW); remove_x86_feature(x86_featureset, X86FSET_AVX512FMAPS); + remove_x86_feature(x86_featureset, + X86FSET_VAES); + remove_x86_feature(x86_featureset, + X86FSET_VPCLMULQDQ); CPI_FEATURES_ECX(cpi) &= ~CPUID_INTC_ECX_XSAVE; @@ -4515,6 +4531,11 @@ cpuid_pass2(cpu_t *cpu) CPI_FEATURES_7_0_ECX(cpi) &= ~CPUID_INTC_ECX_7_0_ALL_AVX512; + CPI_FEATURES_7_0_ECX(cpi) &= + ~CPUID_INTC_ECX_7_0_VAES; + CPI_FEATURES_7_0_ECX(cpi) &= + ~CPUID_INTC_ECX_7_0_VPCLMULQDQ; + CPI_FEATURES_7_0_EDX(cpi) &= ~CPUID_INTC_EDX_7_0_ALL_AVX512; @@ -5305,6 +5326,10 @@ cpuid_pass4(cpu_t *cpu, uint_t *hwcap_out) hwcap_flags_2 |= AV_386_2_AVX512_VNNI; if (*ecx_7 & CPUID_INTC_ECX_7_0_AVX512VPOPCDQ) hwcap_flags_2 |= AV_386_2_AVX512VPOPCDQ; + if (*ecx_7 & CPUID_INTC_ECX_7_0_VAES) + hwcap_flags_2 |= AV_386_2_VAES; + if (*ecx_7 & CPUID_INTC_ECX_7_0_VPCLMULQDQ) + hwcap_flags_2 |= AV_386_2_VPCLMULQDQ; if (*edx_7 & CPUID_INTC_EDX_7_0_AVX5124NNIW) hwcap_flags_2 |= AV_386_2_AVX512_4NNIW; diff --git a/usr/src/uts/i86pc/os/cpuid_subr.c b/usr/src/uts/i86pc/os/cpuid_subr.c index 83b3e115eb..faa3e75b03 100644 --- a/usr/src/uts/i86pc/os/cpuid_subr.c +++ b/usr/src/uts/i86pc/os/cpuid_subr.c @@ -88,10 +88,12 @@ * 15 for family 0x17, models 30 - 3f * 16 for family 0x17, models 60 - 6f * 17 for family 0x17, models 70 - 7f + * 18 for family 0x19, models 00 - 0f + * 19 for family 0x19, models 20 - 2f * Second index by (model & 0x3) for family 0fh, * CPUID pkg bits (Fn8000_0001_EBX[31:28]) for later families. */ -static uint32_t amd_skts[18][8] = { +static uint32_t amd_skts[20][8] = { /* * Family 0xf revisions B through E */ @@ -361,6 +363,36 @@ static uint32_t amd_skts[18][8] = { X86_SOCKET_UNKNOWN, /* 0b110 */ X86_SOCKET_UNKNOWN /* 0b111 */ }, + + /* + * Family 0x19 models 00-0f (Zen 3 - Milan) + */ +#define A_SKTS_18 18 + { + 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_STRX4 /* 0b111 */ + }, + + /* + * Family 0x19 models 20-2f (Zen 3 - Vermeer) + */ +#define A_SKTS_19 19 + { + 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 { @@ -401,6 +433,7 @@ static struct amd_sktmap_s amd_sktmap_strs[X86_NUM_SOCKETS_AMD + 1] = { { X86_SOCKET_SP3R2, "SP3r2" }, { X86_SOCKET_FP5, "FP5" }, { X86_SOCKET_FP6, "FP6" }, + { X86_SOCKET_STRX4, "sTRX4" }, { X86_SOCKET_UNKNOWN, "Unknown" } }; @@ -425,7 +458,9 @@ static const struct amd_skt_mapent { { 0x17, 0x10, 0x2f, A_SKTS_14 }, { 0x17, 0x30, 0x3f, A_SKTS_15 }, { 0x17, 0x60, 0x6f, A_SKTS_16 }, - { 0x17, 0x70, 0x7f, A_SKTS_17 } + { 0x17, 0x70, 0x7f, A_SKTS_17 }, + { 0x19, 0x00, 0x0f, A_SKTS_18 }, + { 0x19, 0x20, 0x2f, A_SKTS_19 } }; /* diff --git a/usr/src/uts/intel/io/amdzen/amdzen.c b/usr/src/uts/intel/io/amdzen/amdzen.c index 25e38ee988..ac6ce9c94f 100644 --- a/usr/src/uts/intel/io/amdzen/amdzen.c +++ b/usr/src/uts/intel/io/amdzen/amdzen.c @@ -144,7 +144,7 @@ static const uint16_t amdzen_nb_ids[] = { 0x1450, /* Family 17h Raven Ridge, Kestrel, Dali Models 10h-2fh (Zen uarch) */ 0x15d0, - /* Family 17h Epyc Models 30h-3fh, Matisse 70-7fh (Zen 2 uarch) */ + /* Family 17h/19h Rome, Milan, Matisse, Vermeer Zen 2/Zen 3 uarch */ 0x1480, /* Family 17h Renoir Models 60-6fh (Zen 2 uarch) */ 0x1630 @@ -436,6 +436,16 @@ static const uint8_t amdzen_df_rome_ids[0x2b] = { }; /* + * Check the first df entry to see if it belongs to Rome or Milan. If so, then + * it uses the disjoint ID space. + */ +static boolean_t +amdzen_is_rome_style(uint_t id) +{ + return (id == 0x1490 || id == 0x1650); +} + +/* * Initialize our knowledge about a given series of nodes on the data fabric. */ static void @@ -464,11 +474,11 @@ amdzen_setup_df(amdzen_t *azn, amdzen_df_t *df) * indexes that we iterate over, though the total number of * entries is right. */ - if (df->adf_funcs[0]->azns_did == 0x1490) { + if (amdzen_is_rome_style(df->adf_funcs[0]->azns_did)) { if (inst > ARRAY_SIZE(amdzen_df_rome_ids)) { dev_err(azn->azn_dip, CE_WARN, "Rome family " "processor reported more ids than the PPR, " - "resting %u to instance zero", inst); + "resetting %u to instance zero", inst); inst = 0; } else { inst = amdzen_df_rome_ids[inst]; diff --git a/usr/src/uts/intel/os/driver_aliases b/usr/src/uts/intel/os/driver_aliases index 6c79bd182c..8aab0f3f4a 100644 --- a/usr/src/uts/intel/os/driver_aliases +++ b/usr/src/uts/intel/os/driver_aliases @@ -111,6 +111,14 @@ amdzen_stub "pci1022,15ed,p" amdzen_stub "pci1022,15ee,p" amdzen_stub "pci1022,15ef,p" amdzen_stub "pci1022,1630,p" +amdzen_stub "pci1022,1650,p" +amdzen_stub "pci1022,1651,p" +amdzen_stub "pci1022,1652,p" +amdzen_stub "pci1022,1653,p" +amdzen_stub "pci1022,1654,p" +amdzen_stub "pci1022,1655,p" +amdzen_stub "pci1022,1656,p" +amdzen_stub "pci1022,1657,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 eed3c5fd4e..b75ab18f5e 100644 --- a/usr/src/uts/intel/sys/x86_archext.h +++ b/usr/src/uts/intel/sys/x86_archext.h @@ -735,6 +735,8 @@ extern "C" { #define X86FSET_TSX_CTRL 97 #define X86FSET_TAA_NO 98 #define X86FSET_PPIN 99 +#define X86FSET_VAES 100 +#define X86FSET_VPCLMULQDQ 101 /* * Intel Deep C-State invariant TSC in leaf 0x80000007. @@ -1021,7 +1023,8 @@ extern "C" { #define X86_SOCKET_SP3R2 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x20) #define X86_SOCKET_FP5 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x21) #define X86_SOCKET_FP6 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x22) -#define X86_NUM_SOCKETS_AMD 0x23 +#define X86_SOCKET_STRX4 _X86_SOCKET_MKVAL(X86_VENDOR_AMD, 0x23) +#define X86_NUM_SOCKETS_AMD 0x24 /* @@ -1116,7 +1119,7 @@ extern "C" { #if defined(_KERNEL) || defined(_KMEMUSER) -#define NUM_X86_FEATURES 100 +#define NUM_X86_FEATURES 102 extern uchar_t x86_featureset[]; extern void free_x86_featureset(void *featureset); |