public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86, amd: Make check_c1e_idle explicit
@ 2009-12-10 13:32 Andreas Herrmann
  2009-12-11  1:03 ` H. Peter Anvin
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Herrmann @ 2009-12-10 13:32 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel, stable


CC: stable@kernel.org
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 arch/x86/kernel/process.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index ea54ce8..1bf98b1 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -494,21 +494,19 @@ static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
 }
 
 /*
- * Check for AMD CPUs, which have potentially C1E support
+ * Check for AMD CPUs, which potentially use SMI or hardware initiated C1E
  */
 static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
 {
 	if (c->x86_vendor != X86_VENDOR_AMD)
 		return 0;
 
-	if (c->x86 < 0x0F)
-		return 0;
-
-	/* Family 0x0f models < rev F do not have C1E */
-	if (c->x86 == 0x0f && c->x86_model < 0x40)
-		return 0;
+	if ((c->x86 == 0x0F && c->x86_model >= 0x40) ||
+	    (c->x86 == 0x10) ||
+	    (c->x86 == 0x11))
+		return 1;
 
-	return 1;
+	return 0;
 }
 
 static cpumask_var_t c1e_mask;
-- 
1.6.4.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86, amd: Make check_c1e_idle explicit
  2009-12-10 13:32 [PATCH] x86, amd: Make check_c1e_idle explicit Andreas Herrmann
@ 2009-12-11  1:03 ` H. Peter Anvin
  2009-12-11 13:23   ` [PATCH v2] " Andreas Herrmann
  0 siblings, 1 reply; 3+ messages in thread
From: H. Peter Anvin @ 2009-12-11  1:03 UTC (permalink / raw)
  To: Andreas Herrmann; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel, stable

This patch needs a lot better documentation.  For one thing, it needs an
explicit patch comment!

In particular, is this a contract that fam 0x12+ will behave differently?

	-hpa

On 12/10/2009 05:32 AM, Andreas Herrmann wrote:
> 
> CC: stable@kernel.org
> Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
> ---
>  arch/x86/kernel/process.c |   14 ++++++--------
>  1 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index ea54ce8..1bf98b1 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -494,21 +494,19 @@ static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
>  }
>  
>  /*
> - * Check for AMD CPUs, which have potentially C1E support
> + * Check for AMD CPUs, which potentially use SMI or hardware initiated C1E
>   */
>  static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
>  {
>  	if (c->x86_vendor != X86_VENDOR_AMD)
>  		return 0;
>  
> -	if (c->x86 < 0x0F)
> -		return 0;
> -
> -	/* Family 0x0f models < rev F do not have C1E */
> -	if (c->x86 == 0x0f && c->x86_model < 0x40)
> -		return 0;
> +	if ((c->x86 == 0x0F && c->x86_model >= 0x40) ||
> +	    (c->x86 == 0x10) ||
> +	    (c->x86 == 0x11))
> +		return 1;
>  
> -	return 1;
> +	return 0;
>  }
>  
>  static cpumask_var_t c1e_mask;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] x86, amd: Make check_c1e_idle explicit
  2009-12-11  1:03 ` H. Peter Anvin
@ 2009-12-11 13:23   ` Andreas Herrmann
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Herrmann @ 2009-12-11 13:23 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Ingo Molnar, Thomas Gleixner, linux-kernel, stable


With current code c1e_idle() will try to access MSR 0xc0010055 for all
future AMD CPUs. But that MSR is not architectural. So it's wrong to
access the MSR unconditionally.

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 arch/x86/kernel/process.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index ea54ce8..1bf98b1 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -494,21 +494,19 @@ static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
 }
 
 /*
- * Check for AMD CPUs, which have potentially C1E support
+ * Check for AMD CPUs, which potentially use SMI or hardware initiated C1E
  */
 static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
 {
 	if (c->x86_vendor != X86_VENDOR_AMD)
 		return 0;
 
-	if (c->x86 < 0x0F)
-		return 0;
-
-	/* Family 0x0f models < rev F do not have C1E */
-	if (c->x86 == 0x0f && c->x86_model < 0x40)
-		return 0;
+	if ((c->x86 == 0x0F && c->x86_model >= 0x40) ||
+	    (c->x86 == 0x10) ||
+	    (c->x86 == 0x11))
+		return 1;
 
-	return 1;
+	return 0;
 }
 
 static cpumask_var_t c1e_mask;
-- 
1.6.4.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-12-11 13:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10 13:32 [PATCH] x86, amd: Make check_c1e_idle explicit Andreas Herrmann
2009-12-11  1:03 ` H. Peter Anvin
2009-12-11 13:23   ` [PATCH v2] " Andreas Herrmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox