1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#include <linux/linkage.h>
19#include <linux/threads.h>
20#include <asm/page.h>
21#include <asm/thread_info.h>
22#include <asm/types.h>
23#include <asm/asm-offsets.h>
24#include <hv/hypervisor.h>
25
26 .text
27
28
29
30
31
32
33#define r_tmp r10
34#define r_save_sp r11
35
36
37#define FRAME_SP 8
38#define FRAME_R30 16
39#define FRAME_R31 24
40#define FRAME_R32 32
41#define FRAME_SIZE 40
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56#define r_context_in r0
57#define r_access_in r1
58#define r_asid_in r2
59#define r_my_cpumask r3
60
61
62#define r_context r30
63#define r_access r31
64#define r_asid r32
65
66
67
68
69
70
71STD_ENTRY(flush_and_install_context)
72
73
74
75
76 {
77 move r_save_sp, sp
78 st sp, lr
79 addi sp, sp, -FRAME_SIZE
80 }
81 addi r_tmp, sp, FRAME_SP
82 {
83 st r_tmp, r_save_sp
84 addi r_tmp, sp, FRAME_R30
85 }
86 {
87 st r_tmp, r30
88 addi r_tmp, sp, FRAME_R31
89 }
90 {
91 st r_tmp, r31
92 addi r_tmp, sp, FRAME_R32
93 }
94 st r_tmp, r32
95
96
97 {
98 move r_context, r_context_in
99 move r_access, r_access_in
100 }
101 move r_asid, r_asid_in
102
103
104 {
105 move r0, zero
106 moveli r1, hw2_last(HV_FLUSH_EVICT_L2)
107 }
108 {
109 shl16insli r1, r1, hw1(HV_FLUSH_EVICT_L2)
110 move r2, r_my_cpumask
111 }
112 {
113 shl16insli r1, r1, hw0(HV_FLUSH_EVICT_L2)
114 move r3, zero
115 }
116 {
117 move r4, zero
118 move r5, zero
119 }
120 {
121 move r6, zero
122 move r7, zero
123 }
124 {
125 move r8, zero
126 jal _hv_flush_remote
127 }
128 bnez r0, 1f
129
130
131 {
132 move r0, r_context
133 move r1, r_access
134 }
135 {
136 move r2, r_asid
137 moveli r3, HV_CTX_DIRECTIO | CTX_PAGE_FLAG
138 }
139 jal _hv_install_context
140 bnez r0, 1f
141
142
143 {
144 movei r0, 0
145 jal hv_flush_all
146 }
147
1481:
149 addli lr, sp, FRAME_SIZE
150 {
151 ld lr, lr
152 addli r_tmp, sp, FRAME_R30
153 }
154 {
155 ld r30, r_tmp
156 addli r_tmp, sp, FRAME_R31
157 }
158 {
159 ld r31, r_tmp
160 addli r_tmp, sp, FRAME_R32
161 }
162 {
163 ld r32, r_tmp
164 addi sp, sp, FRAME_SIZE
165 }
166 jrp lr
167 STD_ENDPROC(flush_and_install_context)
168