[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [IA64] more cleanup in vhpt.h



# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID 2f86b84d0483590057006cbdb5a37b685ec7c864
# Parent  de2dc4e7966ab6e43ca8ce4405cf48306a3f1ff0
[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@xxxxxxxx>

diff -r de2dc4e7966a -r 2f86b84d0483 xen/arch/ia64/xen/ivt.S
--- a/xen/arch/ia64/xen/ivt.S   Fri Apr 21 09:03:19 2006 -0600
+++ b/xen/arch/ia64/xen/ivt.S   Fri Apr 21 09:06:38 2006 -0600
@@ -249,9 +249,21 @@ ENTRY(itlb_miss)
 ENTRY(itlb_miss)
        DBG_FAULT(1)
 #ifdef XEN
-       VHPT_CCHAIN_LOOKUP(itlb_miss,i)
+       mov r31 = pr
+       mov r16 = cr.ifa
+       ;;
+       extr.u r17=r16,59,5
+       ;;
+       /* If address belongs to VMM, go to alt tlb handler */
+       cmp.eq p6,p0=0x1e,r17
+(p6)   br.cond.spnt    late_alt_itlb_miss
+       ;;
+       cmp.eq p6,p0=0x1d,r17
+(p6)   br.cond.spnt    late_alt_itlb_miss
+       ;;
+       mov pr = r31, 0x1ffff
+       ;;                                                      
 #ifdef VHPT_GLOBAL
-//     br.cond.sptk page_fault
        br.cond.sptk fast_tlb_miss_reflect
        ;;
 #endif
@@ -301,14 +313,23 @@ ENTRY(dtlb_miss)
 ENTRY(dtlb_miss)
        DBG_FAULT(2)
 #ifdef XEN
-       VHPT_CCHAIN_LOOKUP(dtlb_miss,d)
+       mov r31=pr
+       mov r16=cr.ifa                          // get virtual address
+       ;;
+       extr.u r17=r16,59,5
+       ;;
+       /* If address belongs to VMM, go to alt tlb handler */
+       cmp.eq p6,p0=0x1e,r17
+(p6)   br.cond.spnt    late_alt_dtlb_miss
+       ;;
+       cmp.eq p6,p0=0x1d,r17
+(p6)   br.cond.spnt    late_alt_dtlb_miss
+       ;;
 #if VHPT_ENABLED
        // XXX TODO optimization
-       mov r31=pr                              // save predicates
        mov r30=cr.ipsr
        mov r28=cr.iip                  
-       mov r16=cr.ifa                          // get virtual address
-       mov r17=cr.isr                          // save predicates
+       mov r17=cr.isr
        ;;
 
        extr.u r18 = r30, IA64_PSR_CPL0_BIT, 2  // extract psr.cpl
@@ -414,13 +435,6 @@ ENTRY(alt_itlb_miss)
 ENTRY(alt_itlb_miss)
        DBG_FAULT(3)
 #ifdef XEN
-//#ifdef VHPT_GLOBAL
-//     VHPT_CCHAIN_LOOKUP(alt_itlb_miss,i)
-//     br.cond.sptk page_fault
-//     ;;
-//#endif
-#endif
-#ifdef XEN
        mov r31=pr
        mov r16=cr.ifa          // get address that caused the TLB miss
        ;;
@@ -478,13 +492,6 @@ END(alt_itlb_miss)
 // 0x1000 Entry 4 (size 64 bundles) Alt DTLB (7,46)
 ENTRY(alt_dtlb_miss)
        DBG_FAULT(4)
-#ifdef XEN
-//#ifdef VHPT_GLOBAL
-//     VHPT_CCHAIN_LOOKUP(alt_dtlb_miss,d)
-//     br.cond.sptk page_fault
-//     ;;
-//#endif
-#endif
 #ifdef XEN
        mov r31=pr
        mov r16=cr.ifa          // get address that caused the TLB miss
diff -r de2dc4e7966a -r 2f86b84d0483 xen/arch/ia64/xen/vhpt.c
--- a/xen/arch/ia64/xen/vhpt.c  Fri Apr 21 09:03:19 2006 -0600
+++ b/xen/arch/ia64/xen/vhpt.c  Fri Apr 21 09:06:38 2006 -0600
@@ -14,6 +14,8 @@
 #include <asm/page.h>
 #include <asm/dma.h>
 #include <asm/vhpt.h>
+
+extern long running_on_sim;
 
 DEFINE_PER_CPU (unsigned long, vhpt_paddr);
 DEFINE_PER_CPU (unsigned long, vhpt_pend);
@@ -101,16 +103,26 @@ static void vhpt_map(unsigned long pte)
        ia64_srlz_i();
 }
 
+void vhpt_insert (unsigned long vadr, unsigned long pte, unsigned long logps)
+{
+       struct vhpt_lf_entry *vlfe = (struct vhpt_lf_entry *)ia64_thash(vadr);
+       unsigned long tag = ia64_ttag (vadr);
+
+       /* No need to first disable the entry, since VHPT is per LP
+          and VHPT is TR mapped.  */
+       vlfe->itir = logps;
+       vlfe->page_flags = pte | _PAGE_P;
+       vlfe->ti_tag = tag;
+}
+
 void vhpt_multiple_insert(unsigned long vaddr, unsigned long pte, unsigned 
long logps)
 {
        unsigned long mask = (1L << logps) - 1;
-       extern long running_on_sim;
        int i;
 
        if (logps-PAGE_SHIFT > 10 && !running_on_sim) {
                // if this happens, we may want to revisit this algorithm
-               printf("vhpt_multiple_insert:logps-PAGE_SHIFT>10,spinning..\n");
-               while(1);
+               panic("vhpt_multiple_insert:logps-PAGE_SHIFT>10,spinning..\n");
        }
        if (logps-PAGE_SHIFT > 2) {
                // FIXME: Should add counter here to see how often this
@@ -151,12 +163,9 @@ void vhpt_init(void)
         * from domain heap when each domain is created. Assume xen buddy
         * allocator can provide natural aligned page by order?
         */
-//     vhpt_imva = alloc_xenheap_pages(VHPT_SIZE_LOG2 - PAGE_SHIFT);
        page = alloc_domheap_pages(NULL, VHPT_SIZE_LOG2 - PAGE_SHIFT, 0);
-       if (!page) {
-               printf("vhpt_init: can't allocate VHPT!\n");
-               while(1);
-       }
+       if (!page)
+               panic("vhpt_init: can't allocate VHPT!\n");
        paddr = page_to_maddr(page);
        __get_cpu_var(vhpt_paddr) = paddr;
        __get_cpu_var(vhpt_pend) = paddr + vhpt_total_size - 1;
diff -r de2dc4e7966a -r 2f86b84d0483 xen/arch/ia64/xen/xenasm.S
--- a/xen/arch/ia64/xen/xenasm.S        Fri Apr 21 09:03:19 2006 -0600
+++ b/xen/arch/ia64/xen/xenasm.S        Fri Apr 21 09:06:38 2006 -0600
@@ -182,7 +182,7 @@ 1:
        mov r21=loc6                    // saved vhpt physical address
        ;;
        or r23=r25,r21                  // construct PA | page properties
-       mov r24=VHPT_PAGE_SHIFT<<2
+       mov r24=VHPT_SIZE_LOG2<<2
        ;;
        ptr.d   r22,r24
        ;;
@@ -503,19 +503,6 @@ stacked:
 stacked:
        br.ret.sptk.few rp
 END(pal_emulator_static)
-
-GLOBAL_ENTRY(vhpt_insert)
-//     alloc loc0 = ar.pfs, 3, 1, 0, 0
-       mov r16=r32
-       mov r26=r33
-       mov r27=r34
-       ;;
-       VHPT_INSERT()
-//     VHPT_INSERT1()  ... add collision chains later
-//     mov ar.pfs = loc0
-       br.ret.sptk.few rp
-       ;;
-END(vhpt_insert)
 
 //  These instructions are copied in the domains.
 //  This is the virtual PAL, which simply does an hypercall.
diff -r de2dc4e7966a -r 2f86b84d0483 xen/include/asm-ia64/vhpt.h
--- a/xen/include/asm-ia64/vhpt.h       Fri Apr 21 09:03:19 2006 -0600
+++ b/xen/include/asm-ia64/vhpt.h       Fri Apr 21 09:06:38 2006 -0600
@@ -10,8 +10,6 @@
 
 /* Number of entries in the VHPT.  The size of an entry is 4*8B == 32B */
 #define        VHPT_NUM_ENTRIES                (1 << (VHPT_SIZE_LOG2 - 5))
-
-#define        VHPT_PAGE_SHIFT                 VHPT_SIZE_LOG2
 
 #ifdef CONFIG_SMP
 # define vhpt_flush_all()      smp_vhpt_flush_all()
@@ -46,8 +44,8 @@ extern void vhpt_flush_address_remote(in
                                      unsigned long addr_range);
 extern void vhpt_multiple_insert(unsigned long vaddr, unsigned long pte,
                                 unsigned long logps);
-extern void vhpt_insert (unsigned long vadr, unsigned long ptr,
-                        unsigned logps);
+extern void vhpt_insert (unsigned long vadr, unsigned long pte,
+                        unsigned long logps);
 extern void vhpt_flush(void);
 extern void smp_vhpt_flush_all(void);
 
@@ -56,59 +54,4 @@ DECLARE_PER_CPU (unsigned long, vhpt_pen
 DECLARE_PER_CPU (unsigned long, vhpt_pend);
 
 #endif /* !__ASSEMBLY */
-
-#if !VHPT_ENABLED
-#define VHPT_CCHAIN_LOOKUP(Name, i_or_d)
-#else
-
-// VHPT_CCHAIN_LOOKUP is intended to run with psr.i+ic off
-#define VHPT_CCHAIN_LOOKUP(Name, i_or_d)                       \
-                                                               \
-CC_##Name:;                                                    \
-       mov r31 = pr;                                           \
-       mov r16 = cr.ifa;                                       \
-       ;;                                                      \
-       extr.u r17=r16,59,5                                     \
-       ;;                                                      \
-       /* If address belongs to VMM, go to alt tlb handler */  \
-       cmp.eq p6,p0=0x1e,r17;                                  \
-(p6)   br.cond.spnt    late_alt_##Name                         \
-       ;;                                                      \
-       cmp.eq p6,p0=0x1d,r17;                                  \
-(p6)   br.cond.spnt    late_alt_##Name                         \
-       ;;                                                      \
-       mov pr = r31, 0x1ffff;                                  \
-       ;;                                                      
-
-
-/* r16 = vadr, r26 = pte, r27 = logps */ 
-#define VHPT_INSERT()                                  \
-       {.mmi;                                          \
-               thash r17 = r16;                        \
-               or r26 = 1, r26;                        \
-               nop 0;                                  \
-               ;;                                      \
-       };                                              \
-       {.mii;                                          \
-               ttag r21 = r16;                         \
-               adds r18 = VLE_ITIR_OFFSET, r17;        \
-               adds r19 = VLE_PGFLAGS_OFFSET, r17;     \
-               ;;                                      \
-       };                                              \
-       {.mmi;                                          \
-                                                       \
-               st8[r18] = r27;                         \
-               adds r20 = VLE_TITAG_OFFSET, r17;       \
-               nop 0;                                  \
-               ;;                                      \
-       };                                              \
-       {.mmb;                                          \
-               st8[r19] = r26;                         \
-               st8[r20] = r21;                         \
-               nop 0;                                  \
-               ;;                                      \
-       }
-
-
-#endif /* VHPT_ENABLED */
 #endif

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.