linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: Quark: Add if/else to setup_arch for Quark TLB bug
@ 2014-09-26 17:19 Bryan O'Donoghue
  2014-09-26 17:35 ` Dave Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Bryan O'Donoghue @ 2014-09-26 17:19 UTC (permalink / raw)
  To: hpa, mingo, tglx, hmh, boon.leong.ong
  Cc: x86, linux-kernel, Bryan O'Donoghue

Quark X1000 incorrectly advertises PGE. In later the stages of boot
specifically in early_init_intel we setup_clear_cpu_cap for PGE.
At this point in time cpu_has_pge() will still be true.

Use the boot_cpu_data to decide if __flush_tlb_all() or __flush_tlb()
should be called subsequent to loading CR3

Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
---
 arch/x86/kernel/setup.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 41ead8d..8e61d5e 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -879,7 +879,20 @@ void __init setup_arch(char **cmdline_p)
 			KERNEL_PGD_PTRS);
 
 	load_cr3(swapper_pg_dir);
-	__flush_tlb_all();
+
+	/*
+	 * Flush the TLB after loading CR3
+	 *
+	 * Quark X1000 wrongly advertises PGE. Use boot_cpu_data to
+	 * to make sure the TLB is flushed correctly in the early
+	 * stage of setup_arch() for Quark X1000.
+	 * X86_FEATURE_PGE flag is only setup later stage at
+	 * early_cpu_init();
+	 */
+	if (boot_cpu_data.x86 == 5 && boot_cpu_data.x86_model == 9)
+		__flush_tlb();
+	else
+		__flush_tlb_all();
 #else
 	printk(KERN_INFO "Command line: %s\n", boot_command_line);
 #endif
-- 
1.9.1


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

* Re: [PATCH] x86: Quark: Add if/else to setup_arch for Quark TLB bug
  2014-09-26 17:19 [PATCH] x86: Quark: Add if/else to setup_arch for Quark TLB bug Bryan O'Donoghue
@ 2014-09-26 17:35 ` Dave Jones
  2014-09-26 17:40   ` Bryan O'Donoghue
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2014-09-26 17:35 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: hpa, mingo, tglx, hmh, boon.leong.ong, x86, linux-kernel

On Fri, Sep 26, 2014 at 06:19:45PM +0100, Bryan O'Donoghue wrote:
 > Quark X1000 incorrectly advertises PGE. In later the stages of boot
 > specifically in early_init_intel we setup_clear_cpu_cap for PGE.
 > At this point in time cpu_has_pge() will still be true.
 > 
 > Use the boot_cpu_data to decide if __flush_tlb_all() or __flush_tlb()
 > should be called subsequent to loading CR3
 
 > +	 * Flush the TLB after loading CR3
 > +	 *
 > +	 * Quark X1000 wrongly advertises PGE. Use boot_cpu_data to
 > +	 * to make sure the TLB is flushed correctly in the early
 > +	 * stage of setup_arch() for Quark X1000.
 > +	 * X86_FEATURE_PGE flag is only setup later stage at
 > +	 * early_cpu_init();
 > +	 */
 > +	if (boot_cpu_data.x86 == 5 && boot_cpu_data.x86_model == 9)
 > +		__flush_tlb();

This also needs a check for the cpu vendor, or this will apply
the workaround on for eg, AMD K6-III's.

	Dave
 

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

* Re: [PATCH] x86: Quark: Add if/else to setup_arch for Quark TLB bug
  2014-09-26 17:35 ` Dave Jones
@ 2014-09-26 17:40   ` Bryan O'Donoghue
  0 siblings, 0 replies; 3+ messages in thread
From: Bryan O'Donoghue @ 2014-09-26 17:40 UTC (permalink / raw)
  To: Dave Jones, hpa, mingo, tglx, hmh, boon.leong.ong, x86, linux-kernel

On 26/09/14 18:35, Dave Jones wrote:
>   > +	if (boot_cpu_data.x86 == 5 && boot_cpu_data.x86_model == 9)
>   > +		__flush_tlb();
>
> This also needs a check for the cpu vendor, or this will apply
> the workaround on for eg, AMD K6-III's.

Ah OK.

Will update.

--
BOD


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

end of thread, other threads:[~2014-09-26 17:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26 17:19 [PATCH] x86: Quark: Add if/else to setup_arch for Quark TLB bug Bryan O'Donoghue
2014-09-26 17:35 ` Dave Jones
2014-09-26 17:40   ` Bryan O'Donoghue

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).