ia64/xen-unstable

changeset 9408:7e3cbc409676

[IA64] ptc.ga for SMP-g

ptc.ga extended for SMP-g.

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Mon Mar 27 15:36:47 2006 -0700 (2006-03-27)
parents 27050b1390cf
children d75a6cc5e68a
files xen/arch/ia64/xen/vcpu.c
line diff
     1.1 --- a/xen/arch/ia64/xen/vcpu.c	Mon Mar 27 15:35:31 2006 -0700
     1.2 +++ b/xen/arch/ia64/xen/vcpu.c	Mon Mar 27 15:36:47 2006 -0700
     1.3 @@ -1865,16 +1865,63 @@ IA64FAULT vcpu_ptc_g(VCPU *vcpu, UINT64 
     1.4  	return IA64_ILLOP_FAULT;
     1.5  }
     1.6  
     1.7 +#if defined(CONFIG_XEN_SMP) && defined(VHPT_GLOBAL)
     1.8 +struct ptc_ga_args {
     1.9 +	unsigned long vadr;
    1.10 +	unsigned long addr_range;
    1.11 +};
    1.12 +
    1.13 +static void ptc_ga_remote_func (void *varg)
    1.14 +{
    1.15 +	struct ptc_ga_args *args = (struct ptc_ga_args *)varg;
    1.16 +	vhpt_flush_address (args->vadr, args->addr_range);
    1.17 +}
    1.18 +#endif
    1.19 +
    1.20  IA64FAULT vcpu_ptc_ga(VCPU *vcpu,UINT64 vadr,UINT64 addr_range)
    1.21  {
    1.22  	// FIXME: validate not flushing Xen addresses
    1.23  	// if (Xen address) return(IA64_ILLOP_FAULT);
    1.24  	// FIXME: ??breaks if domain PAGE_SIZE < Xen PAGE_SIZE
    1.25  //printf("######## vcpu_ptc_ga(%p,%p) ##############\n",vadr,addr_range);
    1.26 +
    1.27 +#ifdef CONFIG_XEN_SMP
    1.28 +	struct domain *d = vcpu->domain;
    1.29 +	struct vcpu *v;
    1.30 +	struct ptc_ga_args args;
    1.31 +
    1.32 +	args.vadr = vadr;
    1.33 +	args.addr_range = addr_range;
    1.34 +
    1.35 +	/* This method is very conservative and should be optimized:
    1.36 +	   - maybe IPI calls can be avoided,
    1.37 +	   - a processor map can be built to avoid duplicate purge
    1.38 +	   - maybe ptc.ga can be replaced by ptc.l+invala.
    1.39 +	   Hopefully, it has no impact when UP.
    1.40 +	*/
    1.41 +	for_each_vcpu (d, v) {
    1.42 +		if (v != vcpu) {
    1.43 +			/* Purge tc entry.
    1.44 +			   Can we do this directly ?  Well, this is just a
    1.45 +			   single atomic write.  */
    1.46 +			vcpu_purge_tr_entry(&PSCBX(v,dtlb));
    1.47 +			vcpu_purge_tr_entry(&PSCBX(v,itlb));
    1.48 +#ifdef VHPT_GLOBAL
    1.49 +			/* Flush VHPT on remote processors.
    1.50 +			   FIXME: invalidate directly the entries? */
    1.51 +			smp_call_function_single
    1.52 +				(v->processor, &ptc_ga_remote_func,
    1.53 +				 &args, 0, 1);
    1.54 +#endif
    1.55 +		}
    1.56 +	}
    1.57 +#endif
    1.58 +
    1.59  #ifdef VHPT_GLOBAL
    1.60  	vhpt_flush_address(vadr,addr_range);
    1.61  #endif
    1.62  	ia64_global_tlb_purge(vadr,vadr+addr_range,PAGE_SHIFT);
    1.63 +	/* Purge tc.  */
    1.64  	vcpu_purge_tr_entry(&PSCBX(vcpu,dtlb));
    1.65  	vcpu_purge_tr_entry(&PSCBX(vcpu,itlb));
    1.66  	return IA64_NO_FAULT;