Skip to content

Commit d91cb39

Browse files
npigginpaulusmack
authored andcommitted
KVM: PPC: Book3S HV: Make radix use the Linux translation flush functions for partition scope
This has the advantage of consolidating TLB flush code in fewer places, and it also implements powerpc:tlbie trace events. Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent a5704e8 commit d91cb39

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed

arch/powerpc/kvm/book3s_64_mmu_radix.c

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -139,41 +139,21 @@ int kvmppc_mmu_radix_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
139139
return 0;
140140
}
141141

142-
#ifdef CONFIG_PPC_64K_PAGES
143-
#define MMU_BASE_PSIZE MMU_PAGE_64K
144-
#else
145-
#define MMU_BASE_PSIZE MMU_PAGE_4K
146-
#endif
147-
148142
static void kvmppc_radix_tlbie_page(struct kvm *kvm, unsigned long addr,
149143
unsigned int pshift)
150144
{
151-
int psize = MMU_BASE_PSIZE;
152-
153-
if (pshift >= PUD_SHIFT)
154-
psize = MMU_PAGE_1G;
155-
else if (pshift >= PMD_SHIFT)
156-
psize = MMU_PAGE_2M;
157-
addr &= ~0xfffUL;
158-
addr |= mmu_psize_defs[psize].ap << 5;
159-
asm volatile("ptesync": : :"memory");
160-
asm volatile(PPC_TLBIE_5(%0, %1, 0, 0, 1)
161-
: : "r" (addr), "r" (kvm->arch.lpid) : "memory");
162-
if (cpu_has_feature(CPU_FTR_P9_TLBIE_BUG))
163-
asm volatile(PPC_TLBIE_5(%0, %1, 0, 0, 1)
164-
: : "r" (addr), "r" (kvm->arch.lpid) : "memory");
165-
asm volatile("eieio ; tlbsync ; ptesync": : :"memory");
145+
unsigned long psize = PAGE_SIZE;
146+
147+
if (pshift)
148+
psize = 1UL << pshift;
149+
150+
addr &= ~(psize - 1);
151+
radix__flush_tlb_lpid_page(kvm->arch.lpid, addr, psize);
166152
}
167153

168154
static void kvmppc_radix_flush_pwc(struct kvm *kvm)
169155
{
170-
unsigned long rb = 0x2 << PPC_BITLSHIFT(53); /* IS = 2 */
171-
172-
asm volatile("ptesync": : :"memory");
173-
/* RIC=1 PRS=0 R=1 IS=2 */
174-
asm volatile(PPC_TLBIE_5(%0, %1, 1, 0, 1)
175-
: : "r" (rb), "r" (kvm->arch.lpid) : "memory");
176-
asm volatile("eieio ; tlbsync ; ptesync": : :"memory");
156+
radix__flush_pwc_lpid(kvm->arch.lpid);
177157
}
178158

179159
unsigned long kvmppc_radix_update_pte(struct kvm *kvm, pte_t *ptep,

0 commit comments

Comments
 (0)