aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/paravirt.h
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-01-30 07:33:15 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:33:15 -0500
commit4eed80cd7a1668df6ddd884f9474beccc81ef3f7 (patch)
tree05637cccefe3f76cf116f9bae3e9255458e7c07f /include/asm-x86/paravirt.h
parenta632da2fc9c1e4e8021c5665fc34201fea485dcf (diff)
x86/paravirt: make set_pte operations common
Remove duplicate set_pte* operations. PAE still needs to have special variants of some of these because it can't atomically update a 64-bit pte, so there's still some duplication. Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/paravirt.h')
-rw-r--r--include/asm-x86/paravirt.h116
1 files changed, 60 insertions, 56 deletions
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index 3593211e345b..ba1b94334144 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -978,6 +978,66 @@ static inline pgdval_t pgd_val(pgd_t pgd)
978 return ret; 978 return ret;
979} 979}
980 980
981static inline void set_pte(pte_t *ptep, pte_t pte)
982{
983 if (sizeof(pteval_t) > sizeof(long))
984 PVOP_VCALL3(pv_mmu_ops.set_pte, ptep,
985 pte.pte, (u64)pte.pte >> 32);
986 else
987 PVOP_VCALL2(pv_mmu_ops.set_pte, ptep,
988 pte.pte);
989}
990
991static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
992 pte_t *ptep, pte_t pte)
993{
994 if (sizeof(pteval_t) > sizeof(long))
995 /* 5 arg words */
996 pv_mmu_ops.set_pte_at(mm, addr, ptep, pte);
997 else
998 PVOP_VCALL4(pv_mmu_ops.set_pte_at, mm, addr, ptep, pte.pte);
999}
1000
1001#ifdef CONFIG_X86_PAE
1002/* Special-case pte-setting operations for PAE, which can't update a
1003 64-bit pte atomically */
1004static inline void set_pte_atomic(pte_t *ptep, pte_t pte)
1005{
1006 PVOP_VCALL3(pv_mmu_ops.set_pte_atomic, ptep,
1007 pte.pte, pte.pte >> 32);
1008}
1009
1010static inline void set_pte_present(struct mm_struct *mm, unsigned long addr,
1011 pte_t *ptep, pte_t pte)
1012{
1013 /* 5 arg words */
1014 pv_mmu_ops.set_pte_present(mm, addr, ptep, pte);
1015}
1016
1017static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
1018 pte_t *ptep)
1019{
1020 PVOP_VCALL3(pv_mmu_ops.pte_clear, mm, addr, ptep);
1021}
1022#else /* !CONFIG_X86_PAE */
1023static inline void set_pte_atomic(pte_t *ptep, pte_t pte)
1024{
1025 set_pte(ptep, pte);
1026}
1027
1028static inline void set_pte_present(struct mm_struct *mm, unsigned long addr,
1029 pte_t *ptep, pte_t pte)
1030{
1031 set_pte(ptep, pte);
1032}
1033
1034static inline void pte_clear(struct mm_struct *mm, unsigned long addr,
1035 pte_t *ptep)
1036{
1037 set_pte_at(mm, addr, ptep, __pte(0));
1038}
1039#endif /* CONFIG_X86_PAE */
1040
981#if PAGETABLE_LEVELS >= 3 1041#if PAGETABLE_LEVELS >= 3
982static inline pmd_t __pmd(pmdval_t val) 1042static inline pmd_t __pmd(pmdval_t val)
983{ 1043{
@@ -1010,31 +1070,6 @@ static inline pmdval_t pmd_val(pmd_t pmd)
1010 1070
1011#ifdef CONFIG_X86_PAE 1071#ifdef CONFIG_X86_PAE
1012 1072
1013static inline void set_pte(pte_t *ptep, pte_t pteval)
1014{
1015 PVOP_VCALL3(pv_mmu_ops.set_pte, ptep, pteval.pte_low, pteval.pte_high);
1016}
1017
1018static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
1019 pte_t *ptep, pte_t pteval)
1020{
1021 /* 5 arg words */
1022 pv_mmu_ops.set_pte_at(mm, addr, ptep, pteval);
1023}
1024
1025static inline void set_pte_atomic(pte_t *ptep, pte_t pteval)
1026{
1027 PVOP_VCALL3(pv_mmu_ops.set_pte_atomic, ptep,
1028 pteval.pte_low, pteval.pte_high);
1029}
1030
1031static inline void set_pte_present(struct mm_struct *mm, unsigned long addr,
1032 pte_t *ptep, pte_t pte)
1033{
1034 /* 5 arg words */
1035 pv_mmu_ops.set_pte_present(mm, addr, ptep, pte);
1036}
1037
1038static inline void set_pmd(pmd_t *pmdp, pmd_t pmdval) 1073static inline void set_pmd(pmd_t *pmdp, pmd_t pmdval)
1039{ 1074{
1040 PVOP_VCALL3(pv_mmu_ops.set_pmd, pmdp, 1075 PVOP_VCALL3(pv_mmu_ops.set_pmd, pmdp,
@@ -1047,11 +1082,6 @@ static inline void set_pud(pud_t *pudp, pud_t pudval)
1047 pudval.pgd.pgd, pudval.pgd.pgd >> 32); 1082 pudval.pgd.pgd, pudval.pgd.pgd >> 32);
1048} 1083}
1049 1084
1050static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
1051{
1052 PVOP_VCALL3(pv_mmu_ops.pte_clear, mm, addr, ptep);
1053}
1054
1055static inline void pmd_clear(pmd_t *pmdp) 1085static inline void pmd_clear(pmd_t *pmdp)
1056{ 1086{
1057 PVOP_VCALL1(pv_mmu_ops.pmd_clear, pmdp); 1087 PVOP_VCALL1(pv_mmu_ops.pmd_clear, pmdp);
@@ -1059,17 +1089,6 @@ static inline void pmd_clear(pmd_t *pmdp)
1059 1089
1060#else /* !CONFIG_X86_PAE */ 1090#else /* !CONFIG_X86_PAE */
1061 1091
1062static inline void set_pte(pte_t *ptep, pte_t pteval)
1063{
1064 PVOP_VCALL2(pv_mmu_ops.set_pte, ptep, pteval.pte_low);
1065}
1066
1067static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
1068 pte_t *ptep, pte_t pteval)
1069{
1070 PVOP_VCALL4(pv_mmu_ops.set_pte_at, mm, addr, ptep, pteval.pte_low);
1071}
1072
1073static inline void set_pmd(pmd_t *pmdp, pmd_t pmdval) 1092static inline void set_pmd(pmd_t *pmdp, pmd_t pmdval)
1074{ 1093{
1075 PVOP_VCALL2(pv_mmu_ops.set_pmd, pmdp, pmdval.pud.pgd.pgd); 1094 PVOP_VCALL2(pv_mmu_ops.set_pmd, pmdp, pmdval.pud.pgd.pgd);
@@ -1080,21 +1099,6 @@ static inline void pmd_clear(pmd_t *pmdp)
1080 set_pmd(pmdp, __pmd(0)); 1099 set_pmd(pmdp, __pmd(0));
1081} 1100}
1082 1101
1083static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
1084{
1085 set_pte_at(mm, addr, ptep, __pte(0));
1086}
1087
1088static inline void set_pte_atomic(pte_t *ptep, pte_t pte)
1089{
1090 set_pte(ptep, pte);
1091}
1092
1093static inline void set_pte_present(struct mm_struct *mm, unsigned long addr,
1094 pte_t *ptep, pte_t pte)
1095{
1096 set_pte(ptep, pte);
1097}
1098#endif /* CONFIG_X86_PAE */ 1102#endif /* CONFIG_X86_PAE */
1099 1103
1100/* Lazy mode for batching updates / context switch */ 1104/* Lazy mode for batching updates / context switch */