KVM: arm64: Make vcpu_cp1x() work on Big Endian hosts
authorMarc Zyngier <maz@kernel.org>
Tue, 9 Jun 2020 07:40:35 +0000 (08:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Jun 2020 08:24:12 +0000 (10:24 +0200)
commit3fce258c1163bd69547327c66e82df7ac3077a0d
treee7351cc4f0ef3c932956ac0551f24e22a1c0c75c
parentcb671aa02528073d677aaf1d044539ab024c9470
KVM: arm64: Make vcpu_cp1x() work on Big Endian hosts

commit 3204be4109ad681523e3461ce64454c79278450a upstream.

AArch32 CP1x registers are overlayed on their AArch64 counterparts
in the vcpu struct. This leads to an interesting problem as they
are stored in their CPU-local format, and thus a CP1x register
doesn't "hit" the lower 32bit portion of the AArch64 register on
a BE host.

To workaround this unfortunate situation, introduce a bias trick
in the vcpu_cp1x() accessors which picks the correct half of the
64bit register.

Cc: stable@vger.kernel.org
Reported-by: James Morse <james.morse@arm.com>
Tested-by: James Morse <james.morse@arm.com>
Acked-by: James Morse <james.morse@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/include/asm/kvm_host.h