powerpc: enable cpu clock for powerpc64
authorLi Zhong <zhong@linux.vnet.ibm.com>
Fri, 4 Dec 2015 05:50:06 +0000 (13:50 +0800)
committerJens Axboe <axboe@fb.com>
Fri, 4 Dec 2015 17:24:22 +0000 (10:24 -0700)
commit1c73ebeac14187f062a3f18a528942cf648e375e
tree0bf4ac679b50d58bb4bdfc1a1d14bc1ee84e9e16
parent40649b005743e98d460edd8c570e238ded14f0a5
powerpc: enable cpu clock for powerpc64

This patch tries to enable cpu clock for powerpc64, the code is copied from
mftb() in kernel source.

The two instructions after mfspr are added in the kernel to solve an erratum on
Cell and fsl booke CPUs. On those CPUs, 64 bits mftb is not atomic, so it is
possible that the low order 32 bits are already reset to 0x00000000 but the
high order bits are not yet incremented by one.

Don't know how to tell whether it will be running on those CPUs or not, I just
keep the above fix for all ppc64 CPUs. Even if we have some method to check
whether we are on those CPUs or not at run time, I think the check won't cost
less than the two added instructions. Maybe we could use the similar fix up
code kernel uses to dynamically patch the instructions with nops if not needed.
But that would add much more complexity.

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
arch/arch-ppc.h