FAILED: patch "[PATCH] platform/x86: ISST: Return error during profile addition" failed to apply to 6.6-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x f9a647cb8d90c09633a49a1e766e140e78012444
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090339-boxcar-confused-152e@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f9a647cb8d90c09633a49a1e766e140e78012444 Mon Sep 17 00:00:00 2001
From: Srinivas Pandruvada <[email protected]>
Date: Tue, 11 Aug 2026 15:21:33 -0700
Subject: [PATCH] platform/x86: ISST: Return error during profile addition
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If sst_add_perf_profiles() fails for memory allocation, it continues to allow SST-CP (core-power) feature. But in practice this is not very useful as to achieve some frequencies via SST-CP, an SST-PP (perf-profile) level change is required.
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +7 -3
@@ -339,7 +339,7 @@ static int sst_add_perf_profiles(struct auxiliary_device *auxdev,if (!pd_info->perf_levels) { pd_info->pp_header.allowed_level_mask =0 ; pd_info->pp_header.level_en_mask =0 ; -return 0 ; +return -ENOMEM ; } pd_info->ratio_unit = pd_info->pp_header.ratio_unit;
@@ -370,7 +370,7 @@ static int sst_add_perf_profiles(struct auxiliary_device *auxdev,static int sst_main (struct auxiliary_device *auxdev,struct tpmi_per_power_domain_info *pd_info) {struct device *dev = &auxdev->dev; -int i, mask, levels; +int i, ret, mask, levels; *((u64 *)&pd_info->sst_header) =readq (pd_info->sst_base); pd_info->sst_header.cp_offset *=8 ;
@@ -402,8 +402,12 @@ static int sst_main(struct auxiliary_device *auxdev, struct tpmi_per_power_domai levels = i; mask <<=1 ; } + + ret =sst_add_perf_profiles (auxdev, pd_info, levels +1 ); +if (ret) +return ret; + pd_info->max_level = levels; -sst_add_perf_profiles (auxdev, pd_info, levels +1 );return 0 ; }
Sasha Levin
maintainerPATCH 1/7 platform/x86: ISST: Ignore minor version change
From: Srinivas Pandruvada <[email protected]>
[ Upstream commit 07510a59b316445311775ee53adf10448140607a ]
The hardware definition of every TPMI feature contains a major and minor version. When there is a change in the MMIO offset or change in the definition of a field, hardware will change major version. For addition of new fields without modifying existing MMIO offsets or fields, only the minor version is changed.
Driver is developed to support SST functionality for a major and minor version. If the hardware changes major version, since offsets and definitions are changed, driver cannot continue to provide SST interface to users. Driver can still function with a minor version change as it will just miss the new functionality added by the hardware. The current implementation doesn't ignore any version change.
If there is mismatch with the minor version, continue with an information log message. If there is mismatch with the major version, log error and exit.
Stable-dep-of: f9a647cb8d90 ("platform/x86: ISST: Return error during profile addition")
--- .../x86/intel/speed_select_if/isst_tpmi_core.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +12 -4
@@ -30,7 +30,8 @@#include "isst_if_common.h" /* Supported SST hardware version by this driver */ -#define ISST_HEADER_VERSION 1 +#define ISST_MAJOR_VERSION 0 +#define ISST_MINOR_VERSION 1/* * Used to indicate if value read from MMIO needs to get multiplied
@@ -352,12 +353,19 @@ static int sst_main(struct auxiliary_device *auxdev, struct tpmi_per_power_domai pd_info->sst_header.cp_offset *=8 ; pd_info->sst_header.pp_offset *=8 ; -if (pd_info->sst_header.interface_version !=ISST_HEADER_VERSION ) { -dev_err (&auxdev->dev,"SST: Unsupported version:%x\n" , - pd_info->sst_header.interface_version); +if (pd_info->sst_header.interface_version ==TPMI_VERSION_INVALID ) +return -ENODEV ; + +if (TPMI_MAJOR_VERSION (pd_info->sst_header.interface_version) !=ISST_MAJOR_VERSION ) { +dev_err (&auxdev->dev,"SST: Unsupported major version:%lx\n" , +TPMI_MAJOR_VERSION (pd_info->sst_header.interface_version));return -ENODEV ; } +if (TPMI_MINOR_VERSION (pd_info->sst_header.interface_version) !=ISST_MINOR_VERSION ) +dev_info (&auxdev->dev,"SST: Ignore: Unsupported minor version:%lx\n" , +TPMI_MINOR_VERSION (pd_info->sst_header.interface_version)); +/* Read SST CP Header */ *((u64 *)&pd_info->cp_header) =readq (pd_info->sst_base + pd_info->sst_header.cp_offset);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/7 platform/x86/intel/tpmi: Move TPMI ID definition
From: Srinivas Pandruvada <[email protected]>
[ Upstream commit 046d7be6210e7f870e53eb38fd410237e9d1d88f ]
Move TPMI ID definitions to common include file. In this way other feature drivers don't have to redefine.
Stable-dep-of: f9a647cb8d90 ("platform/x86: ISST: Return error during profile addition")
--- drivers/platform/x86/intel/tpmi.c | 13 ------------- include/linux/intel_tpmi.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-)
drivers/platform/x86/intel/tpmi.c +0 -13
@@ -143,19 +143,6 @@ struct tpmi_info_header { u64 lock:1; } __packed; -/* -* List of supported TMPI IDs. -* Some TMPI IDs are not used by Linux, so the numbers are not consecutive. -*/ -enum intel_tpmi_id { -TPMI_ID_RAPL =0 ,/* Running Average Power Limit */ -TPMI_ID_PEM =1 ,/* Power and Perf excursion Monitor */ -TPMI_ID_UNCORE =2 ,/* Uncore Frequency Scaling */ -TPMI_ID_SST =5 ,/* Speed Select Technology */ -TPMI_CONTROL_ID =0x80 ,/* Special ID for getting feature status */ -TPMI_INFO_ID =0x81 ,/* Special ID for PCI BDF and Package ID information */ -}; -/* * The size from hardware is in u32 units. This size is from a trusted hardware, * but better to verify for pre silicon platforms. Set size to 0, when invalid.
include/linux/intel_tpmi.h +13 -0
@@ -12,6 +12,19 @@#define TPMI_MINOR_VERSION (val) FIELD_GET(GENMASK(4, 0), val)#define TPMI_MAJOR_VERSION (val) FIELD_GET(GENMASK(7, 5), val) +/* +* List of supported TMPI IDs. +* Some TMPI IDs are not used by Linux, so the numbers are not consecutive. +*/ +enum intel_tpmi_id { +TPMI_ID_RAPL =0 ,/* Running Average Power Limit */ +TPMI_ID_PEM =1 ,/* Power and Perf excursion Monitor */ +TPMI_ID_UNCORE =2 ,/* Uncore Frequency Scaling */ +TPMI_ID_SST =5 ,/* Speed Select Technology */ +TPMI_CONTROL_ID =0x80 ,/* Special ID for getting feature status */ +TPMI_INFO_ID =0x81 ,/* Special ID for PCI BDF and Package ID information */ +}; +/** * struct intel_tpmi_plat_info - Platform information for a TPMI device instance * @package_id: CPU Package id
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/7 platform/x86: ISST: Process read/write blocked feature status
In reply to Sasha LevinFrom: Srinivas Pandruvada <[email protected]>
[ Upstream commit 8bed9ff7dbcce4d1a436f7839be48c6fd5fac0ce ]
When a feature is read blocked, don't continue to read SST information and register with SST core.
When the feature is write blocked, continue to offer read interface for SST parameters, but don't allow any operation to change state. A state change results from SST level change, feature change or class of service change.
Stable-dep-of: f9a647cb8d90 ("platform/x86: ISST: Return error during profile addition")
--- .../intel/speed_select_if/isst_tpmi_core.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +25 -0
@@ -234,6 +234,7 @@ struct perf_level {* @saved_clos_configs: Save SST-CP CLOS configuration to store restore for suspend/resume * @saved_clos_assocs: Save SST-CP CLOS association to store restore for suspend/resume * @saved_pp_control: Save SST-PP control information to store restore for suspend/resume +* @write_blocked: Write operation is blocked, so can't change SST state * * This structure is used store complete SST information for a power_domain. This information * is used to read/write request for any SST IOCTL. Each physical CPU package can have multiple
@@ -259,6 +260,7 @@ struct tpmi_per_power_domain_info {u64 saved_clos_configs[4 ];u64 saved_clos_assocs[4 ];u64 saved_pp_control; +bool write_blocked; };/**
@@ -518,6 +520,9 @@ static long isst_if_clos_param(void __user *argp)return -EINVAL ;if (clos_param.get_set) { +if (power_domain_info->write_blocked) +return -EPERM ; + _write_cp_info("clos.min_freq", clos_param.min_freq_mhz, (SST_CLOS_CONFIG_0_OFFSET + clos_param.clos * SST_REG_SIZE), SST_CLOS_CONFIG_MIN_START, SST_CLOS_CONFIG_MIN_WIDTH,
@@ -605,6 +610,9 @@ static long isst_if_clos_assoc(void __user *argp) power_domain_info = &sst_inst->power_domain_info[punit_id]; +if (assoc_cmds.get_set && power_domain_info->write_blocked) +return -EPERM ; + offset =SST_CLOS_ASSOC_0_OFFSET + (punit_cpu_no /SST_CLOS_ASSOC_CPUS_PER_REG ) *SST_REG_SIZE ; shift = punit_cpu_no %SST_CLOS_ASSOC_CPUS_PER_REG ;
@@ -755,6 +763,9 @@ static int isst_if_set_perf_level(void __user *argp)if (!power_domain_info)return -EINVAL ; +if (power_domain_info->write_blocked) +return -EPERM ; +if (!(power_domain_info->pp_header.allowed_level_mask &BIT (perf_level.level)))return -EINVAL ;
@@ -812,6 +823,9 @@ static int isst_if_set_perf_feature(void __user *argp)if (!power_domain_info)return -EINVAL ; +if (power_domain_info->write_blocked) +return -EPERM ; +_write_pp_info ("perf_feature" , perf_feature.feature,SST_PP_CONTROL_OFFSET ,SST_PP_FEATURE_STATE_START ,SST_PP_FEATURE_STATE_WIDTH ,SST_MUL_FACTOR_NONE )
@@ -1260,11 +1274,21 @@ static long isst_if_def_ioctl(struct file *file, unsigned int cmd,int tpmi_sst_dev_add (struct auxiliary_device *auxdev) { +bool read_blocked =0 , write_blocked =0 ;struct intel_tpmi_plat_info *plat_info;struct tpmi_sst_struct *tpmi_sst;int i, ret, pkg =0 , inst =0 ;int num_resources; + ret =tpmi_get_feature_status (auxdev,TPMI_ID_SST , &read_blocked, &write_blocked); +if (ret) +dev_info (&auxdev->dev,"Can't read feature status: ignoring read/write blocked status\n" ); + +if (read_blocked) { +dev_info (&auxdev->dev,"Firmware has blocked reads, exiting\n" ); +return -ENODEV ; + } + plat_info =tpmi_get_platform_data (auxdev);if (!plat_info) {dev_err (&auxdev->dev,"No platform info\n" );
@@ -1309,6 +1333,7 @@ int tpmi_sst_dev_add(struct auxiliary_device *auxdev) tpmi_sst->power_domain_info[i].package_id = pkg; tpmi_sst->power_domain_info[i].power_domain_id = i; tpmi_sst->power_domain_info[i].auxdev = auxdev; + tpmi_sst->power_domain_info[i].write_blocked = write_blocked; tpmi_sst->power_domain_info[i].sst_base =devm_ioremap_resource (&auxdev->dev, res);if (IS_ERR (tpmi_sst->power_domain_info[i].sst_base))return PTR_ERR (tpmi_sst->power_domain_info[i].sst_base);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 4/7 platform/x86: ISST: Use local variable for auxdev->dev
In reply to Sasha LevinFrom: Srinivas Pandruvada <[email protected]>
[ Upstream commit 8c5a689eef5b1c1eaddd17b0b1f2609d3f66c5b0 ]
Define a local variable for &auxdev->dev and use to shorten length of lines. No functional change is done.
Stable-dep-of: f9a647cb8d90 ("platform/x86: ISST: Return error during profile addition")
--- .../intel/speed_select_if/isst_tpmi_core.c | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +14 -13
@@ -313,12 +313,11 @@ static int sst_add_perf_profiles(struct auxiliary_device *auxdev, struct tpmi_per_power_domain_info *pd_info, int levels) { +struct device *dev = &auxdev->dev;u64 perf_level_offsets;int i; - pd_info->perf_levels =devm_kcalloc (&auxdev->dev, levels, -sizeof (struct perf_level ), -GFP_KERNEL ); + pd_info->perf_levels =devm_kcalloc (dev, levels,sizeof (struct perf_level ),GFP_KERNEL );if (!pd_info->perf_levels)return 0 ;
@@ -349,6 +348,7 @@ static int sst_add_perf_profiles(struct auxiliary_device *auxdev,static int sst_main (struct auxiliary_device *auxdev,struct tpmi_per_power_domain_info *pd_info) { +struct device *dev = &auxdev->dev;int i, mask, levels; *((u64 *)&pd_info->sst_header) =readq (pd_info->sst_base);
@@ -359,13 +359,13 @@ static int sst_main(struct auxiliary_device *auxdev, struct tpmi_per_power_domaireturn -ENODEV ;if (TPMI_MAJOR_VERSION (pd_info->sst_header.interface_version) !=ISST_MAJOR_VERSION ) { -dev_err (&auxdev->dev,"SST: Unsupported major version:%lx\n" , +dev_err (dev,"SST: Unsupported major version:%lx\n" ,TPMI_MAJOR_VERSION (pd_info->sst_header.interface_version));return -ENODEV ; }if (TPMI_MINOR_VERSION (pd_info->sst_header.interface_version) !=ISST_MINOR_VERSION ) -dev_info (&auxdev->dev,"SST: Ignore: Unsupported minor version:%lx\n" , +dev_info (dev,"SST: Ignore: Unsupported minor version:%lx\n" ,TPMI_MINOR_VERSION (pd_info->sst_header.interface_version));/* Read SST CP Header */
@@ -1276,28 +1276,29 @@ int tpmi_sst_dev_add(struct auxiliary_device *auxdev) {bool read_blocked =0 , write_blocked =0 ;struct intel_tpmi_plat_info *plat_info; +struct device *dev = &auxdev->dev;struct tpmi_sst_struct *tpmi_sst;int i, ret, pkg =0 , inst =0 ;int num_resources; ret =tpmi_get_feature_status (auxdev,TPMI_ID_SST , &read_blocked, &write_blocked);if (ret) -dev_info (&auxdev->dev,"Can't read feature status: ignoring read/write blocked status\n" ); +dev_info (dev,"Can't read feature status: ignoring read/write blocked status\n" );if (read_blocked) { -dev_info (&auxdev->dev,"Firmware has blocked reads, exiting\n" ); +dev_info (dev,"Firmware has blocked reads, exiting\n" );return -ENODEV ; } plat_info =tpmi_get_platform_data (auxdev);if (!plat_info) { -dev_err (&auxdev->dev,"No platform info\n" ); +dev_err (dev,"No platform info\n" );return -EINVAL ; } pkg = plat_info->package_id;if (pkg >=topology_max_packages ()) { -dev_err (&auxdev->dev,"Invalid package id :%x\n" , pkg); +dev_err (dev,"Invalid package id :%x\n" , pkg);return -EINVAL ; }
@@ -1309,11 +1310,11 @@ int tpmi_sst_dev_add(struct auxiliary_device *auxdev)if (!num_resources)return -EINVAL ; - tpmi_sst =devm_kzalloc (&auxdev->dev,sizeof (*tpmi_sst),GFP_KERNEL ); + tpmi_sst =devm_kzalloc (dev,sizeof (*tpmi_sst),GFP_KERNEL );if (!tpmi_sst)return -ENOMEM ; - tpmi_sst->power_domain_info =devm_kcalloc (&auxdev->dev, num_resources, + tpmi_sst->power_domain_info =devm_kcalloc (dev, num_resources,sizeof (*tpmi_sst->power_domain_info),GFP_KERNEL );if (!tpmi_sst->power_domain_info)
@@ -1334,13 +1335,13 @@ int tpmi_sst_dev_add(struct auxiliary_device *auxdev) tpmi_sst->power_domain_info[i].power_domain_id = i; tpmi_sst->power_domain_info[i].auxdev = auxdev; tpmi_sst->power_domain_info[i].write_blocked = write_blocked; - tpmi_sst->power_domain_info[i].sst_base =devm_ioremap_resource (&auxdev->dev, res); + tpmi_sst->power_domain_info[i].sst_base =devm_ioremap_resource (dev, res);if (IS_ERR (tpmi_sst->power_domain_info[i].sst_base))return PTR_ERR (tpmi_sst->power_domain_info[i].sst_base); ret =sst_main (auxdev, &tpmi_sst->power_domain_info[i]);if (ret) { -devm_iounmap (&auxdev->dev, tpmi_sst->power_domain_info[i].sst_base); +devm_iounmap (dev, tpmi_sst->power_domain_info[i].sst_base); tpmi_sst->power_domain_info[i].sst_base =NULL ;continue ; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 5/7 platform/x86: ISST: Validate level in perf mask ioctls
In reply to Sasha LevinFrom: HyeongJun An <[email protected]>
[ Upstream commit 80e0d353c86a9a168ad6d213f494796294381538 ]
isst_if_get_perf_level_mask() and isst_if_get_base_freq_mask() use the user-provided level as an index into perf_levels[] via _read_pp_level_info() and _read_bf_level_info(), but neither helper validates it first.
The adjacent level-info helpers reject levels above max_level before reading the same per-level register block. Add the same bounds checks to the mask helpers, and reject disabled SST-PP levels in isst_if_get_perf_level_mask() to match isst_if_get_perf_level_info().
This prevents out-of-bounds reads from the per-level offset table on invalid ioctl input.
Stable-dep-of: f9a647cb8d90 ("platform/x86: ISST: Return error during profile addition")
--- .../platform/x86/intel/speed_select_if/isst_tpmi_core.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +9 -0
@@ -1029,6 +1029,12 @@ static int isst_if_get_perf_level_mask(void __user *argp)if (!power_domain_info)return -EINVAL ; +if (cpumask.level > power_domain_info->max_level) +return -EINVAL ; + +if (!(power_domain_info->pp_header.level_en_mask &BIT (cpumask.level))) +return -EINVAL ; +_read_pp_level_info ("mask" , mask, cpumask.level,SST_PP_INFO_2_OFFSET ,SST_PP_RSLVD_CORE_MASK_START ,SST_PP_RSLVD_CORE_MASK_WIDTH ,SST_MUL_FACTOR_NONE )
@@ -1110,6 +1116,9 @@ static int isst_if_get_base_freq_mask(void __user *argp)if (!power_domain_info)return -EINVAL ; +if (cpumask.level > power_domain_info->max_level) +return -EINVAL ; +_read_bf_level_info ("BF-cpumask" , mask, cpumask.level,SST_BF_INFO_1_OFFSET ,P1_HI_CORE_MASK_START ,P1_HI_CORE_MASK_WIDTH ,SST_MUL_FACTOR_NONE )
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 6/7 platform/x86: ISST: Use PP level enable mask
In reply to Sasha LevinFrom: Srinivas Pandruvada <[email protected]>
[ Upstream commit 9b9026943b19d06ebf520b1f4786621947cf43c8 ]
Add check for enabled levels only when reading MMIO. Some levels can be disabled by BIOS. If the level is not enabled, return an error.
Reset the enable and allowed level masks if there is a failure to add a perf level.
Stable adaptation: omit the enabled-mask filtering of the per-level BF/TF support loops. This tree predates 76f09e22027fc ("platform/x86:
ISST: Support SST-BF and SST-TF per level") and still reads support only for level 0, which sst_main() forces enabled. Keep those existing reads instead of importing the unrelated per-level reporting change.
Retain the allocation-failure mask clearing and the disabled-level checks in the BF information, BF CPU-mask, and TF information ioctls. The mask clearing supplies the context needed by f9a647cb8d90 ("platform/x86: ISST:
Return error during profile addition") to return -ENOMEM and propagate the failure through sst_main(). No functions are added.
Build testing exposed an API mismatch inherited from the earlier 8bed9ff7dbcce backport: ISST requests bool read/write-blocked outputs, but the stable TPMI core still returns int locked/disabled outputs. Include the required status plumbing from 8df012a7f5131 and 72dd14d241e1c in this dependency. Return the raw feature-state word from the existing internal helper and decode read-blocked bit 5 and write-blocked bit 4 in tpmi_get_feature_status(), with matching bool outputs in the header. Preserve the existing locked/disabled debugfs output. This avoids importing unrelated debugfs and enumeration changes.
Stable-dep-of: f9a647cb8d90 ("platform/x86: ISST: Return error during profile addition")
--- .../intel/speed_select_if/isst_tpmi_core.c | 14 ++++++- drivers/platform/x86/intel/tpmi.c | 38 ++++++++++--------- include/linux/intel_tpmi.h | 4 +- 3 files changed, 35 insertions(+), 21 deletions(-)
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +13 -1
@@ -318,8 +318,11 @@ static int sst_add_perf_profiles(struct auxiliary_device *auxdev,int i; pd_info->perf_levels =devm_kcalloc (dev, levels,sizeof (struct perf_level ),GFP_KERNEL ); -if (!pd_info->perf_levels) +if (!pd_info->perf_levels) { + pd_info->pp_header.allowed_level_mask =0 ; + pd_info->pp_header.level_en_mask =0 ;return 0 ; + } pd_info->ratio_unit = pd_info->pp_header.ratio_unit; pd_info->avx_levels =SST_MAX_AVX_LEVELS ;
@@ -1080,6 +1083,9 @@ static int isst_if_get_base_freq_info(void __user *argp)if (base_freq.level > power_domain_info->max_level)return -EINVAL ; +if (!(power_domain_info->pp_header.level_en_mask &BIT (base_freq.level))) +return -EINVAL ; +_read_bf_level_info ("p1_high" , base_freq.high_base_freq_mhz, base_freq.level,SST_BF_INFO_0_OFFSET ,SST_BF_P1_HIGH_START ,SST_BF_P1_HIGH_WIDTH ,SST_MUL_FACTOR_FREQ )
@@ -1119,6 +1125,9 @@ static int isst_if_get_base_freq_mask(void __user *argp)if (cpumask.level > power_domain_info->max_level)return -EINVAL ; +if (!(power_domain_info->pp_header.level_en_mask &BIT (cpumask.level))) +return -EINVAL ; +_read_bf_level_info ("BF-cpumask" , mask, cpumask.level,SST_BF_INFO_1_OFFSET ,P1_HI_CORE_MASK_START ,P1_HI_CORE_MASK_WIDTH ,SST_MUL_FACTOR_NONE )
@@ -1195,6 +1204,9 @@ static int isst_if_get_turbo_freq_info(void __user *argp)if (turbo_freq.level > power_domain_info->max_level)return -EINVAL ; +if (!(power_domain_info->pp_header.level_en_mask &BIT (turbo_freq.level))) +return -EINVAL ; + turbo_freq.max_buckets =TRL_MAX_BUCKETS ; turbo_freq.max_trl_levels =TRL_MAX_LEVELS ; turbo_freq.max_clip_freqs =SST_TF_MAX_LP_CLIP_RATIOS ;
drivers/platform/x86/intel/tpmi.c +20 -18
@@ -228,6 +228,8 @@ EXPORT_SYMBOL_NS_GPL(tpmi_get_resource_at_index, INTEL_TPMI);#define TPMI_CMD_LEN_MASK GENMASK_ULL(18, 16)#define TPMI_STATE_DISABLED BIT_ULL(0) +#define TPMI_STATE_WRITE_BLOCKED BIT_ULL(4) +#define TPMI_STATE_READ_BLOCKED BIT_ULL(5)#define TPMI_STATE_LOCKED BIT_ULL(31)/* Mutex to complete get feature status without interruption */
@@ -243,7 +245,7 @@ static int tpmi_wait_for_owner(struct intel_tpmi_info *tpmi_info, u8 owner) }static int tpmi_read_feature_status (struct intel_tpmi_info *tpmi_info,int feature_id, -int *locked,int *disabled) +u64 *feature_state) {u64 control, data;int ret;
@@ -294,16 +296,7 @@ static int tpmi_read_feature_status(struct intel_tpmi_info *tpmi_info, int featu/* Response is ready */ data =readq (tpmi_info->tpmi_control_mem +TPMI_COMMAND_OFFSET ); - data =FIELD_GET (TMPI_CONTROL_DATA_VAL , data); - - *disabled =0 ; - *locked =0 ; - -if (!(data &TPMI_STATE_DISABLED )) - *disabled =1 ; - -if (data &TPMI_STATE_LOCKED ) - *locked =1 ; + *feature_state =FIELD_GET (TMPI_CONTROL_DATA_VAL , data); ret =0 ;
@@ -317,13 +310,22 @@ static int tpmi_read_feature_status(struct intel_tpmi_info *tpmi_info, int featureturn ret; } -int tpmi_get_feature_status (struct auxiliary_device *auxdev,int feature_id, -int *locked,int *disabled) +int tpmi_get_feature_status (struct auxiliary_device *auxdev, +int feature_id,bool *read_blocked,bool *write_blocked) {struct intel_vsec_device *intel_vsec_dev =dev_to_ivdev (auxdev->dev.parent);struct intel_tpmi_info *tpmi_info =auxiliary_get_drvdata (&intel_vsec_dev->auxdev); +u64 feature_state; +int ret; -return tpmi_read_feature_status (tpmi_info, feature_id, locked, disabled); + ret =tpmi_read_feature_status (tpmi_info, feature_id, &feature_state); +if (ret) +return ret; + + *read_blocked = !!(feature_state &TPMI_STATE_READ_BLOCKED ); + *write_blocked = !!(feature_state &TPMI_STATE_WRITE_BLOCKED ); + +return 0 ; }EXPORT_SYMBOL_NS_GPL (tpmi_get_feature_status,INTEL_TPMI );
@@ -332,19 +334,19 @@ static int tpmi_pfs_dbg_show(struct seq_file *s, void *unused)struct intel_tpmi_info *tpmi_info = s->private;struct intel_tpmi_pm_feature *pfs;int locked, disabled, ret, i; +u64 feature_state;seq_printf (s,"tpmi PFS start offset 0x:%llx\n" , tpmi_info->pfs_start);seq_puts (s,"tpmi_id\t\tentries\t\tsize\t\tcap_offset\tattribute\tvsec_offset\tlocked\tdisabled\n" );for (i =0 ; i < tpmi_info->feature_count; ++i) { pfs = &tpmi_info->tpmi_features[i]; - ret =tpmi_read_feature_status (tpmi_info, pfs->pfs_header.tpmi_id, &locked, - &disabled); + ret =tpmi_read_feature_status (tpmi_info, pfs->pfs_header.tpmi_id, &feature_state);if (ret) { locked ='U' ; disabled ='U' ; }else { - disabled = disabled ?'Y' :'N' ; - locked = locked ?'Y' :'N' ; + disabled = feature_state &TPMI_STATE_DISABLED ?'N' :'Y' ; + locked = feature_state &TPMI_STATE_LOCKED ?'Y' :'N' ; } seq_printf(s, "0x%02x\t\t0x%02x\t\t0x%04x\t\t0x%04x\t\t0x%02x\t\t0x%016llx\t%c\t%c\n", pfs->pfs_header.tpmi_id, pfs->pfs_header.num_entries,
include/linux/intel_tpmi.h +2 -2
@@ -46,6 +46,6 @@ struct intel_tpmi_plat_info *tpmi_get_platform_data(struct auxiliary_device *auxstruct resource *tpmi_get_resource_at_index (struct auxiliary_device *auxdev,int index);int tpmi_get_resource_count (struct auxiliary_device *auxdev); -int tpmi_get_feature_status (struct auxiliary_device *auxdev,int feature_id,int *locked, -int *disabled); +int tpmi_get_feature_status (struct auxiliary_device *auxdev,int feature_id,bool *read_blocked, +bool *write_blocked);#endif
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 7/7 platform/x86: ISST: Return error during profile addition
In reply to Sasha LevinFrom: Srinivas Pandruvada <[email protected]>
[ Upstream commit f9a647cb8d90c09633a49a1e766e140e78012444 ]
If sst_add_perf_profiles() fails for memory allocation, it continues to allow SST-CP (core-power) feature. But in practice this is not very useful as to achieve some frequencies via SST-CP, an SST-PP (perf-profile) level change is required.
--- .../x86/intel/speed_select_if/isst_tpmi_core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +7 -3
@@ -321,7 +321,7 @@ static int sst_add_perf_profiles(struct auxiliary_device *auxdev,if (!pd_info->perf_levels) { pd_info->pp_header.allowed_level_mask =0 ; pd_info->pp_header.level_en_mask =0 ; -return 0 ; +return -ENOMEM ; } pd_info->ratio_unit = pd_info->pp_header.ratio_unit;
@@ -352,7 +352,7 @@ static int sst_add_perf_profiles(struct auxiliary_device *auxdev,static int sst_main (struct auxiliary_device *auxdev,struct tpmi_per_power_domain_info *pd_info) {struct device *dev = &auxdev->dev; -int i, mask, levels; +int i, ret, mask, levels; *((u64 *)&pd_info->sst_header) =readq (pd_info->sst_base); pd_info->sst_header.cp_offset *=8 ;
@@ -387,8 +387,12 @@ static int sst_main(struct auxiliary_device *auxdev, struct tpmi_per_power_domai levels = i; mask <<=1 ; } + + ret =sst_add_perf_profiles (auxdev, pd_info, levels +1 ); +if (ret) +return ret; + pd_info->max_level = levels; -sst_add_perf_profiles (auxdev, pd_info, levels +1 );return 0 ; }
Signature · 1 line
2.53.0