Commit f0be9a55 authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by Jia, Yingbao
Browse files

platform/x86: ISST: Support SST-BF and SST-TF per level

mainline inclusion
from mainline-v6.10
commit 76f09e22027fc0dbec1e9c82898d9059b4455df6
category: bugfix
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/IB6QD3
CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=76f09e22027fc0dbec1e9c82898d9059b4455df6



-------------------------------------------------

Intel-SIG: commit 76f09e22027f platform/x86: ISST: Support SST-BF and SST-TF per level.
Backport intel SST driver update for 5.10 from 6.10

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: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: default avatarZhang Rui <rui.zhang@intel.com>
Link: https://lore.kernel.org/r/20240430221052.15825-1-srinivas.pandruvada@linux.intel.com


Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
[ Yingbao Jia: amend commit log ]
Signed-off-by: default avatarYingbao Jia <yingbao.jia@intel.com>
parent c74039d2
Loading
Loading
Loading
Loading
+31 −7
Original line number Diff line number Diff line
@@ -848,6 +848,8 @@ static int isst_if_get_perf_level(void __user *argp)
{
	struct isst_perf_level_info perf_level;
	struct tpmi_per_power_domain_info *power_domain_info;
	unsigned long level_mask;
	u8 level, support;

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

	_read_bf_level_info("bf_support", perf_level.sst_bf_support, 0, 0,
			    SST_BF_FEATURE_SUPPORTED_START, SST_BF_FEATURE_SUPPORTED_WIDTH,
			    SST_MUL_FACTOR_NONE);
	_read_tf_level_info("tf_support", perf_level.sst_tf_support, 0, 0,
			    SST_TF_FEATURE_SUPPORTED_START, SST_TF_FEATURE_SUPPORTED_WIDTH,
			    SST_MUL_FACTOR_NONE);
	level_mask = perf_level.level_mask;
	perf_level.sst_bf_support = 0;
	for_each_set_bit(level, &level_mask, BITS_PER_BYTE) {
		/*
		 * Read BF support for a level. Read output is updated
		 * to "support" variable by the below macro.
		 */
		_read_bf_level_info("bf_support", support, level, 0, SST_BF_FEATURE_SUPPORTED_START,
				    SST_BF_FEATURE_SUPPORTED_WIDTH, SST_MUL_FACTOR_NONE);

		/* If supported set the bit for the level */
		if (support)
			perf_level.sst_bf_support |= BIT(level);
	}

	perf_level.sst_tf_support = 0;
	for_each_set_bit(level, &level_mask, BITS_PER_BYTE) {
		/*
		 * Read TF support for a level. Read output is updated
		 * to "support" variable by the below macro.
		 */
		_read_tf_level_info("tf_support", support, level, 0, SST_TF_FEATURE_SUPPORTED_START,
				    SST_TF_FEATURE_SUPPORTED_WIDTH, SST_MUL_FACTOR_NONE);

		/* If supported set the bit for the level */
		if (support)
			perf_level.sst_tf_support |= BIT(level);
	}

	if (copy_to_user(argp, &perf_level, sizeof(perf_level)))
		return -EFAULT;
@@ -1649,7 +1673,7 @@ void tpmi_sst_dev_resume(struct auxiliary_device *auxdev)
}
EXPORT_SYMBOL_NS_GPL(tpmi_sst_dev_resume, INTEL_TPMI_SST);

#define ISST_TPMI_API_VERSION	0x02
#define ISST_TPMI_API_VERSION	0x03

int tpmi_sst_init(void)
{