Commit 7c2e76d8 authored by Andrew Scull's avatar Andrew Scull Committed by Marc Zyngier

KVM: arm64: Update context references from host to hyp

Hyp now has its own nominal context for saving and restoring its state
when switching to and from a guest. Update the related comments and
utilities to match the new name.
Signed-off-by: default avatarAndrew Scull <ascull@google.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200915104643.2543892-10-ascull@google.com
parent b619d9aa
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
.endm .endm
/* /*
* Both ptrauth_switch_to_guest and ptrauth_switch_to_host macros will * Both ptrauth_switch_to_guest and ptrauth_switch_to_hyp macros will
* check for the presence ARM64_HAS_ADDRESS_AUTH, which is defined as * check for the presence ARM64_HAS_ADDRESS_AUTH, which is defined as
* (ARM64_HAS_ADDRESS_AUTH_ARCH || ARM64_HAS_ADDRESS_AUTH_IMP_DEF) and * (ARM64_HAS_ADDRESS_AUTH_ARCH || ARM64_HAS_ADDRESS_AUTH_IMP_DEF) and
* then proceed ahead with the save/restore of Pointer Authentication * then proceed ahead with the save/restore of Pointer Authentication
...@@ -78,7 +78,7 @@ alternative_else_nop_endif ...@@ -78,7 +78,7 @@ alternative_else_nop_endif
.L__skip_switch\@: .L__skip_switch\@:
.endm .endm
.macro ptrauth_switch_to_host g_ctxt, h_ctxt, reg1, reg2, reg3 .macro ptrauth_switch_to_hyp g_ctxt, h_ctxt, reg1, reg2, reg3
alternative_if_not ARM64_HAS_ADDRESS_AUTH alternative_if_not ARM64_HAS_ADDRESS_AUTH
b .L__skip_switch\@ b .L__skip_switch\@
alternative_else_nop_endif alternative_else_nop_endif
...@@ -96,7 +96,7 @@ alternative_else_nop_endif ...@@ -96,7 +96,7 @@ alternative_else_nop_endif
#else /* !CONFIG_ARM64_PTR_AUTH */ #else /* !CONFIG_ARM64_PTR_AUTH */
.macro ptrauth_switch_to_guest g_ctxt, reg1, reg2, reg3 .macro ptrauth_switch_to_guest g_ctxt, reg1, reg2, reg3
.endm .endm
.macro ptrauth_switch_to_host g_ctxt, h_ctxt, reg1, reg2, reg3 .macro ptrauth_switch_to_hyp g_ctxt, h_ctxt, reg1, reg2, reg3
.endm .endm
#endif /* CONFIG_ARM64_PTR_AUTH */ #endif /* CONFIG_ARM64_PTR_AUTH */
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
......
...@@ -66,16 +66,16 @@ SYM_FUNC_START(__guest_enter) ...@@ -66,16 +66,16 @@ SYM_FUNC_START(__guest_enter)
hyp_adr_this_cpu x1, kvm_hyp_ctxt, x2 hyp_adr_this_cpu x1, kvm_hyp_ctxt, x2
// Store the host regs // Store the hyp regs
save_callee_saved_regs x1 save_callee_saved_regs x1
// Save the host's sp_el0 // Save hyp's sp_el0
save_sp_el0 x1, x2 save_sp_el0 x1, x2
// Now the host state is stored if we have a pending RAS SError it must // Now the hyp state is stored if we have a pending RAS SError it must
// affect the host. If any asynchronous exception is pending we defer // affect the host or hyp. If any asynchronous exception is pending we
// the guest entry. The DSB isn't necessary before v8.2 as any SError // defer the guest entry. The DSB isn't necessary before v8.2 as any
// would be fatal. // SError would be fatal.
alternative_if ARM64_HAS_RAS_EXTN alternative_if ARM64_HAS_RAS_EXTN
dsb nshst dsb nshst
isb isb
...@@ -150,17 +150,17 @@ SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL) ...@@ -150,17 +150,17 @@ SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL)
hyp_adr_this_cpu x2, kvm_hyp_ctxt, x3 hyp_adr_this_cpu x2, kvm_hyp_ctxt, x3
// Macro ptrauth_switch_to_guest format: // Macro ptrauth_switch_to_hyp format:
// ptrauth_switch_to_host(guest cxt, host cxt, tmp1, tmp2, tmp3) // ptrauth_switch_to_hyp(guest cxt, host cxt, tmp1, tmp2, tmp3)
// The below macro to save/restore keys is not implemented in C code // The below macro to save/restore keys is not implemented in C code
// as it may cause Pointer Authentication key signing mismatch errors // as it may cause Pointer Authentication key signing mismatch errors
// when this feature is enabled for kernel code. // when this feature is enabled for kernel code.
ptrauth_switch_to_host x1, x2, x3, x4, x5 ptrauth_switch_to_hyp x1, x2, x3, x4, x5
// Restore the hosts's sp_el0 // Restore hyp's sp_el0
restore_sp_el0 x2, x3 restore_sp_el0 x2, x3
// Now restore the host regs // Now restore the hyp regs
restore_callee_saved_regs x2 restore_callee_saved_regs x2
alternative_if ARM64_HAS_RAS_EXTN alternative_if ARM64_HAS_RAS_EXTN
......
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