Skip to content

Commit

Permalink
UPSTREAM: KVM: arm64: pkvm: Give priority to standard traps over pvm …
Browse files Browse the repository at this point in the history
…handling

Checking for pvm handling first means that we cannot handle ptrauth
traps or apply any of the workarounds (GICv3 or TX2 torvalds#219).

Flip the order around.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Fuad Tabba <tabba@google.com>
Tested-by: Fuad Tabba <tabba@google.com>
Link: https://lore.kernel.org/r/20211013120346.2926621-12-maz@kernel.org
(cherry picked from commit 0730559)
Bug: 204960018
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I89b2cf3dd330ddcde01c8da3dc42aac83be05c0b
  • Loading branch information
Marc Zyngier authored and Will Deacon committed Nov 3, 2021
1 parent a6ee337 commit 437b0bb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions arch/arm64/kvm/hyp/nvhe/switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,13 @@ static void __pmu_switch_to_host(struct kvm_cpu_context *host_ctxt)
*/
static bool kvm_handle_pvm_sys64(struct kvm_vcpu *vcpu, u64 *exit_code)
{
if (kvm_handle_pvm_sysreg(vcpu, exit_code))
return true;

return kvm_hyp_handle_sysreg(vcpu, exit_code);
/*
* Make sure we handle the exit for workarounds and ptrauth
* before the pKVM handling, as the latter could decide to
* UNDEF.
*/
return (kvm_hyp_handle_sysreg(vcpu, exit_code) ||
kvm_handle_pvm_sysreg(vcpu, exit_code));
}

/**
Expand Down

0 comments on commit 437b0bb

Please sign in to comment.