diff options
author | James Morse <james.morse@arm.com> | 2020-02-20 17:58:38 +0100 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2020-02-22 12:01:47 +0100 |
commit | 8c2d146ee7a2e0782eea4dd70fddc1c837140136 (patch) | |
tree | 2a61fec4e43a9ebc5d677e0f2c227c898655d76d /arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c | |
parent | KVM: arm64: Ask the compiler to __always_inline functions used at HYP (diff) | |
download | linux-8c2d146ee7a2e0782eea4dd70fddc1c837140136.tar.xz linux-8c2d146ee7a2e0782eea4dd70fddc1c837140136.zip |
KVM: arm64: Define our own swab32() to avoid a uapi static inline
KVM uses swab32() when mediating GIC MMIO accesses if the GICV is badly
aligned, and the host and guest differ in endianness.
arm64 doesn't provide a __arch_swab32(), so __fswab32() is always backed
by the macro implementation that the compiler reduces to a single
instruction. But the static-inline causes problems for KVM if the compiler
chooses not to inline this function, it may not be located in the
__hyp_text where __vgic_v2_perform_cpuif_access() needs it.
Create our own __kvm_swab32() macro that calls ___constant_swab32()
directly. This way we know it will always be inlined.
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200220165839.256881-3-james.morse@arm.com
Diffstat (limited to 'arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c')
-rw-r--r-- | arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c b/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c index 29ee1feba4eb..4f3a087e36d5 100644 --- a/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c +++ b/arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c @@ -69,14 +69,14 @@ int __hyp_text __vgic_v2_perform_cpuif_access(struct kvm_vcpu *vcpu) u32 data = vcpu_get_reg(vcpu, rd); if (__is_be(vcpu)) { /* guest pre-swabbed data, undo this for writel() */ - data = swab32(data); + data = __kvm_swab32(data); } writel_relaxed(data, addr); } else { u32 data = readl_relaxed(addr); if (__is_be(vcpu)) { /* guest expects swabbed data */ - data = swab32(data); + data = __kvm_swab32(data); } vcpu_set_reg(vcpu, rd, data); } |