blob: f701aff31e4471d59cd8d3b9ab7059924c7a6e3e [file] [log] [blame]
Christoffer Dall749cf76c2013-01-20 18:28:06 -05001/*
2 * Copyright (C) 2012 - Virtual Open Systems and Columbia University
3 * Author: Christoffer Dall <c.dall@virtualopensystems.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, write to the Free Software
16 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
Christoffer Dall342cd0a2013-01-20 18:28:06 -050018
19#include <linux/linkage.h>
20#include <linux/const.h>
21#include <asm/unified.h>
22#include <asm/page.h>
Christoffer Dall749cf76c2013-01-20 18:28:06 -050023#include <asm/asm-offsets.h>
24#include <asm/kvm_asm.h>
Christoffer Dall342cd0a2013-01-20 18:28:06 -050025#include <asm/kvm_arm.h>
26
27 .text
28
29__kvm_hyp_code_start:
30 .globl __kvm_hyp_code_start
31
32/********************************************************************
33 * Flush per-VMID TLBs
34 */
Christoffer Dalld5d81842013-01-20 18:28:07 -050035ENTRY(__kvm_tlb_flush_vmid)
36 bx lr
37ENDPROC(__kvm_tlb_flush_vmid)
38
39/********************************************************************
40 * Flush TLBs and instruction caches of current CPU for all VMIDs
41 */
Christoffer Dall342cd0a2013-01-20 18:28:06 -050042ENTRY(__kvm_flush_vm_context)
43 bx lr
44ENDPROC(__kvm_flush_vm_context)
45
46/********************************************************************
47 * Hypervisor world-switch code
48 */
49ENTRY(__kvm_vcpu_run)
50 bx lr
51
52/********************************************************************
53 * Call function in Hyp mode
54 *
55 *
56 * u64 kvm_call_hyp(void *hypfn, ...);
57 *
58 * This is not really a variadic function in the classic C-way and care must
59 * be taken when calling this to ensure parameters are passed in registers
60 * only, since the stack will change between the caller and the callee.
61 *
62 * Call the function with the first argument containing a pointer to the
63 * function you wish to call in Hyp mode, and subsequent arguments will be
64 * passed as r0, r1, and r2 (a maximum of 3 arguments in addition to the
65 * function pointer can be passed). The function being called must be mapped
66 * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c). Return values are
67 * passed in r0 and r1.
68 *
69 * The calling convention follows the standard AAPCS:
70 * r0 - r3: caller save
71 * r12: caller save
72 * rest: callee save
73 */
74ENTRY(kvm_call_hyp)
75 hvc #0
76 bx lr
77
78/********************************************************************
79 * Hypervisor exception vector and handlers
80 */
81
82 .align 5
83__kvm_hyp_vector:
84 .globl __kvm_hyp_vector
85 nop
86
87__kvm_hyp_code_end:
88 .globl __kvm_hyp_code_end