Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: PPC: Book3S HV: Don't use streamlined entry path on early POWER9 chips

This disables the use of the streamlined entry path for radix guests
on early POWER9 chips that need the workaround added in commit
a25bd72badfa ("powerpc/mm/radix: Workaround prefetch issue with KVM",
2017-07-24), because the streamlined entry path does not include
that workaround. This also means that we can't do nested HV-KVM
on those chips.

Since the chips that need that workaround are the same ones that can't
run both radix and HPT guests at the same time on different threads of
a core, we use the existing 'no_mixing_hpt_and_radix' variable that
identifies those chips to identify when we can't use the new guest
entry path, and when we can't do nested virtualization.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

+11 -2
+11 -2
arch/powerpc/kvm/book3s_hv.c
··· 4174 4174 vcpu->arch.state = KVMPPC_VCPU_BUSY_IN_HOST; 4175 4175 4176 4176 do { 4177 - if (kvm->arch.threads_indep && kvm_is_radix(kvm)) 4177 + /* 4178 + * The early POWER9 chips that can't mix radix and HPT threads 4179 + * on the same core also need the workaround for the problem 4180 + * where the TLB would prefetch entries in the guest exit path 4181 + * for radix guests using the guest PIDR value and LPID 0. 4182 + * The workaround is in the old path (kvmppc_run_vcpu()) 4183 + * but not the new path (kvmhv_run_single_vcpu()). 4184 + */ 4185 + if (kvm->arch.threads_indep && kvm_is_radix(kvm) && 4186 + !no_mixing_hpt_and_radix) 4178 4187 r = kvmhv_run_single_vcpu(run, vcpu, ~(u64)0, 4179 4188 vcpu->arch.vcore->lpcr); 4180 4189 else ··· 5205 5196 { 5206 5197 if (!nested) 5207 5198 return -EPERM; 5208 - if (!cpu_has_feature(CPU_FTR_ARCH_300)) 5199 + if (!cpu_has_feature(CPU_FTR_ARCH_300) || no_mixing_hpt_and_radix) 5209 5200 return -ENODEV; 5210 5201 5211 5202 /* kvm == NULL means the caller is testing if the capability exists */