summaryrefslogtreecommitdiff
path: root/arch/arm64/include/asm/timex.h
diff options
context:
space:
mode:
authorChristoffer Dall <cdall@linaro.org>2017-07-05 12:04:28 +0300
committerChristoffer Dall <christoffer.dall@linaro.org>2017-11-06 18:23:09 +0300
commite6d68b00e989f27116fd8575f1f9c217873e9b0e (patch)
treebac611b097d5e9a7b5e69aea4e2a44ab9f0521e3 /arch/arm64/include/asm/timex.h
parentf2e600c149fda3453344f89c7e9353fe278ebd32 (diff)
downloadlinux-e6d68b00e989f27116fd8575f1f9c217873e9b0e.tar.xz
arm64: Use physical counter for in-kernel reads when booted in EL2
Using the physical counter allows KVM to retain the offset between the virtual and physical counter as long as it is actively running a VCPU. As soon as a VCPU is released, another thread is scheduled or we start running userspace applications, we reset the offset to 0, so that userspace accessing the virtual timer can still read the virtual counter and get the same view of time as the kernel. This opens up potential improvements for KVM performance, but we have to make a few adjustments to preserve system consistency. Currently get_cycles() is hardwired to arch_counter_get_cntvct() on arm64, but as we move to using the physical timer for the in-kernel time-keeping on systems that boot in EL2, we should use the same counter for get_cycles() as for other in-kernel timekeeping operations. Similarly, implementations of arch_timer_set_next_event_phys() is modified to use the counter specific to the timer being programmed. VHE kernels or kernels continuing to use the virtual timer are unaffected. Cc: Will Deacon <will.deacon@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@linaro.org>
Diffstat (limited to 'arch/arm64/include/asm/timex.h')
-rw-r--r--arch/arm64/include/asm/timex.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/include/asm/timex.h b/arch/arm64/include/asm/timex.h
index 81a076eb37fa..9ad60bae5c8d 100644
--- a/arch/arm64/include/asm/timex.h
+++ b/arch/arm64/include/asm/timex.h
@@ -22,7 +22,7 @@
* Use the current timer as a cycle counter since this is what we use for
* the delay loop.
*/
-#define get_cycles() arch_counter_get_cntvct()
+#define get_cycles() arch_timer_read_counter()
#include <asm-generic/timex.h>