KVM: PPC: Book3S HV P9: Factor PMU save/load into context switch functions
authorNicholas Piggin <npiggin@gmail.com>
Tue, 23 Nov 2021 09:51:52 +0000 (19:51 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 24 Nov 2021 10:08:58 +0000 (21:08 +1100)
commit401e1ae372673664465d45a86975c006dc6a488d
tree5fea6b042b9c9a5328ea8941a02729a1c7b70b8e
parent57dc0eed73caa31bfe36ce8fed234e214e37a5ae
KVM: PPC: Book3S HV P9: Factor PMU save/load into context switch functions

Rather than guest/host save/retsore functions, implement context switch
functions that take care of details like the VPA update for nested.

The reason to split these kind of helpers into explicit save/load
functions is mainly to schedule SPR access nicely, but PMU is a special
case where the load requires mtSPR (to stop counters) and other
difficulties, so there's less possibility to schedule those nicely. The
SPR accesses also have side-effects if the PMU is running, and in later
changes we keep the host PMU running as long as possible so this code
can be better profiled, which also complicates scheduling.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211123095231.1036501-15-npiggin@gmail.com
arch/powerpc/kvm/book3s_hv.c