From: Matthew Garrett <mjg@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: borislav.petkov@amd.com, davej@redhat.com,
mark.langsdorf@amd.com, cpufreq@vger.kernel.org,
Matthew Garrett <mjg@redhat.com>
Subject: [PATCH 3/5] ACPI: Add fixups for AMD P-state figures
Date: Tue, 17 May 2011 13:03:37 -0400 [thread overview]
Message-ID: <1305651819-25660-3-git-send-email-mjg@redhat.com> (raw)
In-Reply-To: <1305651819-25660-1-git-send-email-mjg@redhat.com>
Some AMD systems may round the frequencies in ACPI tables to 100MHz
boundaries. We can obtain the real frequencies from MSRs, so add a quirk
to fix these frequencies up on AMD systems.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
drivers/acpi/processor_perflib.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c
index 3a73a93..6c7d49d 100644
--- a/drivers/acpi/processor_perflib.c
+++ b/drivers/acpi/processor_perflib.c
@@ -306,6 +306,34 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
return result;
}
+#ifdef CONFIG_X86
+/*
+ * Some AMDs have 50MHz frequency multiples, but only provide 100MHz rounding
+ * in their ACPI data. Calculate the real values and fix up the _PSS data.
+ */
+static void amd_fixup_frequency(struct acpi_processor_px *px, int i)
+{
+ u32 hi, lo, fid, did;
+ int index = px->control & 0x00000007;
+
+ if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
+ return;
+
+ if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10)
+ || boot_cpu_data.x86 == 0x11) {
+ rdmsr(0xc0010064 + index, lo, hi);
+ fid = lo & 0x3f;
+ did = (lo >> 6) & 7;
+ if (boot_cpu_data.x86 == 0x10)
+ px->core_frequency = (100 * (fid + 0x10)) >> did;
+ else
+ px->core_frequency = (100 * (fid + 8)) >> did;
+ }
+}
+#else
+static void amd_fixup_frequency(struct acpi_processor_px *px, int i) {};
+#endif
+
static int acpi_processor_get_performance_states(struct acpi_processor *pr)
{
int result = 0;
@@ -360,6 +388,8 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
goto end;
}
+ amd_fixup_frequency(px, i);
+
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"State [%d]: core_frequency[%d] power[%d] transition_latency[%d] bus_master_latency[%d] control[0x%x] status[0x%x]\n",
i,
--
1.7.5
next prev parent reply other threads:[~2011-05-17 17:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-17 17:03 [PATCH 1/5] acpi-cpufreq: Add support for modern AMD CPUs Matthew Garrett
2011-05-17 17:03 ` [PATCH 2/5] acpi-cpufreq: Add support for disabling dynamic overclocking Matthew Garrett
2011-08-02 20:21 ` Len Brown
2011-08-02 20:50 ` Borislav Petkov
2011-05-17 17:03 ` Matthew Garrett [this message]
2011-05-17 17:03 ` [PATCH 4/5] cpufreq: Add compatibility hack to powernow-k8 Matthew Garrett
2011-05-17 17:03 ` [PATCH 5/5] cpufreq: Remove support for hardware P-state chips from powernow-k8 Matthew Garrett
2011-05-17 17:35 ` [PATCH 1/5] acpi-cpufreq: Add support for modern AMD CPUs Borislav Petkov
2011-05-17 17:42 ` Matthew Garrett
2011-05-17 18:13 ` Borislav Petkov
2011-05-17 18:17 ` Matthew Garrett
2011-05-19 7:26 ` Andreas Herrmann
2011-08-02 20:18 ` Len Brown
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=1305651819-25660-3-git-send-email-mjg@redhat.com \
--to=mjg@redhat.com \
--cc=borislav.petkov@amd.com \
--cc=cpufreq@vger.kernel.org \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.langsdorf@amd.com \
/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).