ia64/xen-unstable

annotate linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S @ 10703:8d501f39286c

[IA64] vDSO paravirtualization: paravirtualize vDSO

paravirtualize vdso areabased on Kevin's pointout and Dan's Idea.
introduce hyperprivop HYPERPRIVOP_RSM_BE and HYPERPRIVOP_GET_PSR.
and paravirtualize vdso area using them.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild.aw
date Mon Jul 24 13:43:35 2006 -0600 (2006-07-24)
parents 90329e7d6be5
children 147144f9ec51
rev   line source
djm@6872 1 /*
djm@6872 2 * Support routines for Xen hypercalls
djm@6872 3 *
djm@6872 4 * Copyright (C) 2005 Dan Magenheimer <dan.magenheimer@hp.com>
djm@6872 5 */
djm@6872 6
djm@6872 7 #include <linux/config.h>
djm@6872 8 #include <asm/processor.h>
djm@6872 9 #include <asm/asmmacro.h>
djm@6872 10
awilliam@9479 11 /* To clear vpsr.ic, vpsr.i needs to be cleared first */
awilliam@9479 12 #define XEN_CLEAR_PSR_IC \
awilliam@9479 13 mov r14=1; \
awilliam@9479 14 movl r15=XSI_PSR_I_ADDR; \
awilliam@9479 15 movl r2=XSI_PSR_IC; \
awilliam@9479 16 ;; \
awilliam@9479 17 ld8 r15=[r15]; \
awilliam@9479 18 ld4 r3=[r2]; \
awilliam@9479 19 ;; \
awilliam@9479 20 ld1 r16=[r15]; \
awilliam@9479 21 ;; \
awilliam@9479 22 st1 [r15]=r14; \
awilliam@9479 23 st4 [r2]=r0; \
awilliam@9479 24 ;;
awilliam@9479 25
awilliam@9479 26 /* First restore vpsr.ic, and then vpsr.i */
awilliam@9479 27 #define XEN_RESTORE_PSR_IC \
awilliam@9479 28 st4 [r2]=r3; \
awilliam@9479 29 st1 [r15]=r16; \
awilliam@9479 30 ;;
awilliam@9479 31
djm@6872 32 GLOBAL_ENTRY(xen_get_ivr)
djm@6872 33 movl r8=running_on_xen;;
djm@6872 34 ld4 r8=[r8];;
djm@6872 35 cmp.eq p7,p0=r8,r0;;
djm@6872 36 (p7) mov r8=cr.ivr;;
djm@6872 37 (p7) br.ret.sptk.many rp
djm@6872 38 ;;
awilliam@9479 39 XEN_CLEAR_PSR_IC
djm@6872 40 ;;
djm@6872 41 XEN_HYPER_GET_IVR
djm@6872 42 ;;
awilliam@9479 43 XEN_RESTORE_PSR_IC
awilliam@9479 44 ;;
djm@6872 45 br.ret.sptk.many rp
djm@6872 46 ;;
djm@6872 47 END(xen_get_ivr)
djm@6872 48
djm@6872 49 GLOBAL_ENTRY(xen_get_tpr)
djm@6872 50 movl r8=running_on_xen;;
djm@6872 51 ld4 r8=[r8];;
djm@6872 52 cmp.eq p7,p0=r8,r0;;
djm@6872 53 (p7) mov r8=cr.tpr;;
djm@6872 54 (p7) br.ret.sptk.many rp
djm@6872 55 ;;
awilliam@9479 56 XEN_CLEAR_PSR_IC
djm@6872 57 ;;
djm@6872 58 XEN_HYPER_GET_TPR
djm@6872 59 ;;
awilliam@9479 60 XEN_RESTORE_PSR_IC
awilliam@9479 61 ;;
djm@6872 62 br.ret.sptk.many rp
djm@6872 63 ;;
djm@6872 64 END(xen_get_tpr)
djm@6872 65
djm@6872 66 GLOBAL_ENTRY(xen_set_tpr)
djm@6872 67 movl r8=running_on_xen;;
djm@6872 68 ld4 r8=[r8];;
djm@6872 69 cmp.eq p7,p0=r8,r0;;
djm@6872 70 (p7) mov cr.tpr=r32;;
djm@6872 71 (p7) br.ret.sptk.many rp
djm@6872 72 ;;
djm@6872 73 mov r8=r32
djm@6872 74 ;;
awilliam@9479 75 XEN_CLEAR_PSR_IC
djm@6872 76 ;;
djm@6872 77 XEN_HYPER_SET_TPR
djm@6872 78 ;;
awilliam@9479 79 XEN_RESTORE_PSR_IC
awilliam@9479 80 ;;
djm@6872 81 br.ret.sptk.many rp
djm@6872 82 ;;
djm@6872 83 END(xen_set_tpr)
djm@6872 84
djm@6872 85 GLOBAL_ENTRY(xen_eoi)
djm@6872 86 movl r8=running_on_xen;;
djm@6872 87 ld4 r8=[r8];;
djm@6872 88 cmp.eq p7,p0=r8,r0;;
djm@6872 89 (p7) mov cr.eoi=r0;;
djm@6872 90 (p7) br.ret.sptk.many rp
djm@6872 91 ;;
djm@6872 92 mov r8=r32
djm@6872 93 ;;
awilliam@9479 94 XEN_CLEAR_PSR_IC
djm@6872 95 ;;
djm@6872 96 XEN_HYPER_EOI
djm@6872 97 ;;
awilliam@9479 98 XEN_RESTORE_PSR_IC
awilliam@9479 99 ;;
djm@6872 100 br.ret.sptk.many rp
djm@6872 101 ;;
djm@6872 102 END(xen_eoi)
djm@6872 103
djm@6872 104 GLOBAL_ENTRY(xen_thash)
djm@6872 105 movl r8=running_on_xen;;
djm@6872 106 ld4 r8=[r8];;
djm@6872 107 cmp.eq p7,p0=r8,r0;;
djm@6872 108 (p7) thash r8=r32;;
djm@6872 109 (p7) br.ret.sptk.many rp
djm@6872 110 ;;
djm@6872 111 mov r8=r32
djm@6872 112 ;;
awilliam@9479 113 XEN_CLEAR_PSR_IC
djm@6872 114 ;;
djm@6872 115 XEN_HYPER_THASH
djm@6872 116 ;;
awilliam@9479 117 XEN_RESTORE_PSR_IC
djm@6872 118 ;;
djm@6872 119 br.ret.sptk.many rp
djm@6872 120 ;;
djm@6872 121 END(xen_thash)
djm@6872 122
djm@6872 123 GLOBAL_ENTRY(xen_set_itm)
djm@6872 124 movl r8=running_on_xen;;
djm@6872 125 ld4 r8=[r8];;
djm@6872 126 cmp.eq p7,p0=r8,r0;;
djm@6872 127 (p7) mov cr.itm=r32;;
djm@6872 128 (p7) br.ret.sptk.many rp
djm@6872 129 ;;
djm@6872 130 mov r8=r32
djm@6872 131 ;;
awilliam@9479 132 XEN_CLEAR_PSR_IC
djm@6872 133 ;;
djm@6872 134 XEN_HYPER_SET_ITM
djm@6872 135 ;;
awilliam@9479 136 XEN_RESTORE_PSR_IC
djm@6872 137 ;;
djm@6872 138 br.ret.sptk.many rp
djm@6872 139 ;;
djm@6872 140 END(xen_set_itm)
djm@6872 141
djm@6872 142 GLOBAL_ENTRY(xen_ptcga)
djm@6872 143 movl r8=running_on_xen;;
djm@6872 144 ld4 r8=[r8];;
djm@6872 145 cmp.eq p7,p0=r8,r0;;
djm@6872 146 (p7) ptc.ga r32,r33;;
djm@6872 147 (p7) br.ret.sptk.many rp
djm@6872 148 ;;
djm@6872 149 mov r8=r32
djm@6872 150 mov r9=r33
djm@6872 151 ;;
awilliam@9479 152 XEN_CLEAR_PSR_IC
djm@6872 153 ;;
djm@6872 154 XEN_HYPER_PTC_GA
djm@6872 155 ;;
awilliam@9479 156 XEN_RESTORE_PSR_IC
djm@6872 157 ;;
djm@6872 158 br.ret.sptk.many rp
djm@6872 159 ;;
djm@6872 160 END(xen_ptcga)
djm@6872 161
djm@6872 162 GLOBAL_ENTRY(xen_get_rr)
djm@6872 163 movl r8=running_on_xen;;
djm@6872 164 ld4 r8=[r8];;
djm@6872 165 cmp.eq p7,p0=r8,r0;;
djm@6872 166 (p7) mov r8=rr[r32];;
djm@6872 167 (p7) br.ret.sptk.many rp
djm@6872 168 ;;
djm@6872 169 mov r8=r32
djm@6872 170 ;;
awilliam@9479 171 XEN_CLEAR_PSR_IC
djm@6872 172 ;;
djm@6872 173 XEN_HYPER_GET_RR
djm@6872 174 ;;
awilliam@9479 175 XEN_RESTORE_PSR_IC
djm@6872 176 ;;
djm@6872 177 br.ret.sptk.many rp
djm@6872 178 ;;
djm@6872 179 END(xen_get_rr)
djm@6872 180
djm@6872 181 GLOBAL_ENTRY(xen_set_rr)
djm@6872 182 movl r8=running_on_xen;;
djm@6872 183 ld4 r8=[r8];;
djm@6872 184 cmp.eq p7,p0=r8,r0;;
djm@6872 185 (p7) mov rr[r32]=r33;;
djm@6872 186 (p7) br.ret.sptk.many rp
djm@6872 187 ;;
djm@6872 188 mov r8=r32
djm@6872 189 mov r9=r33
djm@6872 190 ;;
awilliam@9479 191 XEN_CLEAR_PSR_IC
djm@6872 192 ;;
djm@6872 193 XEN_HYPER_SET_RR
djm@6872 194 ;;
awilliam@9479 195 XEN_RESTORE_PSR_IC
djm@6872 196 ;;
djm@6872 197 br.ret.sptk.many rp
djm@6872 198 ;;
djm@6872 199 END(xen_set_rr)
djm@6872 200
djm@7145 201 GLOBAL_ENTRY(xen_set_kr)
djm@7145 202 movl r8=running_on_xen;;
djm@7145 203 ld4 r8=[r8];;
djm@7145 204 cmp.ne p7,p0=r8,r0;;
djm@7145 205 (p7) br.cond.spnt.few 1f;
djm@7145 206 ;;
djm@7145 207 cmp.eq p7,p0=r8,r0
djm@7145 208 adds r8=-1,r8;;
djm@7145 209 (p7) mov ar0=r9
djm@7145 210 (p7) br.ret.sptk.many rp;;
djm@7145 211 cmp.eq p7,p0=r8,r0
djm@7145 212 adds r8=-1,r8;;
djm@7145 213 (p7) mov ar1=r9
djm@7145 214 (p7) br.ret.sptk.many rp;;
djm@7145 215 cmp.eq p7,p0=r8,r0
djm@7145 216 adds r8=-1,r8;;
djm@7145 217 (p7) mov ar2=r9
djm@7145 218 (p7) br.ret.sptk.many rp;;
djm@7145 219 cmp.eq p7,p0=r8,r0
djm@7145 220 adds r8=-1,r8;;
djm@7145 221 (p7) mov ar3=r9
djm@7145 222 (p7) br.ret.sptk.many rp;;
djm@7145 223 cmp.eq p7,p0=r8,r0
djm@7145 224 adds r8=-1,r8;;
djm@7145 225 (p7) mov ar4=r9
djm@7145 226 (p7) br.ret.sptk.many rp;;
djm@7145 227 cmp.eq p7,p0=r8,r0
djm@7145 228 adds r8=-1,r8;;
djm@7145 229 (p7) mov ar5=r9
djm@7145 230 (p7) br.ret.sptk.many rp;;
djm@7145 231 cmp.eq p7,p0=r8,r0
djm@7145 232 adds r8=-1,r8;;
djm@7145 233 (p7) mov ar6=r9
djm@7145 234 (p7) br.ret.sptk.many rp;;
djm@7145 235 cmp.eq p7,p0=r8,r0
djm@7145 236 adds r8=-1,r8;;
djm@7145 237 (p7) mov ar7=r9
djm@7145 238 (p7) br.ret.sptk.many rp;;
djm@7145 239
awilliam@9479 240 1: mov r8=r32
djm@7145 241 mov r9=r33
djm@7145 242 ;;
awilliam@9479 243 XEN_CLEAR_PSR_IC
djm@7145 244 ;;
djm@7145 245 XEN_HYPER_SET_KR
djm@7145 246 ;;
awilliam@9479 247 XEN_RESTORE_PSR_IC
djm@7145 248 ;;
djm@7145 249 br.ret.sptk.many rp
awilliam@10008 250 END(xen_set_kr)
djm@7145 251
djm@6872 252 GLOBAL_ENTRY(xen_fc)
djm@6872 253 movl r8=running_on_xen;;
djm@6872 254 ld4 r8=[r8];;
djm@6872 255 cmp.eq p7,p0=r8,r0;;
djm@6872 256 (p7) fc r32;;
djm@6872 257 (p7) br.ret.sptk.many rp
djm@6872 258 ;;
awilliam@9274 259 mov r8=r32
awilliam@9274 260 ;;
awilliam@9479 261 XEN_CLEAR_PSR_IC
awilliam@9274 262 ;;
awilliam@9274 263 XEN_HYPER_FC
awilliam@9274 264 ;;
awilliam@9479 265 XEN_RESTORE_PSR_IC
djm@6872 266 ;;
djm@6872 267 br.ret.sptk.many rp
djm@6872 268 END(xen_fc)
djm@6872 269
djm@6872 270 GLOBAL_ENTRY(xen_get_cpuid)
djm@6872 271 movl r8=running_on_xen;;
djm@6872 272 ld4 r8=[r8];;
djm@6872 273 cmp.eq p7,p0=r8,r0;;
djm@6872 274 (p7) mov r8=cpuid[r32];;
djm@6872 275 (p7) br.ret.sptk.many rp
djm@6872 276 ;;
awilliam@9274 277 mov r8=r32
awilliam@9274 278 ;;
awilliam@9479 279 XEN_CLEAR_PSR_IC
awilliam@9274 280 ;;
awilliam@9274 281 XEN_HYPER_GET_CPUID
awilliam@9274 282 ;;
awilliam@9479 283 XEN_RESTORE_PSR_IC
djm@6872 284 ;;
djm@6872 285 br.ret.sptk.many rp
djm@6872 286 END(xen_get_cpuid)
djm@6872 287
djm@6872 288 GLOBAL_ENTRY(xen_get_pmd)
djm@6872 289 movl r8=running_on_xen;;
djm@6872 290 ld4 r8=[r8];;
djm@6872 291 cmp.eq p7,p0=r8,r0;;
djm@6872 292 (p7) mov r8=pmd[r32];;
djm@6872 293 (p7) br.ret.sptk.many rp
djm@6872 294 ;;
awilliam@9274 295 mov r8=r32
awilliam@9274 296 ;;
awilliam@9479 297 XEN_CLEAR_PSR_IC
awilliam@9274 298 ;;
awilliam@9274 299 XEN_HYPER_GET_PMD
awilliam@9274 300 ;;
awilliam@9479 301 XEN_RESTORE_PSR_IC
djm@6872 302 ;;
djm@6872 303 br.ret.sptk.many rp
djm@6872 304 END(xen_get_pmd)
djm@6872 305
djm@6872 306 #ifdef CONFIG_IA32_SUPPORT
djm@6872 307 GLOBAL_ENTRY(xen_get_eflag)
djm@6872 308 movl r8=running_on_xen;;
djm@6872 309 ld4 r8=[r8];;
djm@6872 310 cmp.eq p7,p0=r8,r0;;
djm@6872 311 (p7) mov r8=ar24;;
djm@6872 312 (p7) br.ret.sptk.many rp
djm@6872 313 ;;
awilliam@9274 314 mov r8=r32
awilliam@9274 315 ;;
awilliam@9479 316 XEN_CLEAR_PSR_IC
awilliam@9274 317 ;;
awilliam@9274 318 XEN_HYPER_GET_EFLAG
awilliam@9274 319 ;;
awilliam@9479 320 XEN_RESTORE_PSR_IC
djm@6872 321 ;;
djm@6872 322 br.ret.sptk.many rp
djm@6872 323 END(xen_get_eflag)
awilliam@9274 324
djm@6872 325 // some bits aren't set if pl!=0, see SDM vol1 3.1.8
djm@6872 326 GLOBAL_ENTRY(xen_set_eflag)
djm@6872 327 movl r8=running_on_xen;;
djm@6872 328 ld4 r8=[r8];;
djm@6872 329 cmp.eq p7,p0=r8,r0;;
djm@6872 330 (p7) mov ar24=r32
djm@6872 331 (p7) br.ret.sptk.many rp
djm@6872 332 ;;
awilliam@9274 333 mov r8=r32
awilliam@9274 334 ;;
awilliam@9479 335 XEN_CLEAR_PSR_IC
awilliam@9274 336 ;;
awilliam@9274 337 XEN_HYPER_SET_EFLAG
awilliam@9274 338 ;;
awilliam@9479 339 XEN_RESTORE_PSR_IC
djm@6872 340 ;;
djm@6872 341 br.ret.sptk.many rp
awilliam@9274 342 END(xen_set_eflag)
djm@6872 343 #endif
awilliam@9752 344
awilliam@9752 345 GLOBAL_ENTRY(xen_send_ipi)
awilliam@9752 346 mov r14=r32
awilliam@9752 347 mov r15=r33
awilliam@9985 348 mov r2=0x400
awilliam@9752 349 break 0x1000
awilliam@9752 350 ;;
awilliam@9752 351 br.ret.sptk.many rp
awilliam@9752 352 ;;
awilliam@9752 353 END(xen_send_ipi)
awilliam@10703 354
awilliam@10703 355 #ifdef CONFIG_XEN_IA64_VDSO_PARAVIRT
awilliam@10703 356 // Those are vdso specialized.
awilliam@10703 357 // In fsys mode, call, ret can't be used.
awilliam@10703 358 GLOBAL_ENTRY(xen_rsm_be_i)
awilliam@10703 359 ld8 r22=[r22]
awilliam@10703 360 ;;
awilliam@10703 361 st1 [r22]=r20
awilliam@10703 362 st4 [r23]=r0
awilliam@10703 363 XEN_HYPER_RSM_BE
awilliam@10703 364 st4 [r23]=r20
awilliam@10703 365 brl.cond.sptk .vdso_rsm_be_i_ret
awilliam@10703 366 ;;
awilliam@10703 367 END(xen_rsm_be_i)
awilliam@10703 368
awilliam@10703 369 GLOBAL_ENTRY(xen_get_psr)
awilliam@10703 370 mov r31=r8
awilliam@10703 371 mov r25=IA64_PSR_IC
awilliam@10703 372 st4 [r23]=r0
awilliam@10703 373 XEN_HYPER_GET_PSR
awilliam@10703 374 ;;
awilliam@10703 375 st4 [r23]=r20
awilliam@10703 376 or r29=r8,r25 // vpsr.ic was cleared for hyperprivop
awilliam@10703 377 mov r8=r31
awilliam@10703 378 brl.cond.sptk .vdso_get_psr_ret
awilliam@10703 379 ;;
awilliam@10703 380 END(xen_get_psr)
awilliam@10703 381
awilliam@10703 382 GLOBAL_ENTRY(xen_ssm_i_0)
awilliam@10703 383 st4 [r22]=r20
awilliam@10703 384 ld4 r25=[r24]
awilliam@10703 385 ;;
awilliam@10703 386 cmp.ne.unc p11,p0=r0, r25
awilliam@10703 387 ;;
awilliam@10703 388 (p11) st4 [r22]=r0
awilliam@10703 389 (p11) st4 [r23]=r0
awilliam@10703 390 (p11) XEN_HYPER_SSM_I
awilliam@10703 391
awilliam@10703 392 brl.cond.sptk .vdso_ssm_i_0_ret
awilliam@10703 393 ;;
awilliam@10703 394 END(xen_ssm_i_0)
awilliam@10703 395
awilliam@10703 396 GLOBAL_ENTRY(xen_ssm_i_1)
awilliam@10703 397 st4 [r22]=r20
awilliam@10703 398 ld4 r25=[r24]
awilliam@10703 399 ;;
awilliam@10703 400 cmp.ne.unc p11,p0=r0, r25
awilliam@10703 401 ;;
awilliam@10703 402 (p11) st4 [r22]=r0
awilliam@10703 403 (p11) st4 [r23]=r0
awilliam@10703 404 (p11) XEN_HYPER_SSM_I
awilliam@10703 405 ;;
awilliam@10703 406 brl.cond.sptk .vdso_ssm_i_1_ret
awilliam@10703 407 ;;
awilliam@10703 408 END(xen_ssm_i_1)
awilliam@10703 409 #endif