summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kvm
diff options
context:
space:
mode:
authorMarc Zyngier <marc.zyngier@arm.com>2017-04-03 14:37:44 -0400
committerChristoffer Dall <cdall@linaro.org>2017-04-09 10:49:23 -0400
commit506c372ac41dc0c7c1f50f718a8a53cb0748ea96 (patch)
tree768216dce16659e5c92afb8c107e59ea3517a295 /arch/arm64/kvm
parent4adb1341c7ef68af54732ef11f69faedffa6acb7 (diff)
arm64: KVM: Implement HVC_SOFT_RESTART in the init code
Another missing stub hypercall is HVC_SOFT_RESTART. It turns out that it is pretty easy to implement in terms of HVC_RESET_VECTORS (since it needs to turn the MMU off). Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Christoffer Dall <cdall@linaro.org>
Diffstat (limited to 'arch/arm64/kvm')
-rw-r--r--arch/arm64/kvm/hyp-init.S31
1 files changed, 23 insertions, 8 deletions
diff --git a/arch/arm64/kvm/hyp-init.S b/arch/arm64/kvm/hyp-init.S
index b7a8f12293cc..0ad34fd6d2fc 100644
--- a/arch/arm64/kvm/hyp-init.S
+++ b/arch/arm64/kvm/hyp-init.S
@@ -129,21 +129,36 @@ ENTRY(__kvm_handle_stub_hvc)
129 mrs x0, vbar_el2 129 mrs x0, vbar_el2
130 b exit 130 b exit
131 131
1321: cmp x0, #HVC_SOFT_RESTART
133 b.ne 1f
134
135 /* This is where we're about to jump, staying at EL2 */
136 msr elr_el2, x1
137 mov x0, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT | PSR_MODE_EL2h)
138 msr spsr_el2, x0
139
140 /* Shuffle the arguments, and don't come back */
141 mov x0, x2
142 mov x1, x3
143 mov x2, x4
144 b reset
145
1321: cmp x0, #HVC_RESET_VECTORS 1461: cmp x0, #HVC_RESET_VECTORS
133 b.ne 1f 147 b.ne 1f
148reset:
134 /* 149 /*
135 * Reset kvm back to the hyp stub. 150 * Reset kvm back to the hyp stub. Do not clobber x0-x4 in
151 * case we coming via HVC_SOFT_RESTART.
136 */ 152 */
137 /* We're now in idmap, disable MMU */ 153 mrs x5, sctlr_el2
138 mrs x0, sctlr_el2 154 ldr x6, =SCTLR_ELx_FLAGS
139 ldr x1, =SCTLR_ELx_FLAGS 155 bic x5, x5, x6 // Clear SCTL_M and etc
140 bic x0, x0, x1 // Clear SCTL_M and etc 156 msr sctlr_el2, x5
141 msr sctlr_el2, x0
142 isb 157 isb
143 158
144 /* Install stub vectors */ 159 /* Install stub vectors */
145 adr_l x0, __hyp_stub_vectors 160 adr_l x5, __hyp_stub_vectors
146 msr vbar_el2, x0 161 msr vbar_el2, x5
147 b exit 162 b exit
148 163
1491: /* Bad stub call */ 1641: /* Bad stub call */