The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Matthew Garrett <mjg@redhat.com>
Cc: linux-kernel@vger.kernel.org, borislav.petkov@amd.com,
	davej@redhat.com, mark.langsdorf@amd.com,
	cpufreq@vger.kernel.org, andreas.herrmann3@amd.com
Subject: Re: [PATCH V2 4/6] ACPI: Add fixups for AMD P-state figures
Date: Sat, 18 Jun 2011 13:28:25 +0200	[thread overview]
Message-ID: <20110618112825.GC7445@liondog.tnic> (raw)
In-Reply-To: <1308340257-10117-4-git-send-email-mjg@redhat.com>

On Fri, Jun 17, 2011 at 03:50:55PM -0400, Matthew Garrett wrote:
> 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 85b3237..9e18173 100644
> --- a/drivers/acpi/processor_perflib.c
> +++ b/drivers/acpi/processor_perflib.c
> @@ -302,6 +302,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);

		      MSR_PSTATE_DEF_BASE

> +		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;
> @@ -356,6 +384,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.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Regards/Gruss,
    Boris.

  reply	other threads:[~2011-06-18 11:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-17 19:50 [PATCH V2 1/6] x86: Add AMD HW_PSTATE cpu feature bit and MSRs Matthew Garrett
2011-06-17 19:50 ` [PATCH V2 2/6] acpi-cpufreq: Add support for modern AMD CPUs Matthew Garrett
2011-06-17 19:50 ` [PATCH V2 3/6] acpi-cpufreq: Add support for disabling dynamic overclocking Matthew Garrett
2011-06-18 11:28   ` Borislav Petkov
2011-06-17 19:50 ` [PATCH V2 4/6] ACPI: Add fixups for AMD P-state figures Matthew Garrett
2011-06-18 11:28   ` Borislav Petkov [this message]
2011-06-17 19:50 ` [PATCH V2 5/6] cpufreq: Add compatibility hack to powernow-k8 Matthew Garrett
2011-06-18 11:28   ` Borislav Petkov
2011-06-17 19:50 ` [PATCH V2 6/6] cpufreq: Remove support for hardware P-state chips from powernow-k8 Matthew Garrett
2011-06-18 11:25 ` [PATCH V2 1/6] x86: Add AMD HW_PSTATE cpu feature bit and MSRs Borislav Petkov

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=20110618112825.GC7445@liondog.tnic \
    --to=bp@alien8.de \
    --cc=andreas.herrmann3@amd.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 \
    --cc=mjg@redhat.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