20 #ifndef __ASM_KVM_BOOK3S_64_H__
21 #define __ASM_KVM_BOOK3S_64_H__
23 #ifdef CONFIG_KVM_BOOK3S_PR
27 return &get_paca()->shadow_vcpu;
36 #define SPAPR_TCE_SHIFT 12
38 #ifdef CONFIG_KVM_BOOK3S_64_HV
39 #define KVM_DEFAULT_HPT_ORDER 24
43 #define VRMA_VSID 0x1ffffffUL
50 #define HPTE_V_HVLOCK 0x40UL
51 #define HPTE_V_ABSENT 0x20UL
53 static inline long try_lock_hpte(
unsigned long *hpte,
unsigned long bits)
55 unsigned long tmp, old;
57 asm volatile(
" ldarx %0,0,%2\n"
65 :
"=&r" (
tmp),
"=&r" (old)
71 static inline unsigned long compute_tlbie_rb(
unsigned long v,
unsigned long r,
74 unsigned long rb, va_low;
76 rb = (v & ~0x7f
UL) << 16;
77 va_low = pte_index >> 3;
93 rb |= (va_low & 0x7f) << 16;
94 rb |= (va_low & 0xfe);
98 rb |= (va_low & 0x7ff) << 12;
100 rb |= (v >> 54) & 0x300;
104 static inline unsigned long hpte_page_size(
unsigned long h,
unsigned long l)
107 if (!(h & HPTE_V_LARGE))
111 if ((l & 0xff000) == 0)
116 static inline unsigned long hpte_rpn(
unsigned long ptel,
unsigned long psize)
121 static inline int hpte_is_writable(
unsigned long ptel)
128 static inline unsigned long hpte_make_readonly(
unsigned long ptel)
131 ptel = (ptel & ~HPTE_R_PP) |
PP_RXXX;
137 static inline int hpte_cache_flags_ok(
unsigned long ptel,
unsigned long io_type)
156 static inline pte_t kvmppc_read_update_linux_pte(
pte_t *
p,
int writing)
168 :
"=&r" (pte),
"=&r" (tmp),
"=m" (*p)
169 :
"r" (p),
"i" (_PAGE_BUSY)
184 static inline unsigned long hpte_cache_bits(
unsigned long pte_val)
186 #if _PAGE_NO_CACHE == HPTE_R_I && _PAGE_WRITETHRU == HPTE_R_W
194 static inline bool hpte_read_permission(
unsigned long pp,
unsigned long key)
201 static inline bool hpte_write_permission(
unsigned long pp,
unsigned long key)
208 static inline int hpte_get_skey_perm(
unsigned long hpte_r,
unsigned long amr)
214 return (amr >> (62 - 2 * skey)) & 3;
217 static inline void lock_rmap(
unsigned long *rmap)
225 static inline void unlock_rmap(
unsigned long *rmap)
231 unsigned long pagesize)