ia64/xen-unstable

changeset 13109:99ff540b0efe

[IA64] remove the requirement (vpsr.ic==0) from hyperprivop

remove the requirement (vpsr.ic==0) from hyperprivop

There two reasons for this.
1. make xen-parse code more readable.
2. a little bit performance improvement

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
author awilliam@xenbuild2.aw
date Tue Jan 02 16:27:50 2007 -0700 (2007-01-02)
parents a50fd1fed61e
children f69a329a4778
files linux-2.6-xen-sparse/arch/ia64/kernel/gate.S linux-2.6-xen-sparse/arch/ia64/kernel/gate.lds.S linux-2.6-xen-sparse/arch/ia64/kernel/patch.c linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S linux-2.6-xen-sparse/arch/ia64/xen/xenivt.S linux-2.6-xen-sparse/arch/ia64/xen/xenpal.S linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h xen/arch/ia64/xen/faults.c xen/arch/ia64/xen/ivt.S xen/include/public/arch-ia64.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/gate.S	Tue Jan 02 15:19:44 2007 -0700
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/gate.S	Tue Jan 02 16:27:50 2007 -0700
     1.3 @@ -57,18 +57,6 @@
     1.4  [1:]	movl reg=0;					\
     1.5  	.xdata4 ".data.patch.running_on_xen", 1b-.
     1.6  
     1.7 -	.section ".data.patch.brl_xen_rsm_be_i", "a"
     1.8 -	.previous
     1.9 -#define BRL_COND_XEN_RSM_BE_I(pr)			\
    1.10 -[1:](pr)brl.cond.sptk 0;				\
    1.11 -	.xdata4 ".data.patch.brl_xen_rsm_be_i", 1b-.
    1.12 -
    1.13 -	.section ".data.patch.brl_xen_get_psr", "a"
    1.14 -	.previous
    1.15 -#define BRL_COND_XEN_GET_PSR(pr)			\
    1.16 -[1:](pr)brl.cond.sptk 0;				\
    1.17 -	.xdata4 ".data.patch.brl_xen_get_psr", 1b-.
    1.18 -
    1.19  	.section ".data.patch.brl_xen_ssm_i_0", "a"
    1.20  	.previous
    1.21  #define BRL_COND_XEN_SSM_I_0(pr)			\
    1.22 @@ -156,9 +144,9 @@ GLOBAL_ENTRY(__kernel_syscall_via_epc)
    1.23  	cmp.ne isXen,isRaw=r0,r30
    1.24  	;;
    1.25  (isRaw)	rsm psr.be | psr.i
    1.26 -	BRL_COND_XEN_RSM_BE_I(isXen)
    1.27 -	.global .vdso_rsm_be_i_ret
    1.28 -.vdso_rsm_be_i_ret:
    1.29 +(isXen)	st1 [r22]=r20
    1.30 +(isXen)	XEN_HYPER_RSM_BE
    1.31 +	;;
    1.32  #else
    1.33  	rsm psr.be | psr.i			// M2 (5 cyc to srlz.d)
    1.34  #endif
    1.35 @@ -171,9 +159,9 @@ GLOBAL_ENTRY(__kernel_syscall_via_epc)
    1.36  	lfetch [r18]				// M0|1
    1.37  #ifdef CONFIG_XEN_IA64_VDSO_PARAVIRT
    1.38  (isRaw)	mov r29=psr
    1.39 -	BRL_COND_XEN_GET_PSR(isXen)
    1.40 -	.global .vdso_get_psr_ret
    1.41 -.vdso_get_psr_ret:
    1.42 +(isXen)	XEN_HYPER_GET_PSR
    1.43 +	;;
    1.44 +(isXen)	mov r29=r8
    1.45  #else
    1.46  	mov r29=psr				// M2 (12 cyc)
    1.47  #endif
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/gate.lds.S	Tue Jan 02 15:19:44 2007 -0700
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/gate.lds.S	Tue Jan 02 16:27:50 2007 -0700
     2.3 @@ -50,14 +50,6 @@ SECTIONS
     2.4  				    *(.data.patch.running_on_xen)
     2.5  				    __end_gate_running_on_xen_patchlist = .;
     2.6  
     2.7 -				    __start_gate_brl_xen_rsm_be_i_patchlist = .;
     2.8 -				    *(.data.patch.brl_xen_rsm_be_i)
     2.9 -				    __end_gate_brl_xen_rsm_be_i_patchlist = .;
    2.10 -
    2.11 -				    __start_gate_brl_xen_get_psr_patchlist = .;
    2.12 -				    *(.data.patch.brl_xen_get_psr)
    2.13 -				    __end_gate_brl_xen_get_psr_patchlist = .;
    2.14 -
    2.15  				    __start_gate_brl_xen_ssm_i_0_patchlist = .;
    2.16  				    *(.data.patch.brl_xen_ssm_i_0)
    2.17  				    __end_gate_brl_xen_ssm_i_0_patchlist = .;
     3.1 --- a/linux-2.6-xen-sparse/arch/ia64/kernel/patch.c	Tue Jan 02 15:19:44 2007 -0700
     3.2 +++ b/linux-2.6-xen-sparse/arch/ia64/kernel/patch.c	Tue Jan 02 16:27:50 2007 -0700
     3.3 @@ -236,13 +236,9 @@ patch_brl_symaddr(unsigned long start, u
     3.4  static void
     3.5  patch_brl_in_vdso(void)
     3.6  {
     3.7 -	EXTERN_PATCHLIST(xen_rsm_be_i);
     3.8 -	EXTERN_PATCHLIST(xen_get_psr);
     3.9  	EXTERN_PATCHLIST(xen_ssm_i_0);
    3.10  	EXTERN_PATCHLIST(xen_ssm_i_1);
    3.11  
    3.12 -	PATCH_BRL_SYMADDR(xen_rsm_be_i);
    3.13 -	PATCH_BRL_SYMADDR(xen_get_psr);
    3.14  	PATCH_BRL_SYMADDR(xen_ssm_i_0);
    3.15  	PATCH_BRL_SYMADDR(xen_ssm_i_1);
    3.16  }
     4.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S	Tue Jan 02 15:19:44 2007 -0700
     4.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S	Tue Jan 02 16:27:50 2007 -0700
     4.3 @@ -8,27 +8,6 @@
     4.4  #include <asm/processor.h>
     4.5  #include <asm/asmmacro.h>
     4.6  
     4.7 -/* To clear vpsr.ic, vpsr.i needs to be cleared first */
     4.8 -#define XEN_CLEAR_PSR_IC				\
     4.9 -	mov r14=1;					\
    4.10 -	movl r15=XSI_PSR_I_ADDR;			\
    4.11 -	movl r2=XSI_PSR_IC;				\
    4.12 -	;;						\
    4.13 -	ld8 r15=[r15];					\
    4.14 -	ld4 r3=[r2];					\
    4.15 -	;;						\
    4.16 -	ld1 r16=[r15];					\
    4.17 -	;;						\
    4.18 -	st1 [r15]=r14;					\
    4.19 -	st4 [r2]=r0;					\
    4.20 -	;;
    4.21 -
    4.22 -/* First restore vpsr.ic, and then vpsr.i */
    4.23 -#define XEN_RESTORE_PSR_IC				\
    4.24 -	st4 [r2]=r3;					\
    4.25 -	st1 [r15]=r16;					\
    4.26 -	;;
    4.27 -
    4.28  GLOBAL_ENTRY(xen_get_ivr)
    4.29  	movl r8=running_on_xen;;
    4.30  	ld4 r8=[r8];;
    4.31 @@ -36,12 +15,8 @@ GLOBAL_ENTRY(xen_get_ivr)
    4.32  (p7)	mov r8=cr.ivr;;
    4.33  (p7)	br.ret.sptk.many rp
    4.34  	;;
    4.35 -	XEN_CLEAR_PSR_IC
    4.36 -	;;
    4.37  	XEN_HYPER_GET_IVR
    4.38  	;;
    4.39 -	XEN_RESTORE_PSR_IC
    4.40 -	;;
    4.41  	br.ret.sptk.many rp
    4.42  	;;
    4.43  END(xen_get_ivr)
    4.44 @@ -53,12 +28,8 @@ GLOBAL_ENTRY(xen_get_tpr)
    4.45  (p7)	mov r8=cr.tpr;;
    4.46  (p7)	br.ret.sptk.many rp
    4.47  	;;
    4.48 -	XEN_CLEAR_PSR_IC
    4.49 -	;;
    4.50  	XEN_HYPER_GET_TPR
    4.51  	;;
    4.52 -	XEN_RESTORE_PSR_IC
    4.53 -	;;
    4.54  	br.ret.sptk.many rp
    4.55  	;;
    4.56  END(xen_get_tpr)
    4.57 @@ -72,12 +43,8 @@ GLOBAL_ENTRY(xen_set_tpr)
    4.58  	;;
    4.59  	mov r8=r32
    4.60  	;;
    4.61 -	XEN_CLEAR_PSR_IC
    4.62 -	;;
    4.63  	XEN_HYPER_SET_TPR
    4.64  	;;
    4.65 -	XEN_RESTORE_PSR_IC
    4.66 -	;;
    4.67  	br.ret.sptk.many rp
    4.68  	;;
    4.69  END(xen_set_tpr)
    4.70 @@ -91,12 +58,8 @@ GLOBAL_ENTRY(xen_eoi)
    4.71  	;;
    4.72  	mov r8=r32
    4.73  	;;
    4.74 -	XEN_CLEAR_PSR_IC
    4.75 -	;;
    4.76  	XEN_HYPER_EOI
    4.77  	;;
    4.78 -	XEN_RESTORE_PSR_IC
    4.79 -	;;
    4.80  	br.ret.sptk.many rp
    4.81  	;;
    4.82  END(xen_eoi)
    4.83 @@ -110,12 +73,8 @@ GLOBAL_ENTRY(xen_thash)
    4.84  	;;
    4.85  	mov r8=r32
    4.86  	;;
    4.87 -	XEN_CLEAR_PSR_IC
    4.88 -	;;
    4.89  	XEN_HYPER_THASH
    4.90  	;;
    4.91 -	XEN_RESTORE_PSR_IC
    4.92 -	;;
    4.93  	br.ret.sptk.many rp
    4.94  	;;
    4.95  END(xen_thash)
    4.96 @@ -129,12 +88,8 @@ GLOBAL_ENTRY(xen_set_itm)
    4.97  	;;
    4.98  	mov r8=r32
    4.99  	;;
   4.100 -	XEN_CLEAR_PSR_IC
   4.101 -	;;
   4.102  	XEN_HYPER_SET_ITM
   4.103  	;;
   4.104 -	XEN_RESTORE_PSR_IC
   4.105 -	;;
   4.106  	br.ret.sptk.many rp
   4.107  	;;
   4.108  END(xen_set_itm)
   4.109 @@ -149,12 +104,8 @@ GLOBAL_ENTRY(xen_ptcga)
   4.110  	mov r8=r32
   4.111  	mov r9=r33
   4.112  	;;
   4.113 -	XEN_CLEAR_PSR_IC
   4.114 -	;;
   4.115  	XEN_HYPER_PTC_GA
   4.116  	;;
   4.117 -	XEN_RESTORE_PSR_IC
   4.118 -	;;
   4.119  	br.ret.sptk.many rp
   4.120  	;;
   4.121  END(xen_ptcga)
   4.122 @@ -168,12 +119,8 @@ GLOBAL_ENTRY(xen_get_rr)
   4.123  	;;
   4.124  	mov r8=r32
   4.125  	;;
   4.126 -	XEN_CLEAR_PSR_IC
   4.127 -	;;
   4.128  	XEN_HYPER_GET_RR
   4.129  	;;
   4.130 -	XEN_RESTORE_PSR_IC
   4.131 -	;;
   4.132  	br.ret.sptk.many rp
   4.133  	;;
   4.134  END(xen_get_rr)
   4.135 @@ -188,12 +135,8 @@ GLOBAL_ENTRY(xen_set_rr)
   4.136  	mov r8=r32
   4.137  	mov r9=r33
   4.138  	;;
   4.139 -	XEN_CLEAR_PSR_IC
   4.140 -	;;
   4.141  	XEN_HYPER_SET_RR
   4.142  	;;
   4.143 -	XEN_RESTORE_PSR_IC
   4.144 -	;;
   4.145  	br.ret.sptk.many rp
   4.146  	;;
   4.147  END(xen_set_rr)
   4.148 @@ -240,12 +183,8 @@ GLOBAL_ENTRY(xen_set_kr)
   4.149  1:	mov r8=r32
   4.150  	mov r9=r33
   4.151  	;;
   4.152 -	XEN_CLEAR_PSR_IC
   4.153 -	;;
   4.154  	XEN_HYPER_SET_KR
   4.155  	;;
   4.156 -	XEN_RESTORE_PSR_IC
   4.157 -	;;
   4.158  	br.ret.sptk.many rp
   4.159  END(xen_set_kr)
   4.160  
   4.161 @@ -258,12 +197,8 @@ GLOBAL_ENTRY(xen_fc)
   4.162  	;;
   4.163  	mov r8=r32
   4.164  	;;
   4.165 -	XEN_CLEAR_PSR_IC
   4.166 -	;;
   4.167  	XEN_HYPER_FC
   4.168  	;;
   4.169 -	XEN_RESTORE_PSR_IC
   4.170 -	;;
   4.171  	br.ret.sptk.many rp
   4.172  END(xen_fc)
   4.173  
   4.174 @@ -276,12 +211,8 @@ GLOBAL_ENTRY(xen_get_cpuid)
   4.175  	;;
   4.176  	mov r8=r32
   4.177  	;;
   4.178 -	XEN_CLEAR_PSR_IC
   4.179 -	;;
   4.180  	XEN_HYPER_GET_CPUID
   4.181  	;;
   4.182 -	XEN_RESTORE_PSR_IC
   4.183 -	;;
   4.184  	br.ret.sptk.many rp
   4.185  END(xen_get_cpuid)
   4.186  
   4.187 @@ -294,12 +225,8 @@ GLOBAL_ENTRY(xen_get_pmd)
   4.188  	;;
   4.189  	mov r8=r32
   4.190  	;;
   4.191 -	XEN_CLEAR_PSR_IC
   4.192 -	;;
   4.193  	XEN_HYPER_GET_PMD
   4.194  	;;
   4.195 -	XEN_RESTORE_PSR_IC
   4.196 -	;;
   4.197  	br.ret.sptk.many rp
   4.198  END(xen_get_pmd)
   4.199  
   4.200 @@ -313,12 +240,8 @@ GLOBAL_ENTRY(xen_get_eflag)
   4.201  	;;
   4.202  	mov r8=r32
   4.203  	;;
   4.204 -	XEN_CLEAR_PSR_IC
   4.205 -	;;
   4.206  	XEN_HYPER_GET_EFLAG
   4.207  	;;
   4.208 -	XEN_RESTORE_PSR_IC
   4.209 -	;;
   4.210  	br.ret.sptk.many rp
   4.211  END(xen_get_eflag)
   4.212  	
   4.213 @@ -332,12 +255,8 @@ GLOBAL_ENTRY(xen_set_eflag)
   4.214  	;;
   4.215  	mov r8=r32
   4.216  	;;
   4.217 -	XEN_CLEAR_PSR_IC
   4.218 -	;;
   4.219  	XEN_HYPER_SET_EFLAG
   4.220  	;;
   4.221 -	XEN_RESTORE_PSR_IC
   4.222 -	;;
   4.223  	br.ret.sptk.many rp
   4.224  END(xen_set_eflag)
   4.225  #endif
   4.226 @@ -355,27 +274,6 @@ END(xen_send_ipi)
   4.227  #ifdef CONFIG_XEN_IA64_VDSO_PARAVIRT
   4.228  // Those are vdso specialized.
   4.229  // In fsys mode, call, ret can't be used.
   4.230 -GLOBAL_ENTRY(xen_rsm_be_i)
   4.231 -	st1 [r22]=r20
   4.232 -	st4 [r23]=r0
   4.233 -	XEN_HYPER_RSM_BE
   4.234 -	st4 [r23]=r20
   4.235 -	brl.cond.sptk	.vdso_rsm_be_i_ret
   4.236 -	;; 
   4.237 -END(xen_rsm_be_i)
   4.238 -
   4.239 -GLOBAL_ENTRY(xen_get_psr)
   4.240 -	mov r31=r8
   4.241 -	mov r25=IA64_PSR_IC
   4.242 -	st4 [r23]=r0
   4.243 -	XEN_HYPER_GET_PSR
   4.244 -	;; 
   4.245 -	st4 [r23]=r20
   4.246 -	or r29=r8,r25 // vpsr.ic was cleared for hyperprivop
   4.247 -	mov r8=r31
   4.248 -	brl.cond.sptk	.vdso_get_psr_ret
   4.249 -	;; 
   4.250 -END(xen_get_psr)
   4.251  
   4.252  	// see xen_ssm_i() in privop.h
   4.253  	// r22 = &vcpu->vcpu_info->evtchn_upcall_mask
   4.254 @@ -395,7 +293,6 @@ END(xen_get_psr)
   4.255  (p14)	cmp.ne.unc p11,p0=r0,r25;	\
   4.256  	;;				\
   4.257  (p11)	st1 [r22]=r20;			\
   4.258 -(p11)	st4 [r23]=r0;			\
   4.259  (p11)	XEN_HYPER_SSM_I;
   4.260  		
   4.261  GLOBAL_ENTRY(xen_ssm_i_0)
     5.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S	Tue Jan 02 15:19:44 2007 -0700
     5.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S	Tue Jan 02 16:27:50 2007 -0700
     5.3 @@ -59,12 +59,6 @@ GLOBAL_ENTRY(ia64_switch_to)
     5.4  	shr.u r26=r20,IA64_GRANULE_SHIFT
     5.5  	cmp.eq p7,p6=r25,in0
     5.6  	;;
     5.7 -#ifdef CONFIG_XEN
     5.8 -	movl r8=XSI_PSR_IC
     5.9 -	;;
    5.10 -	st4 [r8]=r0	// force psr.ic off for hyperprivop(s)
    5.11 -	;;
    5.12 -#endif
    5.13  	/*
    5.14  	 * If we've already mapped this task's page, we can skip doing it again.
    5.15  	 */
    5.16 @@ -72,19 +66,13 @@ GLOBAL_ENTRY(ia64_switch_to)
    5.17  (p6)	br.cond.dpnt .map
    5.18  	;;
    5.19  .done:
    5.20 +	ld8 sp=[r21]			// load kernel stack pointer of new task
    5.21  #ifdef CONFIG_XEN
    5.22 -	// psr.ic already off
    5.23  	// update "current" application register
    5.24  	mov r8=IA64_KR_CURRENT
    5.25  	mov r9=in0;;
    5.26  	XEN_HYPER_SET_KR
    5.27 -	ld8 sp=[r21]			// load kernel stack pointer of new task
    5.28 -	movl r27=XSI_PSR_IC
    5.29 -	mov r8=1
    5.30 -	;;
    5.31 -	st4 [r27]=r8			// psr.ic back on
    5.32  #else
    5.33 -	ld8 sp=[r21]			// load kernel stack pointer of new task
    5.34  	mov IA64_KR(CURRENT)=in0	// update "current" application register
    5.35  #endif
    5.36  	mov r8=r13			// return pointer to previously running task
    5.37 @@ -99,7 +87,10 @@ GLOBAL_ENTRY(ia64_switch_to)
    5.38  
    5.39  .map:
    5.40  #ifdef CONFIG_XEN
    5.41 -	// psr.ic already off
    5.42 +    movl r25=XSI_PSR_IC			// clear psr.ic
    5.43 +    ;;
    5.44 +    st4 [r25]=r0
    5.45 +    ;;
    5.46  #else
    5.47  	rsm psr.ic			// interrupts (psr.i) are already disabled here
    5.48  #endif
    5.49 @@ -132,7 +123,13 @@ GLOBAL_ENTRY(ia64_switch_to)
    5.50  #endif
    5.51  	;;
    5.52  	itr.d dtr[r25]=r23		// wire in new mapping...
    5.53 -#ifndef CONFIG_XEN
    5.54 +#ifdef CONFIG_XEN
    5.55 +	mov r9=1
    5.56 +	movl r8=XSI_PSR_IC
    5.57 +	;;
    5.58 +	st4 [r8]=r9
    5.59 +	;;
    5.60 +#else    
    5.61  	ssm psr.ic			// reenable the psr.ic bit
    5.62  	;;
    5.63  	srlz.d
     6.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xenivt.S	Tue Jan 02 15:19:44 2007 -0700
     6.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xenivt.S	Tue Jan 02 16:27:50 2007 -0700
     6.3 @@ -709,11 +709,23 @@ ENTRY(page_fault)
     6.4  	;;
     6.5  #endif
     6.6  #ifdef CONFIG_XEN
     6.7 -	br.cond.sptk.many	xen_page_fault
     6.8 +    
     6.9 +#define MASK_TO_PEND_OFS    (-1)
    6.10 +    
    6.11 +(p15)	movl r14=XSI_PSR_I_ADDR
    6.12 +	;;
    6.13 +(p15)	ld8 r14=[r14]
    6.14  	;;
    6.15 -done_xen_page_fault:
    6.16 +(p15)	st1 [r14]=r0,MASK_TO_PEND_OFS		// if (p15) vpsr.i = 1
    6.17 +	;;		// if (p15) (vcpu->vcpu_info->evtchn_upcall_mask)=0
    6.18 +(p15)	ld1 r14=[r14]	// if (vcpu->vcpu_info->evtchn_upcall_pending)
    6.19 +	;;
    6.20 +(p15)	cmp.ne	p15,p0=r14,r0
    6.21 +	;;
    6.22 +(p15)	XEN_HYPER_SSM_I
    6.23 +#else
    6.24 +(p15)	ssm psr.i				// restore psr.i
    6.25  #endif
    6.26 -(p15)	ssm psr.i				// restore psr.i
    6.27  	movl r14=ia64_leave_kernel
    6.28  	;;
    6.29  	SAVE_REST
    6.30 @@ -729,25 +741,6 @@ END(page_fault)
    6.31  ENTRY(dkey_miss)
    6.32  	DBG_FAULT(7)
    6.33  	FAULT(7)
    6.34 -#ifdef CONFIG_XEN
    6.35 -	// Leaving this code inline above results in an IVT section overflow
    6.36 -	// There is no particular reason for this code to be here...
    6.37 -xen_page_fault:
    6.38 -(p15)	movl r3=XSI_PSR_I_ADDR
    6.39 -	;;
    6.40 -(p15)	ld8 r3=[r3]
    6.41 -	;;
    6.42 -(p15)	st1 [r3]=r0,-1	// if (p15) vpsr.i = 1
    6.43 -	mov r14=r0
    6.44 -	;;
    6.45 -(p15)	ld1 r14=[r3]				// if (pending_events)
    6.46 -	adds r3=8,r2				// re-set up second base pointer
    6.47 -	;;
    6.48 -(p15)	cmp.ne	p15,p0=r14,r0
    6.49 -	;;
    6.50 -	br.cond.sptk.many done_xen_page_fault
    6.51 -	;;
    6.52 -#endif
    6.53  END(dkey_miss)
    6.54  
    6.55  	.org ia64_ivt+0x2000
    6.56 @@ -1170,14 +1163,13 @@ 1:
    6.57  #ifdef CONFIG_XEN
    6.58  (p15)	ld8 r16=[r16]				// vpsr.i
    6.59  	;;
    6.60 -(p15)	st1 [r16]=r0,-1		// if (p15) vpsr.i = 1
    6.61 -	mov r2=r0
    6.62 +(p15)	st1 [r16]=r0,MASK_TO_PEND_OFS		// if (p15) vpsr.i = 1
    6.63 +	;;		// if (p15) (vcpu->vcpu_info->evtchn_upcall_mask)=0
    6.64 +(p15)	ld1 r2=[r16]	// if (vcpu->vcpu_info->evtchn_upcall_pending)
    6.65  	;;
    6.66 -(p15)	ld1 r2=[r16]				// if (pending_events)
    6.67 +(p15)	cmp.ne.unc p6,p0=r2,r0
    6.68  	;;
    6.69 -	cmp.ne	p6,p0=r2,r0
    6.70 -	;;
    6.71 -(p6)	ssm	psr.i				//   do a real ssm psr.i
    6.72 +(p6)	XEN_HYPER_SSM_I				//   do a real ssm psr.i
    6.73  #else
    6.74  (p15)	ssm psr.i				// M2   restore psr.i
    6.75  #endif
     7.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xenpal.S	Tue Jan 02 15:19:44 2007 -0700
     7.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xenpal.S	Tue Jan 02 16:27:50 2007 -0700
     7.3 @@ -41,16 +41,16 @@ 1:	{
     7.4  #ifdef CONFIG_XEN
     7.5  	// this is low priority for paravirtualization, but is called
     7.6  	// from the idle loop so confuses privop counting
     7.7 -	movl r31=XSI_PSR_IC
     7.8 +	movl r31=XSI_PSR_I_ADDR
     7.9  	;;
    7.10 -(p6)	st4 [r31]=r0
    7.11 +	ld8 r31=[r31]
    7.12 +	mov r22=1
    7.13  	;;
    7.14 -(p7)	adds r31=XSI_PSR_I_ADDR_OFS-XSI_PSR_IC_OFS,r31
    7.15 -(p7)	mov r22=1
    7.16 +	st1 [r31]=r22
    7.17 +	;;  
    7.18 +(p6)	movl r31=XSI_PSR_IC
    7.19  	;;
    7.20 -(p7)	ld8 r31=[r31]
    7.21 -	;;
    7.22 -(p7)	st1 [r31]=r22
    7.23 +(p6)	st4.rel [r31]=r0
    7.24  	;;
    7.25  	mov r31 = in3
    7.26  	mov b7 = loc2
     8.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h	Tue Jan 02 15:19:44 2007 -0700
     8.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h	Tue Jan 02 16:27:50 2007 -0700
     8.3 @@ -123,8 +123,6 @@ extern void xen_set_eflag(unsigned long)
     8.4   * that we inline it */
     8.5  #define xen_hyper_ssm_i()						\
     8.6  ({									\
     8.7 -	xen_set_virtual_psr_i(0);					\
     8.8 -	xen_set_virtual_psr_ic(0);					\
     8.9  	XEN_HYPER_SSM_I;						\
    8.10  })
    8.11  
    8.12 @@ -139,8 +137,12 @@ extern void xen_set_eflag(unsigned long)
    8.13  #define xen_ssm_i()							\
    8.14  ({									\
    8.15  	int old = xen_get_virtual_psr_i();				\
    8.16 -	xen_set_virtual_psr_i(1);					\
    8.17 -	if (!old && xen_get_virtual_pend()) xen_hyper_ssm_i();		\
    8.18 +	if (!old) {							\
    8.19 +		if (xen_get_virtual_pend())				\
    8.20 +			xen_hyper_ssm_i();				\
    8.21 +		else							\
    8.22 +			xen_set_virtual_psr_i(1);			\
    8.23 +	}								\
    8.24  })
    8.25  
    8.26  #define xen_ia64_intrin_local_irq_restore(x)				\
     9.1 --- a/xen/arch/ia64/xen/faults.c	Tue Jan 02 15:19:44 2007 -0700
     9.2 +++ b/xen/arch/ia64/xen/faults.c	Tue Jan 02 16:27:50 2007 -0700
     9.3 @@ -545,7 +545,8 @@ ia64_handle_break(unsigned long ifa, str
     9.4  				vcpu_increment_iip(current);
     9.5  		} else
     9.6  			reflect_interruption(isr, regs, vector);
     9.7 -	} else if (!PSCB(v, interrupt_collection_enabled)) {
     9.8 +	} else if ((iim - HYPERPRIVOP_START) < HYPERPRIVOP_MAX
     9.9 +		   && ia64_get_cpl(regs->cr_ipsr) == 2) {
    9.10  		if (ia64_hyperprivop(iim, regs))
    9.11  			vcpu_increment_iip(current);
    9.12  	} else {
    10.1 --- a/xen/arch/ia64/xen/ivt.S	Tue Jan 02 15:19:44 2007 -0700
    10.2 +++ b/xen/arch/ia64/xen/ivt.S	Tue Jan 02 16:27:50 2007 -0700
    10.3 @@ -1,6 +1,7 @@
    10.4  #ifdef XEN
    10.5  #include <asm/debugger.h>
    10.6  #include <asm/vhpt.h>
    10.7 +#include <public/arch-ia64.h>
    10.8  #endif
    10.9  /*
   10.10   * arch/ia64/kernel/ivt.S
   10.11 @@ -1074,18 +1075,26 @@ ENTRY(break_fault)
   10.12  #endif
   10.13  	movl r18=THIS_CPU(current_psr_ic_addr)
   10.14  	;;
   10.15 -	ld8 r18=[r18]
   10.16 -	;;
   10.17 -	ld4 r19=[r18]
   10.18 +	ld8 r18=[r18]    
   10.19  	;;
   10.20  	cmp.eq p7,p0=r0,r17			// is this a psuedo-cover?
   10.21  (p7)	br.spnt.many dispatch_privop_fault
   10.22  	;;
   10.23 -	// If vpsr.ic is off, we have a hyperprivop.  A hyperprivop is
   10.24 -	// hand-coded assembly with psr.ic off which means it can make
   10.25 -	// no calls, cannot use r1-r15, and it can have no memory accesses
   10.26 -	// unless they are to pinned addresses!
   10.27 -	cmp4.eq p7,p0=r0,r19
   10.28 +	// if (ipsr.cpl == 2 && (iim - HYPERPRIVOP_START) < HYPERPRIVOP_MAX)
   10.29 +	// this is a hyperprivop. A hyperprivop is hand-coded assembly with
   10.30 +	// psr.ic off which means it can make no calls, cannot use r1-r15,
   10.31 +	// and it can have no memory accesses unless they are to pinned
   10.32 +	// addresses!
   10.33 +	mov r19= cr.ipsr
   10.34 +	movl r20=HYPERPRIVOP_START
   10.35 +	mov r21=HYPERPRIVOP_MAX
   10.36 +	;;
   10.37 +	sub r20=r17,r20
   10.38 +	extr.u r19=r19,IA64_PSR_CPL0_BIT,2  // extract cpl field from cr.ipsr
   10.39 +	;;
   10.40 +	cmp.gtu p7,p0=r21,r20
   10.41 +	;;
   10.42 +	cmp.eq.and p7,p0=2,r19			// ipsr.cpl==2
   10.43  (p7)	br.sptk.many fast_hyperprivop
   10.44  	;;
   10.45  	movl r22=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET
    11.1 --- a/xen/include/public/arch-ia64.h	Tue Jan 02 15:19:44 2007 -0700
    11.2 +++ b/xen/include/public/arch-ia64.h	Tue Jan 02 16:27:50 2007 -0700
    11.3 @@ -434,32 +434,33 @@ struct xen_ia64_boot_param {
    11.4  #define XMAPPEDREGS_OFS			XSI_SIZE
    11.5  
    11.6  /* Hyperprivops.  */
    11.7 -#define HYPERPRIVOP_RFI			0x1
    11.8 -#define HYPERPRIVOP_RSM_DT		0x2
    11.9 -#define HYPERPRIVOP_SSM_DT		0x3
   11.10 -#define HYPERPRIVOP_COVER		0x4
   11.11 -#define HYPERPRIVOP_ITC_D		0x5
   11.12 -#define HYPERPRIVOP_ITC_I		0x6
   11.13 -#define HYPERPRIVOP_SSM_I		0x7
   11.14 -#define HYPERPRIVOP_GET_IVR		0x8
   11.15 -#define HYPERPRIVOP_GET_TPR		0x9
   11.16 -#define HYPERPRIVOP_SET_TPR		0xa
   11.17 -#define HYPERPRIVOP_EOI			0xb
   11.18 -#define HYPERPRIVOP_SET_ITM		0xc
   11.19 -#define HYPERPRIVOP_THASH		0xd
   11.20 -#define HYPERPRIVOP_PTC_GA		0xe
   11.21 -#define HYPERPRIVOP_ITR_D		0xf
   11.22 -#define HYPERPRIVOP_GET_RR		0x10
   11.23 -#define HYPERPRIVOP_SET_RR		0x11
   11.24 -#define HYPERPRIVOP_SET_KR		0x12
   11.25 -#define HYPERPRIVOP_FC			0x13
   11.26 -#define HYPERPRIVOP_GET_CPUID		0x14
   11.27 -#define HYPERPRIVOP_GET_PMD		0x15
   11.28 -#define HYPERPRIVOP_GET_EFLAG		0x16
   11.29 -#define HYPERPRIVOP_SET_EFLAG		0x17
   11.30 -#define HYPERPRIVOP_RSM_BE		0x18
   11.31 -#define HYPERPRIVOP_GET_PSR		0x19
   11.32 -#define HYPERPRIVOP_MAX			0x19
   11.33 +#define HYPERPRIVOP_START		0x1
   11.34 +#define HYPERPRIVOP_RFI			(HYPERPRIVOP_START + 0x0)
   11.35 +#define HYPERPRIVOP_RSM_DT		(HYPERPRIVOP_START + 0x1)
   11.36 +#define HYPERPRIVOP_SSM_DT		(HYPERPRIVOP_START + 0x2)
   11.37 +#define HYPERPRIVOP_COVER		(HYPERPRIVOP_START + 0x3)
   11.38 +#define HYPERPRIVOP_ITC_D		(HYPERPRIVOP_START + 0x4)
   11.39 +#define HYPERPRIVOP_ITC_I		(HYPERPRIVOP_START + 0x5)
   11.40 +#define HYPERPRIVOP_SSM_I		(HYPERPRIVOP_START + 0x6)
   11.41 +#define HYPERPRIVOP_GET_IVR		(HYPERPRIVOP_START + 0x7)
   11.42 +#define HYPERPRIVOP_GET_TPR		(HYPERPRIVOP_START + 0x8)
   11.43 +#define HYPERPRIVOP_SET_TPR		(HYPERPRIVOP_START + 0x9)
   11.44 +#define HYPERPRIVOP_EOI			(HYPERPRIVOP_START + 0xa)
   11.45 +#define HYPERPRIVOP_SET_ITM		(HYPERPRIVOP_START + 0xb)
   11.46 +#define HYPERPRIVOP_THASH		(HYPERPRIVOP_START + 0xc)
   11.47 +#define HYPERPRIVOP_PTC_GA		(HYPERPRIVOP_START + 0xd)
   11.48 +#define HYPERPRIVOP_ITR_D		(HYPERPRIVOP_START + 0xe)
   11.49 +#define HYPERPRIVOP_GET_RR		(HYPERPRIVOP_START + 0xf)
   11.50 +#define HYPERPRIVOP_SET_RR		(HYPERPRIVOP_START + 0x10)
   11.51 +#define HYPERPRIVOP_SET_KR		(HYPERPRIVOP_START + 0x11)
   11.52 +#define HYPERPRIVOP_FC			(HYPERPRIVOP_START + 0x12)
   11.53 +#define HYPERPRIVOP_GET_CPUID		(HYPERPRIVOP_START + 0x13)
   11.54 +#define HYPERPRIVOP_GET_PMD		(HYPERPRIVOP_START + 0x14)
   11.55 +#define HYPERPRIVOP_GET_EFLAG		(HYPERPRIVOP_START + 0x15)
   11.56 +#define HYPERPRIVOP_SET_EFLAG		(HYPERPRIVOP_START + 0x16)
   11.57 +#define HYPERPRIVOP_RSM_BE		(HYPERPRIVOP_START + 0x17)
   11.58 +#define HYPERPRIVOP_GET_PSR		(HYPERPRIVOP_START + 0x18)
   11.59 +#define HYPERPRIVOP_MAX			(0x19)
   11.60  
   11.61  /* Fast and light hypercalls.  */
   11.62  #define __HYPERVISOR_ia64_fast_eoi	0x0200