summaryrefslogtreecommitdiffstats
path: root/virt/kvm/arm/hypercalls.c
diff options
context:
space:
mode:
authorSteven Price <steven.price@arm.com>2019-10-21 16:28:18 +0100
committerMarc Zyngier <maz@kernel.org>2019-10-21 19:20:28 +0100
commit8564d6372a7d8a6d440441b8ed8020f97f744450 (patch)
tree1ec19f1184aafb3ccfe9574f760115e170b5cb16 /virt/kvm/arm/hypercalls.c
parentcac0f1b7285eaaf9a186c618c3a7304d82ed5493 (diff)
downloadlinux-8564d6372a7d8a6d440441b8ed8020f97f744450.tar.gz
linux-8564d6372a7d8a6d440441b8ed8020f97f744450.tar.bz2
linux-8564d6372a7d8a6d440441b8ed8020f97f744450.zip
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>
Diffstat (limited to 'virt/kvm/arm/hypercalls.c')
-rw-r--r--virt/kvm/arm/hypercalls.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/virt/kvm/arm/hypercalls.c b/virt/kvm/arm/hypercalls.c
index 97ea8b133e77..550dfa3e53cd 100644
--- a/virt/kvm/arm/hypercalls.c
+++ b/virt/kvm/arm/hypercalls.c
@@ -14,6 +14,7 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)
u32 func_id = smccc_get_function(vcpu);
long val = SMCCC_RET_NOT_SUPPORTED;
u32 feature;
+ gpa_t gpa;
switch (func_id) {
case ARM_SMCCC_VERSION_FUNC_ID:
@@ -56,6 +57,11 @@ int kvm_hvc_call_handler(struct kvm_vcpu *vcpu)
case ARM_SMCCC_HV_PV_TIME_FEATURES:
val = kvm_hypercall_pv_features(vcpu);
break;
+ case ARM_SMCCC_HV_PV_TIME_ST:
+ gpa = kvm_init_stolen_time(vcpu);
+ if (gpa != GPA_INVALID)
+ val = gpa;
+ break;
default:
return kvm_psci_call(vcpu);
}