ia64/xen-unstable

changeset 8434:40648452d45f

Sync caches only on split cache machines (dynamic test instead of compile ifdef)
Signed-off-by: Dan Magenheimer <dan.magenheimer@hp.com>
author djm@kirby.fc.hp.com
date Wed Dec 28 15:07:30 2005 -0600 (2005-12-28)
parents f218e6ba2653
children 8643b4d778f5
files xen/arch/ia64/xen/domain.c xen/arch/ia64/xen/xenmisc.c
line diff
     1.1 --- a/xen/arch/ia64/xen/domain.c	Fri Dec 23 15:14:21 2005 -0600
     1.2 +++ b/xen/arch/ia64/xen/domain.c	Wed Dec 28 15:07:30 2005 -0600
     1.3 @@ -291,16 +291,7 @@ int arch_set_info_guest(struct vcpu *v, 
     1.4  	d->arch.cmdline      = c->cmdline;
     1.5  	new_thread(v, regs->cr_iip, 0, 0);
     1.6  
     1.7 -#ifdef CONFIG_IA64_SPLIT_CACHE
     1.8 -    /* Sync d/i cache conservatively */
     1.9 -    if (!running_on_sim) {
    1.10 -        ret = ia64_pal_cache_flush(4, 0, &progress, NULL);
    1.11 -        if ((ret!=PAL_STATUS_SUCCESS)&& (ret!=PAL_STATUS_UNIMPLEMENTED))
    1.12 -            printk("PAL CACHE FLUSH failed for dom0.\n");
    1.13 -        else
    1.14 -            printk("Sync i/d cache for guest SUCC\n");
    1.15 -    }
    1.16 -#endif
    1.17 +	sync_split_caches();
    1.18   	v->vcpu_info->arch.evtchn_vector = c->vcpu.evtchn_vector;
    1.19  	if ( c->vcpu.privregs && copy_from_user(v->arch.privregs,
    1.20  			   c->vcpu.privregs, sizeof(mapped_regs_t))) {
    1.21 @@ -959,16 +950,7 @@ int construct_dom0(struct domain *d,
    1.22  
    1.23  	new_thread(v, pkern_entry, 0, 0);
    1.24  	physdev_init_dom0(d);
    1.25 -#ifdef CONFIG_IA64_SPLIT_CACHE
    1.26 -    /* Sync d/i cache conservatively */
    1.27 -    if (!running_on_sim) {
    1.28 -        ret = ia64_pal_cache_flush(4, 0, &progress, NULL);
    1.29 -        if ((ret!=PAL_STATUS_SUCCESS)&& (ret!=PAL_STATUS_UNIMPLEMENTED))
    1.30 -            printk("PAL CACHE FLUSH failed for dom0.\n");
    1.31 -        else
    1.32 -            printk("Sync i/d cache for guest SUCC\n");
    1.33 -    }
    1.34 -#endif
    1.35 +	sync_split_caches();
    1.36  
    1.37  	// FIXME: Hack for keyboard input
    1.38  #ifdef CLONE_DOMAIN0
    1.39 @@ -1027,16 +1009,7 @@ int construct_domU(struct domain *d,
    1.40  #endif
    1.41  	new_thread(v, pkern_entry, 0, 0);
    1.42  	printk("new_thread returns\n");
    1.43 -#ifdef CONFIG_IA64_SPLIT_CACHE
    1.44 -    /* Sync d/i cache conservatively */
    1.45 -    if (!running_on_sim) {
    1.46 -        ret = ia64_pal_cache_flush(4, 0, &progress, NULL);
    1.47 -        if ((ret!=PAL_STATUS_SUCCESS)&& (ret!=PAL_STATUS_UNIMPLEMENTED))
    1.48 -            printk("PAL CACHE FLUSH failed for dom0.\n");
    1.49 -        else
    1.50 -            printk("Sync i/d cache for guest SUCC\n");
    1.51 -    }
    1.52 -#endif
    1.53 +	sync_split_caches();
    1.54  	__set_bit(0x30, VCPU(v, delivery_mask));
    1.55  
    1.56  	return 0;
    1.57 @@ -1050,16 +1023,7 @@ void reconstruct_domU(struct vcpu *v)
    1.58  		v->domain->domain_id);
    1.59  	loaddomainelfimage(v->domain,v->domain->arch.image_start);
    1.60  	new_thread(v, v->domain->arch.entry, 0, 0);
    1.61 -#ifdef CONFIG_IA64_SPLIT_CACHE
    1.62 -    /* Sync d/i cache conservatively */
    1.63 -    if (!running_on_sim) {
    1.64 -        ret = ia64_pal_cache_flush(4, 0, &progress, NULL);
    1.65 -        if ((ret!=PAL_STATUS_SUCCESS)&& (ret!=PAL_STATUS_UNIMPLEMENTED))
    1.66 -            printk("PAL CACHE FLUSH failed for dom0.\n");
    1.67 -        else
    1.68 -            printk("Sync i/d cache for guest SUCC\n");
    1.69 -    }
    1.70 -#endif
    1.71 +	sync_split_caches();
    1.72  }
    1.73  #endif
    1.74  
     2.1 --- a/xen/arch/ia64/xen/xenmisc.c	Fri Dec 23 15:14:21 2005 -0600
     2.2 +++ b/xen/arch/ia64/xen/xenmisc.c	Wed Dec 28 15:07:30 2005 -0600
     2.3 @@ -368,3 +368,23 @@ loop:
     2.4  		goto loop;
     2.5  	}
     2.6  }
     2.7 +
     2.8 +/* FIXME: for the forseeable future, all cpu's that enable VTi have split
     2.9 + *  caches and all cpu's that have split caches enable VTi.  This may
    2.10 + *  eventually be untrue though. */
    2.11 +#define cpu_has_split_cache	vmx_enabled
    2.12 +extern unsigned int vmx_enabled;
    2.13 +
    2.14 +void sync_split_caches(void)
    2.15 +{
    2.16 +	unsigned long ret, progress;
    2.17 +
    2.18 +	if (cpu_has_split_cache) {
    2.19 +		/* Sync d/i cache conservatively */
    2.20 +		ret = ia64_pal_cache_flush(4, 0, &progress, NULL);
    2.21 +		if ((ret!=PAL_STATUS_SUCCESS)&& (ret!=PAL_STATUS_UNIMPLEMENTED))
    2.22 +			printk("PAL CACHE FLUSH failed\n");
    2.23 +		else printk("Sync i/d cache for guest SUCC\n");
    2.24 +	}
    2.25 +	else printk("sync_split_caches ignored for CPU with no split cache\n");
    2.26 +}