Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Andrew Scull <ascull@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200915104643.2543892-10-ascull@google.com

authored by

Andrew Scull and committed by
Marc Zyngier
7c2e76d8 b619d9aa

+14 -14
+3 -3
arch/arm64/include/asm/kvm_ptrauth.h
··· 60 60 .endm 61 61 62 62 /* 63 - * Both ptrauth_switch_to_guest and ptrauth_switch_to_host macros will 63 + * Both ptrauth_switch_to_guest and ptrauth_switch_to_hyp macros will 64 64 * check for the presence ARM64_HAS_ADDRESS_AUTH, which is defined as 65 65 * (ARM64_HAS_ADDRESS_AUTH_ARCH || ARM64_HAS_ADDRESS_AUTH_IMP_DEF) and 66 66 * then proceed ahead with the save/restore of Pointer Authentication ··· 78 78 .L__skip_switch\@: 79 79 .endm 80 80 81 - .macro ptrauth_switch_to_host g_ctxt, h_ctxt, reg1, reg2, reg3 81 + .macro ptrauth_switch_to_hyp g_ctxt, h_ctxt, reg1, reg2, reg3 82 82 alternative_if_not ARM64_HAS_ADDRESS_AUTH 83 83 b .L__skip_switch\@ 84 84 alternative_else_nop_endif ··· 96 96 #else /* !CONFIG_ARM64_PTR_AUTH */ 97 97 .macro ptrauth_switch_to_guest g_ctxt, reg1, reg2, reg3 98 98 .endm 99 - .macro ptrauth_switch_to_host g_ctxt, h_ctxt, reg1, reg2, reg3 99 + .macro ptrauth_switch_to_hyp g_ctxt, h_ctxt, reg1, reg2, reg3 100 100 .endm 101 101 #endif /* CONFIG_ARM64_PTR_AUTH */ 102 102 #endif /* __ASSEMBLY__ */
+11 -11
arch/arm64/kvm/hyp/entry.S
··· 66 66 67 67 hyp_adr_this_cpu x1, kvm_hyp_ctxt, x2 68 68 69 - // Store the host regs 69 + // Store the hyp regs 70 70 save_callee_saved_regs x1 71 71 72 - // Save the host's sp_el0 72 + // Save hyp's sp_el0 73 73 save_sp_el0 x1, x2 74 74 75 - // Now the host state is stored if we have a pending RAS SError it must 76 - // affect the host. If any asynchronous exception is pending we defer 77 - // the guest entry. The DSB isn't necessary before v8.2 as any SError 78 - // would be fatal. 75 + // Now the hyp state is stored if we have a pending RAS SError it must 76 + // affect the host or hyp. If any asynchronous exception is pending we 77 + // defer the guest entry. The DSB isn't necessary before v8.2 as any 78 + // SError would be fatal. 79 79 alternative_if ARM64_HAS_RAS_EXTN 80 80 dsb nshst 81 81 isb ··· 150 150 151 151 hyp_adr_this_cpu x2, kvm_hyp_ctxt, x3 152 152 153 - // Macro ptrauth_switch_to_guest format: 154 - // ptrauth_switch_to_host(guest cxt, host cxt, tmp1, tmp2, tmp3) 153 + // Macro ptrauth_switch_to_hyp format: 154 + // ptrauth_switch_to_hyp(guest cxt, host cxt, tmp1, tmp2, tmp3) 155 155 // The below macro to save/restore keys is not implemented in C code 156 156 // as it may cause Pointer Authentication key signing mismatch errors 157 157 // when this feature is enabled for kernel code. 158 - ptrauth_switch_to_host x1, x2, x3, x4, x5 158 + ptrauth_switch_to_hyp x1, x2, x3, x4, x5 159 159 160 - // Restore the hosts's sp_el0 160 + // Restore hyp's sp_el0 161 161 restore_sp_el0 x2, x3 162 162 163 - // Now restore the host regs 163 + // Now restore the hyp regs 164 164 restore_callee_saved_regs x2 165 165 166 166 alternative_if ARM64_HAS_RAS_EXTN