KVM: arm64: Fix nVHE hyp panic host context restore
authorAndrew Scull <ascull@google.com>
Mon, 15 Mar 2021 12:22:10 +0000 (12:22 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Mar 2021 16:06:37 +0000 (17:06 +0100)
commit1dbce9ba2aa96c70fbf9584ea967f0e7dd290c9e
tree0385dca5197ea1ef3414a30265c637ecdccfe5d5
parentf67e5243d0f3b89123e1433dbc4ea88f70271d32
KVM: arm64: Fix nVHE hyp panic host context restore

Commit c4b000c3928d4f20acef79dccf3a65ae3795e0b0 upstream.

When panicking from the nVHE hyp and restoring the host context, x29 is
expected to hold a pointer to the host context. This wasn't being done
so fix it to make sure there's a valid pointer the host context being
used.

Rather than passing a boolean indicating whether or not the host context
should be restored, instead pass the pointer to the host context. NULL
is passed to indicate that no context should be restored.

Fixes: a2e102e20fd6 ("KVM: arm64: nVHE: Handle hyp panics")
Cc: stable@vger.kernel.org # 5.10.y only
Signed-off-by: Andrew Scull <ascull@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210219122406.1337626-1-ascull@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/include/asm/kvm_hyp.h
arch/arm64/kvm/hyp/nvhe/host.S
arch/arm64/kvm/hyp/nvhe/switch.c