diff options
author | Marc Zyngier <maz@kernel.org> | 2024-04-19 11:29:29 +0100 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2024-04-20 12:42:51 +0100 |
commit | 279946ada1f26a905061d0d6f134fff9e7b14239 (patch) | |
tree | ee16ab9ada2fb90f41d7f0eb1f45a445b09b03d2 /arch/arm64/include/asm | |
parent | 4cc3f31914d6df9dba8825db933d19c60028f5a8 (diff) | |
download | linux-stable-279946ada1f26a905061d0d6f134fff9e7b14239.tar.gz linux-stable-279946ada1f26a905061d0d6f134fff9e7b14239.tar.bz2 linux-stable-279946ada1f26a905061d0d6f134fff9e7b14239.zip |
KVM: arm64: nv: Handle HCR_EL2.{API,APK} independently
Although KVM couples API and APK for simplicity, the architecture
makes no such requirement, and the two can be independently set or
cleared.
Check for which of the two possible reasons we have trapped here,
and if the corresponding L1 control bit isn't set, delegate the
handling for forwarding.
Otherwise, set this exact bit in HCR_EL2 and resume the guest.
Of course, in the non-NV case, we keep setting both bits and
be done with it. Note that the entry core already saves/restores
the keys should any of the two control bits be set.
This results in a bit of rework, and the removal of the (trivial)
vcpu_ptrauth_enable() helper.
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20240419102935.1935571-10-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'arch/arm64/include/asm')
-rw-r--r-- | arch/arm64/include/asm/kvm_emulate.h | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h index 975af30af31f..87f2c31f3206 100644 --- a/arch/arm64/include/asm/kvm_emulate.h +++ b/arch/arm64/include/asm/kvm_emulate.h @@ -125,11 +125,6 @@ static inline void vcpu_set_wfx_traps(struct kvm_vcpu *vcpu) vcpu->arch.hcr_el2 |= HCR_TWI; } -static inline void vcpu_ptrauth_enable(struct kvm_vcpu *vcpu) -{ - vcpu->arch.hcr_el2 |= (HCR_API | HCR_APK); -} - static inline void vcpu_ptrauth_disable(struct kvm_vcpu *vcpu) { vcpu->arch.hcr_el2 &= ~(HCR_API | HCR_APK); |