aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>2005-12-28 15:07:30 -0600
committerdjm@kirby.fc.hp.com <djm@kirby.fc.hp.com>2005-12-28 15:07:30 -0600
commitc15d1c3de79029dc917234aab8f2f4bd8a2b4291 (patch)
treeba4768b71ddc27bd2be536bfe638eee99b041fc8
parent114a01a531e2f251344f05a1bd18bd46106a42c7 (diff)
downloadxen-c15d1c3de79029dc917234aab8f2f4bd8a2b4291.tar.gz
xen-c15d1c3de79029dc917234aab8f2f4bd8a2b4291.tar.bz2
xen-c15d1c3de79029dc917234aab8f2f4bd8a2b4291.zip
Sync caches only on split cache machines (dynamic test instead of compile ifdef)
Signed-off-by: Dan Magenheimer <dan.magenheimer@hp.com>
-rw-r--r--xen/arch/ia64/xen/domain.c44
-rw-r--r--xen/arch/ia64/xen/xenmisc.c20
2 files changed, 24 insertions, 40 deletions
diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c
index a1fc49d7bd..5f4827ec2d 100644
--- a/xen/arch/ia64/xen/domain.c
+++ b/xen/arch/ia64/xen/domain.c
@@ -291,16 +291,7 @@ int arch_set_info_guest(struct vcpu *v, struct vcpu_guest_context *c)
d->arch.cmdline = c->cmdline;
new_thread(v, regs->cr_iip, 0, 0);
-#ifdef CONFIG_IA64_SPLIT_CACHE
- /* Sync d/i cache conservatively */
- if (!running_on_sim) {
- ret = ia64_pal_cache_flush(4, 0, &progress, NULL);
- if ((ret!=PAL_STATUS_SUCCESS)&& (ret!=PAL_STATUS_UNIMPLEMENTED))
- printk("PAL CACHE FLUSH failed for dom0.\n");
- else
- printk("Sync i/d cache for guest SUCC\n");
- }
-#endif
+ sync_split_caches();
v->vcpu_info->arch.evtchn_vector = c->vcpu.evtchn_vector;
if ( c->vcpu.privregs && copy_from_user(v->arch.privregs,
c->vcpu.privregs, sizeof(mapped_regs_t))) {
@@ -959,16 +950,7 @@ int construct_dom0(struct domain *d,
new_thread(v, pkern_entry, 0, 0);
physdev_init_dom0(d);
-#ifdef CONFIG_IA64_SPLIT_CACHE
- /* Sync d/i cache conservatively */
- if (!running_on_sim) {
- ret = ia64_pal_cache_flush(4, 0, &progress, NULL);
- if ((ret!=PAL_STATUS_SUCCESS)&& (ret!=PAL_STATUS_UNIMPLEMENTED))
- printk("PAL CACHE FLUSH failed for dom0.\n");
- else
- printk("Sync i/d cache for guest SUCC\n");
- }
-#endif
+ sync_split_caches();
// FIXME: Hack for keyboard input
#ifdef CLONE_DOMAIN0
@@ -1027,16 +1009,7 @@ int construct_domU(struct domain *d,
#endif
new_thread(v, pkern_entry, 0, 0);
printk("new_thread returns\n");
-#ifdef CONFIG_IA64_SPLIT_CACHE
- /* Sync d/i cache conservatively */
- if (!running_on_sim) {
- ret = ia64_pal_cache_flush(4, 0, &progress, NULL);
- if ((ret!=PAL_STATUS_SUCCESS)&& (ret!=PAL_STATUS_UNIMPLEMENTED))
- printk("PAL CACHE FLUSH failed for dom0.\n");
- else
- printk("Sync i/d cache for guest SUCC\n");
- }
-#endif
+ sync_split_caches();
__set_bit(0x30, VCPU(v, delivery_mask));
return 0;
@@ -1050,16 +1023,7 @@ void reconstruct_domU(struct vcpu *v)
v->domain->domain_id);
loaddomainelfimage(v->domain,v->domain->arch.image_start);
new_thread(v, v->domain->arch.entry, 0, 0);
-#ifdef CONFIG_IA64_SPLIT_CACHE
- /* Sync d/i cache conservatively */
- if (!running_on_sim) {
- ret = ia64_pal_cache_flush(4, 0, &progress, NULL);
- if ((ret!=PAL_STATUS_SUCCESS)&& (ret!=PAL_STATUS_UNIMPLEMENTED))
- printk("PAL CACHE FLUSH failed for dom0.\n");
- else
- printk("Sync i/d cache for guest SUCC\n");
- }
-#endif
+ sync_split_caches();
}
#endif
diff --git a/xen/arch/ia64/xen/xenmisc.c b/xen/arch/ia64/xen/xenmisc.c
index 099eec5987..be3cd7239d 100644
--- a/xen/arch/ia64/xen/xenmisc.c
+++ b/xen/arch/ia64/xen/xenmisc.c
@@ -368,3 +368,23 @@ loop:
goto loop;
}
}
+
+/* FIXME: for the forseeable future, all cpu's that enable VTi have split
+ * caches and all cpu's that have split caches enable VTi. This may
+ * eventually be untrue though. */
+#define cpu_has_split_cache vmx_enabled
+extern unsigned int vmx_enabled;
+
+void sync_split_caches(void)
+{
+ unsigned long ret, progress;
+
+ if (cpu_has_split_cache) {
+ /* Sync d/i cache conservatively */
+ ret = ia64_pal_cache_flush(4, 0, &progress, NULL);
+ if ((ret!=PAL_STATUS_SUCCESS)&& (ret!=PAL_STATUS_UNIMPLEMENTED))
+ printk("PAL CACHE FLUSH failed\n");
+ else printk("Sync i/d cache for guest SUCC\n");
+ }
+ else printk("sync_split_caches ignored for CPU with no split cache\n");
+}