ia64/xen-unstable

changeset 9748:2f86b84d0483

[IA64] more cleanup in vhpt.h

VHPT_CCHAIN_LOOKUP removed, body is now inlined in ivt.S
vhpt_insert() is now written in C.
Cleanup within vhpt.c/.h

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Fri Apr 21 09:06:38 2006 -0600 (2006-04-21)
parents de2dc4e7966a
children 1774144596d5
files xen/arch/ia64/xen/ivt.S xen/arch/ia64/xen/vhpt.c xen/arch/ia64/xen/xenasm.S xen/include/asm-ia64/vhpt.h
line diff
     1.1 --- a/xen/arch/ia64/xen/ivt.S	Fri Apr 21 09:03:19 2006 -0600
     1.2 +++ b/xen/arch/ia64/xen/ivt.S	Fri Apr 21 09:06:38 2006 -0600
     1.3 @@ -249,9 +249,21 @@ END(vhpt_miss)
     1.4  ENTRY(itlb_miss)
     1.5  	DBG_FAULT(1)
     1.6  #ifdef XEN
     1.7 -	VHPT_CCHAIN_LOOKUP(itlb_miss,i)
     1.8 +	mov r31 = pr
     1.9 +	mov r16 = cr.ifa
    1.10 +	;;
    1.11 +	extr.u r17=r16,59,5
    1.12 +	;;
    1.13 +	/* If address belongs to VMM, go to alt tlb handler */
    1.14 +	cmp.eq p6,p0=0x1e,r17
    1.15 +(p6)	br.cond.spnt	late_alt_itlb_miss
    1.16 +	;;
    1.17 +	cmp.eq p6,p0=0x1d,r17
    1.18 +(p6)	br.cond.spnt	late_alt_itlb_miss
    1.19 +	;;
    1.20 +	mov pr = r31, 0x1ffff
    1.21 +	;;							
    1.22  #ifdef VHPT_GLOBAL
    1.23 -//	br.cond.sptk page_fault
    1.24  	br.cond.sptk fast_tlb_miss_reflect
    1.25  	;;
    1.26  #endif
    1.27 @@ -301,14 +313,23 @@ END(itlb_miss)
    1.28  ENTRY(dtlb_miss)
    1.29  	DBG_FAULT(2)
    1.30  #ifdef XEN
    1.31 -	VHPT_CCHAIN_LOOKUP(dtlb_miss,d)
    1.32 +	mov r31=pr
    1.33 +	mov r16=cr.ifa				// get virtual address
    1.34 +	;;
    1.35 +	extr.u r17=r16,59,5
    1.36 +	;;
    1.37 +	/* If address belongs to VMM, go to alt tlb handler */
    1.38 +	cmp.eq p6,p0=0x1e,r17
    1.39 +(p6)	br.cond.spnt	late_alt_dtlb_miss
    1.40 +	;;
    1.41 +	cmp.eq p6,p0=0x1d,r17
    1.42 +(p6)	br.cond.spnt	late_alt_dtlb_miss
    1.43 +	;;
    1.44  #if VHPT_ENABLED
    1.45  	// XXX TODO optimization
    1.46 -	mov r31=pr				// save predicates
    1.47  	mov r30=cr.ipsr
    1.48  	mov r28=cr.iip			
    1.49 -	mov r16=cr.ifa				// get virtual address
    1.50 -	mov r17=cr.isr				// save predicates
    1.51 +	mov r17=cr.isr
    1.52  	;;
    1.53  
    1.54  	extr.u r18 = r30, IA64_PSR_CPL0_BIT, 2	// extract psr.cpl
    1.55 @@ -414,13 +435,6 @@ END(dtlb_miss)
    1.56  ENTRY(alt_itlb_miss)
    1.57  	DBG_FAULT(3)
    1.58  #ifdef XEN
    1.59 -//#ifdef VHPT_GLOBAL
    1.60 -//	VHPT_CCHAIN_LOOKUP(alt_itlb_miss,i)
    1.61 -//	br.cond.sptk page_fault
    1.62 -//	;;
    1.63 -//#endif
    1.64 -#endif
    1.65 -#ifdef XEN
    1.66  	mov r31=pr
    1.67  	mov r16=cr.ifa		// get address that caused the TLB miss
    1.68  	;;
    1.69 @@ -479,13 +493,6 @@ END(alt_itlb_miss)
    1.70  ENTRY(alt_dtlb_miss)
    1.71  	DBG_FAULT(4)
    1.72  #ifdef XEN
    1.73 -//#ifdef VHPT_GLOBAL
    1.74 -//	VHPT_CCHAIN_LOOKUP(alt_dtlb_miss,d)
    1.75 -//	br.cond.sptk page_fault
    1.76 -//	;;
    1.77 -//#endif
    1.78 -#endif
    1.79 -#ifdef XEN
    1.80  	mov r31=pr
    1.81  	mov r16=cr.ifa		// get address that caused the TLB miss
    1.82  	;;
     2.1 --- a/xen/arch/ia64/xen/vhpt.c	Fri Apr 21 09:03:19 2006 -0600
     2.2 +++ b/xen/arch/ia64/xen/vhpt.c	Fri Apr 21 09:06:38 2006 -0600
     2.3 @@ -15,6 +15,8 @@
     2.4  #include <asm/dma.h>
     2.5  #include <asm/vhpt.h>
     2.6  
     2.7 +extern long running_on_sim;
     2.8 +
     2.9  DEFINE_PER_CPU (unsigned long, vhpt_paddr);
    2.10  DEFINE_PER_CPU (unsigned long, vhpt_pend);
    2.11  
    2.12 @@ -101,16 +103,26 @@ static void vhpt_map(unsigned long pte)
    2.13  	ia64_srlz_i();
    2.14  }
    2.15  
    2.16 +void vhpt_insert (unsigned long vadr, unsigned long pte, unsigned long logps)
    2.17 +{
    2.18 +	struct vhpt_lf_entry *vlfe = (struct vhpt_lf_entry *)ia64_thash(vadr);
    2.19 +	unsigned long tag = ia64_ttag (vadr);
    2.20 +
    2.21 +	/* No need to first disable the entry, since VHPT is per LP
    2.22 +	   and VHPT is TR mapped.  */
    2.23 +	vlfe->itir = logps;
    2.24 +	vlfe->page_flags = pte | _PAGE_P;
    2.25 +	vlfe->ti_tag = tag;
    2.26 +}
    2.27 +
    2.28  void vhpt_multiple_insert(unsigned long vaddr, unsigned long pte, unsigned long logps)
    2.29  {
    2.30  	unsigned long mask = (1L << logps) - 1;
    2.31 -	extern long running_on_sim;
    2.32  	int i;
    2.33  
    2.34  	if (logps-PAGE_SHIFT > 10 && !running_on_sim) {
    2.35  		// if this happens, we may want to revisit this algorithm
    2.36 -		printf("vhpt_multiple_insert:logps-PAGE_SHIFT>10,spinning..\n");
    2.37 -		while(1);
    2.38 +		panic("vhpt_multiple_insert:logps-PAGE_SHIFT>10,spinning..\n");
    2.39  	}
    2.40  	if (logps-PAGE_SHIFT > 2) {
    2.41  		// FIXME: Should add counter here to see how often this
    2.42 @@ -151,12 +163,9 @@ void vhpt_init(void)
    2.43  	 * from domain heap when each domain is created. Assume xen buddy
    2.44  	 * allocator can provide natural aligned page by order?
    2.45  	 */
    2.46 -//	vhpt_imva = alloc_xenheap_pages(VHPT_SIZE_LOG2 - PAGE_SHIFT);
    2.47  	page = alloc_domheap_pages(NULL, VHPT_SIZE_LOG2 - PAGE_SHIFT, 0);
    2.48 -	if (!page) {
    2.49 -		printf("vhpt_init: can't allocate VHPT!\n");
    2.50 -		while(1);
    2.51 -	}
    2.52 +	if (!page)
    2.53 +		panic("vhpt_init: can't allocate VHPT!\n");
    2.54  	paddr = page_to_maddr(page);
    2.55  	__get_cpu_var(vhpt_paddr) = paddr;
    2.56  	__get_cpu_var(vhpt_pend) = paddr + vhpt_total_size - 1;
     3.1 --- a/xen/arch/ia64/xen/xenasm.S	Fri Apr 21 09:03:19 2006 -0600
     3.2 +++ b/xen/arch/ia64/xen/xenasm.S	Fri Apr 21 09:06:38 2006 -0600
     3.3 @@ -182,7 +182,7 @@ 1:
     3.4  	mov r21=loc6			// saved vhpt physical address
     3.5  	;;
     3.6  	or r23=r25,r21			// construct PA | page properties
     3.7 -	mov r24=VHPT_PAGE_SHIFT<<2
     3.8 +	mov r24=VHPT_SIZE_LOG2<<2
     3.9  	;;
    3.10  	ptr.d	r22,r24
    3.11  	;;
    3.12 @@ -504,19 +504,6 @@ stacked:
    3.13  	br.ret.sptk.few rp
    3.14  END(pal_emulator_static)
    3.15  
    3.16 -GLOBAL_ENTRY(vhpt_insert)
    3.17 -//	alloc loc0 = ar.pfs, 3, 1, 0, 0
    3.18 -	mov r16=r32
    3.19 -	mov r26=r33
    3.20 -	mov r27=r34
    3.21 -	;;
    3.22 -	VHPT_INSERT()
    3.23 -//	VHPT_INSERT1()	... add collision chains later
    3.24 -//	mov ar.pfs = loc0
    3.25 -	br.ret.sptk.few rp
    3.26 -	;;
    3.27 -END(vhpt_insert)
    3.28 -
    3.29  //  These instructions are copied in the domains.
    3.30  //  This is the virtual PAL, which simply does an hypercall.
    3.31  //  The size is 2 bunldes (32 Bytes).  It handles both static and stacked
     4.1 --- a/xen/include/asm-ia64/vhpt.h	Fri Apr 21 09:03:19 2006 -0600
     4.2 +++ b/xen/include/asm-ia64/vhpt.h	Fri Apr 21 09:06:38 2006 -0600
     4.3 @@ -11,8 +11,6 @@
     4.4  /* Number of entries in the VHPT.  The size of an entry is 4*8B == 32B */
     4.5  #define	VHPT_NUM_ENTRIES		(1 << (VHPT_SIZE_LOG2 - 5))
     4.6  
     4.7 -#define	VHPT_PAGE_SHIFT			VHPT_SIZE_LOG2
     4.8 -
     4.9  #ifdef CONFIG_SMP
    4.10  # define vhpt_flush_all()	smp_vhpt_flush_all()
    4.11  #else
    4.12 @@ -46,8 +44,8 @@ extern void vhpt_flush_address_remote(in
    4.13  				      unsigned long addr_range);
    4.14  extern void vhpt_multiple_insert(unsigned long vaddr, unsigned long pte,
    4.15  				 unsigned long logps);
    4.16 -extern void vhpt_insert (unsigned long vadr, unsigned long ptr,
    4.17 -			 unsigned logps);
    4.18 +extern void vhpt_insert (unsigned long vadr, unsigned long pte,
    4.19 +			 unsigned long logps);
    4.20  extern void vhpt_flush(void);
    4.21  extern void smp_vhpt_flush_all(void);
    4.22  
    4.23 @@ -56,59 +54,4 @@ DECLARE_PER_CPU (unsigned long, vhpt_pad
    4.24  DECLARE_PER_CPU (unsigned long, vhpt_pend);
    4.25  
    4.26  #endif /* !__ASSEMBLY */
    4.27 -
    4.28 -#if !VHPT_ENABLED
    4.29 -#define VHPT_CCHAIN_LOOKUP(Name, i_or_d)
    4.30 -#else
    4.31 -
    4.32 -// VHPT_CCHAIN_LOOKUP is intended to run with psr.i+ic off
    4.33 -#define VHPT_CCHAIN_LOOKUP(Name, i_or_d) 			\
    4.34 -								\
    4.35 -CC_##Name:;							\
    4.36 -	mov r31 = pr;						\
    4.37 -	mov r16 = cr.ifa;					\
    4.38 -	;;							\
    4.39 -	extr.u r17=r16,59,5					\
    4.40 -	;;							\
    4.41 -	/* If address belongs to VMM, go to alt tlb handler */	\
    4.42 -	cmp.eq p6,p0=0x1e,r17;					\
    4.43 -(p6)	br.cond.spnt	late_alt_##Name				\
    4.44 -	;;							\
    4.45 -	cmp.eq p6,p0=0x1d,r17;					\
    4.46 -(p6)	br.cond.spnt	late_alt_##Name				\
    4.47 -	;;							\
    4.48 -	mov pr = r31, 0x1ffff;					\
    4.49 -	;;							
    4.50 -
    4.51 -
    4.52 -/* r16 = vadr, r26 = pte, r27 = logps */ 
    4.53 -#define VHPT_INSERT()					\
    4.54 -	{.mmi;						\
    4.55 -		thash r17 = r16;			\
    4.56 -		or r26 = 1, r26;			\
    4.57 -		nop 0;					\
    4.58 -		;;					\
    4.59 -	};						\
    4.60 -	{.mii;						\
    4.61 -		ttag r21 = r16;				\
    4.62 -		adds r18 = VLE_ITIR_OFFSET, r17;	\
    4.63 -		adds r19 = VLE_PGFLAGS_OFFSET, r17;	\
    4.64 -		;;					\
    4.65 -	};						\
    4.66 -	{.mmi;						\
    4.67 -							\
    4.68 -		st8[r18] = r27;				\
    4.69 -		adds r20 = VLE_TITAG_OFFSET, r17;	\
    4.70 -		nop 0;					\
    4.71 -		;;					\
    4.72 -	};						\
    4.73 -	{.mmb;						\
    4.74 -		st8[r19] = r26;				\
    4.75 -		st8[r20] = r21;				\
    4.76 -		nop 0;					\
    4.77 -		;;					\
    4.78 -	}
    4.79 -
    4.80 -
    4.81 -#endif	/* VHPT_ENABLED */
    4.82  #endif