Commit 2c3db77c authored by Marc Zyngier's avatar Marc Zyngier

KVM: arm64: pauth: Use ctxt_sys_reg() instead of raw sys_regs access

Now that we have a wrapper for the sysreg accesses, let's use that
consistently.
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
parent 308472c6
...@@ -364,11 +364,14 @@ static inline bool esr_is_ptrauth_trap(u32 esr) ...@@ -364,11 +364,14 @@ static inline bool esr_is_ptrauth_trap(u32 esr)
return false; return false;
} }
#define __ptrauth_save_key(regs, key) \ #define __ptrauth_save_key(ctxt, key) \
({ \ do { \
regs[key ## KEYLO_EL1] = read_sysreg_s(SYS_ ## key ## KEYLO_EL1); \ u64 __val; \
regs[key ## KEYHI_EL1] = read_sysreg_s(SYS_ ## key ## KEYHI_EL1); \ __val = read_sysreg_s(SYS_ ## key ## KEYLO_EL1); \
}) ctxt_sys_reg(ctxt, key ## KEYLO_EL1) = __val; \
__val = read_sysreg_s(SYS_ ## key ## KEYHI_EL1); \
ctxt_sys_reg(ctxt, key ## KEYHI_EL1) = __val; \
} while(0)
static inline bool __hyp_handle_ptrauth(struct kvm_vcpu *vcpu) static inline bool __hyp_handle_ptrauth(struct kvm_vcpu *vcpu)
{ {
...@@ -380,11 +383,11 @@ static inline bool __hyp_handle_ptrauth(struct kvm_vcpu *vcpu) ...@@ -380,11 +383,11 @@ static inline bool __hyp_handle_ptrauth(struct kvm_vcpu *vcpu)
return false; return false;
ctxt = &__hyp_this_cpu_ptr(kvm_host_data)->host_ctxt; ctxt = &__hyp_this_cpu_ptr(kvm_host_data)->host_ctxt;
__ptrauth_save_key(ctxt->sys_regs, APIA); __ptrauth_save_key(ctxt, APIA);
__ptrauth_save_key(ctxt->sys_regs, APIB); __ptrauth_save_key(ctxt, APIB);
__ptrauth_save_key(ctxt->sys_regs, APDA); __ptrauth_save_key(ctxt, APDA);
__ptrauth_save_key(ctxt->sys_regs, APDB); __ptrauth_save_key(ctxt, APDB);
__ptrauth_save_key(ctxt->sys_regs, APGA); __ptrauth_save_key(ctxt, APGA);
vcpu_ptrauth_enable(vcpu); vcpu_ptrauth_enable(vcpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment