summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/time.c
diff options
context:
space:
mode:
authorSteven Price <steven.price@arm.com>2019-10-21 16:28:23 +0100
committerMarc Zyngier <maz@kernel.org>2019-10-21 19:20:31 +0100
commite0685fa228fdaf386f82ac0d64b2d6f3e0ddd588 (patch)
tree82a0c4c7b00b1ba16518c7be5dbf58640e154f28 /arch/arm64/kernel/time.c
parentce4d5ca2b9dd5d85944eb93c1bbf9eb11b7a907d (diff)
downloadlinux-e0685fa228fdaf386f82ac0d64b2d6f3e0ddd588.tar.gz
linux-e0685fa228fdaf386f82ac0d64b2d6f3e0ddd588.tar.bz2
linux-e0685fa228fdaf386f82ac0d64b2d6f3e0ddd588.zip
arm64: Retrieve stolen time as paravirtualized guest
Enable paravirtualization features when running under a hypervisor supporting the PV_TIME_ST hypercall. For each (v)CPU, we ask the hypervisor for the location of a shared page which the hypervisor will use to report stolen time to us. We set pv_time_ops to the stolen time function which simply reads the stolen value from the shared page for a VCPU. We guarantee single-copy atomicity using READ_ONCE which means we can also read the stolen time for another VCPU than the currently running one while it is potentially being updated by the hypervisor. Signed-off-by: Steven Price <steven.price@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'arch/arm64/kernel/time.c')
-rw-r--r--arch/arm64/kernel/time.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c
index 0b2946414dc9..73f06d4b3aae 100644
--- a/arch/arm64/kernel/time.c
+++ b/arch/arm64/kernel/time.c
@@ -30,6 +30,7 @@
#include <asm/thread_info.h>
#include <asm/stacktrace.h>
+#include <asm/paravirt.h>
unsigned long profile_pc(struct pt_regs *regs)
{
@@ -65,4 +66,6 @@ void __init time_init(void)
/* Calibrate the delay loop directly */
lpj_fine = arch_timer_rate / HZ;
+
+ pv_time_init();
}