Skip to contentSkip to conversation

IPS driver: apply BIOS provided CPU limit if different from default

PATCH In review Jesse Barnes 2 participants 4 messages Oct 5, 2010 – Feb 28, 2011 x86 platform drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 IPS driver: apply BIOS provided CPU limit if different from default

The BIOS may hand us a lower CPU power limit than the default for a given SKU. We should use it in case the platform isn't designed to dissapate the full TDP of a given part.

---
 drivers/platform/x86/intel_ips.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
drivers/platform/x86/intel_ips.c +4 -3
index c402cc4..f7924c5 100644
@@ -1377,9 +1377,10 @@ static struct ips_mcp_limits *ips_detect_cpu(struct ips_driver *ips)
 	tdp = turbo_power & TURBO_TDP_MASK;
 
 	/* Sanity check TDP against CPU */
-	if (limits->mcp_power_limit != (tdp / 8) * 1000) {
-		dev_warn(&ips->dev->dev, "Warning: CPU TDP doesn't match expected value (found %d, expected %d)\n",
-			 tdp / 8, limits->mcp_power_limit / 1000);
+	if (limits->core_power_limit != (tdp / 8) * 1000) {
+		dev_info(&ips->dev->dev, "CPU TDP doesn't match expected value (found %d, expected %d)\n",
+			 tdp / 8, limits->core_power_limit / 1000);
+		limits->core_power_limit = (tdp / 8) * 1000;
 	}
 
 out:
Signature · 1 line
1.7.2.1
#1 lore raw

PATCH 2/2 IPS driver: disable CPU turbo

The undocumented interface we're using for reading CPU power seems to be overreporting power. Until we figure out how to correct it, disable CPU turbo and power reporting to be safe. This will keep the CPU within default limits and still allow us to increase GPU frequency as needed.

---
 drivers/platform/x86/intel_ips.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
drivers/platform/x86/intel_ips.c +5 -3
index f7924c5..af4d2c7 100644
@@ -703,6 +703,7 @@ static void update_turbo_limits(struct ips_driver *ips)
 	u32 hts = thm_readl(THM_HTS);
 
 	ips->cpu_turbo_enabled = !(hts & HTS_PCTD_DIS);
+	ips->cpu_turbo_enabled = false;
 	ips->gpu_turbo_enabled = !(hts & HTS_GTD_DIS);
 	ips->core_power_limit = thm_readw(THM_MPCPC);
 	ips->mch_power_limit = thm_readw(THM_MMGPC);
@@ -882,7 +883,7 @@ static u32 get_cpu_power(struct ips_driver *ips, u32 *last, int period)
 	ret = (ret * 1000) / 65535;
 	*last = val;
 
-	return ret;
+	return 0;
 }
 
 static const u16 temp_decay_factor = 2;
@@ -1173,6 +1174,7 @@ static irqreturn_t ips_irq_handler(int irq, void *arg)
 				STS_GPL_SHIFT;
 			/* ignore EC CPU vs GPU pref */
 			ips->cpu_turbo_enabled = !(sts & STS_PCTD_DIS);
+			ips->cpu_turbo_enabled = false;
 			ips->gpu_turbo_enabled = !(sts & STS_GTD_DIS);
 			ips->mcp_temp_limit = (sts & STS_PTL_MASK) >>
 				STS_PTL_SHIFT;
@@ -1559,8 +1561,8 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	/* Save turbo limits & ratios */
 	rdmsrl(TURBO_POWER_CURRENT_LIMIT, ips->orig_turbo_limit);
 
-	ips_enable_cpu_turbo(ips);
-	ips->cpu_turbo_enabled = true;
+	ips_disable_cpu_turbo(ips);
+	ips->cpu_turbo_enabled = false;
 
 	/* Create thermal adjust thread */
 	ips->adjust = kthread_create(ips_adjust, ips, "ips-adjust");
Signature · 1 line
1.7.2.1
#2 lore raw

Re: [PATCH 2/2] IPS driver: disable CPU turbo

Quoted 4 lines · Jesse Barnes

The undocumented interface we're using for reading CPU power seems to be overreporting power. Until we figure out how to correct it, disable CPU turbo and power reporting to be safe. This will keep the CPU within default limits and still allow us to increase GPU frequency as needed.

Any news on this one, or is it expected to be disabled indefinitely?

Signature · 1 line
Anssi Hannula
#3 lore raw

Re: [PATCH 2/2] IPS driver: disable CPU turbo

Quoted 7 lines · On Mon, 28 Feb 2011 21:01:44 +0200 Anssi Hannula <[email protected]> wrote:
Quoted 4 lines · Jesse Barnes

The undocumented interface we're using for reading CPU power seems to be overreporting power. Until we figure out how to correct it, disable CPU turbo and power reporting to be safe. This will keep the CPU within default limits and still allow us to increase GPU frequency as needed.

Any news on this one, or is it expected to be disabled indefinitely?

No news, you could add a module param to force it on or revert this patch, then run some comparisons and see what kind of perf difference you see between enabled/disabled.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center