GNU Linux-libre 5.4.274-gnu1
[releases.git] / arch / arm64 / kvm / hyp.S
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2012,2013 - ARM Ltd
4  * Author: Marc Zyngier <marc.zyngier@arm.com>
5  */
6
7 #include <linux/linkage.h>
8
9 #include <asm/alternative.h>
10 #include <asm/assembler.h>
11 #include <asm/cpufeature.h>
12
13 /*
14  * u64 __kvm_call_hyp(void *hypfn, ...);
15  *
16  * This is not really a variadic function in the classic C-way and care must
17  * be taken when calling this to ensure parameters are passed in registers
18  * only, since the stack will change between the caller and the callee.
19  *
20  * Call the function with the first argument containing a pointer to the
21  * function you wish to call in Hyp mode, and subsequent arguments will be
22  * passed as x0, x1, and x2 (a maximum of 3 arguments in addition to the
23  * function pointer can be passed).  The function being called must be mapped
24  * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c).  Return values are
25  * passed in x0.
26  *
27  * A function pointer with a value less than 0xfff has a special meaning,
28  * and is used to implement hyp stubs in the same way as in
29  * arch/arm64/kernel/hyp_stub.S.
30  */
31 ENTRY(__kvm_call_hyp)
32         hvc     #0
33         ret
34 ENDPROC(__kvm_call_hyp)