From: Len Brown <lenb@kernel.org>
To: Zhao Yakui <yakui.zhao@intel.com>
Cc: linux-acpi@vger.kernel.org, venkatesh.pallipadi@intel.com
Subject: Re: [PATCH] : ACPI : Add the MWAIT C-state mask to avoid overflow
Date: Fri, 09 Jan 2009 01:28:12 -0500 (EST) [thread overview]
Message-ID: <alpine.LFD.2.00.0901090128070.4091@localhost.localdomain> (raw)
In-Reply-To: <1231041861.3967.3.camel@yakui_zhao.sh.intel.com>
applied.
--
Len Brown, Intel Open Source Technology Center
On Sun, 4 Jan 2009, Zhao Yakui wrote:
> Subject: ACPI: Add the MWAIT C-state mask to avoid overflow
> From: Zhao Yakui <yakui.zhao@intel.com>
>
> The Cx Register address obtained from the _CST object is used as the mait
> hints if the register type is FFixedHW. And it is used to check whether
> the Cx type is supported or not.
>
> On some boxes the following Cx state package is obtained from _CST object:
> >{
> ResourceTemplate ()
> {
> Register (FFixedHW,
> 0x01, // Bit Width
> 0x02, // Bit Offset
> 0x0000000000889759, // Address
> 0x03, // Access Size
> )
> },
>
> 0x03,
> 0xF5,
> 0x015E }
> In such case we should use the bit[7:4] of Cx address to check whether
> the Cx type is supported or not.
>
> Add the MWAIT C-state mask to avoid overflow
>
> Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
> Acked-by:Venki Pallipadi <venkatesh.pallipadi@intel.com>
> ---
> arch/x86/kernel/acpi/cstate.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> Index: linux-2.6/arch/x86/kernel/acpi/cstate.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/acpi/cstate.c
> +++ linux-2.6/arch/x86/kernel/acpi/cstate.c
> @@ -56,6 +56,7 @@ static struct cstate_entry *cpu_cstate_e
> static short mwait_supported[ACPI_PROCESSOR_MAX_POWER];
>
> #define MWAIT_SUBSTATE_MASK (0xf)
> +#define MWAIT_CSTATE_MASK (0xf)
> #define MWAIT_SUBSTATE_SIZE (4)
>
> #define CPUID_MWAIT_LEAF (5)
> @@ -98,7 +99,8 @@ int acpi_processor_ffh_cstate_probe(unsi
> cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
>
> /* Check whether this particular cx_type (in CST) is supported or not */
> - cstate_type = (cx->address >> MWAIT_SUBSTATE_SIZE) + 1;
> + cstate_type = ((cx->address >> MWAIT_SUBSTATE_SIZE) &
> + MWAIT_CSTATE_MASK) + 1;
> edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE);
> num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK;
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> Subject: ACPI: Add the MWAIT C-state mask to avoid overflow
> From: Zhao Yakui <yakui.zhao@intel.com>
>
> The Cx Register address obtained from the _CST object is used as the mait
> hints if the register type is FFixedHW. And it is used to check whether
> the Cx type is supported or not.
>
> On some boxes the following Cx state package is obtained from _CST object:
> >{
> ResourceTemplate ()
> {
> Register (FFixedHW,
> 0x01, // Bit Width
> 0x02, // Bit Offset
> 0x0000000000889759, // Address
> 0x03, // Access Size
> )
> },
>
> 0x03,
> 0xF5,
> 0x015E }
> In such case we should use the bit[7:4] of Cx address to check whether
> the Cx type is supported or not.
>
> Add the MWAIT C-state mask to avoid overflow
>
> Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
> Acked-by:Venki Pallipadi <venkatesh.pallipadi@intel.com>
> ---
> arch/x86/kernel/acpi/cstate.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> Index: linux-2.6/arch/x86/kernel/acpi/cstate.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/acpi/cstate.c
> +++ linux-2.6/arch/x86/kernel/acpi/cstate.c
> @@ -56,6 +56,7 @@ static struct cstate_entry *cpu_cstate_e
> static short mwait_supported[ACPI_PROCESSOR_MAX_POWER];
>
> #define MWAIT_SUBSTATE_MASK (0xf)
> +#define MWAIT_CSTATE_MASK (0xf)
> #define MWAIT_SUBSTATE_SIZE (4)
>
> #define CPUID_MWAIT_LEAF (5)
> @@ -98,7 +99,8 @@ int acpi_processor_ffh_cstate_probe(unsi
> cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
>
> /* Check whether this particular cx_type (in CST) is supported or not */
> - cstate_type = (cx->address >> MWAIT_SUBSTATE_SIZE) + 1;
> + cstate_type = ((cx->address >> MWAIT_SUBSTATE_SIZE) &
> + MWAIT_CSTATE_MASK) + 1;
> edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE);
> num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK;
>
>
>
next prev parent reply other threads:[~2009-01-09 6:28 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-31 18:42 [PATCH] ACPI: EC: clean up tmp variable before reuse Alexey Starikovskiy
2008-11-03 8:02 ` Zhao Yakui
2008-11-03 8:24 ` [PATCH]: ACPI: Initialize EC global lock based on the return value of _GLK Zhao Yakui
2008-11-04 7:41 ` [PATCH]: ACPI Cleanup :Initialize EC global lock based on the return status Zhao Yakui
2008-11-04 8:05 ` Alexey Starikovskiy
2008-11-04 8:58 ` Rafael J. Wysocki
2008-11-04 9:21 ` Alexey Starikovskiy
2008-11-04 9:37 ` Zhao Yakui
2008-11-04 9:38 ` Alexey Starikovskiy
2008-11-05 1:05 ` Zhao Yakui
2008-11-05 7:24 ` Alexey Starikovskiy
2008-12-17 8:55 ` [PATCH] : ACPI : Use RSDT instead of XSDT by adding boot option of "acpi=rsdt" Zhao Yakui
2009-01-09 6:35 ` Len Brown
2009-01-09 10:54 ` Thomas Renninger
2009-01-09 10:59 ` Len Brown
2009-01-09 12:16 ` Thomas Renninger
2009-01-09 12:34 ` Matthew Garrett
2009-01-12 14:13 ` Thomas Renninger
2009-01-12 14:16 ` Matthew Garrett
2009-01-12 22:17 ` Thomas Renninger
2009-01-12 23:38 ` Matthew Garrett
2009-01-09 10:58 ` Blacklist known broken machines to use the rsdt and enabled Cstates on R40e Thomas Renninger
2009-01-09 10:58 ` [PATCH 1/2] Blacklist known broken machines (ThinkPad R40e and R50e) to use rsdt instead xsdt Thomas Renninger
2009-01-09 10:58 ` [PATCH 2/2] R40e using rsdt (previous patch) makes all Cstates work -> remove blacklisting Thomas Renninger
2008-12-30 4:01 ` [PATCH] : ACPI : Add the MWAIT C-state mask to avoid overflow Zhao Yakui
2009-01-04 4:04 ` Zhao Yakui
2009-01-09 6:28 ` Len Brown [this message]
2009-01-12 7:07 ` [PATCH] : ACPI : Use clocksource to get the C-state time instead of ACPI PM timer Zhao Yakui
2009-01-12 7:58 ` Rafael J. Wysocki
2009-01-12 9:31 ` Zhao Yakui
2009-01-12 12:27 ` Rafael J. Wysocki
2009-01-12 9:39 ` Zhao Yakui
2009-01-12 22:09 ` Pallipadi, Venkatesh
2009-01-13 1:26 ` Zhao Yakui
2009-01-13 1:42 ` Zhao Yakui
2009-01-13 3:50 ` [RESEND] " Zhao Yakui
2009-01-20 2:52 ` 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=alpine.LFD.2.00.0901090128070.4091@localhost.localdomain \
--to=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=venkatesh.pallipadi@intel.com \
--cc=yakui.zhao@intel.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