xen/arm: Add an isb() before reading CNTPCT_EL0 to prevent re-ordering
authorJulien Grall <julien.grall@arm.com>
Mon, 29 Apr 2019 14:05:16 +0000 (15:05 +0100)
committerJulien Grall <julien.grall@arm.com>
Fri, 14 Jun 2019 13:27:32 +0000 (14:27 +0100)
commit5e1b9cb0f29d6b52bd603d22bca4ae4cfeef9e74
treef2740f4a74cabccafef02a86f34b4a759a92c6c2
parent36a1c7c213e13eb64d2c2d8aa9c5c805fe19020a
xen/arm: Add an isb() before reading CNTPCT_EL0 to prevent re-ordering

Per D8.2.1 in ARM DDI 0487C.a, "a read to CNTPCT_EL0 can occur
speculatively and out of order relative to other instructions executed
on the same PE."

Add an instruction barrier to get accurate number of cycles when
requested in get_cycles(). For the other users of CNPCT_EL0, replace by
a call to get_cycles().

This is part of XSA-295.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/time.c
xen/include/asm-arm/time.h