Home Home > GIT Browse > SLE15
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-06-21 12:30:55 +0200
committerJiri Slaby <jslaby@suse.cz>2019-06-21 12:31:07 +0200
commit1f7d46c211138150dee6123476ce78ff643e6769 (patch)
treed1024d6e5ecae1f90f03958ae4a50b1673bbb1e2
parent5e50ac5ddf8574ff9f509b3e8237fbb684913848 (diff)
x86/cpufeatures: Carve out CQM features retrieval
(jsc#SLE-5382).
-rw-r--r--patches.suse/x86-cpufeatures-Carve-out-CQM-features-retrieval.patch105
-rw-r--r--series.conf3
2 files changed, 108 insertions, 0 deletions
diff --git a/patches.suse/x86-cpufeatures-Carve-out-CQM-features-retrieval.patch b/patches.suse/x86-cpufeatures-Carve-out-CQM-features-retrieval.patch
new file mode 100644
index 0000000000..f09ff655f4
--- /dev/null
+++ b/patches.suse/x86-cpufeatures-Carve-out-CQM-features-retrieval.patch
@@ -0,0 +1,105 @@
+From: Borislav Petkov <bp@suse.de>
+Date: Wed, 19 Jun 2019 17:24:34 +0200
+Subject: x86/cpufeatures: Carve out CQM features retrieval
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git#x86/cpu
+Git-commit: 45fc56e629caa451467e7664fbd4c797c434a6c4
+Patch-mainline: Queued in subsystem maintainer repository
+References: jsc#SLE-5382
+
+... into a separate function for better readability. Split out from a
+patch from Fenghua Yu <fenghua.yu@intel.com> to keep the mechanical,
+sole code movement separate for easy review.
+
+No functional changes.
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: Fenghua Yu <fenghua.yu@intel.com>
+Cc: x86@kernel.org
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ arch/x86/kernel/cpu/common.c | 60 +++++++++++++++++++++++--------------------
+ 1 file changed, 33 insertions(+), 27 deletions(-)
+
+--- a/arch/x86/kernel/cpu/common.c
++++ b/arch/x86/kernel/cpu/common.c
+@@ -768,6 +768,38 @@ static void init_speculation_control(str
+ }
+ }
+
++static void init_cqm(struct cpuinfo_x86 *c)
++{
++ u32 eax, ebx, ecx, edx;
++
++ /* Additional Intel-defined flags: level 0x0000000F */
++ if (c->cpuid_level >= 0x0000000F) {
++
++ /* QoS sub-leaf, EAX=0Fh, ECX=0 */
++ cpuid_count(0x0000000F, 0, &eax, &ebx, &ecx, &edx);
++ c->x86_capability[CPUID_F_0_EDX] = edx;
++
++ if (cpu_has(c, X86_FEATURE_CQM_LLC)) {
++ /* will be overridden if occupancy monitoring exists */
++ c->x86_cache_max_rmid = ebx;
++
++ /* QoS sub-leaf, EAX=0Fh, ECX=1 */
++ cpuid_count(0x0000000F, 1, &eax, &ebx, &ecx, &edx);
++ c->x86_capability[CPUID_F_1_EDX] = edx;
++
++ if ((cpu_has(c, X86_FEATURE_CQM_OCCUP_LLC)) ||
++ ((cpu_has(c, X86_FEATURE_CQM_MBM_TOTAL)) ||
++ (cpu_has(c, X86_FEATURE_CQM_MBM_LOCAL)))) {
++ c->x86_cache_max_rmid = ecx;
++ c->x86_cache_occ_scale = ebx;
++ }
++ } else {
++ c->x86_cache_max_rmid = -1;
++ c->x86_cache_occ_scale = -1;
++ }
++ }
++}
++
+ void get_cpu_cap(struct cpuinfo_x86 *c)
+ {
+ u32 eax, ebx, ecx, edx;
+@@ -799,33 +831,6 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
+ c->x86_capability[CPUID_D_1_EAX] = eax;
+ }
+
+- /* Additional Intel-defined flags: level 0x0000000F */
+- if (c->cpuid_level >= 0x0000000F) {
+-
+- /* QoS sub-leaf, EAX=0Fh, ECX=0 */
+- cpuid_count(0x0000000F, 0, &eax, &ebx, &ecx, &edx);
+- c->x86_capability[CPUID_F_0_EDX] = edx;
+-
+- if (cpu_has(c, X86_FEATURE_CQM_LLC)) {
+- /* will be overridden if occupancy monitoring exists */
+- c->x86_cache_max_rmid = ebx;
+-
+- /* QoS sub-leaf, EAX=0Fh, ECX=1 */
+- cpuid_count(0x0000000F, 1, &eax, &ebx, &ecx, &edx);
+- c->x86_capability[CPUID_F_1_EDX] = edx;
+-
+- if ((cpu_has(c, X86_FEATURE_CQM_OCCUP_LLC)) ||
+- ((cpu_has(c, X86_FEATURE_CQM_MBM_TOTAL)) ||
+- (cpu_has(c, X86_FEATURE_CQM_MBM_LOCAL)))) {
+- c->x86_cache_max_rmid = ecx;
+- c->x86_cache_occ_scale = ebx;
+- }
+- } else {
+- c->x86_cache_max_rmid = -1;
+- c->x86_cache_occ_scale = -1;
+- }
+- }
+-
+ /* AMD-defined flags: level 0x80000001 */
+ eax = cpuid_eax(0x80000000);
+ c->extended_cpuid_level = eax;
+@@ -863,6 +868,7 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
+
+ init_scattered_cpuid_features(c);
+ init_speculation_control(c);
++ init_cqm(c);
+
+ /*
+ * Clear/Set all flags overridden by options, after probe.
diff --git a/series.conf b/series.conf
index 3fac1e97b1..1023352531 100644
--- a/series.conf
+++ b/series.conf
@@ -22664,6 +22664,9 @@
# git://git.infradead.org/nvme.git nvme-5.2
patches.fixes/nvme-multipath-avoid-crash-on-invalid-subsystem-cntl.patch
+ # tip/tip x86/cpu
+ patches.suse/x86-cpufeatures-Carve-out-CQM-features-retrieval.patch
+
########################################################
#
# packaging-specific patches (tweaks for autobuild,