]> xenbits.xensource.com Git - xen.git/commitdiff
[IA64] Kexec: Fix ia64_do_tlb_purge so that it works with XEN
authorAlex Williamson <alex.williamson@hp.com>
Thu, 27 Sep 2007 22:24:02 +0000 (16:24 -0600)
committerAlex Williamson <alex.williamson@hp.com>
Thu, 27 Sep 2007 22:24:02 +0000 (16:24 -0600)
Fix ia64_do_tlb_purge, its broken in too many ways

1. Call SET_PER_CPU_DATA before making any calls to GET_THIS_PADDR
   to ensure that per-cpu data is set up correctly.

2. Use the per_cpu variable to derive CURRENT_STACK_OFFSET rather
   than reading it from a kernel register. See 1) for explanation
   of why.

3. In the VHPT pruning code, don't use r25 as ia64_jump_to_sal,
   which branches to ia64_do_tlb_purge expects r25 to be preserved.
   There seems no reason not to use r2 as per the other purges
   done in ia64_do_tlb_purge.  Furthermore use r16 and r18 instead
   of r20 and r24 for consistency reasons.

4. Move __va_ul(vcpu_vhpt_maddr(v)) comment outside of
   #if VHPT_ENABLED as it also applies to code further down that
   is outside the #if

Cc: Tristan Gingold <tgingold@free.fr>,
Cc: Yutaka Ezaki <yutaka.ezaki@jp.fujitsu.com>,
Cc: Masaki Kanno <kanno.masaki@jp.fujitsu.com>,
Cc: Kazuhiro Suzuki <kaz@jp.fujitsu.com>,
Signed-off-by: Simon Horman <horms@verge.net.au>
xen/arch/ia64/linux-xen/mca_asm.S

index b5f95345dfc8274991ea93753bb4a90bc78acd18..f9d0de33a75a05a55a88d17c795a9bd01e0a4f97 100644 (file)
  */
 
 ia64_do_tlb_purge:
+#ifdef XEN
+       // This needs to be called in order for GET_THIS_PADDR to work
+       SET_PER_CPU_DATA();;
+#endif
 #define O(member)      IA64_CPUINFO_##member##_OFFSET
 
        GET_THIS_PADDR(r2, cpu_info)    // load phys addr of cpu_info into r2
@@ -263,7 +267,16 @@ ia64_do_tlb_purge:
        srlz.i
        ;;
        // 4. Purge DTR for stack.
+#ifdef XEN
+       // Kernel registers are saved in a per_cpu cpu_kr_ia64_t
+       // to allow the kernel registers themselves to be used by domains.
+       GET_THIS_PADDR(r2, cpu_kr);;
+       add r2=IA64_KR_CURRENT_STACK_OFFSET,r2
+       ;;
+       ld8 r16=[r2]
+#else
        mov r16=IA64_KR(CURRENT_STACK)
+#endif
        ;;
        shl r16=r16,IA64_GRANULE_SHIFT
        movl r19=PAGE_OFFSET
@@ -277,8 +290,8 @@ ia64_do_tlb_purge:
        ;;
 #ifdef XEN
        // 5. VHPT
+       // r2 = __va_ul(vcpu_vhpt_maddr(v));
 #if VHPT_ENABLED
-       // r25 = __va_ul(vcpu_vhpt_maddr(v));
        GET_THIS_PADDR(r2,cpu_kr);;
        add r2=IA64_KR_CURRENT_OFFSET,r2;;
        ld8 r2=[r2];;
@@ -296,18 +309,18 @@ ia64_do_tlb_purge:
        add r2=IA64_VCPU_VHPT_MADDR_OFFSET,r2;;
        dep r2=0,r2,60,4;;                      // virtual to physical
        ld8 r2=[r2];; 
-       dep r25=-1,r2,60,4;;                    // physical to virtual
+       dep r2=-1,r2,60,4;;                     // physical to virtual
        br.sptk         .percpu_vhpt_done
 #endif
 .not_pervcpu_vhpt:
        GET_THIS_PADDR(r2, vhpt_paddr);; 
        ld8 r2=[r2];; 
-       dep r25=-1,r2,60,4;;                    // physical to virtual
+       dep r2=-1,r2,60,4;;                     // physical to virtual
 .percpu_vhpt_done:
-       dep r20=0,r25,0,IA64_GRANULE_SHIFT
-       mov r24=IA64_GRANULE_SHIFT<<2
+       dep r16=0,r2,0,IA64_GRANULE_SHIFT
+       mov r18=IA64_GRANULE_SHIFT<<2
        ;;
-       ptr.d r20,r24
+       ptr.d r16,r18
        ;;
        srlz.d
        ;;