From: Glauber de Oliveira Costa <gcosta@redhat.com>
Date: Wed, 30 Jan 2008 12:31:27 +0000 (+0100)
Subject: x86: move load_cr3 to a common place.
X-Git-Tag: firefly_0821_release~23636^2~545
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c72dcf83ff8585c95739abffa3be7c87ca63d66b;p=firefly-linux-kernel-4.4.55.git

x86: move load_cr3 to a common place.

There are currently two definitions of load_cr3, that essentially do the
same thing. This patch moves them all to processor.h.

Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---

diff --git a/include/asm-x86/mmu_context_64.h b/include/asm-x86/mmu_context_64.h
index 98bfe43dd806..7e2aa23fccbf 100644
--- a/include/asm-x86/mmu_context_64.h
+++ b/include/asm-x86/mmu_context_64.h
@@ -23,11 +23,6 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 #endif
 }
 
-static inline void load_cr3(pgd_t *pgd)
-{
-	asm volatile("movq %0,%%cr3" :: "r" (__pa(pgd)) : "memory");
-}
-
 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 
 			     struct task_struct *tsk)
 {
diff --git a/include/asm-x86/processor.h b/include/asm-x86/processor.h
index e8dd394c9f46..36ee9881b74f 100644
--- a/include/asm-x86/processor.h
+++ b/include/asm-x86/processor.h
@@ -3,6 +3,9 @@
 
 #include <asm/processor-flags.h>
 
+#include <asm/page.h>
+#include <asm/system.h>
+
 static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
 					 unsigned int *ecx, unsigned int *edx)
 {
@@ -15,6 +18,10 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
 		: "0" (*eax), "2" (*ecx));
 }
 
+static inline void load_cr3(pgd_t *pgdir)
+{
+	write_cr3(__pa(pgdir));
+}
 
 #ifdef CONFIG_X86_32
 # include "processor_32.h"
diff --git a/include/asm-x86/processor_32.h b/include/asm-x86/processor_32.h
index cadeffb54a72..b586902acd85 100644
--- a/include/asm-x86/processor_32.h
+++ b/include/asm-x86/processor_32.h
@@ -120,7 +120,6 @@ extern void detect_ht(struct cpuinfo_x86 *c);
 static inline void detect_ht(struct cpuinfo_x86 *c) {}
 #endif
 
-#define load_cr3(pgdir) write_cr3(__pa(pgdir))
 
 /*
  * Save the cr4 feature set we're using (ie