Skip to content

Commit b9e10d4

Browse files
AndrewScullMarc Zyngier
authored andcommitted
KVM: arm64: Stop clobbering x0 for HVC_SOFT_RESTART
HVC_SOFT_RESTART is given values for x0-2 that it should installed before exiting to the new address so should not set x0 to stub HVC success or failure code. Fixes: af42f20 ("arm64: hyp-stub: Zero x0 on successful stub handling") Cc: stable@vger.kernel.org Signed-off-by: Andrew Scull <ascull@google.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20200706095259.1338221-1-ascull@google.com
1 parent 146f76c commit b9e10d4

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

arch/arm64/kvm/hyp-init.S

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,15 @@ SYM_CODE_START(__kvm_handle_stub_hvc)
136136

137137
1: cmp x0, #HVC_RESET_VECTORS
138138
b.ne 1f
139-
reset:
139+
140140
/*
141-
* Reset kvm back to the hyp stub. Do not clobber x0-x4 in
142-
* case we coming via HVC_SOFT_RESTART.
141+
* Set the HVC_RESET_VECTORS return code before entering the common
142+
* path so that we do not clobber x0-x2 in case we are coming via
143+
* HVC_SOFT_RESTART.
143144
*/
145+
mov x0, xzr
146+
reset:
147+
/* Reset kvm back to the hyp stub. */
144148
mrs x5, sctlr_el2
145149
mov_q x6, SCTLR_ELx_FLAGS
146150
bic x5, x5, x6 // Clear SCTL_M and etc
@@ -151,7 +155,6 @@ reset:
151155
/* Install stub vectors */
152156
adr_l x5, __hyp_stub_vectors
153157
msr vbar_el2, x5
154-
mov x0, xzr
155158
eret
156159

157160
1: /* Bad stub call */

0 commit comments

Comments
 (0)