]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/time: Fix mftb()/get_tb() for use with the compat VDSO
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 26 Nov 2020 13:10:01 +0000 (00:10 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 3 Dec 2020 14:01:10 +0000 (01:01 +1100)
commit7bd29ccdbb71c1bf034f6a5980dc2770cf59ae5a
tree2df65630c6d9700000f8ef01f648ce4e3fc8057b
parent3ee53141929b586f3770285253e8a5204f58e472
powerpc/time: Fix mftb()/get_tb() for use with the compat VDSO

When we're building the compat VDSO we are building 32-bit code but in
the context of a 64-bit kernel configuration.

To make this work we need to be careful in some places when using
ifdefs to differentiate between CONFIG_PPC64 and __powerpc64__.

CONFIG_PPC64 indicates the kernel we're building is 64-bit, but it
doesn't tell us that we're currently building 64-bit code - we could
be building 32-bit code for the compat VDSO.

On the other hand __powerpc64__ tells us that we are currently
building 64-bit code (and therefore we must also be building a 64-bit
kernel).

In the case of get_tb() we want to use the 32-bit code sequence
regardless of whether the kernel we're building for is 64-bit or
32-bit, what matters is the word size of the current object. So we
need to check __powerpc64__ to decide if we use mftb() or the
mftbu()/mftb() sequence.

For mftb() the logic for CPU_FTR_CELL_TB_BUG only makes sense if we're
building 64-bit code, so guard that with a __powerpc64__ check.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201126131006.2431205-4-mpe@ellerman.id.au
arch/powerpc/include/asm/vdso/timebase.h