Skip to content

Commit 76f09e2

Browse files
spandruvadajwrdegoede
authored andcommitted
platform/x86: ISST: Support SST-BF and SST-TF per level
SST SST-BF and SST-TF can be enabled/disabled per SST-PP level. So return a mask of all levels, where the feature is supported, instead of just for level 0. Since the return value returns all levels mask, not just level 0, update API version. Signed-off-by: Srinivas Pandruvada <[email protected]> Reviewed-by: Zhang Rui <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent b35814a commit 76f09e2

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,8 @@ static int isst_if_get_perf_level(void __user *argp)
847847
{
848848
struct isst_perf_level_info perf_level;
849849
struct tpmi_per_power_domain_info *power_domain_info;
850+
unsigned long level_mask;
851+
u8 level, support;
850852

851853
if (copy_from_user(&perf_level, argp, sizeof(perf_level)))
852854
return -EFAULT;
@@ -866,12 +868,34 @@ static int isst_if_get_perf_level(void __user *argp)
866868
SST_PP_FEATURE_STATE_START, SST_PP_FEATURE_STATE_WIDTH, SST_MUL_FACTOR_NONE)
867869
perf_level.enabled = !!(power_domain_info->sst_header.cap_mask & BIT(1));
868870

869-
_read_bf_level_info("bf_support", perf_level.sst_bf_support, 0, 0,
870-
SST_BF_FEATURE_SUPPORTED_START, SST_BF_FEATURE_SUPPORTED_WIDTH,
871-
SST_MUL_FACTOR_NONE);
872-
_read_tf_level_info("tf_support", perf_level.sst_tf_support, 0, 0,
873-
SST_TF_FEATURE_SUPPORTED_START, SST_TF_FEATURE_SUPPORTED_WIDTH,
874-
SST_MUL_FACTOR_NONE);
871+
level_mask = perf_level.level_mask;
872+
perf_level.sst_bf_support = 0;
873+
for_each_set_bit(level, &level_mask, BITS_PER_BYTE) {
874+
/*
875+
* Read BF support for a level. Read output is updated
876+
* to "support" variable by the below macro.
877+
*/
878+
_read_bf_level_info("bf_support", support, level, 0, SST_BF_FEATURE_SUPPORTED_START,
879+
SST_BF_FEATURE_SUPPORTED_WIDTH, SST_MUL_FACTOR_NONE);
880+
881+
/* If supported set the bit for the level */
882+
if (support)
883+
perf_level.sst_bf_support |= BIT(level);
884+
}
885+
886+
perf_level.sst_tf_support = 0;
887+
for_each_set_bit(level, &level_mask, BITS_PER_BYTE) {
888+
/*
889+
* Read TF support for a level. Read output is updated
890+
* to "support" variable by the below macro.
891+
*/
892+
_read_tf_level_info("tf_support", support, level, 0, SST_TF_FEATURE_SUPPORTED_START,
893+
SST_TF_FEATURE_SUPPORTED_WIDTH, SST_MUL_FACTOR_NONE);
894+
895+
/* If supported set the bit for the level */
896+
if (support)
897+
perf_level.sst_tf_support |= BIT(level);
898+
}
875899

876900
if (copy_to_user(argp, &perf_level, sizeof(perf_level)))
877901
return -EFAULT;
@@ -1648,7 +1672,7 @@ void tpmi_sst_dev_resume(struct auxiliary_device *auxdev)
16481672
}
16491673
EXPORT_SYMBOL_NS_GPL(tpmi_sst_dev_resume, INTEL_TPMI_SST);
16501674

1651-
#define ISST_TPMI_API_VERSION 0x02
1675+
#define ISST_TPMI_API_VERSION 0x03
16521676

16531677
int tpmi_sst_init(void)
16541678
{

0 commit comments

Comments
 (0)