interrupts.S revision d5d8184d35c990b1324d9b30bcd0e4e8aa08f56d
1749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall/*
2749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall * Copyright (C) 2012 - Virtual Open Systems and Columbia University
3749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall * Author: Christoffer Dall <c.dall@virtualopensystems.com>
4749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall *
5749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall * This program is free software; you can redistribute it and/or modify
6749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall * it under the terms of the GNU General Public License, version 2, as
7749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall * published by the Free Software Foundation.
8749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall *
9749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall * This program is distributed in the hope that it will be useful,
10749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall * but WITHOUT ANY WARRANTY; without even the implied warranty of
11749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall * GNU General Public License for more details.
13749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall *
14749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall * You should have received a copy of the GNU General Public License
15749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall * along with this program; if not, write to the Free Software
16749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall */
18342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall
19342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall#include <linux/linkage.h>
20342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall#include <linux/const.h>
21342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall#include <asm/unified.h>
22342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall#include <asm/page.h>
23749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall#include <asm/asm-offsets.h>
24749cf76c5a363e1383108a914ea09530bfa0bd43Christoffer Dall#include <asm/kvm_asm.h>
25342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall#include <asm/kvm_arm.h>
26342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall
27342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall	.text
28342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall
29342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall__kvm_hyp_code_start:
30342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall	.globl __kvm_hyp_code_start
31342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall
32342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall/********************************************************************
33342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * Flush per-VMID TLBs
34342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall */
35d5d8184d35c990b1324d9b30bcd0e4e8aa08f56dChristoffer DallENTRY(__kvm_tlb_flush_vmid)
36d5d8184d35c990b1324d9b30bcd0e4e8aa08f56dChristoffer Dall	bx	lr
37d5d8184d35c990b1324d9b30bcd0e4e8aa08f56dChristoffer DallENDPROC(__kvm_tlb_flush_vmid)
38d5d8184d35c990b1324d9b30bcd0e4e8aa08f56dChristoffer Dall
39d5d8184d35c990b1324d9b30bcd0e4e8aa08f56dChristoffer Dall/********************************************************************
40d5d8184d35c990b1324d9b30bcd0e4e8aa08f56dChristoffer Dall * Flush TLBs and instruction caches of current CPU for all VMIDs
41d5d8184d35c990b1324d9b30bcd0e4e8aa08f56dChristoffer Dall */
42342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer DallENTRY(__kvm_flush_vm_context)
43342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall	bx	lr
44342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer DallENDPROC(__kvm_flush_vm_context)
45342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall
46342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall/********************************************************************
47342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall *  Hypervisor world-switch code
48342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall */
49342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer DallENTRY(__kvm_vcpu_run)
50342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall	bx	lr
51342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall
52342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall/********************************************************************
53342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall *  Call function in Hyp mode
54342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall *
55342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall *
56342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * u64 kvm_call_hyp(void *hypfn, ...);
57342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall *
58342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * This is not really a variadic function in the classic C-way and care must
59342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * be taken when calling this to ensure parameters are passed in registers
60342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * only, since the stack will change between the caller and the callee.
61342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall *
62342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * Call the function with the first argument containing a pointer to the
63342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * function you wish to call in Hyp mode, and subsequent arguments will be
64342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * passed as r0, r1, and r2 (a maximum of 3 arguments in addition to the
65342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * function pointer can be passed).  The function being called must be mapped
66342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * in Hyp mode (see init_hyp_mode in arch/arm/kvm/arm.c).  Return values are
67342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * passed in r0 and r1.
68342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall *
69342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * The calling convention follows the standard AAPCS:
70342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall *   r0 - r3: caller save
71342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall *   r12:     caller save
72342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall *   rest:    callee save
73342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall */
74342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer DallENTRY(kvm_call_hyp)
75342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall	hvc	#0
76342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall	bx	lr
77342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall
78342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall/********************************************************************
79342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall * Hypervisor exception vector and handlers
80342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall */
81342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall
82342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall	.align 5
83342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall__kvm_hyp_vector:
84342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall	.globl __kvm_hyp_vector
85342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall	nop
86342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall
87342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall__kvm_hyp_code_end:
88342cd0ab0e6ca3fe7c88a78890352748b8e894a9Christoffer Dall	.globl	__kvm_hyp_code_end
89