platform/x86: ISST: Support SST-TF revision 2
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Tue, 6 May 2025 16:35:29 +0000 (09:35 -0700)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 8 May 2025 13:04:04 +0000 (16:04 +0300)
SST-TF revision 2 supports a higher number of cores per bucket, as the
current limit of 256 cores may be insufficient. To accommodate this, a
new offset, "SST_TF_INFO-8," is introduced, allowing for a higher core
count. Utilize this offset instead of the current "SST_TF_INFO-1" offset,
based on SST-TF revision 2 or higher, and if there is a non-zero core
count in any bucket.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://lore.kernel.org/r/20250506163531.1061185-2-srinivas.pandruvada@linux.intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c

index 9978cdd..a52fc2f 100644 (file)
@@ -1328,9 +1328,14 @@ static int isst_if_get_tpmi_instance_count(void __user *argp)
 #define SST_TF_INFO_0_OFFSET   0
 #define SST_TF_INFO_1_OFFSET   8
 #define SST_TF_INFO_2_OFFSET   16
+#define SST_TF_INFO_8_OFFSET   64
+#define SST_TF_INFO_8_BUCKETS  3
 
 #define SST_TF_MAX_LP_CLIP_RATIOS      TRL_MAX_LEVELS
 
+#define SST_TF_FEATURE_REV_START       4
+#define SST_TF_FEATURE_REV_WIDTH       8
+
 #define SST_TF_LP_CLIP_RATIO_0_START   16
 #define SST_TF_LP_CLIP_RATIO_0_WIDTH   8
 
@@ -1340,10 +1345,14 @@ static int isst_if_get_tpmi_instance_count(void __user *argp)
 #define SST_TF_NUM_CORE_0_START 0
 #define SST_TF_NUM_CORE_0_WIDTH 8
 
+#define SST_TF_NUM_MOD_0_START 0
+#define SST_TF_NUM_MOD_0_WIDTH 16
+
 static int isst_if_get_turbo_freq_info(void __user *argp)
 {
        static struct isst_turbo_freq_info turbo_freq;
        struct tpmi_per_power_domain_info *power_domain_info;
+       u8 feature_rev;
        int i, j;
 
        if (copy_from_user(&turbo_freq, argp, sizeof(turbo_freq)))
@@ -1360,6 +1369,10 @@ static int isst_if_get_turbo_freq_info(void __user *argp)
        turbo_freq.max_trl_levels = TRL_MAX_LEVELS;
        turbo_freq.max_clip_freqs = SST_TF_MAX_LP_CLIP_RATIOS;
 
+       _read_tf_level_info("feature_rev", feature_rev, turbo_freq.level,
+                           SST_TF_INFO_0_OFFSET, SST_TF_FEATURE_REV_START,
+                           SST_TF_FEATURE_REV_WIDTH, SST_MUL_FACTOR_NONE);
+
        for (i = 0; i < turbo_freq.max_clip_freqs; ++i)
                _read_tf_level_info("lp_clip*", turbo_freq.lp_clip_freq_mhz[i],
                                    turbo_freq.level, SST_TF_INFO_0_OFFSET,
@@ -1376,12 +1389,32 @@ static int isst_if_get_turbo_freq_info(void __user *argp)
                                            SST_MUL_FACTOR_FREQ)
        }
 
+       if (feature_rev >= 2) {
+               bool has_tf_info_8 = false;
+
+               for (i = 0; i < SST_TF_INFO_8_BUCKETS; ++i) {
+                       _read_tf_level_info("bucket_*_mod_count", turbo_freq.bucket_core_counts[i],
+                                           turbo_freq.level, SST_TF_INFO_8_OFFSET,
+                                           SST_TF_NUM_MOD_0_WIDTH * i, SST_TF_NUM_MOD_0_WIDTH,
+                                           SST_MUL_FACTOR_NONE)
+
+                       if (turbo_freq.bucket_core_counts[i])
+                               has_tf_info_8 = true;
+               }
+
+               if (has_tf_info_8)
+                       goto done_core_count;
+       }
+
        for (i = 0; i < TRL_MAX_BUCKETS; ++i)
                _read_tf_level_info("bucket_*_core_count", turbo_freq.bucket_core_counts[i],
                                    turbo_freq.level, SST_TF_INFO_1_OFFSET,
                                    SST_TF_NUM_CORE_0_WIDTH * i, SST_TF_NUM_CORE_0_WIDTH,
                                    SST_MUL_FACTOR_NONE)
 
+
+done_core_count:
+
        if (copy_to_user(argp, &turbo_freq, sizeof(turbo_freq)))
                return -EFAULT;