Wed Jun 21 19:02:18 2023 UTC ()
Pull up following revision(s) (requested by msaitoh in ticket #200):

	sys/arch/x86/include/specialreg.h: revision 1.202
	sys/arch/x86/include/specialreg.h: revision 1.203
	usr.sbin/cpuctl/arch/i386.c: revision 1.136

Add some CPUID bits from PPR for AMD Family 19h Model 61h Revision B1.

Add AMD CPUID Fn0000_0008 %ebx bit 3 INVLPGB.


(martin)
diff -r1.198.2.1 -r1.198.2.2 src/sys/arch/x86/include/specialreg.h
diff -r1.133.2.1 -r1.133.2.2 src/usr.sbin/cpuctl/arch/i386.c

cvs diff -r1.198.2.1 -r1.198.2.2 src/sys/arch/x86/include/specialreg.h (expand / switch to unified diff)

--- src/sys/arch/x86/include/specialreg.h 2023/01/23 12:52:17 1.198.2.1
+++ src/sys/arch/x86/include/specialreg.h 2023/06/21 19:02:18 1.198.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: specialreg.h,v 1.198.2.1 2023/01/23 12:52:17 martin Exp $ */ 1/* $NetBSD: specialreg.h,v 1.198.2.2 2023/06/21 19:02:18 martin Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2014-2020 The NetBSD Foundation, Inc. 4 * Copyright (c) 2014-2020 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -858,49 +858,50 @@ @@ -858,49 +858,50 @@
858/* 858/*
859 * AMD Processor Capacity Parameters and Extended Features. 859 * AMD Processor Capacity Parameters and Extended Features.
860 * CPUID Fn8000_0008 860 * CPUID Fn8000_0008
861 * %eax: Long Mode Size Identifiers 861 * %eax: Long Mode Size Identifiers
862 * %ebx: Extended Feature Identifiers 862 * %ebx: Extended Feature Identifiers
863 * %ecx: Size Identifiers 863 * %ecx: Size Identifiers
864 * %edx: RDPRU Register Identifier Range 864 * %edx: RDPRU Register Identifier Range
865 */ 865 */
866 866
867/* %ebx */ 867/* %ebx */
868#define CPUID_CAPEX_CLZERO __BIT(0) /* CLZERO instruction */ 868#define CPUID_CAPEX_CLZERO __BIT(0) /* CLZERO instruction */
869#define CPUID_CAPEX_IRPERF __BIT(1) /* InstRetCntMsr */ 869#define CPUID_CAPEX_IRPERF __BIT(1) /* InstRetCntMsr */
870#define CPUID_CAPEX_XSAVEERPTR __BIT(2) /* RstrFpErrPtrs by XRSTOR */ 870#define CPUID_CAPEX_XSAVEERPTR __BIT(2) /* RstrFpErrPtrs by XRSTOR */
 871#define CPUID_CAPEX_INVLPGB __BIT(3) /* INVLPGB instruction */
871#define CPUID_CAPEX_RDPRU __BIT(4) /* RDPRU instruction */ 872#define CPUID_CAPEX_RDPRU __BIT(4) /* RDPRU instruction */
872#define CPUID_CAPEX_MBE __BIT(6) /* Memory Bandwidth Enforcement */ 873#define CPUID_CAPEX_MBE __BIT(6) /* Memory Bandwidth Enforcement */
873#define CPUID_CAPEX_MCOMMIT __BIT(8) /* MCOMMIT instruction */ 874#define CPUID_CAPEX_MCOMMIT __BIT(8) /* MCOMMIT instruction */
874#define CPUID_CAPEX_WBNOINVD __BIT(9) /* WBNOINVD instruction */ 875#define CPUID_CAPEX_WBNOINVD __BIT(9) /* WBNOINVD instruction */
875#define CPUID_CAPEX_IBPB __BIT(12) /* Speculation Control IBPB */ 876#define CPUID_CAPEX_IBPB __BIT(12) /* Speculation Control IBPB */
876#define CPUID_CAPEX_INT_WBINVD __BIT(13) /* Interruptable WB[NO]INVD */ 877#define CPUID_CAPEX_INT_WBINVD __BIT(13) /* Interruptable WB[NO]INVD */
877#define CPUID_CAPEX_IBRS __BIT(14) /* Speculation Control IBRS */ 878#define CPUID_CAPEX_IBRS __BIT(14) /* Speculation Control IBRS */
878#define CPUID_CAPEX_STIBP __BIT(15) /* Speculation Control STIBP */ 879#define CPUID_CAPEX_STIBP __BIT(15) /* Speculation Control STIBP */
879#define CPUID_CAPEX_IBRS_ALWAYSON __BIT(16) /* IBRS always on mode */ 880#define CPUID_CAPEX_IBRS_ALWAYSON __BIT(16) /* IBRS always on mode */
880#define CPUID_CAPEX_STIBP_ALWAYSON __BIT(17) /* STIBP always on mode */ 881#define CPUID_CAPEX_STIBP_ALWAYSON __BIT(17) /* STIBP always on mode */
881#define CPUID_CAPEX_PREFER_IBRS __BIT(18) /* IBRS preferred */ 882#define CPUID_CAPEX_PREFER_IBRS __BIT(18) /* IBRS preferred */
882#define CPUID_CAPEX_IBRS_SAMEMODE __BIT(19) /* IBRS same speculation limits */ 883#define CPUID_CAPEX_IBRS_SAMEMODE __BIT(19) /* IBRS same speculation limits */
883#define CPUID_CAPEX_EFER_LSMSLE_UN __BIT(20) /* EFER.LMSLE is unsupported */ 884#define CPUID_CAPEX_EFER_LSMSLE_UN __BIT(20) /* EFER.LMSLE is unsupported */
884#define CPUID_CAPEX_AMD_PPIN __BIT(23) /* Protected Processor Inventory Number */ 885#define CPUID_CAPEX_AMD_PPIN __BIT(23) /* Protected Processor Inventory Number */
885#define CPUID_CAPEX_SSBD __BIT(24) /* Speculation Control SSBD */ 886#define CPUID_CAPEX_SSBD __BIT(24) /* Speculation Control SSBD */
886#define CPUID_CAPEX_VIRT_SSBD __BIT(25) /* Virt Spec Control SSBD */ 887#define CPUID_CAPEX_VIRT_SSBD __BIT(25) /* Virt Spec Control SSBD */
887#define CPUID_CAPEX_SSB_NO __BIT(26) /* SSBD not required */ 888#define CPUID_CAPEX_SSB_NO __BIT(26) /* SSBD not required */
888#define CPUID_CAPEX_CPPC __BIT(27) /* Collaborative Processor Perf. Control */ 889#define CPUID_CAPEX_CPPC __BIT(27) /* Collaborative Processor Perf. Control */
889#define CPUID_CAPEX_PSFD __BIT(28) /* Predictive Store Forward Dis */ 890#define CPUID_CAPEX_PSFD __BIT(28) /* Predictive Store Forward Dis */
890#define CPUID_CAPEX_BTC_NO __BIT(29) /* Branch Type Confusion NO */ 891#define CPUID_CAPEX_BTC_NO __BIT(29) /* Branch Type Confusion NO */
891 892
892#define CPUID_CAPEX_FLAGS "\20" \ 893#define CPUID_CAPEX_FLAGS "\20" \
893 "\1CLZERO" "\2IRPERF" "\3XSAVEERPTR" \ 894 "\1CLZERO" "\2IRPERF" "\3XSAVEERPTR" "\4INVLPGB" \
894 "\5RDPRU" "\7MBE" \ 895 "\5RDPRU" "\7MBE" \
895 "\11MCOMMIT" "\12WBNOINVD" "\13B10" \ 896 "\11MCOMMIT" "\12WBNOINVD" "\13B10" \
896 "\15IBPB" "\16INT_WBINVD" "\17IBRS" "\20STIBP" \ 897 "\15IBPB" "\16INT_WBINVD" "\17IBRS" "\20STIBP" \
897 "\21IBRS_ALWAYSON" "\22STIBP_ALWAYSON" "\23PREFER_IBRS" \ 898 "\21IBRS_ALWAYSON" "\22STIBP_ALWAYSON" "\23PREFER_IBRS" \
898 "\24IBRS_SAMEMODE" \ 899 "\24IBRS_SAMEMODE" \
899 "\25EFER_LSMSLE_UN" "\30PPIN" \ 900 "\25EFER_LSMSLE_UN" "\30PPIN" \
900 "\31SSBD" "\32VIRT_SSBD" "\33SSB_NO" "\34CPPC" \ 901 "\31SSBD" "\32VIRT_SSBD" "\33SSB_NO" "\34CPPC" \
901 "\35PSFD" "\36BTC_NO" 902 "\35PSFD" "\36BTC_NO"
902 903
903/* %ecx */ 904/* %ecx */
904#define CPUID_CAPEX_PerfTscSize __BITS(17,16) /* Perf. tstamp counter size */ 905#define CPUID_CAPEX_PerfTscSize __BITS(17,16) /* Perf. tstamp counter size */
905#define CPUID_CAPEX_ApicIdSize __BITS(15,12) /* APIC ID Size */ 906#define CPUID_CAPEX_ApicIdSize __BITS(15,12) /* APIC ID Size */
906#define CPUID_CAPEX_NC __BITS(7,0) /* Number of threads - 1 */ 907#define CPUID_CAPEX_NC __BITS(7,0) /* Number of threads - 1 */
@@ -926,38 +927,41 @@ @@ -926,38 +927,41 @@
926#define CPUID_AMD_SVM_PFThreshold __BIT(12) /* PAUSE filter threshold */ 927#define CPUID_AMD_SVM_PFThreshold __BIT(12) /* PAUSE filter threshold */
927#define CPUID_AMD_SVM_AVIC __BIT(13) /* Advanced Virt. Intr. Ctrl */ 928#define CPUID_AMD_SVM_AVIC __BIT(13) /* Advanced Virt. Intr. Ctrl */
928#define CPUID_AMD_SVM_V_VMSAVE_VMLOAD __BIT(15) /* Virtual VM{SAVE/LOAD} */ 929#define CPUID_AMD_SVM_V_VMSAVE_VMLOAD __BIT(15) /* Virtual VM{SAVE/LOAD} */
929#define CPUID_AMD_SVM_vGIF __BIT(16) /* Virtualized GIF */ 930#define CPUID_AMD_SVM_vGIF __BIT(16) /* Virtualized GIF */
930#define CPUID_AMD_SVM_GMET __BIT(17) /* Guest Mode Execution Trap */ 931#define CPUID_AMD_SVM_GMET __BIT(17) /* Guest Mode Execution Trap */
931#define CPUID_AMD_SVM_X2AVIC __BIT(18) /* Virt. Intr. Ctrl 4 x2APIC */ 932#define CPUID_AMD_SVM_X2AVIC __BIT(18) /* Virt. Intr. Ctrl 4 x2APIC */
932#define CPUID_AMD_SVM_SSSCHECK __BIT(19) /* Shadow Stack restrictions */ 933#define CPUID_AMD_SVM_SSSCHECK __BIT(19) /* Shadow Stack restrictions */
933#define CPUID_AMD_SVM_SPEC_CTRL __BIT(20) /* SPEC_CTRL virtualization */ 934#define CPUID_AMD_SVM_SPEC_CTRL __BIT(20) /* SPEC_CTRL virtualization */
934#define CPUID_AMD_SVM_ROGPT __BIT(21) /* Read-Only Guest PTable */ 935#define CPUID_AMD_SVM_ROGPT __BIT(21) /* Read-Only Guest PTable */
935#define CPUID_AMD_SVM_HOST_MCE_OVERRIDE __BIT(23) /* #MC intercept */ 936#define CPUID_AMD_SVM_HOST_MCE_OVERRIDE __BIT(23) /* #MC intercept */
936#define CPUID_AMD_SVM_TLBICTL __BIT(24) /* TLB Intercept Control */ 937#define CPUID_AMD_SVM_TLBICTL __BIT(24) /* TLB Intercept Control */
937#define CPUID_AMD_SVM_VNMI __BIT(25) /* NMI Virtualization */ 938#define CPUID_AMD_SVM_VNMI __BIT(25) /* NMI Virtualization */
938#define CPUID_AMD_SVM_IBSVIRT __BIT(26) /* IBS Virtualization */ 939#define CPUID_AMD_SVM_IBSVIRT __BIT(26) /* IBS Virtualization */
 940#define CPUID_AMD_SVM_XLVTOFFFLTCHG __BIT(27) /* Ext LVToffset FLT changed */
 941#define CPUID_AMD_SVM_VMCBADRCHKCHG __BIT(28) /* VMCB addr check changed */
 942
939 943
940#define CPUID_AMD_SVM_FLAGS "\20" \ 944#define CPUID_AMD_SVM_FLAGS "\20" \
941 "\1" "NP" "\2" "LbrVirt" "\3" "SVML" "\4" "NRIPS" \ 945 "\1" "NP" "\2" "LbrVirt" "\3" "SVML" "\4" "NRIPS" \
942 "\5" "TSCRate" "\6" "VMCBCleanBits" \ 946 "\5" "TSCRate" "\6" "VMCBCleanBits" \
943 "\7" "FlushByASID" "\10" "DecodeAssist" \ 947 "\7" "FlushByASID" "\10" "DecodeAssist" \
944 "\11" "B08" "\12" "B09" "\13" "PauseFilter" "\14" "B11" \ 948 "\11" "B08" "\12" "B09" "\13" "PauseFilter" "\14" "B11" \
945 "\15" "PFThreshold" "\16" "AVIC" "\17" "B14" \ 949 "\15" "PFThreshold" "\16" "AVIC" "\17" "B14" \
946 "\20" "V_VMSAVE_VMLOAD" \ 950 "\20" "V_VMSAVE_VMLOAD" \
947 "\21" "VGIF" "\22" "GMET" "\23x2AVIC" "\24SSSCHECK" \ 951 "\21" "VGIF" "\22" "GMET" "\23x2AVIC" "\24SSSCHECK" \
948 "\25" "SPEC_CTRL" "\26" "ROGPT" "\30HOST_MCE_OVERRIDE" \ 952 "\25" "SPEC_CTRL" "\26" "ROGPT" "\30HOST_MCE_OVERRIDE" \
949 "\31" "TLBICTL" "\32VNMI" "\33IBSVIRT" "\34B27" \ 953 "\31" "TLBICTL" "\32VNMI" "\33IBSVIRT" "\34ExtLvtOffsetFaultChg" \
950 "\35B28" 954 "\35VmcbAddrChkChg"
951 955
952/* 956/*
953 * AMD Instruction-Based Sampling Capabilities. 957 * AMD Instruction-Based Sampling Capabilities.
954 * CPUID Fn8000_001b 958 * CPUID Fn8000_001b
955 */ 959 */
956/* %eax */ 960/* %eax */
957#define CPUID_IBS_FFV __BIT(0) /* Feature Flags Valid */ 961#define CPUID_IBS_FFV __BIT(0) /* Feature Flags Valid */
958#define CPUID_IBS_FETCHSUM __BIT(1) /* Fetch Sampling */ 962#define CPUID_IBS_FETCHSUM __BIT(1) /* Fetch Sampling */
959#define CPUID_IBS_OPSAM __BIT(2) /* execution SAMpling */ 963#define CPUID_IBS_OPSAM __BIT(2) /* execution SAMpling */
960#define CPUID_IBS_RDWROPCNT __BIT(3) /* Read Write of Op Counter */ 964#define CPUID_IBS_RDWROPCNT __BIT(3) /* Read Write of Op Counter */
961#define CPUID_IBS_OPCNT __BIT(4) /* OP CouNTing mode */ 965#define CPUID_IBS_OPCNT __BIT(4) /* OP CouNTing mode */
962#define CPUID_IBS_BRNTRGT __BIT(5) /* Branch Target */ 966#define CPUID_IBS_BRNTRGT __BIT(5) /* Branch Target */
963#define CPUID_IBS_OPCNTEXT __BIT(6) /* OpCurCnt and OpMaxCnt extended */ 967#define CPUID_IBS_OPCNTEXT __BIT(6) /* OpCurCnt and OpMaxCnt extended */
@@ -1040,59 +1044,65 @@ @@ -1040,59 +1044,65 @@
1040 "\11SecureTSC" "\12TscAuxVirt" "\13HwEnfCacheCoh" "\14" "64BitHost" \ 1044 "\11SecureTSC" "\12TscAuxVirt" "\13HwEnfCacheCoh" "\14" "64BitHost" \
1041 "\15" "RSTRINJ" "\16" "ALTINJ" "\17" "DebugSwap" "\20PreventHostIbs" \ 1045 "\15" "RSTRINJ" "\16" "ALTINJ" "\17" "DebugSwap" "\20PreventHostIbs" \
1042 "\21VTE" "\22VmgexitParam" "\23VirtualTomMsr" "\24IbsVirtGuest" \ 1046 "\21VTE" "\22VmgexitParam" "\23VirtualTomMsr" "\24IbsVirtGuest" \
1043 "\31VmsaRegProt" "\32SmtProtection" \ 1047 "\31VmsaRegProt" "\32SmtProtection" \
1044 "\35SvsmCommPageMSR" "\36NestedVirtSnpMsr" 1048 "\35SvsmCommPageMSR" "\36NestedVirtSnpMsr"
1045 1049
1046/* 1050/*
1047 * AMD Extended Features 2. 1051 * AMD Extended Features 2.
1048 * CPUID Fn8000_0021 1052 * CPUID Fn8000_0021
1049 */ 1053 */
1050 1054
1051/* %eax */ 1055/* %eax */
1052#define CPUID_AMDEXT2_NONESTEDDBP __BIT(0) /* No nested data breakpoints */ 1056#define CPUID_AMDEXT2_NONESTEDDBP __BIT(0) /* No nested data breakpoints */
 1057#define CPUID_AMDEXT2_FGKBNOSERIAL __BIT(1) /* {FS,GS,K}BASE WRMSR !serializ */
1053#define CPUID_AMDEXT2_LFENCESERIAL __BIT(2) /* LFENCE always serializing */ 1058#define CPUID_AMDEXT2_LFENCESERIAL __BIT(2) /* LFENCE always serializing */
1054#define CPUID_AMDEXT2_SMMPGCFGLCK __BIT(3) /* SMM Paging configuration lock */ 1059#define CPUID_AMDEXT2_SMMPGCFGLCK __BIT(3) /* SMM Paging configuration lock */
1055#define CPUID_AMDEXT2_NULLSELCLRB __BIT(6) /* Null segment selector clr base */ 1060#define CPUID_AMDEXT2_NULLSELCLRB __BIT(6) /* Null segment selector clr base */
1056#define CPUID_AMDEXT2_UPADDRIGN __BIT(7) /* Upper Address Ignore */ 1061#define CPUID_AMDEXT2_UPADDRIGN __BIT(7) /* Upper Address Ignore */
1057#define CPUID_AMDEXT2_AUTOIBRS __BIT(8) /* Automatic IBRS */ 1062#define CPUID_AMDEXT2_AUTOIBRS __BIT(8) /* Automatic IBRS */
1058#define CPUID_AMDEXT2_NOSMMCTL __BIT(9) /* SMM_CTL MSR is not supported */ 1063#define CPUID_AMDEXT2_NOSMMCTL __BIT(9) /* SMM_CTL MSR is not supported */
 1064#define CPUID_AMDEXT2_FSRS __BIT(10) /* Fast Short Rep Stosb */
 1065#define CPUID_AMDEXT2_FSRC __BIT(11) /* Fast Short Rep Cmpsb */
1059#define CPUID_AMDEXT2_PREFETCHCTL __BIT(13) /* Prefetch control MSR */ 1066#define CPUID_AMDEXT2_PREFETCHCTL __BIT(13) /* Prefetch control MSR */
1060#define CPUID_AMDEXT2_CPUIDUSRDIS __BIT(17) /* CPUID dis. for non-priv. soft */ 1067#define CPUID_AMDEXT2_CPUIDUSRDIS __BIT(17) /* CPUID dis. for non-priv. soft */
 1068#define CPUID_AMDEXT2_EPSF __BIT(18) /* Enhanced Predective Store Fwd */
1061 1069
1062#define CPUID_AMDEXT2_FLAGS "\20" \ 1070#define CPUID_AMDEXT2_FLAGS "\20" \
1063 "\1NoNestedDataBp" "\3LfenceAlwaysSerialize" "\4SmmPgCfgLock" \ 1071 "\1NoNestedDataBp" "\2FsGsKernelGsBaseNonSerializing" \
 1072 "\3LfenceAlwaysSerialize" "\4SmmPgCfgLock" \
1064 "\7NullSelectClearsBase" "\10UpperAddressIgnore" \ 1073 "\7NullSelectClearsBase" "\10UpperAddressIgnore" \
1065 "\11AutomaticIBRS" "\12NoSmmCtlMSR" \ 1074 "\11AutomaticIBRS" "\12NoSmmCtlMSR" "\13FSRS" "\14FSRC" \
1066 "\16PrefetchCtlMSR" \ 1075 "\16PrefetchCtlMSR" \
1067 "\22CpuidUserDis" 1076 "\22CpuidUserDis" "\23EPSF"
1068 1077
1069/* 1078/*
1070 * AMD Extended Performance Monitoring and Debug 1079 * AMD Extended Performance Monitoring and Debug
1071 * CPUID Fn8000_0022 1080 * CPUID Fn8000_0022
1072 */ 1081 */
1073 1082
1074/* %eax */ 1083/* %eax */
1075#define CPUID_AXPERF_PERFMONV2 __BIT(0) /* Version 2 */ 1084#define CPUID_AXPERF_PERFMONV2 __BIT(0) /* Version 2 */
1076#define CPUID_AXPERF_LBRSTACK __BIT(1) /* Last Branch Record Stack */ 1085#define CPUID_AXPERF_LBRSTACK __BIT(1) /* Last Branch Record Stack */
1077#define CPUID_AXPERF_LBRPMCFREEZE __BIT(2) /* Freezing LBR and PMC */ 1086#define CPUID_AXPERF_LBRPMCFREEZE __BIT(2) /* Freezing LBR and PMC */
1078 1087
1079#define CPUID_AXPERF_FLAGS "\20" \ 1088#define CPUID_AXPERF_FLAGS "\20" \
1080 "\1PerfMonV2" "\2LbrStack" "\3LbrAndPmcFreeze" 1089 "\1PerfMonV2" "\2LbrStack" "\3LbrAndPmcFreeze"
1081 1090
1082/* %ebx */ 1091/* %ebx */
1083#define CPUID_AXPERF_NCPC __BITS(3, 0) /* Num of Core PMC counters */ 1092#define CPUID_AXPERF_NCPC __BITS(3, 0) /* Num of Core PMC counters */
1084#define CPUID_AXPERF_NLBRSTACK __BITS(9, 4) /* Num of LBR Stack entries */ 1093#define CPUID_AXPERF_NLBRSTACK __BITS(9, 4) /* Num of LBR Stack entries */
1085#define CPUID_AXPERF_NNBPC __BITS(15, 10) /* Num of Northbridge PMC */ 1094#define CPUID_AXPERF_NNBPC __BITS(15, 10) /* Num of NorthBridge PMCs */
 1095#define CPUID_AXPERF_NUMCPC __BITS(21, 16) /* Num of UMC PMCs */
1086 1096
1087/* 1097/*
1088 * Centaur Extended Feature flags. 1098 * Centaur Extended Feature flags.
1089 * CPUID FnC000_0001 1099 * CPUID FnC000_0001
1090 */ 1100 */
1091#define CPUID_VIA_HAS_RNG __BIT(2) /* Random number generator */ 1101#define CPUID_VIA_HAS_RNG __BIT(2) /* Random number generator */
1092#define CPUID_VIA_DO_RNG __BIT(3) 1102#define CPUID_VIA_DO_RNG __BIT(3)
1093#define CPUID_VIA_HAS_ACE __BIT(6) /* AES Encryption */ 1103#define CPUID_VIA_HAS_ACE __BIT(6) /* AES Encryption */
1094#define CPUID_VIA_DO_ACE __BIT(7) 1104#define CPUID_VIA_DO_ACE __BIT(7)
1095#define CPUID_VIA_HAS_ACE2 __BIT(8) /* AES+CTR instructions */ 1105#define CPUID_VIA_HAS_ACE2 __BIT(8) /* AES+CTR instructions */
1096#define CPUID_VIA_DO_ACE2 __BIT(9) 1106#define CPUID_VIA_DO_ACE2 __BIT(9)
1097#define CPUID_VIA_HAS_PHE __BIT(10) /* SHA1+SHA256 HMAC */ 1107#define CPUID_VIA_HAS_PHE __BIT(10) /* SHA1+SHA256 HMAC */
1098#define CPUID_VIA_DO_PHE __BIT(11) 1108#define CPUID_VIA_DO_PHE __BIT(11)

cvs diff -r1.133.2.1 -r1.133.2.2 src/usr.sbin/cpuctl/arch/i386.c (expand / switch to unified diff)

--- src/usr.sbin/cpuctl/arch/i386.c 2023/01/23 12:54:14 1.133.2.1
+++ src/usr.sbin/cpuctl/arch/i386.c 2023/06/21 19:02:18 1.133.2.2
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: i386.c,v 1.133.2.1 2023/01/23 12:54:14 martin Exp $ */ 1/* $NetBSD: i386.c,v 1.133.2.2 2023/06/21 19:02:18 martin Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden, and by Jason R. Thorpe. 8 * by Frank van der Linden, and by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -47,27 +47,27 @@ @@ -47,27 +47,27 @@
47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 47 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 48 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 49 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 50 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 51 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 52 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 53 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 54 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * SUCH DAMAGE. 55 * SUCH DAMAGE.
56 */ 56 */
57 57
58#include <sys/cdefs.h> 58#include <sys/cdefs.h>
59#ifndef lint 59#ifndef lint
60__RCSID("$NetBSD: i386.c,v 1.133.2.1 2023/01/23 12:54:14 martin Exp $"); 60__RCSID("$NetBSD: i386.c,v 1.133.2.2 2023/06/21 19:02:18 martin Exp $");
61#endif /* not lint */ 61#endif /* not lint */
62 62
63#include <sys/types.h> 63#include <sys/types.h>
64#include <sys/param.h> 64#include <sys/param.h>
65#include <sys/bitops.h> 65#include <sys/bitops.h>
66#include <sys/sysctl.h> 66#include <sys/sysctl.h>
67#include <sys/ioctl.h> 67#include <sys/ioctl.h>
68#include <sys/cpuio.h> 68#include <sys/cpuio.h>
69 69
70#include <errno.h> 70#include <errno.h>
71#include <string.h> 71#include <string.h>
72#include <stdio.h> 72#include <stdio.h>
73#include <stdlib.h> 73#include <stdlib.h>
@@ -2268,38 +2268,39 @@ identifycpu(int fd, const char *cpuname) @@ -2268,38 +2268,39 @@ identifycpu(int fd, const char *cpuname)
2268 CPUID_AMD_SVM_FLAGS, descs[3]); 2268 CPUID_AMD_SVM_FLAGS, descs[3]);
2269 } 2269 }
2270 if (ci->ci_max_ext_cpuid >= 0x8000001b) { 2270 if (ci->ci_max_ext_cpuid >= 0x8000001b) {
2271 x86_cpuid(0x8000001b, descs); 2271 x86_cpuid(0x8000001b, descs);
2272 print_bits(cpuname, "IBS features", 2272 print_bits(cpuname, "IBS features",
2273 CPUID_IBS_FLAGS, descs[0]); 2273 CPUID_IBS_FLAGS, descs[0]);
2274 } 2274 }
2275 if (ci->ci_max_ext_cpuid >= 0x8000001f) { 2275 if (ci->ci_max_ext_cpuid >= 0x8000001f) {
2276 x86_cpuid(0x8000001f, descs); 2276 x86_cpuid(0x8000001f, descs);
2277 print_bits(cpuname, "Encrypted Memory features", 2277 print_bits(cpuname, "Encrypted Memory features",
2278 CPUID_AMD_ENCMEM_FLAGS, descs[0]); 2278 CPUID_AMD_ENCMEM_FLAGS, descs[0]);
2279 } 2279 }
2280 if (ci->ci_max_ext_cpuid >= 0x80000022) { 2280 if (ci->ci_max_ext_cpuid >= 0x80000022) {
2281 uint8_t ncore, nnb, nlbrs; 2281 uint8_t ncore, nnb, numc, nlbrs;
2282 2282
2283 x86_cpuid(0x80000022, descs); 2283 x86_cpuid(0x80000022, descs);
2284 print_bits(cpuname, "Perfmon:", 2284 print_bits(cpuname, "Perfmon:",
2285 CPUID_AXPERF_FLAGS, descs[0]); 2285 CPUID_AXPERF_FLAGS, descs[0]);
2286 2286
2287 ncore = __SHIFTOUT(descs[1], CPUID_AXPERF_NCPC); 2287 ncore = __SHIFTOUT(descs[1], CPUID_AXPERF_NCPC);
2288 nnb = __SHIFTOUT(descs[1], CPUID_AXPERF_NNBPC); 2288 nnb = __SHIFTOUT(descs[1], CPUID_AXPERF_NNBPC);
 2289 numc = __SHIFTOUT(descs[1], CPUID_AXPERF_NUMCPC);
2289 nlbrs = __SHIFTOUT(descs[1], CPUID_AXPERF_NLBRSTACK); 2290 nlbrs = __SHIFTOUT(descs[1], CPUID_AXPERF_NLBRSTACK);
2290 aprint_verbose("%s: Perfmon: counters: " 2291 aprint_verbose("%s: Perfmon: counters: "
2291 "Core %hhu, Northbridge %hhu\n", cpuname, 2292 "Core %hhu, Northbridge %hhu, UMC %hhu\n", cpuname,
2292 ncore, nnb); 2293 ncore, nnb, numc);
2293 aprint_verbose("%s: Perfmon: LBR Stack %hhu entries\n", 2294 aprint_verbose("%s: Perfmon: LBR Stack %hhu entries\n",
2294 cpuname, nlbrs); 2295 cpuname, nlbrs);
2295 } 2296 }
2296 } else if (cpu_vendor == CPUVENDOR_INTEL) { 2297 } else if (cpu_vendor == CPUVENDOR_INTEL) {
2297 if (ci->ci_max_cpuid >= 0x0a) { 2298 if (ci->ci_max_cpuid >= 0x0a) {
2298 unsigned int pmcver, ncounter, veclen; 2299 unsigned int pmcver, ncounter, veclen;
2299 2300
2300 x86_cpuid(0x0a, descs); 2301 x86_cpuid(0x0a, descs);
2301 pmcver = __SHIFTOUT(descs[0], CPUID_PERF_VERSION); 2302 pmcver = __SHIFTOUT(descs[0], CPUID_PERF_VERSION);
2302 ncounter = __SHIFTOUT(descs[0], CPUID_PERF_NGPPC); 2303 ncounter = __SHIFTOUT(descs[0], CPUID_PERF_NGPPC);
2303 veclen = __SHIFTOUT(descs[0], CPUID_PERF_BVECLEN); 2304 veclen = __SHIFTOUT(descs[0], CPUID_PERF_BVECLEN);
2304 aprint_verbose("%s: Perfmon: Ver. %u", 2305 aprint_verbose("%s: Perfmon: Ver. %u",
2305 cpuname, pmcver); 2306 cpuname, pmcver);