KVM: arm/arm64: Do not use kern_hyp_va() with kvm_vgic_global_state
authorMarc Zyngier <marc.zyngier@arm.com>
Fri, 20 Jul 2018 09:52:57 +0000 (10:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 22 Jul 2018 12:28:50 +0000 (14:28 +0200)
commitdca7815605aff032d0b7f9c4f1d98af0e529cdee
treebc3f3310ea1fe7b178145f4b1acafb41e5dda654
parente77175fafa7dd941873dc248ab0f20aa56fe3431
KVM: arm/arm64: Do not use kern_hyp_va() with kvm_vgic_global_state

Commit 44a497abd621a71c645f06d3d545ae2f46448830 upstream.

kvm_vgic_global_state is part of the read-only section, and is
usually accessed using a PC-relative address generation (adrp + add).

It is thus useless to use kern_hyp_va() on it, and actively problematic
if kern_hyp_va() becomes non-idempotent. On the other hand, there is
no way that the compiler is going to guarantee that such access is
always PC relative.

So let's bite the bullet and provide our own accessor.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: James Morse <james.morse@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/include/asm/kvm_mmu.h
arch/arm64/include/asm/kvm_mmu.h
virt/kvm/arm/hyp/vgic-v2-sr.c