direct-io.hg

changeset 6437:fd61ce502c71

Removing KR to PER CPU memory.
signed-off-by Eddie(Eddie.dong@intel.com)
author ydong@localhost.localdomain
date Mon Aug 15 14:52:20 2005 +0800 (2005-08-15)
parents 90c6abbd4a59
children 12ddc012238a
files xen/arch/ia64/asm-offsets.c xen/arch/ia64/hyperprivop.S xen/arch/ia64/ivt.S xen/arch/ia64/linux-xen/entry.S xen/arch/ia64/linux-xen/head.S xen/arch/ia64/linux-xen/setup.c xen/arch/ia64/linux/minstate.h xen/arch/ia64/xenmisc.c xen/include/asm-ia64/linux-xen/asm/processor.h
line diff
     1.1 --- a/xen/arch/ia64/asm-offsets.c	Fri Aug 12 11:16:25 2005 +0800
     1.2 +++ b/xen/arch/ia64/asm-offsets.c	Mon Aug 15 14:52:20 2005 +0800
     1.3 @@ -296,4 +296,11 @@ void foo(void)
     1.4  	//DEFINE(IA64_TIME_SOURCE_MMIO64, TIME_SOURCE_MMIO64);
     1.5  	//DEFINE(IA64_TIME_SOURCE_MMIO32, TIME_SOURCE_MMIO32);
     1.6  	//DEFINE(IA64_TIMESPEC_TV_NSEC_OFFSET, offsetof (struct timespec, tv_nsec));
     1.7 +	DEFINE(IA64_KR_CURRENT_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_CURRENT]));
     1.8 +	DEFINE(IA64_KR_PT_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_PT_BASE]));
     1.9 +	DEFINE(IA64_KR_IO_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_IO_BASE]));
    1.10 +	DEFINE(IA64_KR_PERCPU_DATA_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_PER_CPU_DATA]));
    1.11 +	DEFINE(IA64_KR_IO_BASE_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_IO_BASE]));
    1.12 +	DEFINE(IA64_KR_CURRENT_STACK_OFFSET, offsetof (cpu_kr_ia64_t, _kr[IA64_KR_CURRENT_STACK]));
    1.13 +
    1.14  }
     2.1 --- a/xen/arch/ia64/hyperprivop.S	Fri Aug 12 11:16:25 2005 +0800
     2.2 +++ b/xen/arch/ia64/hyperprivop.S	Mon Aug 15 14:52:20 2005 +0800
     2.3 @@ -73,7 +73,8 @@ GLOBAL_ENTRY(fast_hyperprivop)
     2.4  	ld4 r20=[r20] ;;
     2.5  	cmp.eq p7,p0=r0,r20
     2.6  (p7)	br.cond.sptk.many 1f
     2.7 -	mov r20=IA64_KR(CURRENT);;
     2.8 +	movl r20=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
     2.9 +	ld8 r20=[r20];;
    2.10  	adds r21=IA64_VCPU_IRR0_OFFSET,r20;
    2.11  	adds r22=IA64_VCPU_IRR0_OFFSET+8,r20;;
    2.12  	ld8 r23=[r21],16; ld8 r24=[r22],16;;
    2.13 @@ -257,7 +258,8 @@ ENTRY(hyper_ssm_i)
    2.14  	st8 [r21]=r20 ;;
    2.15  	// leave cr.ifs alone for later rfi
    2.16  	// set iip to go to domain IVA break instruction vector
    2.17 -	mov r22=IA64_KR(CURRENT);;
    2.18 +	movl r22=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
    2.19 +	ld8 r22=[r22];;
    2.20  	adds r22=IA64_VCPU_IVA_OFFSET,r22;;
    2.21  	ld8 r23=[r22];;
    2.22  	movl r24=0x3000;;
    2.23 @@ -340,7 +342,8 @@ GLOBAL_ENTRY(fast_tick_reflect)
    2.24  (p6)	br.cond.spnt.few fast_tick_reflect_done;;
    2.25  	extr.u r27=r20,0,6	// r27 has low 6 bits of itv.vector
    2.26  	extr.u r26=r20,6,2;;	// r26 has irr index of itv.vector
    2.27 -	mov r19=IA64_KR(CURRENT);;
    2.28 +	movl r19=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
    2.29 +	ld8 r19=[r19];;
    2.30  	adds r22=IA64_VCPU_DOMAIN_ITM_LAST_OFFSET,r19
    2.31  	adds r23=IA64_VCPU_DOMAIN_ITM_OFFSET,r19;;
    2.32  	ld8 r24=[r22];;
    2.33 @@ -581,7 +584,8 @@ ENTRY(fast_reflect)
    2.34  	st8 [r18]=r0;;
    2.35  	// FIXME: need to save iipa and isr to be arch-compliant
    2.36  	// set iip to go to domain IVA break instruction vector
    2.37 -	mov r22=IA64_KR(CURRENT);;
    2.38 +	movl r22=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
    2.39 +	ld8 r22=[r22];;
    2.40  	adds r22=IA64_VCPU_IVA_OFFSET,r22;;
    2.41  	ld8 r23=[r22];;
    2.42  	add r20=r20,r23;;
    2.43 @@ -803,7 +807,8 @@ GLOBAL_ENTRY(rfi_check_extint)
    2.44  
    2.45  	// r18=&vpsr.i|vpsr.ic, r21==vpsr, r22=vcr.iip
    2.46  	// make sure none of these get trashed in case going to just_do_rfi
    2.47 -	mov r30=IA64_KR(CURRENT);;
    2.48 +	movl r30=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
    2.49 +	ld8 r30=[r30];;
    2.50  	adds r24=IA64_VCPU_INSVC3_OFFSET,r30;;
    2.51  	mov r25=192
    2.52  	adds r16=IA64_VCPU_IRR3_OFFSET,r30;;
    2.53 @@ -1010,7 +1015,8 @@ ENTRY(hyper_ssm_dt)
    2.54  	ld4 r21=[r20];;
    2.55  	cmp.eq p7,p0=r21,r0	// meta==0?
    2.56  (p7)	br.spnt.many	1f ;;	// already in virtual mode
    2.57 -	mov r22=IA64_KR(CURRENT);;
    2.58 +	movl r22=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
    2.59 +	ld8 r22=[r22];;
    2.60  	adds r22=IA64_VCPU_META_SAVED_RR0_OFFSET,r22;;
    2.61  	ld4 r23=[r22];;
    2.62  	mov rr[r0]=r23;;
    2.63 @@ -1045,7 +1051,8 @@ ENTRY(hyper_rsm_dt)
    2.64  	ld4 r21=[r20];;
    2.65  	cmp.ne p7,p0=r21,r0	// meta==0?
    2.66  (p7)	br.spnt.many	1f ;;	// already in metaphysical mode
    2.67 -	mov r22=IA64_KR(CURRENT);;
    2.68 +	movl r22=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
    2.69 +	ld8 r22=[r22];;
    2.70  	adds r22=IA64_VCPU_META_RR0_OFFSET,r22;;
    2.71  	ld4 r23=[r22];;
    2.72  	mov rr[r0]=r23;;
    2.73 @@ -1137,7 +1144,8 @@ ENTRY(hyper_get_ivr)
    2.74  (p7)	adds r20=XSI_PEND_OFS-XSI_PSR_IC_OFS,r18 ;;
    2.75  (p7)	st4 [r20]=r0;;
    2.76  (p7)	br.spnt.many 1f ;;
    2.77 -	mov r30=IA64_KR(CURRENT);;
    2.78 +	movl r30=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
    2.79 +	ld8 r30=[r30];;
    2.80  	adds r24=IA64_VCPU_INSVC3_OFFSET,r30;;
    2.81  	mov r25=192
    2.82  	adds r22=IA64_VCPU_IRR3_OFFSET,r30;;
    2.83 @@ -1242,7 +1250,8 @@ ENTRY(hyper_eoi)
    2.84  	adds r21=1,r21;;
    2.85  	st8 [r20]=r21;;
    2.86  #endif
    2.87 -	mov r22=IA64_KR(CURRENT);;
    2.88 +	movl r22=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
    2.89 +	ld8 r22=[r22];;
    2.90  	adds r22=IA64_VCPU_INSVC3_OFFSET,r22;;
    2.91  	ld8 r23=[r22];;
    2.92  	cmp.eq p6,p0=r23,r0;;
    2.93 @@ -1307,7 +1316,8 @@ ENTRY(hyper_set_itm)
    2.94  #endif
    2.95  	movl r20=THIS_CPU(cpu_info)+IA64_CPUINFO_ITM_NEXT_OFFSET;;
    2.96  	ld8 r21=[r20];;
    2.97 -	mov r20=IA64_KR(CURRENT);;
    2.98 +	movl r20=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
    2.99 +	ld8 r20=[r20];;
   2.100  	adds r20=IA64_VCPU_DOMAIN_ITM_OFFSET,r20;;
   2.101  	st8 [r20]=r8;;
   2.102  	cmp.geu p6,p0=r21,r8;;
   2.103 @@ -1378,7 +1388,8 @@ ENTRY(hyper_set_rr)
   2.104  	st8 [r20]=r21;;
   2.105  #endif
   2.106  	extr.u r26=r9,8,24	// r26 = r9.rid
   2.107 -	mov r20=IA64_KR(CURRENT);;
   2.108 +	movl r20=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
   2.109 +	ld8 r20=[r20];;
   2.110  	adds r21=IA64_VCPU_STARTING_RID_OFFSET,r20;;
   2.111  	ld4 r22=[r21];;
   2.112  	adds r21=IA64_VCPU_ENDING_RID_OFFSET,r20;;
   2.113 @@ -1544,7 +1555,8 @@ 2:
   2.114  	mov ar.lc=r30 ;;
   2.115  	mov r29=cr.ipsr
   2.116  	mov r30=cr.iip;;
   2.117 -	mov r27=IA64_KR(CURRENT);;
   2.118 +	movl r27=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
   2.119 +	ld8 r27=[r27];;
   2.120  	adds r25=IA64_VCPU_DTLB_OFFSET,r27
   2.121  	adds r26=IA64_VCPU_ITLB_OFFSET,r27;;
   2.122  	ld8 r24=[r25]
     3.1 --- a/xen/arch/ia64/ivt.S	Fri Aug 12 11:16:25 2005 +0800
     3.2 +++ b/xen/arch/ia64/ivt.S	Mon Aug 15 14:52:20 2005 +0800
     3.3 @@ -833,7 +833,9 @@ ENTRY(break_fault)
     3.4  	cmp4.eq p7,p0=r0,r19
     3.5  (p7)	br.sptk.many fast_hyperprivop
     3.6  	;;
     3.7 -	mov r22=IA64_KR(CURRENT);;
     3.8 +	movl r22=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
     3.9 +	ld8 r22 = [r22]
    3.10 +	;;
    3.11  	adds r22=IA64_VCPU_BREAKIMM_OFFSET,r22;;
    3.12  	ld4 r23=[r22];;
    3.13  	cmp4.eq p6,p7=r23,r17			// Xen-reserved breakimm?
    3.14 @@ -842,7 +844,8 @@ ENTRY(break_fault)
    3.15  	br.sptk.many fast_break_reflect
    3.16  	;;
    3.17  #endif
    3.18 -	mov r16=IA64_KR(CURRENT)		// r16 = current task; 12 cycle read lat.
    3.19 +	movl r16=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
    3.20 +	ld8 r16=[r16]
    3.21  	mov r17=cr.iim
    3.22  	mov r18=__IA64_BREAK_SYSCALL
    3.23  	mov r21=ar.fpsr
     4.1 --- a/xen/arch/ia64/linux-xen/entry.S	Fri Aug 12 11:16:25 2005 +0800
     4.2 +++ b/xen/arch/ia64/linux-xen/entry.S	Mon Aug 15 14:52:20 2005 +0800
     4.3 @@ -191,7 +191,8 @@ GLOBAL_ENTRY(ia64_switch_to)
     4.4  
     4.5  	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
     4.6  	movl r25=init_task
     4.7 -	mov r27=IA64_KR(CURRENT_STACK)
     4.8 +	movl r27=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_STACK_OFFSET;;
     4.9 +	ld8 r27=[r27]
    4.10  	adds r21=IA64_TASK_THREAD_KSP_OFFSET,in0
    4.11  #ifdef XEN
    4.12  	dep r20=0,in0,60,4		// physical address of "next"
    4.13 @@ -214,7 +215,8 @@ GLOBAL_ENTRY(ia64_switch_to)
    4.14  	;;
    4.15  (p6)	srlz.d
    4.16  	ld8 sp=[r21]			// load kernel stack pointer of new task
    4.17 -	mov IA64_KR(CURRENT)=in0	// update "current" application register
    4.18 +	movl r8=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
    4.19 +	st8 [r8]=in0
    4.20  	mov r8=r13			// return pointer to previously running task
    4.21  	mov r13=in0			// set "current" pointer
    4.22  	;;
    4.23 @@ -233,7 +235,8 @@ GLOBAL_ENTRY(ia64_switch_to)
    4.24  	;;
    4.25  	cmp.eq p7,p0=r25,r23
    4.26  	;;
    4.27 -(p7)	mov IA64_KR(CURRENT_STACK)=r26	// remember last page we mapped...
    4.28 +(p7)	movl r8=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_STACK_OFFSET;;
    4.29 +(p7)	st8 [r8]=r26
    4.30  (p7)	br.cond.sptk .done
    4.31  #endif
    4.32  	rsm psr.ic			// interrupts (psr.i) are already disabled here
    4.33 @@ -247,8 +250,8 @@ GLOBAL_ENTRY(ia64_switch_to)
    4.34  	mov cr.ifa=in0			// VA of next task...
    4.35  	;;
    4.36  	mov r25=IA64_TR_CURRENT_STACK
    4.37 -	mov IA64_KR(CURRENT_STACK)=r26	// remember last page we mapped...
    4.38 -	;;
    4.39 +	movl r8=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_STACK_OFFSET;;
    4.40 +	st8 [r8]=r26
    4.41  	itr.d dtr[r25]=r23		// wire in new mapping...
    4.42  	br.cond.sptk .done
    4.43  END(ia64_switch_to)
    4.44 @@ -947,7 +950,8 @@ GLOBAL_ENTRY(ia64_leave_kernel)
    4.45  	ldf.fill f11=[r2]
    4.46  	bsw.0			// switch back to bank 0 (no stop bit required beforehand...)
    4.47  	;;
    4.48 -(pUStk)	mov r18=IA64_KR(CURRENT)// M2 (12 cycle read latency)
    4.49 +(pUStk) movl r18=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;
    4.50 +(pUStk) ld8 r18=[r18]
    4.51  	adds r16=PT(CR_IPSR)+16,r12
    4.52  	adds r17=PT(CR_IIP)+16,r12
    4.53  
     5.1 --- a/xen/arch/ia64/linux-xen/head.S	Fri Aug 12 11:16:25 2005 +0800
     5.2 +++ b/xen/arch/ia64/linux-xen/head.S	Mon Aug 15 14:52:20 2005 +0800
     5.3 @@ -226,8 +226,6 @@ 1:	// now we are in virtual mode
     5.4  	bsw.1
     5.5  	;;
     5.6  #else // CONFIG_VTI
     5.7 -	mov IA64_KR(CURRENT)=r2		// virtual address
     5.8 -	mov IA64_KR(CURRENT_STACK)=r16
     5.9  #endif // CONFIG_VTI
    5.10  	mov r13=r2
    5.11  	/*
     6.1 --- a/xen/arch/ia64/linux-xen/setup.c	Fri Aug 12 11:16:25 2005 +0800
     6.2 +++ b/xen/arch/ia64/linux-xen/setup.c	Mon Aug 15 14:52:20 2005 +0800
     6.3 @@ -66,6 +66,7 @@ EXPORT_SYMBOL(__per_cpu_offset);
     6.4  #endif
     6.5  
     6.6  DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info);
     6.7 +DEFINE_PER_CPU(cpu_kr_ia64_t, cpu_kr);
     6.8  DEFINE_PER_CPU(unsigned long, local_per_cpu_offset);
     6.9  DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8);
    6.10  unsigned long ia64_cycles_per_usec;
    6.11 @@ -261,9 +262,9 @@ io_port_init (void)
    6.12  	phys_iobase = efi_get_iobase();
    6.13  	if (phys_iobase)
    6.14  		/* set AR.KR0 since this is all we use it for anyway */
    6.15 -		ia64_set_kr(IA64_KR_IO_BASE, phys_iobase);
    6.16 +		__get_cpu_var(cpu_kr)._kr[IA64_KR_IO_BASE]=phys_iobase;
    6.17  	else {
    6.18 -		phys_iobase = ia64_get_kr(IA64_KR_IO_BASE);
    6.19 +		phys_iobase=__get_cpu_var(cpu_kr)._kr[IA64_KR_IO_BASE];
    6.20  		printk(KERN_INFO "No I/O port range found in EFI memory map, falling back "
    6.21  		       "to AR.KR0\n");
    6.22  		printk(KERN_INFO "I/O port base = 0x%lx\n", phys_iobase);
    6.23 @@ -610,6 +611,8 @@ void
    6.24  setup_per_cpu_areas (void)
    6.25  {
    6.26  	/* start_kernel() requires this... */
    6.27 +	__get_cpu_var(cpu_kr)._kr[IA64_KR_CURRENT] = current;
    6.28 +	__get_cpu_var(cpu_kr)._kr[IA64_KR_CURRENT_STACK] = -1;
    6.29  }
    6.30  
    6.31  static void
    6.32 @@ -667,8 +670,8 @@ cpu_init (void)
    6.33  	 * physical addresses of per cpu variables with a simple:
    6.34  	 *   phys = ar.k3 + &per_cpu_var
    6.35  	 */
    6.36 -	ia64_set_kr(IA64_KR_PER_CPU_DATA,
    6.37 -		    ia64_tpa(cpu_data) - (long) __per_cpu_start);
    6.38 +//	ia64_set_kr(IA64_KR_PER_CPU_DATA,
    6.39 +//		    ia64_tpa(cpu_data) - (long) __per_cpu_start);
    6.40  
    6.41  	get_max_cacheline_size();
    6.42  
    6.43 @@ -698,7 +701,7 @@ cpu_init (void)
    6.44  	/* Clear the stack memory reserved for pt_regs: */
    6.45  	memset(ia64_task_regs(current), 0, sizeof(struct pt_regs));
    6.46  
    6.47 -	ia64_set_kr(IA64_KR_FPU_OWNER, 0);
    6.48 +	__get_cpu_var(cpu_kr)._kr[IA64_KR_FPU_OWNER] = 0;
    6.49  
    6.50  	/*
    6.51  	 * Initialize default control register to defer all speculative faults.  The
     7.1 --- a/xen/arch/ia64/linux/minstate.h	Fri Aug 12 11:16:25 2005 +0800
     7.2 +++ b/xen/arch/ia64/linux/minstate.h	Mon Aug 15 14:52:20 2005 +0800
     7.3 @@ -61,7 +61,9 @@
     7.4  	;;
     7.5  
     7.6  #ifdef MINSTATE_VIRT
     7.7 -# define MINSTATE_GET_CURRENT(reg)	mov reg=IA64_KR(CURRENT)
     7.8 +# define MINSTATE_GET_CURRENT(reg)	\
     7.9 +		movl reg=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;\
    7.10 +		ld8 reg=[reg]
    7.11  # define MINSTATE_START_SAVE_MIN	MINSTATE_START_SAVE_MIN_VIRT
    7.12  # define MINSTATE_END_SAVE_MIN		MINSTATE_END_SAVE_MIN_VIRT
    7.13  #endif
    7.14 @@ -170,7 +172,8 @@
    7.15  	;;											\
    7.16  .mem.offset 0,0; st8.spill [r16]=r13,16;							\
    7.17  .mem.offset 8,0; st8.spill [r17]=r21,16;	/* save ar.fpsr */				\
    7.18 -	mov r13=IA64_KR(CURRENT);	/* establish `current' */				\
    7.19 +	movl r13=THIS_CPU(cpu_kr)+IA64_KR_CURRENT_OFFSET;;					\
    7.20 +	ld8 r13=[r13];			/* establish 'current' */				\
    7.21  	;;											\
    7.22  .mem.offset 0,0; st8.spill [r16]=r15,16;							\
    7.23  .mem.offset 8,0; st8.spill [r17]=r14,16;							\
     8.1 --- a/xen/arch/ia64/xenmisc.c	Fri Aug 12 11:16:25 2005 +0800
     8.2 +++ b/xen/arch/ia64/xenmisc.c	Mon Aug 15 14:52:20 2005 +0800
     8.3 @@ -347,7 +347,8 @@ void panic_domain(struct pt_regs *regs, 
     8.4      
     8.5  loop:
     8.6  	printf("$$$$$ PANIC in domain %d (k6=%p): ",
     8.7 -		v->domain->domain_id, ia64_get_kr(IA64_KR_CURRENT));
     8.8 +		v->domain->domain_id, 
     8.9 +		__get_cpu_var(cpu_kr)._kr[IA64_KR_CURRENT]);
    8.10  	va_start(args, fmt);
    8.11  	(void)vsnprintf(buf, sizeof(buf), fmt, args);
    8.12  	va_end(args);
     9.1 --- a/xen/include/asm-ia64/linux-xen/asm/processor.h	Fri Aug 12 11:16:25 2005 +0800
     9.2 +++ b/xen/include/asm-ia64/linux-xen/asm/processor.h	Mon Aug 15 14:52:20 2005 +0800
     9.3 @@ -183,6 +183,22 @@ struct cpuinfo_ia64 {
     9.4  
     9.5  DECLARE_PER_CPU(struct cpuinfo_ia64, cpu_info);
     9.6  
     9.7 +typedef union {
     9.8 +	struct {
     9.9 +		__u64 kr0;
    9.10 +		__u64 kr1;
    9.11 +		__u64 kr2;
    9.12 +		__u64 kr3;
    9.13 +		__u64 kr4;
    9.14 +		__u64 kr5;
    9.15 +		__u64 kr6;
    9.16 +		__u64 kr7;
    9.17 +	};
    9.18 +	__u64 _kr[8];
    9.19 +} cpu_kr_ia64_t;
    9.20 +
    9.21 +DECLARE_PER_CPU(cpu_kr_ia64_t, cpu_kr);
    9.22 +
    9.23  /*
    9.24   * The "local" data variable.  It refers to the per-CPU data of the currently executing
    9.25   * CPU, much like "current" points to the per-task data of the currently executing task.