Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 1 | /* |
| 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 Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 18 | |
| 19 | #include <linux/linkage.h> |
| 20 | #include <linux/const.h> |
| 21 | #include <asm/unified.h> |
| 22 | #include <asm/page.h> |
Christoffer Dall | 749cf76c | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 23 | #include <asm/asm-offsets.h> |
| 24 | #include <asm/kvm_asm.h> |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 25 | #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 Dall | d5d8184 | 2013-01-20 18:28:07 -0500 | [diff] [blame^] | 35 | ENTRY(__kvm_tlb_flush_vmid) |
| 36 | bx lr |
| 37 | ENDPROC(__kvm_tlb_flush_vmid) |
| 38 | |
| 39 | /******************************************************************** |
| 40 | * Flush TLBs and instruction caches of current CPU for all VMIDs |
| 41 | */ |
Christoffer Dall | 342cd0a | 2013-01-20 18:28:06 -0500 | [diff] [blame] | 42 | ENTRY(__kvm_flush_vm_context) |
| 43 | bx lr |
| 44 | ENDPROC(__kvm_flush_vm_context) |
| 45 | |
| 46 | /******************************************************************** |
| 47 | * Hypervisor world-switch code |
| 48 | */ |
| 49 | ENTRY(__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 | */ |
| 74 | ENTRY(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 |