diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2015-03-20 05:39:43 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2015-04-21 09:21:29 -0400 |
commit | a4bd6eb07ca72d21a7a34499ad34cfef6f527d4e (patch) | |
tree | bba74c5424652cc64edb0911da97a670212c418d /arch/powerpc/include | |
parent | 31037ecad275e9ad9bc671c34f72b495cf708ca3 (diff) |
KVM: PPC: Book3S HV: Add helpers for lock/unlock hpte
This adds helper routines for locking and unlocking HPTEs, and uses
them in the rest of the code. We don't change any locking rules in
this patch.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r-- | arch/powerpc/include/asm/kvm_book3s_64.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index 2d81e202bdcc..0789a0f50969 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h | |||
@@ -85,6 +85,20 @@ static inline long try_lock_hpte(__be64 *hpte, unsigned long bits) | |||
85 | return old == 0; | 85 | return old == 0; |
86 | } | 86 | } |
87 | 87 | ||
88 | static inline void unlock_hpte(__be64 *hpte, unsigned long hpte_v) | ||
89 | { | ||
90 | hpte_v &= ~HPTE_V_HVLOCK; | ||
91 | asm volatile(PPC_RELEASE_BARRIER "" : : : "memory"); | ||
92 | hpte[0] = cpu_to_be64(hpte_v); | ||
93 | } | ||
94 | |||
95 | /* Without barrier */ | ||
96 | static inline void __unlock_hpte(__be64 *hpte, unsigned long hpte_v) | ||
97 | { | ||
98 | hpte_v &= ~HPTE_V_HVLOCK; | ||
99 | hpte[0] = cpu_to_be64(hpte_v); | ||
100 | } | ||
101 | |||
88 | static inline int __hpte_actual_psize(unsigned int lp, int psize) | 102 | static inline int __hpte_actual_psize(unsigned int lp, int psize) |
89 | { | 103 | { |
90 | int i, shift; | 104 | int i, shift; |