From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel@lists.xensource.com, bp@suse.de, stefan.bader@canonical.com
Subject: Re: [PATCH] ACPI: Add fixups for AMD P-state figures.
Date: Tue, 05 Mar 2013 17:12:56 -0500 [thread overview]
Message-ID: <51366DE8.50204@oracle.com> (raw)
In-Reply-To: <20130305213319.GA8235@phenom.dumpdata.com>
On 03/05/2013 04:33 PM, Konrad Rzeszutek Wilk wrote:
> On Tue, Mar 05, 2013 at 03:22:25PM -0500, Boris Ostrovsky wrote:
>> On 03/05/2013 02:45 PM, Konrad Rzeszutek Wilk wrote:
>>> This a copy-n-paste from two Linux git commits:
>>>
>>> - f594065faf4f9067c2283a34619fc0714e79a98d
>>> ACPI: Add fixups for AMD P-state figures
>>> - 9855d8ce41a7801548a05d844db2f46c3e810166
>>> ACPI: Check MSR valid bit before using P-state frequencies
>>>
>>> The issue is that "some AMD systems may round the frequencies in
>>> ACPI tables to 100MHz boundaries. We canobtain the real
>>> frequencies from MSRs, so add a quirk to fix these frequencies up
>>> on AMD systems." (from f594065..)
>>>
>>> In discussion (around 9855d8..) "it turned out that indeed real
>>> HW/BIOSes may choose to not set the valid bit and thus mark the
>>> P-state as invalid. So this could be considered a fix for broken
>>> BIOSes that also works around the issue on Xen." (from 9855d8..)
>>>
>>> I've tested it under Dell Inc. PowerEdge T105 /0RR825, BIOS 1.3.2
>>> 08/20/2008 where this quirk can indeed be observed.
>>>
>>> CC: stefan.bader@canonical.com
>>> CC: bp@suse.de
>>> CC: borislav.ostrovsky@oracle.com
>> boris.ostrovsky@oracle.com
> Whoops!
>
> Here is an updated version:
>
> From 3b7584f0c3c91d073bd760a038d0091b3bf5a19b Mon Sep 17 00:00:00 2001
> From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Date: Tue, 5 Mar 2013 14:40:52 -0500
> Subject: [PATCH] ACPI: Add fixups for AMD P-state figures.
>
> This a copy-n-paste from two Linux git commits:
>
> - f594065faf4f9067c2283a34619fc0714e79a98d
> ACPI: Add fixups for AMD P-state figures
> - 9855d8ce41a7801548a05d844db2f46c3e810166
> ACPI: Check MSR valid bit before using P-state frequencies
>
> The issue is that "some AMD systems may round the frequencies in
> ACPI tables to 100MHz boundaries. We canobtain the real
> frequencies from MSRs, so add a quirk to fix these frequencies up
> on AMD systems." (from f594065..)
>
> In discussion (around 9855d8..) "it turned out that indeed real
> HW/BIOSes may choose to not set the valid bit and thus mark the
> P-state as invalid. So this could be considered a fix for broken
> BIOSes that also works around the issue on Xen." (from 9855d8..)
>
> I've tested it under Dell Inc. PowerEdge T105 /0RR825, BIOS 1.3.2
> 08/20/2008 where this quirk can indeed be observed.
>
> CC: stefan.bader@canonical.com
> CC: bp@suse.de
> CC: boris.ostrovsky@oracle.com
> [v1: Indent, #define, and email changes per Boris's review]
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> xen/arch/x86/acpi/cpufreq/powernow.c | 38 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 38 insertions(+)
>
> diff --git a/xen/arch/x86/acpi/cpufreq/powernow.c b/xen/arch/x86/acpi/cpufreq/powernow.c
> index a9b7792..5037c30 100644
> --- a/xen/arch/x86/acpi/cpufreq/powernow.c
> +++ b/xen/arch/x86/acpi/cpufreq/powernow.c
> @@ -147,6 +147,42 @@ static int powernow_cpufreq_target(struct cpufreq_policy *policy,
> return 0;
> }
>
> +static void amd_fixup_frequency(struct xen_processor_px *px)
> +{
> + 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(MSR_PSTATE_DEF_BASE + index, lo, hi);
> + /*
> + * MSR C001_0064+:
> + * Bit 63: PstateEn. Read-write. If set, the P-state is valid.
> + */
> + if (!(hi & (1UL << 31)))
> + return;
> +
> + 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;
> + }
> +}
There is still something wrong with indentation, I think it's tabs vs.
spaces. Everything
inside if clause (except rdmsr) is indented by spaces but the rest uses
tabs.
-boris
next prev parent reply other threads:[~2013-03-05 22:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-05 19:45 [PATCH] ACPI: Add fixups for AMD P-state figures Konrad Rzeszutek Wilk
2013-03-05 20:22 ` Boris Ostrovsky
2013-03-05 21:33 ` Konrad Rzeszutek Wilk
2013-03-05 22:12 ` Boris Ostrovsky [this message]
2013-03-06 9:05 ` Jan Beulich
2013-03-06 10:30 ` Borislav Petkov
2013-03-06 15:53 ` Konrad Rzeszutek Wilk
2013-03-06 9:48 ` Stefan Bader
2013-03-06 15:51 ` Konrad Rzeszutek Wilk
2013-03-06 21:37 ` Konrad Rzeszutek Wilk
2013-03-07 8:45 ` Stefan Bader
2013-03-07 14:17 ` Konrad Rzeszutek Wilk
2013-03-07 14:55 ` Stefan Bader
-- strict thread matches above, loose matches on Subject: below --
2013-03-07 18:49 Konrad Rzeszutek Wilk
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=51366DE8.50204@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=bp@suse.de \
--cc=konrad.wilk@oracle.com \
--cc=stefan.bader@canonical.com \
--cc=xen-devel@lists.xensource.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.