Merge remote-tracking branch 'spi/for-next'
[deliverable/linux.git] / arch / arm64 / kvm / hyp.S
CommitLineData
55c7401d
MZ
1/*
2 * Copyright (C) 2012,2013 - ARM Ltd
3 * Author: Marc Zyngier <marc.zyngier@arm.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include <linux/linkage.h>
55c7401d 19
b81125c7 20#include <asm/alternative.h>
c6d01a94 21#include <asm/assembler.h>
b81125c7 22#include <asm/cpufeature.h>
55c7401d 23
b20c9f29 24/*
a0bf9776 25 * u64 __kvm_call_hyp(void *hypfn, ...);
b20c9f29
MZ
26 *
27 * This is not really a variadic function in the classic C-way and care must
28 * be taken when calling this to ensure parameters are passed in registers
29 * only, since the stack will change between the caller and the callee.
30 *
31 * Call the function with the first argument containing a pointer to the
32 * function you wish to call in Hyp mode, and subsequent arguments will be
33 * passed as x0, x1, and x2 (a maximum of 3 arguments in addition to the
34 * function pointer can be passed). The function being called must be mapped
35 * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are
1ea66d27 36 * passed in x0.
b20c9f29 37 *
ad72e59f
GL
38 * A function pointer with a value less than 0xfff has a special meaning,
39 * and is used to implement __hyp_get_vectors in the same way as in
b20c9f29 40 * arch/arm64/kernel/hyp_stub.S.
00a44cda 41 * HVC behaves as a 'bl' call and will clobber lr.
b20c9f29 42 */
a0bf9776 43ENTRY(__kvm_call_hyp)
00a44cda
JM
44alternative_if_not ARM64_HAS_VIRT_HOST_EXTN
45 str lr, [sp, #-16]!
55c7401d 46 hvc #0
00a44cda 47 ldr lr, [sp], #16
55c7401d 48 ret
e506236a 49alternative_else_nop_endif
b81125c7 50 b __vhe_hyp_call
a0bf9776 51ENDPROC(__kvm_call_hyp)
This page took 0.156188 seconds and 5 git commands to generate.