ia64/xen-unstable
changeset 16003:687de7ae2298
[IA64] Kexec: Fix ia64_do_tlb_purge so that it works with XEN
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>
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>
author | Alex Williamson <alex.williamson@hp.com> |
---|---|
date | Thu Sep 27 16:24:02 2007 -0600 (2007-09-27) |
parents | ec3f4e9e62f6 |
children | cbe97b8802e9 |
files | xen/arch/ia64/linux-xen/mca_asm.S |
line diff
1.1 --- a/xen/arch/ia64/linux-xen/mca_asm.S Thu Sep 27 15:35:02 2007 -0600 1.2 +++ b/xen/arch/ia64/linux-xen/mca_asm.S Thu Sep 27 16:24:02 2007 -0600 1.3 @@ -195,6 +195,10 @@ 3: add r4 = r6, r3;; \ 1.4 */ 1.5 1.6 ia64_do_tlb_purge: 1.7 +#ifdef XEN 1.8 + // This needs to be called in order for GET_THIS_PADDR to work 1.9 + SET_PER_CPU_DATA();; 1.10 +#endif 1.11 #define O(member) IA64_CPUINFO_##member##_OFFSET 1.12 1.13 GET_THIS_PADDR(r2, cpu_info) // load phys addr of cpu_info into r2 1.14 @@ -263,7 +267,16 @@ 4: 1.15 srlz.i 1.16 ;; 1.17 // 4. Purge DTR for stack. 1.18 +#ifdef XEN 1.19 + // Kernel registers are saved in a per_cpu cpu_kr_ia64_t 1.20 + // to allow the kernel registers themselves to be used by domains. 1.21 + GET_THIS_PADDR(r2, cpu_kr);; 1.22 + add r2=IA64_KR_CURRENT_STACK_OFFSET,r2 1.23 + ;; 1.24 + ld8 r16=[r2] 1.25 +#else 1.26 mov r16=IA64_KR(CURRENT_STACK) 1.27 +#endif 1.28 ;; 1.29 shl r16=r16,IA64_GRANULE_SHIFT 1.30 movl r19=PAGE_OFFSET 1.31 @@ -277,8 +290,8 @@ 4: 1.32 ;; 1.33 #ifdef XEN 1.34 // 5. VHPT 1.35 + // r2 = __va_ul(vcpu_vhpt_maddr(v)); 1.36 #if VHPT_ENABLED 1.37 - // r25 = __va_ul(vcpu_vhpt_maddr(v)); 1.38 GET_THIS_PADDR(r2,cpu_kr);; 1.39 add r2=IA64_KR_CURRENT_OFFSET,r2;; 1.40 ld8 r2=[r2];; 1.41 @@ -296,18 +309,18 @@ 4: 1.42 add r2=IA64_VCPU_VHPT_MADDR_OFFSET,r2;; 1.43 dep r2=0,r2,60,4;; // virtual to physical 1.44 ld8 r2=[r2];; 1.45 - dep r25=-1,r2,60,4;; // physical to virtual 1.46 + dep r2=-1,r2,60,4;; // physical to virtual 1.47 br.sptk .percpu_vhpt_done 1.48 #endif 1.49 .not_pervcpu_vhpt: 1.50 GET_THIS_PADDR(r2, vhpt_paddr);; 1.51 ld8 r2=[r2];; 1.52 - dep r25=-1,r2,60,4;; // physical to virtual 1.53 + dep r2=-1,r2,60,4;; // physical to virtual 1.54 .percpu_vhpt_done: 1.55 - dep r20=0,r25,0,IA64_GRANULE_SHIFT 1.56 - mov r24=IA64_GRANULE_SHIFT<<2 1.57 + dep r16=0,r2,0,IA64_GRANULE_SHIFT 1.58 + mov r18=IA64_GRANULE_SHIFT<<2 1.59 ;; 1.60 - ptr.d r20,r24 1.61 + ptr.d r16,r18 1.62 ;; 1.63 srlz.d 1.64 ;;