[IA64] Kexec: Unpin shared_info and mapped_regs TR in ia64_do_tlb_purge

Unpinning shared_info and mapped_regs seems to be missing
from ia64_do_tlb_purge and seems to be needed for kexec.

Like VHPT, the pinned value is recored in a percpu variable
so that the correct value can be unpinned.

Cc: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>

Index: xen-unstable.hg/xen/arch/ia64/linux-xen/mca_asm.S
===================================================================
--- xen-unstable.hg.orig/xen/arch/ia64/linux-xen/mca_asm.S	2008-01-25 14:38:34.000000000 +0900
+++ xen-unstable.hg/xen/arch/ia64/linux-xen/mca_asm.S	2008-01-25 14:38:36.000000000 +0900
@@ -26,6 +26,7 @@
 #include <asm/mca.h>
 #ifdef XEN
 #include <asm/vhpt.h>
+#include <public/arch-ia64.h>
 #endif
 
 /*
@@ -324,7 +325,30 @@ ia64_do_tlb_purge:
 	srlz.i
 	;;
 #ifdef XEN
-	// 5. VHPT
+	// 5. shared_info
+	// v->domain->arch.shared_info_va may not be the
+	// value of shared_info currently pinned into the TLB
+	GET_THIS_PADDR(r2, inserted_shared_info);;
+	ld8 r16=[r2]
+	mov r18=XSI_SHIFT<<2
+	;;
+	ptr.d r16,r18
+	;;
+	srlz.d
+	;;
+
+	// 6. mapped_regs
+	mov r2=XMAPPEDREGS_OFS
+	mov r18=XMAPPEDREGS_SHIFT<<2
+	;;
+	add r16=r16,r2
+	;;
+	ptr.d r16,r18
+	;;
+	srlz.d
+	;;
+
+	// 7. VHPT
 #if VHPT_ENABLED
 	// GET_VA_VCPU_VHPT_MADDR() may not give the
 	// value of the VHPT currently pinned into the TLB
Index: xen-unstable.hg/xen/arch/ia64/xen/regionreg.c
===================================================================
--- xen-unstable.hg.orig/xen/arch/ia64/xen/regionreg.c	2008-01-25 14:38:34.000000000 +0900
+++ xen-unstable.hg/xen/arch/ia64/xen/regionreg.c	2008-01-25 14:38:36.000000000 +0900
@@ -231,6 +231,7 @@ set_rr(unsigned long rr, unsigned long r
 #if VHPT_ENABLED
 DEFINE_PER_CPU(unsigned long, inserted_vhpt);
 #endif
+DEFINE_PER_CPU(unsigned long, inserted_shared_info);
 
 // validates and changes a single region register
 // in the currently executing domain
@@ -270,6 +271,8 @@ int set_one_rr(unsigned long rr, unsigne
 #if VHPT_ENABLED
 		__get_cpu_var(inserted_vhpt) = __va_ul(vcpu_vhpt_maddr(v));
 #endif
+		__get_cpu_var(inserted_shared_info) =
+					v->domain->arch.shared_info_va;
 		ia64_new_rr7(vmMangleRID(newrrv.rrval),v->domain->shared_info,
 			     v->arch.privregs, v->domain->arch.shared_info_va,
 		             __va_ul(vcpu_vhpt_maddr(v)));
