diff options
-rw-r--r-- | tools/power/x86/turbostat/turbostat.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 43a6dda434ef..db9c9d100042 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -3052,6 +3052,17 @@ guess: | |||
3052 | return 0; | 3052 | return 0; |
3053 | } | 3053 | } |
3054 | 3054 | ||
3055 | void decode_feature_control_msr(void) | ||
3056 | { | ||
3057 | unsigned long long msr; | ||
3058 | |||
3059 | if (!get_msr(base_cpu, MSR_IA32_FEATURE_CONTROL, &msr)) | ||
3060 | fprintf(outf, "cpu%d: MSR_IA32_FEATURE_CONTROL: 0x%08llx (%sLocked %s)\n", | ||
3061 | base_cpu, msr, | ||
3062 | msr & FEATURE_CONTROL_LOCKED ? "" : "UN-", | ||
3063 | msr & (1 << 18) ? "SGX" : ""); | ||
3064 | } | ||
3065 | |||
3055 | void decode_misc_enable_msr(void) | 3066 | void decode_misc_enable_msr(void) |
3056 | { | 3067 | { |
3057 | unsigned long long msr; | 3068 | unsigned long long msr; |
@@ -3111,9 +3122,10 @@ void process_cpuid() | |||
3111 | if (debug) { | 3122 | if (debug) { |
3112 | fprintf(outf, "%d CPUID levels; family:model:stepping 0x%x:%x:%x (%d:%d:%d)\n", | 3123 | fprintf(outf, "%d CPUID levels; family:model:stepping 0x%x:%x:%x (%d:%d:%d)\n", |
3113 | max_level, family, model, stepping, family, model, stepping); | 3124 | max_level, family, model, stepping, family, model, stepping); |
3114 | fprintf(outf, "CPUID(1): %s %s %s %s %s %s %s %s\n", | 3125 | fprintf(outf, "CPUID(1): %s %s %s %s %s %s %s %s %s\n", |
3115 | ecx & (1 << 0) ? "SSE3" : "-", | 3126 | ecx & (1 << 0) ? "SSE3" : "-", |
3116 | ecx & (1 << 3) ? "MONITOR" : "-", | 3127 | ecx & (1 << 3) ? "MONITOR" : "-", |
3128 | ecx & (1 << 6) ? "SMX" : "-", | ||
3117 | ecx & (1 << 7) ? "EIST" : "-", | 3129 | ecx & (1 << 7) ? "EIST" : "-", |
3118 | ecx & (1 << 8) ? "TM2" : "-", | 3130 | ecx & (1 << 8) ? "TM2" : "-", |
3119 | edx & (1 << 4) ? "TSC" : "-", | 3131 | edx & (1 << 4) ? "TSC" : "-", |
@@ -3175,6 +3187,20 @@ void process_cpuid() | |||
3175 | if (debug) | 3187 | if (debug) |
3176 | decode_misc_enable_msr(); | 3188 | decode_misc_enable_msr(); |
3177 | 3189 | ||
3190 | if (max_level >= 0x7) { | ||
3191 | int has_sgx; | ||
3192 | |||
3193 | ecx = 0; | ||
3194 | |||
3195 | __cpuid_count(0x7, 0, eax, ebx, ecx, edx); | ||
3196 | |||
3197 | has_sgx = ebx & (1 << 2); | ||
3198 | fprintf(outf, "CPUID(7): %sSGX\n", has_sgx ? "" : "No-"); | ||
3199 | |||
3200 | if (has_sgx) | ||
3201 | decode_feature_control_msr(); | ||
3202 | } | ||
3203 | |||
3178 | if (max_level >= 0x15) { | 3204 | if (max_level >= 0x15) { |
3179 | unsigned int eax_crystal; | 3205 | unsigned int eax_crystal; |
3180 | unsigned int ebx_tsc; | 3206 | unsigned int ebx_tsc; |