changeset 3729:b35ac6f887e3

6502578 sun4v block store commit VIS emulation does not implement commit semantics
author wh94709
date Wed, 28 Feb 2007 12:37:39 -0800
parents 5e98171c4156
children caeeab9fbf5a
files usr/src/uts/sun4/os/visinstr.c usr/src/uts/sun4v/os/error.c usr/src/uts/sun4v/os/mach_cpu_states.c usr/src/uts/sun4v/sys/machsystm.h
diffstat 4 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/sun4/os/visinstr.c	Wed Feb 28 07:00:07 2007 -0800
+++ b/usr/src/uts/sun4/os/visinstr.c	Wed Feb 28 12:37:39 2007 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -39,7 +39,6 @@
 #include <sys/debug.h>
 #include <sys/cpu_module.h>
 #include <sys/systm.h>
-#include <sys/machsystm.h>
 
 #define	FPU_REG_FIELD uint32_reg	/* Coordinate with FPU_REGS_TYPE. */
 #define	FPU_DREG_FIELD uint64_reg	/* Coordinate with FPU_DREGS_TYPE. */
@@ -1692,9 +1691,8 @@
 
 /*
  * Simulator for block loads and stores between floating-point unit and memory.
- * XXX - OK, so it is really gross to flush the whole Ecache for a block commit
- *	 store - but the circumstances under which this code actually gets
- *	 used in real life are so obscure that you can live with it!
+ * We pass the addrees of ea to sync_data_memory() to flush the Ecache.
+ * Sync_data_memory() calls platform dependent code to flush the Ecache.
  */
 static enum ftt_type
 vis_blk_fldst(
@@ -1764,7 +1762,7 @@
 	case ASI_BLK_COMMIT_P:
 	case ASI_BLK_COMMIT_S:
 		if ((inst.op3 & 7) == 3) {	/* lddf */
-		    for (i = 0; i < 8; i++, ea += 8, nrd += 2) {
+		    for (i = 0; i < 8; i++, nrd += 2) {
 			ftt = _fp_read_extword((uint64_t *)ea, &k.ll, pfpsd);
 			if (ftt != ftt_none)
 				return (ftt);
@@ -1774,9 +1772,10 @@
 				k.ll = l.ll;
 			}
 			_fp_pack_extword(pfpsd, &k.f.FPU_DREG_FIELD, nrd);
+			ea += 8;
 		    }
 		} else {			/* stdf */
-		    for (i = 0; i < 8; i++, ea += 8, nrd += 2) {
+		    for (i = 0; i < 8; i++, nrd += 2) {
 			_fp_unpack_extword(pfpsd, &k.f.FPU_DREG_FIELD, nrd);
 			if (little_endian) {
 				for (j = 0, h = 7; j < 8; j++, h--)
@@ -1786,10 +1785,11 @@
 			ftt = _fp_write_extword((uint64_t *)ea, k.ll, pfpsd);
 			if (ftt != ftt_none)
 				return (ftt);
+			ea += 8;
 		    }
 		}
 		if ((asi == ASI_BLK_COMMIT_P) || (asi == ASI_BLK_COMMIT_S))
-			cpu_flush_ecache();
+			sync_data_memory((caddr_t)(ea - 64), 64);
 		break;
 	default:
 		/* addr of unimp inst */
--- a/usr/src/uts/sun4v/os/error.c	Wed Feb 28 07:00:07 2007 -0800
+++ b/usr/src/uts/sun4v/os/error.c	Wed Feb 28 12:37:39 2007 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -603,15 +603,21 @@
  * Returns the total number of bytes flushed.
  */
 uint64_t
-mem_sync(caddr_t va, size_t len)
+mem_sync(caddr_t orig_va, size_t orig_len)
 {
 	uint64_t pa, length, flushed;
 	uint64_t chunk_len = MMU_PAGESIZE;
 	uint64_t total_flushed = 0;
+	uint64_t va, len;
 
-	if (((uint64_t)va | (uint64_t)len) & MMU_PAGEOFFSET)
+	if (orig_len == 0)
 		return (total_flushed);
 
+	/* align va */
+	va = P2ALIGN_TYPED(orig_va, MMU_PAGESIZE, uint64_t);
+	/* round up len to MMU_PAGESIZE aligned */
+	len = P2ROUNDUP_TYPED(orig_va + orig_len, MMU_PAGESIZE, uint64_t) - va;
+
 	while (len > 0) {
 		pa = va_to_pa((caddr_t)va);
 		if (pa == (uint64_t)-1)
--- a/usr/src/uts/sun4v/os/mach_cpu_states.c	Wed Feb 28 07:00:07 2007 -0800
+++ b/usr/src/uts/sun4v/os/mach_cpu_states.c	Wed Feb 28 12:37:39 2007 -0800
@@ -879,11 +879,6 @@
 }
 
 void
-cpu_flush_ecache(void)
-{
-}
-
-void
 sticksync_slave(void)
 {}
 
--- a/usr/src/uts/sun4v/sys/machsystm.h	Wed Feb 28 07:00:07 2007 -0800
+++ b/usr/src/uts/sun4v/sys/machsystm.h	Wed Feb 28 12:37:39 2007 -0800
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -419,7 +419,6 @@
  */
 void	syncfpu(void);
 
-void	cpu_flush_ecache(void);
 void	cpu_faulted_enter(struct cpu *);
 void	cpu_faulted_exit(struct cpu *);