summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2006-05-31 06:51:25 +0000
committerkettenis <kettenis@openbsd.org>2006-05-31 06:51:25 +0000
commitdd531af614e28f94cc0b0a6f35ee47c71d25bcc3 (patch)
tree8632971836559ed06a7aa3bee99418a7d27cf3f2
parent- stop counting input/output bytes in the driver as this is taken care of (diff)
downloadwireguard-openbsd-dd531af614e28f94cc0b0a6f35ee47c71d25bcc3.tar.xz
wireguard-openbsd-dd531af614e28f94cc0b0a6f35ee47c71d25bcc3.zip
The bright people at Sun removed the secondary context from the IMMU in the
UltraSPARC III. Hack around it by temporarily switching to nucleus context when flushing TLBs. Put this hack under HORRID_III_HACK for now. Compiling with HORRID_III_HACK results in a kernel that runs on the Blade 2000 "at the speed of a 140MHz UltraSPARC I". ok jason@
-rw-r--r--sys/arch/sparc64/sparc64/locore.s28
1 files changed, 26 insertions, 2 deletions
diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s
index fb8af0d2f98..e8840660791 100644
--- a/sys/arch/sparc64/sparc64/locore.s
+++ b/sys/arch/sparc64/sparc64/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.56 2006/05/31 02:43:05 kettenis Exp $ */
+/* $OpenBSD: locore.s,v 1.57 2006/05/31 06:51:25 kettenis Exp $ */
/* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */
/*
@@ -4680,6 +4680,25 @@ _C_LABEL(tlb_flush_pte):
.text
2:
#endif /* DEBUG */
+#ifdef HORRID_III_HACK
+ rdpr %pstate, %o5
+ andn %o5, PSTATE_IE, %o4
+ wrpr %o4, %pstate ! disable interrupts
+
+ rdpr %tl, %o3
+ brnz %o3, 1f
+ add %o3, 1, %g2
+ wrpr %g0, %g2, %tl ! Switch to traplevel > 0
+1:
+ mov CTX_PRIMARY, %o2
+ andn %o0, 0xfff, %g2 ! drop unused va bits
+ ldxa [%o2] ASI_DMMU, %g1 ! Save primary context
+ sethi %hi(KERNBASE), %o4
+ membar #LoadStore
+ stxa %o1, [%o2] ASI_DMMU ! Insert context to demap
+ membar #Sync
+ or %g2, DEMAP_PAGE_PRIMARY, %g2 ! Demap page from primary context only
+#else
mov CTX_SECONDARY, %o2
andn %o0, 0xfff, %g2 ! drop unused va bits
ldxa [%o2] ASI_DMMU, %g1 ! Save secondary context
@@ -4688,6 +4707,7 @@ _C_LABEL(tlb_flush_pte):
stxa %o1, [%o2] ASI_DMMU ! Insert context to demap
membar #Sync
or %g2, DEMAP_PAGE_SECONDARY, %g2 ! Demap page from secondary context only
+#endif
stxa %g2, [%g2] ASI_DMMU_DEMAP ! Do the demap
membar #Sync
stxa %g2, [%g2] ASI_IMMU_DEMAP ! to both TLBs
@@ -4699,9 +4719,13 @@ _C_LABEL(tlb_flush_pte):
stxa %g2, [%g2] ASI_IMMU_DEMAP ! Do the demap
membar #Sync ! No real reason for this XXXX
flush %o4
- stxa %g1, [%o2] ASI_DMMU ! Restore secondary asi
+ stxa %g1, [%o2] ASI_DMMU ! Restore asi
membar #Sync ! No real reason for this XXXX
flush %o4
+#ifdef HORRID_III_HACK
+ wrpr %g0, %o3, %tl ! Restore traplevel
+ wrpr %o5, %pstate ! Restore interrupts
+#endif
retl
nop