KVM: arm64: Support stolen time reporting via shared structure
authorSteven Price <steven.price@arm.com>
Mon, 21 Oct 2019 15:28:18 +0000 (16:28 +0100)
committerMarc Zyngier <maz@kernel.org>
Mon, 21 Oct 2019 18:20:28 +0000 (19:20 +0100)
commit8564d6372a7d8a6d440441b8ed8020f97f744450
tree1ec19f1184aafb3ccfe9574f760115e170b5cb16
parentcac0f1b7285eaaf9a186c618c3a7304d82ed5493
KVM: arm64: Support stolen time reporting via shared structure

Implement the service call for configuring a shared structure between a
VCPU and the hypervisor in which the hypervisor can write the time
stolen from the VCPU's execution time by other tasks on the host.

User space allocates memory which is placed at an IPA also chosen by user
space. The hypervisor then updates the shared structure using
kvm_put_guest() to ensure single copy atomicity of the 64-bit value
reporting the stolen time in nanoseconds.

Whenever stolen time is enabled by the guest, the stolen time counter is
reset.

The stolen time itself is retrieved from the sched_info structure
maintained by the Linux scheduler code. We enable SCHEDSTATS when
selecting KVM Kconfig to ensure this value is meaningful.

Signed-off-by: Steven Price <steven.price@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm/include/asm/kvm_host.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/Kconfig
include/linux/kvm_types.h
virt/kvm/arm/arm.c
virt/kvm/arm/hypercalls.c
virt/kvm/arm/pvtime.c