KVM: PPC: Book3S HV nestedv2: Add support for reading VPA counters for pseries guests
authorGautam Menghani <gautam@linux.ibm.com>
Mon, 20 May 2024 17:57:40 +0000 (23:27 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 3 Jun 2024 12:06:28 +0000 (22:06 +1000)
commite1f288d2f9c69bb8965db9fb99a19b58231a00dd
tree5c212f2d8bbb47f2cc5ef9c768dadc0d941b09b3
parentc3f38fa61af77b49866b006939479069cd451173
KVM: PPC: Book3S HV nestedv2: Add support for reading VPA counters for pseries guests

PAPR hypervisor has introduced three new counters in the VPA area of
LPAR CPUs for KVM L2 guest (see [1] for terminology) observability - two
for context switches from host to guest and vice versa, and one counter
for getting the total time spent inside the KVM guest. Add a tracepoint
that enables reading the counters for use by ftrace/perf. Note that this
tracepoint is only available for nestedv2 API (i.e, KVM on PowerVM).

[1] Terminology:
a. L1 refers to the VM (LPAR) booted on top of PAPR hypervisor
b. L2 refers to the KVM guest booted on top of L1.

Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Acked-by: Naveen N Rao <naveen@kernel.org>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Gautam Menghani <gautam@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240520175742.196329-1-gautam@linux.ibm.com
arch/powerpc/include/asm/kvm_book3s_64.h
arch/powerpc/include/asm/lppaca.h
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/trace_hv.h