From: Jeremy Fitzhardinge <jeremy@goop.org>
Date: Wed, 30 Jan 2008 12:33:15 +0000 (+0100)
Subject: x86/paravirt: common implementation for pgd value ops
X-Git-Tag: firefly_0821_release~23636^2~272
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ef38503e034f82ad16a75a9dfea40ed7adaf00a8;p=firefly-linux-kernel-4.4.55.git

x86/paravirt: common implementation for pgd value ops

Remove duplicate __pgd/pgd_val functions.

Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---

diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index b7342efab834..eac25b5323a2 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -950,16 +950,38 @@ static inline pteval_t pte_val(pte_t pte)
 	return ret;
 }
 
-#ifdef CONFIG_X86_PAE
-static inline pmd_t __pmd(unsigned long long val)
+static inline pgd_t __pgd(pgdval_t val)
 {
-	return (pmd_t) { PVOP_CALL2(unsigned long long, pv_mmu_ops.make_pmd,
-				    val, val >> 32) };
+	pgdval_t ret;
+
+	if (sizeof(pgdval_t) > sizeof(long))
+		ret = PVOP_CALL2(pgdval_t, pv_mmu_ops.make_pgd,
+				 val, (u64)val >> 32);
+	else
+		ret = PVOP_CALL1(pgdval_t, pv_mmu_ops.make_pgd,
+				 val);
+
+	return (pgd_t) { ret };
+}
+
+static inline pgdval_t pgd_val(pgd_t pgd)
+{
+	pgdval_t ret;
+
+	if (sizeof(pgdval_t) > sizeof(long))
+		ret =  PVOP_CALL2(pgdval_t, pv_mmu_ops.pgd_val,
+				  pgd.pgd, (u64)pgd.pgd >> 32);
+	else
+		ret =  PVOP_CALL1(pgdval_t, pv_mmu_ops.pgd_val,
+				  pgd.pgd);
+
+	return ret;
 }
 
-static inline pgd_t __pgd(unsigned long long val)
+#ifdef CONFIG_X86_PAE
+static inline pmd_t __pmd(unsigned long long val)
 {
-	return (pgd_t) { PVOP_CALL2(unsigned long long, pv_mmu_ops.make_pgd,
+	return (pmd_t) { PVOP_CALL2(unsigned long long, pv_mmu_ops.make_pmd,
 				    val, val >> 32) };
 }
 
@@ -969,12 +991,6 @@ static inline unsigned long long pmd_val(pmd_t x)
 			  x.pmd, x.pmd >> 32);
 }
 
-static inline unsigned long long pgd_val(pgd_t x)
-{
-	return PVOP_CALL2(unsigned long long, pv_mmu_ops.pgd_val,
-			  x.pgd, x.pgd >> 32);
-}
-
 static inline void set_pte(pte_t *ptep, pte_t pteval)
 {
 	PVOP_VCALL3(pv_mmu_ops.set_pte, ptep, pteval.pte_low, pteval.pte_high);
@@ -1024,16 +1040,6 @@ static inline void pmd_clear(pmd_t *pmdp)
 
 #else  /* !CONFIG_X86_PAE */
 
-static inline pgd_t __pgd(unsigned long val)
-{
-	return (pgd_t) { PVOP_CALL1(unsigned long, pv_mmu_ops.make_pgd, val) };
-}
-
-static inline unsigned long pgd_val(pgd_t x)
-{
-	return PVOP_CALL1(unsigned long, pv_mmu_ops.pgd_val, x.pgd);
-}
-
 static inline void set_pte(pte_t *ptep, pte_t pteval)
 {
 	PVOP_VCALL2(pv_mmu_ops.set_pte, ptep, pteval.pte_low);