From: Jithu Joseph <[email protected]>

Starting with Granite Rapids (GNR), bit 21 (ALL_LP_JOIN_NEEDED) of
MSR_INTEGRITY_CAPABILITIES register [1] indicates whether all CPUs sharing
the scan test engine need to be tested together. These CPUs must join
using MSR_ACTIVATE_SCAN.

Add an enumeration of bit 21 to determine if CPUs need to join to run IFS
tests together.

[1] Vol. 4 "Table 2-56. Additional MSRs Supported by the Intel® Xeon®
    6 P-Core Processors" in the Intel Software Developers' Manual,
    March 2025.

[ Qiuxu: Elaborate commit message. ]

Signed-off-by: Jithu Joseph <[email protected]>
Signed-off-by: Ehab Ababneh <[email protected]>
---
 arch/x86/include/asm/msr-index.h      |  2 ++
 drivers/platform/x86/intel/ifs/core.c | 12 ++++++++++++
 drivers/platform/x86/intel/ifs/ifs.h  |  2 ++
 3 files changed, 16 insertions(+)

diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 660b0c332be2..554ce662fdf4 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -281,6 +281,8 @@
 #define MSR_INTEGRITY_CAPS_PERIODIC_SCAN_BIST_BIT      4
 #define MSR_INTEGRITY_CAPS_PERIODIC_SCAN_BIST          
BIT(MSR_INTEGRITY_CAPS_PERIODIC_SCAN_BIST_BIT)
 #define MSR_INTEGRITY_CAPS_SAF_GEN_MASK                        GENMASK_ULL(10, 
9)
+#define MSR_INTEGRITY_CAPS_ALL_LP_JOIN_BIT             21
+#define MSR_INTEGRITY_CAPS_ALL_LP_JOIN                 
BIT(MSR_INTEGRITY_CAPS_ALL_LP_JOIN_BIT)
 
 #define MSR_LBR_NHM_FROM               0x00000680
 #define MSR_LBR_NHM_TO                 0x000006c0
diff --git a/drivers/platform/x86/intel/ifs/core.c 
b/drivers/platform/x86/intel/ifs/core.c
index 85a04ecc9dbe..f2d2caab0479 100644
--- a/drivers/platform/x86/intel/ifs/core.c
+++ b/drivers/platform/x86/intel/ifs/core.c
@@ -110,6 +110,18 @@ static int __init ifs_init(void)
                        continue;
                ifs_devices[i].rw_data.generation = 
FIELD_GET(MSR_INTEGRITY_CAPS_SAF_GEN_MASK,
                                                              msrval);
+               /*
+                * For Sapphire Rapids and Emerald Rapids (SAF_GEN=0), the 
ALL_LP_JOIN
+                * indicator is unavailable. However, all the threads within a 
core still
+                * need to run IFS simultaneously, so the variable 
'all_lp_join' is
+                * forced to true.
+                *
+                * For Granite Rapids and later generations (SAF_GEN=2), the 
ALL_LP_JOIN
+                * indicator is available, the variable 'all_lp_join' is 
determined by
+                * this indicator.
+                */
+               ifs_devices[i].rw_data.all_lp_join = 
ifs_devices[i].rw_data.generation ?
+                                               (msrval & 
MSR_INTEGRITY_CAPS_ALL_LP_JOIN) : true;
                ifs_devices[i].rw_data.array_gen = (u32)m->driver_data;
                ret = misc_register(&ifs_devices[i].misc);
                if (ret)
diff --git a/drivers/platform/x86/intel/ifs/ifs.h 
b/drivers/platform/x86/intel/ifs/ifs.h
index f52287745366..814ebac10a5d 100644
--- a/drivers/platform/x86/intel/ifs/ifs.h
+++ b/drivers/platform/x86/intel/ifs/ifs.h
@@ -295,6 +295,7 @@ struct ifs_test_msrs {
  * @generation: IFS test generation enumerated by hardware
  * @chunk_size: size of a test chunk
  * @array_gen: test generation of array test
+ * @all_lp_join: all logical processors join test
  */
 struct ifs_data {
        int     loaded_version;
@@ -307,6 +308,7 @@ struct ifs_data {
        u32     generation;
        u32     chunk_size;
        u32     array_gen;
+       bool    all_lp_join;
 };
 
 struct ifs_work {
-- 
2.43.0


Reply via email to