2012-12-10 09:40:18 -07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012,2013 - ARM Ltd
|
|
|
|
* Author: Marc Zyngier <marc.zyngier@arm.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
|
2015-01-29 06:52:12 -07:00
|
|
|
#include <asm/alternative.h>
|
2014-11-24 06:59:30 -07:00
|
|
|
#include <asm/assembler.h>
|
2015-01-29 06:52:12 -07:00
|
|
|
#include <asm/cpufeature.h>
|
2012-12-10 09:40:18 -07:00
|
|
|
|
2014-02-26 11:47:36 -07:00
|
|
|
/*
|
2016-02-16 05:52:39 -07:00
|
|
|
* u64 __kvm_call_hyp(void *hypfn, ...);
|
2014-02-26 11:47:36 -07:00
|
|
|
*
|
|
|
|
* This is not really a variadic function in the classic C-way and care must
|
|
|
|
* be taken when calling this to ensure parameters are passed in registers
|
|
|
|
* only, since the stack will change between the caller and the callee.
|
|
|
|
*
|
|
|
|
* Call the function with the first argument containing a pointer to the
|
|
|
|
* function you wish to call in Hyp mode, and subsequent arguments will be
|
|
|
|
* passed as x0, x1, and x2 (a maximum of 3 arguments in addition to the
|
|
|
|
* function pointer can be passed). The function being called must be mapped
|
|
|
|
* in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are
|
2015-10-25 09:51:41 -06:00
|
|
|
* passed in x0.
|
2014-02-26 11:47:36 -07:00
|
|
|
*
|
|
|
|
* A function pointer with a value of 0 has a special meaning, and is
|
|
|
|
* used to implement __hyp_get_vectors in the same way as in
|
|
|
|
* arch/arm64/kernel/hyp_stub.S.
|
|
|
|
*/
|
2016-02-16 05:52:39 -07:00
|
|
|
ENTRY(__kvm_call_hyp)
|
2015-01-29 06:52:12 -07:00
|
|
|
alternative_if_not ARM64_HAS_VIRT_HOST_EXTN
|
2012-12-10 09:40:18 -07:00
|
|
|
hvc #0
|
|
|
|
ret
|
2015-01-29 06:52:12 -07:00
|
|
|
alternative_else
|
|
|
|
b __vhe_hyp_call
|
|
|
|
nop
|
|
|
|
alternative_endif
|
2016-02-16 05:52:39 -07:00
|
|
|
ENDPROC(__kvm_call_hyp)
|