Skip to contentSkip to conversation

platform/x86: ISST: Allow reading core-power state on HWP disabled systems

PATCH In review Srinivas Pandruvada 3 participants 5 messages Feb 29, 2024 – Mar 4, 2024

Subsystems (2)
lore
Share & tools
lore

Srinivas Pandruvada

author maintainer
#0 lore raw

PATCH 1/1 platform/x86: ISST: Allow reading core-power state on HWP disabled systems

When HWP (Hardware P-states) is disabled, dynamic SST features are disabled. But user should still be able to read the current core-power state, with legacy P-states. This will allow users to read current configuration with static SST enabled from BIOS.

To address this, do not call disable_dynamic_sst_features() when the request is for reading the state.

---
 drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +2 -2
index 2662fbbddf0c..1d918000d72b 100644
@@ -462,10 +462,10 @@ static long isst_if_core_power_state(void __user *argp)
 	struct tpmi_per_power_domain_info *power_domain_info;
 	struct isst_core_power core_power;
 
-	if (disable_dynamic_sst_features())
+	if (copy_from_user(&core_power, argp, sizeof(core_power)))
 		return -EFAULT;
 
-	if (copy_from_user(&core_power, argp, sizeof(core_power)))
+	if (core_power.get_set && disable_dynamic_sst_features())
 		return -EFAULT;
 
 	power_domain_info = get_instance(core_power.socket_id, core_power.power_domain_id);
Signature · 1 line
2.40.1
maintainer
#1 lore raw
Quoted 9 lines · Srinivas Pandruvada

When HWP (Hardware P-states) is disabled, dynamic SST features are disabled. But user should still be able to read the current core-power state, with legacy P-states. This will allow users to read current configuration with static SST enabled from BIOS.

To address this, do not call disable_dynamic_sst_features() when the request is for reading the state.

Is this a fix? (It's lacking the tag if it is).

Signature · 1 line
 i.
Quoted 22 lines
---
 drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +2 -2
index 2662fbbddf0c..1d918000d72b 100644
@@ -462,10 +462,10 @@ static long isst_if_core_power_state(void __user *argp)
 	struct tpmi_per_power_domain_info *power_domain_info;
 	struct isst_core_power core_power;
 
-	if (disable_dynamic_sst_features())
+	if (copy_from_user(&core_power, argp, sizeof(core_power)))
 		return -EFAULT;
 
-	if (copy_from_user(&core_power, argp, sizeof(core_power)))
+	if (core_power.get_set && disable_dynamic_sst_features())
 		return -EFAULT;
 
 	power_domain_info = get_instance(core_power.socket_id, core_power.power_domain_id);
author maintainer
#2 lore raw
Quoted 8 lines · Ilpo Järvinen
Quoted 6 lines · Srinivas Pandruvada

When HWP (Hardware P-states) is disabled, dynamic SST features are disabled. But user should still be able to read the current core- power
state, with legacy P-states. This will allow users to read current configuration with static SST enabled from BIOS.

Quoted 8 lines
Quoted 6 lines

To address this, do not call disable_dynamic_sst_features() when the
request is for reading the state.

Signed-off-by: Srinivas Pandruvada
<[email protected]>

Is this a fix? (It's lacking the tag if it is).

This is not a fix. This is a feature request from a customer. Some customer wants to use in certain way.

Thanks,
Srinivas

Quoted 1 line
Reviewed-by on v1 1/1
#3 lore raw
In reply to Srinivas Pandruvada
Quoted 10 lines · Srinivas Pandruvada

When HWP (Hardware P-states) is disabled, dynamic SST features are disabled. But user should still be able to read the current core-power state, with legacy P-states. This will allow users to read current configuration with static SST enabled from BIOS.

To address this, do not call disable_dynamic_sst_features() when the request is for reading the state.

---

Looks good to me.

Quoted 20 lines
 drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/intel/speed_select_if/isst_tpmi_core.c +2 -2
index 2662fbbddf0c..1d918000d72b 100644
@@ -462,10 +462,10 @@ static long isst_if_core_power_state(void __user *argp)
 	struct tpmi_per_power_domain_info *power_domain_info;
 	struct isst_core_power core_power;
 
-	if (disable_dynamic_sst_features())
+	if (copy_from_user(&core_power, argp, sizeof(core_power)))
 		return -EFAULT;
 
-	if (copy_from_user(&core_power, argp, sizeof(core_power)))
+	if (core_power.get_set && disable_dynamic_sst_features())
 		return -EFAULT;
 
 	power_domain_info = get_instance(core_power.socket_id, core_power.power_domain_id);
Signature · 2 lines
Sathyanarayanan Kuppuswamy
Linux Kernel Developer
maintainer
#4 lore raw
In reply to Srinivas Pandruvada
Quoted 9 lines · Srinivas Pandruvada

When HWP (Hardware P-states) is disabled, dynamic SST features are disabled. But user should still be able to read the current core-power state, with legacy P-states. This will allow users to read current configuration with static SST enabled from BIOS.

To address this, do not call disable_dynamic_sst_features() when the request is for reading the state.

[...]

Thank you for your contribution, it has been applied to my local review-ilpo branch. Note it will show up in the public platform-drivers-x86/review-ilpo branch only once I've pushed my local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86: ISST: Allow reading core-power state on HWP disabled systems

      commit: 959e640cf7b2d456052b346fa50574242ca56aaa

--
i.