ia64/xen-unstable

changeset 13370:809043a22786

[IA64] Implement hyper_get_psr

Mov from psr is used frequently by xeno.

Signed-of-by: Anthony Xu <anthony.xu@intel.com>
author awilliam@xenbuild2.aw
date Fri Jan 12 13:01:25 2007 -0700 (2007-01-12)
parents c1b98df7386d
children 43c5302ee92d
files 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/xenpal.S linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h xen/arch/ia64/asm-xsi-offsets.c xen/arch/ia64/xen/hyperprivop.S
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S	Fri Jan 12 12:56:20 2007 -0700
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/hypercall.S	Fri Jan 12 13:01:25 2007 -0700
     1.3 @@ -8,6 +8,19 @@
     1.4  #include <asm/processor.h>
     1.5  #include <asm/asmmacro.h>
     1.6  
     1.7 +GLOBAL_ENTRY(xen_get_psr)
     1.8 +	movl r8=running_on_xen;;
     1.9 +	ld4 r8=[r8];;
    1.10 +	cmp.eq p7,p0=r8,r0;;
    1.11 +(p7)	mov r8=psr;;
    1.12 +(p7)	br.ret.sptk.many rp
    1.13 +	;;
    1.14 +	XEN_HYPER_GET_PSR
    1.15 +	;;
    1.16 +	br.ret.sptk.many rp
    1.17 +	;;
    1.18 +END(xen_get_psr)
    1.19 +
    1.20  GLOBAL_ENTRY(xen_get_ivr)
    1.21  	movl r8=running_on_xen;;
    1.22  	ld4 r8=[r8];;
     2.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S	Fri Jan 12 12:56:20 2007 -0700
     2.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xenentry.S	Fri Jan 12 13:01:25 2007 -0700
     2.3 @@ -412,7 +412,16 @@ ENTRY(ia64_leave_syscall)
     2.4  (pUStk) add r14=IA64_TASK_THREAD_ON_USTACK_OFFSET,r13
     2.5  	;;
     2.6  	ld8 r26=[r2],PT(B0)-PT(AR_PFS)	// M0|1 load ar.pfs
     2.7 +#ifdef CONFIG_XEN
     2.8 +(pKStk)	mov r21=r8
     2.9 +(pKStk)	XEN_HYPER_GET_PSR
    2.10 +	;;
    2.11 +(pKStk)	mov r22=r8
    2.12 +(pKStk)	mov r8=r21
    2.13 +	;;
    2.14 +#else    
    2.15  (pKStk)	mov r22=psr			// M2   read PSR now that interrupts are disabled
    2.16 +#endif
    2.17  	nop 0
    2.18  	;;
    2.19  	ld8 r21=[r2],PT(AR_RNAT)-PT(B0) // M0|1 load b0
    2.20 @@ -642,7 +651,16 @@ GLOBAL_ENTRY(ia64_leave_kernel)
    2.21  	adds r16=PT(CR_IPSR)+16,r12
    2.22  	adds r17=PT(CR_IIP)+16,r12
    2.23  
    2.24 +#ifdef CONFIG_XEN    
    2.25 +(pKStk)	mov r29=r8
    2.26 +(pKStk)	XEN_HYPER_GET_PSR
    2.27 +	;;
    2.28 +(pKStk)	mov r22=r8
    2.29 +(pKStk)	mov r8=r29
    2.30 +	;;
    2.31 +#else
    2.32  (pKStk)	mov r22=psr		// M2 read PSR now that interrupts are disabled
    2.33 +#endif
    2.34  	nop.i 0
    2.35  	nop.i 0
    2.36  	;;
     3.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xenpal.S	Fri Jan 12 12:56:20 2007 -0700
     3.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xenpal.S	Fri Jan 12 13:01:25 2007 -0700
     3.3 @@ -33,7 +33,16 @@ 1:	{
     3.4  	mov loc4=ar.rsc			// save RSE configuration
     3.5  	;;
     3.6  	mov ar.rsc=0			// put RSE in enforced lazy, LE mode
     3.7 +#ifdef CONFIG_XEN
     3.8 +	mov r9 = r8
     3.9 +	XEN_HYPER_GET_PSR
    3.10 +	;;
    3.11 +	mov loc3 = r8
    3.12 +	mov r8 = r9
    3.13 +	;;
    3.14 +#else    
    3.15  	mov loc3 = psr
    3.16 +#endif    
    3.17  	mov loc0 = rp
    3.18  	.body
    3.19  	mov r30 = in2
     4.1 --- a/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h	Fri Jan 12 12:56:20 2007 -0700
     4.2 +++ b/linux-2.6-xen-sparse/include/asm-ia64/xen/privop.h	Fri Jan 12 13:01:25 2007 -0700
     4.3 @@ -182,6 +182,7 @@ extern void xen_set_eflag(unsigned long)
     4.4   * be properly handled by Xen, some are frequent enough that we use
     4.5   * hyperprivops for performance. */
     4.6  
     4.7 +extern unsigned long xen_get_psr(void);
     4.8  extern unsigned long xen_get_ivr(void);
     4.9  extern unsigned long xen_get_tpr(void);
    4.10  extern void xen_set_itm(unsigned long);
    4.11 @@ -201,6 +202,11 @@ extern void xen_ptcga(unsigned long addr
    4.12  	__u64 ia64_intri_res;						\
    4.13  									\
    4.14  	switch(regnum) {						\
    4.15 +	case _IA64_REG_PSR:						\
    4.16 +		ia64_intri_res = (is_running_on_xen()) ?			\
    4.17 +			xen_get_psr() :					\
    4.18 +			__ia64_getreg(regnum);				\
    4.19 +		break;							\
    4.20  	case _IA64_REG_CR_IVR:						\
    4.21  		ia64_intri_res = (is_running_on_xen()) ?			\
    4.22  			xen_get_ivr() :					\
     5.1 --- a/xen/arch/ia64/asm-xsi-offsets.c	Fri Jan 12 12:56:20 2007 -0700
     5.2 +++ b/xen/arch/ia64/asm-xsi-offsets.c	Fri Jan 12 13:01:25 2007 -0700
     5.3 @@ -62,6 +62,7 @@ void foo(void)
     5.4  	DEFINE_MAPPED_REG_OFS(XSI_ITV_OFS, itv);
     5.5  	DEFINE_MAPPED_REG_OFS(XSI_PTA_OFS, pta);
     5.6  	DEFINE_MAPPED_REG_OFS(XSI_PSR_IC_OFS, interrupt_collection_enabled);
     5.7 +	DEFINE_MAPPED_REG_OFS(XSI_VPSR_PP_OFS, vpsr_pp);
     5.8  	DEFINE_MAPPED_REG_OFS(XSI_METAPHYS_OFS, metaphysical_mode);
     5.9  	DEFINE_MAPPED_REG_OFS(XSI_BANKNUM_OFS, banknum);
    5.10  	DEFINE_MAPPED_REG_OFS(XSI_BANK0_R16_OFS, bank0_regs[0]);
     6.1 --- a/xen/arch/ia64/xen/hyperprivop.S	Fri Jan 12 12:56:20 2007 -0700
     6.2 +++ b/xen/arch/ia64/xen/hyperprivop.S	Fri Jan 12 13:01:25 2007 -0700
     6.3 @@ -140,6 +140,11 @@ GLOBAL_ENTRY(fast_hyperprivop)
     6.4  (p7)	br.sptk.many hyper_get_rr
     6.5  	;;
     6.6  
     6.7 +	// HYPERPRIVOP_GET_PSR?
     6.8 +	cmp.eq p7,p6=HYPERPRIVOP_GET_PSR,r17
     6.9 +(p7)	br.sptk.many hyper_get_psr
    6.10 +	;;
    6.11 +
    6.12  	// HYPERPRIVOP_PTC_GA?
    6.13  	cmp.eq p7,p6=HYPERPRIVOP_PTC_GA,r17
    6.14  (p7)	br.sptk.many hyper_ptc_ga
    6.15 @@ -1460,6 +1465,53 @@ 1:	mov r24=cr.ipsr
    6.16  	;;
    6.17  END(hyper_set_itm)
    6.18  
    6.19 +ENTRY(hyper_get_psr)
    6.20 +#ifdef FAST_HYPERPRIVOP_CNT
    6.21 +	movl r20=FAST_HYPERPRIVOP_PERFC(HYPERPRIVOP_GET_PSR);;
    6.22 +	ld4 r21=[r20];;
    6.23 +	adds r21=1,r21;;
    6.24 +	st4 [r20]=r21;;
    6.25 +#endif
    6.26 +	mov r24=cr.ipsr
    6.27 +	movl r8=0x18ffffffff;;
    6.28 +	// only return PSR{36:35,31:0}
    6.29 +	and r8=r8,r24
    6.30 +	// set vpsr.ic
    6.31 +	ld4 r21=[r18];;
    6.32 +	dep r8=r21,r8,IA64_PSR_IC_BIT,1
    6.33 +	// set vpsr.pp
    6.34 +	adds r20=XSI_VPSR_PP_OFS-XSI_PSR_IC_OFS,r18 ;;
    6.35 +	ld1 r21=[r20];;
    6.36 +	dep r8=r21,r8,IA64_PSR_PP_BIT,1
    6.37 +	// set vpsr.dt
    6.38 +	adds r20=XSI_METAPHYS_OFS-XSI_PSR_IC_OFS,r18 ;;
    6.39 +	ld4 r21=[r20];;
    6.40 +	cmp.ne p6,p0=r21,r0
    6.41 +	;;
    6.42 +(p6)	dep.z r8=r8,IA64_PSR_DT_BIT,1
    6.43 +	// set vpsr.i
    6.44 +	adds r20=XSI_PSR_I_ADDR_OFS-XSI_PSR_IC_OFS,r18 ;;
    6.45 +	ld8 r20=[r20];;
    6.46 +	ld1 r21=[r20];;
    6.47 +	dep r8=r21,r8,IA64_PSR_I_BIT,1
    6.48 +	;;
    6.49 +	mov r25=cr.iip
    6.50 +	extr.u r26=r24,41,2 ;;
    6.51 +	cmp.eq p6,p7=2,r26 ;;
    6.52 +(p6)	mov r26=0
    6.53 +(p6)	adds r25=16,r25
    6.54 +(p7)	adds r26=1,r26
    6.55 +	;;
    6.56 +	dep r24=r26,r24,41,2
    6.57 +	;;
    6.58 +	mov cr.ipsr=r24
    6.59 +	mov cr.iip=r25
    6.60 +	mov pr=r31,-1 ;;
    6.61 +	rfi
    6.62 +	;;
    6.63 +END(hyper_get_psr)
    6.64 +
    6.65 +    
    6.66  ENTRY(hyper_get_rr)
    6.67  #ifdef FAST_HYPERPRIVOP_CNT
    6.68  	movl r20=FAST_HYPERPRIVOP_PERFC(HYPERPRIVOP_GET_RR);;