From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: platform-driver-x86@vger.kernel.org
Cc: mjg59@redhat.com, Jesse Barnes <jbarnes@virtuousgeek.org>
Subject: [PATCH 2/2] IPS driver: verify BIOS provided limits
Date: Thu, 23 Sep 2010 23:49:29 +0200 [thread overview]
Message-ID: <1285278569-4368-2-git-send-email-jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <1285278569-4368-1-git-send-email-jbarnes@virtuousgeek.org>
They're optional. If not present or sane, we should use the CPU
defaults.
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
drivers/platform/x86/intel_ips.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 71d04ef..c402cc4 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -665,6 +665,27 @@ static bool mch_exceeded(struct ips_driver *ips)
}
/**
+ * verify_limits - verify BIOS provided limits
+ * @ips: IPS structure
+ *
+ * BIOS can optionally provide non-default limits for power and temp. Check
+ * them here and use the defaults if the BIOS values are not provided or
+ * are otherwise unusable.
+ */
+static void verify_limits(struct ips_driver *ips)
+{
+ if (ips->mcp_power_limit < ips->limits->mcp_power_limit ||
+ ips->mcp_power_limit > 35000)
+ ips->mcp_power_limit = ips->limits->mcp_power_limit;
+
+ if (ips->mcp_temp_limit < ips->limits->core_temp_limit ||
+ ips->mcp_temp_limit < ips->limits->mch_temp_limit ||
+ ips->mcp_temp_limit > 150)
+ ips->mcp_temp_limit = min(ips->limits->core_temp_limit,
+ ips->limits->mch_temp_limit);
+}
+
+/**
* update_turbo_limits - get various limits & settings from regs
* @ips: IPS driver struct
*
@@ -688,6 +709,7 @@ static void update_turbo_limits(struct ips_driver *ips)
ips->mcp_temp_limit = thm_readw(THM_PTL);
ips->mcp_power_limit = thm_readw(THM_MPPC);
+ verify_limits(ips);
/* Ignore BIOS CPU vs GPU pref */
}
@@ -1156,6 +1178,7 @@ static irqreturn_t ips_irq_handler(int irq, void *arg)
STS_PTL_SHIFT;
ips->mcp_power_limit = (tc1 & STS_PPL_MASK) >>
STS_PPL_SHIFT;
+ verify_limits(ips);
spin_unlock(&ips->turbo_status_lock);
thm_writeb(THM_SEC, SEC_ACK);
--
1.7.2.3
next prev parent reply other threads:[~2010-09-23 21:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-23 21:49 [PATCH 1/2] IPS driver: don't toggle CPU turbo on unsupported CPUs Jesse Barnes
2010-09-23 21:49 ` Jesse Barnes [this message]
2010-09-23 21:53 ` [PATCH 2/2] IPS driver: verify BIOS provided limits Jesse Barnes
2010-09-27 17:38 ` Jesse Barnes
2010-09-23 21:51 ` [PATCH 1/2] IPS driver: don't toggle CPU turbo on unsupported CPUs Jesse Barnes
2010-09-23 21:58 ` Rafael J. Wysocki
2010-09-23 22:18 ` Jesse Barnes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1285278569-4368-2-git-send-email-jbarnes@virtuousgeek.org \
--to=jbarnes@virtuousgeek.org \
--cc=mjg59@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).