]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: PPC: Book3S HV: Set RWMR on POWER8 so PURR/SPURR count correctly
authorPaul Mackerras <paulus@ozlabs.org>
Fri, 20 Apr 2018 09:53:22 +0000 (19:53 +1000)
committerPaul Mackerras <paulus@ozlabs.org>
Thu, 17 May 2018 06:36:48 +0000 (16:36 +1000)
commitcd7e73f1257b83647d939578ceb03c14afc70b25
tree29cb16d194b0f3e3003054901ee850a644ae5735
parent3b54991ae44c14a3f773a7df3254e65d087cf153
KVM: PPC: Book3S HV: Set RWMR on POWER8 so PURR/SPURR count correctly

Although Linux doesn't use PURR and SPURR ((Scaled) Processor
Utilization of Resources Register), other OSes depend on them.
On POWER8 they count at a rate depending on whether the VCPU is
idle or running, the activity of the VCPU, and the value in the
RWMR (Region-Weighting Mode Register).  Hardware expects the
hypervisor to update the RWMR when a core is dispatched to reflect
the number of online VCPUs in the vcore.

This adds code to maintain a count in the vcore struct indicating
how many VCPUs are online.  In kvmppc_run_core we use that count
to set the RWMR register on POWER8.  If the core is split because
of a static or dynamic micro-threading mode, we use the value for
8 threads.  The RWMR value is not relevant when the host is
executing because Linux does not use the PURR or SPURR register,
so we don't bother saving and restoring the host value.

For the sake of old userspace which does not set the KVM_REG_PPC_ONLINE
register, we set online to 1 if it was 0 at the time of a KVM_RUN
ioctl.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/include/asm/kvm_book3s.h
arch/powerpc/include/asm/reg.h
arch/powerpc/kvm/book3s_hv.c