Skip to content

Commit f3d44f1

Browse files
rchatresuryasaimadhu
authored andcommitted
x86/resctrl: Support CPUID enumeration of MBM counter width
The original Memory Bandwidth Monitoring (MBM) architectural definition defines counters of up to 62 bits in the IA32_QM_CTR MSR while the first-generation MBM implementation uses statically defined 24 bit counters. Expand the MBM CPUID enumeration properties to include the MBM counter width. The previously undefined EAX output register contains, in bits [7:0], the MBM counter width encoded as an offset from 24 bits. Enumerating this property is only specified for Intel CPUs. Suggested-by: Borislav Petkov <[email protected]> Signed-off-by: Reinette Chatre <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lkml.kernel.org/r/afa3af2f753f6bc301fb743bc8944e749cb24afa.1588715690.git.reinette.chatre@intel.com
1 parent 46637d4 commit f3d44f1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

arch/x86/include/asm/processor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@ struct cpuinfo_x86 {
113113
/* in KB - valid for CPUS which support this call: */
114114
unsigned int x86_cache_size;
115115
int x86_cache_alignment; /* In bytes */
116-
/* Cache QoS architectural values: */
116+
/* Cache QoS architectural values, valid only on the BSP: */
117117
int x86_cache_max_rmid; /* max index */
118118
int x86_cache_occ_scale; /* scale to bytes */
119+
int x86_cache_mbm_width_offset;
119120
int x86_power;
120121
unsigned long loops_per_jiffy;
121122
/* cpuid returned max cores value: */

arch/x86/kernel/cpu/resctrl/core.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,7 @@ void resctrl_cpu_detect(struct cpuinfo_x86 *c)
964964
if (!cpu_has(c, X86_FEATURE_CQM_LLC)) {
965965
c->x86_cache_max_rmid = -1;
966966
c->x86_cache_occ_scale = -1;
967+
c->x86_cache_mbm_width_offset = -1;
967968
return;
968969
}
969970

@@ -980,6 +981,10 @@ void resctrl_cpu_detect(struct cpuinfo_x86 *c)
980981

981982
c->x86_cache_max_rmid = ecx;
982983
c->x86_cache_occ_scale = ebx;
984+
if (c->x86_vendor == X86_VENDOR_INTEL)
985+
c->x86_cache_mbm_width_offset = eax & 0xff;
986+
else
987+
c->x86_cache_mbm_width_offset = -1;
983988
}
984989
}
985990

0 commit comments

Comments
 (0)