ia64/xen-unstable

changeset 18085:4f0428e4dd15

[IA64] kexec: Unpin shared_info, mapped_regs and VPD TR in ia64_do_tlb_purge

Unpinning shared_info, mapped_regs and VPD 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>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Tue Jul 22 12:15:02 2008 +0900 (2008-07-22)
parents 0b72d16e794b
children 246a179ebb6d
files xen/arch/ia64/linux-xen/mca_asm.S xen/arch/ia64/vmx/vmx_vcpu.c xen/arch/ia64/xen/regionreg.c xen/include/asm-ia64/regionreg.h
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/mca_asm.S	Tue Jul 22 12:15:02 2008 +0900
     1.2 +++ b/xen/arch/ia64/linux-xen/mca_asm.S	Tue Jul 22 12:15:02 2008 +0900
     1.3 @@ -26,6 +26,7 @@
     1.4  #include <asm/mca.h>
     1.5  #ifdef XEN
     1.6  #include <asm/vhpt.h>
     1.7 +#include <public/arch-ia64.h>
     1.8  #endif
     1.9  
    1.10  /*
    1.11 @@ -320,7 +321,44 @@ 4:
    1.12  	srlz.i
    1.13  	;;
    1.14  #ifdef XEN
    1.15 -	// 5. VHPT
    1.16 +	// 5. shared_info
    1.17 +	GET_THIS_PADDR(r2, inserted_shared_info);;
    1.18 +	ld8 r16=[r2]
    1.19 +	mov r18=XSI_SHIFT<<2
    1.20 +	;;
    1.21 +	ptr.d r16,r18
    1.22 +	;;
    1.23 +	srlz.d
    1.24 +	;;
    1.25 +
    1.26 +	// 6. mapped_regs
    1.27 +	GET_THIS_PADDR(r2, inserted_mapped_regs);;
    1.28 +	ld8 r16=[r2]
    1.29 +	mov r18=XMAPPEDREGS_SHIFT<<2
    1.30 +	;;
    1.31 +	ptr.d r16,r18
    1.32 +	;;
    1.33 +	srlz.d
    1.34 +	;;
    1.35 +
    1.36 +	// 7. VPD
    1.37 +	// The VPD will not be mapped in the case where
    1.38 +	// a VMX domain hasn't been started since boot
    1.39 +	GET_THIS_PADDR(r2, inserted_vpd);;
    1.40 +	ld8 r16=[r2]
    1.41 +	mov r18=XMAPPEDREGS_SHIFT<<2
    1.42 +	;;
    1.43 +	cmp.eq p7,p0=r2,r0
    1.44 +	;;
    1.45 +(p7)	br.cond.sptk .vpd_not_mapped
    1.46 +	;;
    1.47 +	ptr.i r16,r18
    1.48 +	;;
    1.49 +	srlz.i
    1.50 +	;;
    1.51 +.vpd_not_mapped:
    1.52 +
    1.53 +	// 8. VHPT
    1.54  	// GET_VA_VCPU_VHPT_MADDR() may not give the
    1.55  	// value of the VHPT currently pinned into the TLB
    1.56  	GET_THIS_PADDR(r2, inserted_vhpt);;
    1.57 @@ -485,8 +523,9 @@ ia64_reload_tr:
    1.58  #ifdef XEN
    1.59  .reload_vhpt:
    1.60  	// 5. VHPT
    1.61 -#if VHPT_ENABLED
    1.62 -	GET_VA_VCPU_VHPT_MADDR(r2,r3);;
    1.63 +       GET_THIS_PADDR(r1, inserted_vhpt);;
    1.64 +       cmp.eq p7,p0=r2,r0
    1.65 +(p7)   br.cond.sptk    .overlap_vhpt   // vhpt isn't mapped.
    1.66  
    1.67  	// avoid overlapping with stack TR
    1.68  	shr.u r17=r2,IA64_GRANULE_SHIFT
    1.69 @@ -517,7 +556,6 @@ ia64_reload_tr:
    1.70  	;;
    1.71  .overlap_vhpt:
    1.72  #endif
    1.73 -#endif
    1.74  	br.sptk.many done_tlb_purge_and_reload
    1.75  err:
    1.76  	COLD_BOOT_HANDOFF_STATE(r20,r21,r22)
     2.1 --- a/xen/arch/ia64/vmx/vmx_vcpu.c	Tue Jul 22 12:15:02 2008 +0900
     2.2 +++ b/xen/arch/ia64/vmx/vmx_vcpu.c	Tue Jul 22 12:15:02 2008 +0900
     2.3 @@ -200,6 +200,8 @@ void vmx_switch_rr7(unsigned long rid, v
     2.4                      void *pal_vaddr, void *shared_arch_info)
     2.5  {
     2.6      __get_cpu_var(inserted_vhpt) = (unsigned long)guest_vhpt;
     2.7 +    __get_cpu_var(inserted_vpd) = (unsigned long)shared_arch_info;
     2.8 +    __get_cpu_var(inserted_mapped_regs) = (unsigned long)shared_arch_info;
     2.9      __vmx_switch_rr7(rid, guest_vhpt, pal_vaddr, shared_arch_info);
    2.10  }
    2.11  
     3.1 --- a/xen/arch/ia64/xen/regionreg.c	Tue Jul 22 12:15:02 2008 +0900
     3.2 +++ b/xen/arch/ia64/xen/regionreg.c	Tue Jul 22 12:15:02 2008 +0900
     3.3 @@ -49,6 +49,9 @@ static unsigned int domain_rid_bits_defa
     3.4  integer_param("dom_rid_bits", domain_rid_bits_default); 
     3.5  
     3.6  DEFINE_PER_CPU(unsigned long, inserted_vhpt);
     3.7 +DEFINE_PER_CPU(unsigned long, inserted_shared_info);
     3.8 +DEFINE_PER_CPU(unsigned long, inserted_mapped_regs);
     3.9 +DEFINE_PER_CPU(unsigned long, inserted_vpd);
    3.10  
    3.11  #if 0
    3.12  // following already defined in include/asm-ia64/gcc_intrin.h
    3.13 @@ -266,6 +269,11 @@ int set_one_rr(unsigned long rr, unsigne
    3.14  #if VHPT_ENABLED
    3.15  		__get_cpu_var(inserted_vhpt) = __va_ul(vcpu_vhpt_maddr(v));
    3.16  #endif
    3.17 +		__get_cpu_var(inserted_shared_info) =
    3.18 +					v->domain->arch.shared_info_va;
    3.19 +		__get_cpu_var(inserted_mapped_regs) =
    3.20 +					v->domain->arch.shared_info_va +
    3.21 +					XMAPPEDREGS_OFS;
    3.22  		ia64_new_rr7(vmMangleRID(newrrv.rrval),v->domain->shared_info,
    3.23  			     v->arch.privregs, v->domain->arch.shared_info_va,
    3.24  		             __va_ul(vcpu_vhpt_maddr(v)));
     4.1 --- a/xen/include/asm-ia64/regionreg.h	Tue Jul 22 12:15:02 2008 +0900
     4.2 +++ b/xen/include/asm-ia64/regionreg.h	Tue Jul 22 12:15:02 2008 +0900
     4.3 @@ -37,6 +37,9 @@ typedef union ia64_rr {
     4.4  #define RR_RID_MASK     0x00000000ffffff00L
     4.5  
     4.6  DECLARE_PER_CPU(unsigned long, inserted_vhpt);
     4.7 +DECLARE_PER_CPU(unsigned long, inserted_shared_info);
     4.8 +DECLARE_PER_CPU(unsigned long, inserted_mapped_regs);
     4.9 +DECLARE_PER_CPU(unsigned long, inserted_vpd);
    4.10  
    4.11  int set_one_rr(unsigned long rr, unsigned long val);
    4.12