Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/dev Call iommu_strbuf_flush_done every iomm...
details: https://anonhg.NetBSD.org/src/rev/86e26ac85656
branches: trunk
changeset: 749717:86e26ac85656
user: nakayama <nakayama%NetBSD.org@localhost>
date: Sun Dec 06 13:39:22 2009 +0000
description:
Call iommu_strbuf_flush_done every iommu_enter is too expensive,
so call it once if needed.
diffstat:
sys/arch/sparc64/dev/iommu.c | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diffs (125 lines):
diff -r d38b20b8f81e -r 86e26ac85656 sys/arch/sparc64/dev/iommu.c
--- a/sys/arch/sparc64/dev/iommu.c Sun Dec 06 13:31:16 2009 +0000
+++ b/sys/arch/sparc64/dev/iommu.c Sun Dec 06 13:39:22 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iommu.c,v 1.90 2009/12/06 13:15:25 nakayama Exp $ */
+/* $NetBSD: iommu.c,v 1.91 2009/12/06 13:39:22 nakayama Exp $ */
/*
* Copyright (c) 1999, 2000 Matthew R. Green
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.90 2009/12/06 13:15:25 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.91 2009/12/06 13:39:22 nakayama Exp $");
#include "opt_ddb.h"
@@ -275,10 +275,9 @@
#endif
/* Is the streamcache flush really needed? */
- if (sb->sb_flush) {
+ if (sb->sb_flush)
iommu_strbuf_flush(sb, va);
- iommu_strbuf_flush_done(sb);
- } else
+ else
/* If we can't flush the strbuf don't enable it. */
strbuf = 0;
@@ -434,7 +433,7 @@
struct strbuf_ctl *sb = (struct strbuf_ctl *)map->_dm_cookie;
struct iommu_state *is = sb->sb_is;
int s;
- int err;
+ int err, needsflush;
bus_size_t sgsize;
paddr_t curaddr;
u_long dvmaddr, sgstart, sgend, bmask;
@@ -549,6 +548,7 @@
else
pmap = pmap_kernel();
+ needsflush = 0;
for (; buflen > 0; ) {
/*
@@ -576,11 +576,14 @@
(long)trunc_page(curaddr)));
iommu_enter(sb, trunc_page(dvmaddr), trunc_page(curaddr),
flags | IOTTE_DEBUG(0x4000));
+ needsflush = 1;
dvmaddr += PAGE_SIZE;
vaddr += sgsize;
buflen -= sgsize;
}
+ if (needsflush)
+ iommu_strbuf_flush_done(sb);
#ifdef DIAGNOSTIC
for (seg = 0; seg < map->dm_nsegs; seg++) {
if (map->dm_segs[seg].ds_addr < is->is_dvmabase ||
@@ -646,7 +649,7 @@
struct vm_page *pg;
int i, j, s;
int left;
- int err;
+ int err, needsflush;
bus_size_t sgsize;
paddr_t pa;
bus_size_t boundary, align;
@@ -737,6 +740,7 @@
map->dm_mapsize = size;
j = 0;
+ needsflush = 0;
for (i = 0; i < nsegs ; i++) {
pa = segs[i].ds_addr;
@@ -810,10 +814,12 @@
map, (long)dvmaddr,
(long)(pa)));
/* Enter it if we haven't before. */
- if (prev_va != dvmaddr)
+ if (prev_va != dvmaddr) {
iommu_enter(sb, prev_va = dvmaddr,
prev_pa = pa,
flags | IOTTE_DEBUG(++npg << 12));
+ needsflush = 1;
+ }
dvmaddr += pagesz;
pa += pagesz;
}
@@ -821,6 +827,8 @@
size -= left;
++j;
}
+ if (needsflush)
+ iommu_strbuf_flush_done(sb);
map->dm_nsegs = j;
#ifdef DIAGNOSTIC
@@ -876,6 +884,7 @@
(long)map->dm_segs[i].ds_addr, (long)map->dm_segs[i].ds_len));
map->dm_segs[i].ds_len = sgend - sgstart + 1;
+ needsflush = 0;
TAILQ_FOREACH(pg, pglist, pageq.queue) {
if (sgsize == 0)
panic("iommu_dmamap_load_raw: size botch");
@@ -885,10 +894,13 @@
("iommu_dvmamap_load_raw: map %p loading va %lx at pa %lx\n",
map, (long)dvmaddr, (long)(pa)));
iommu_enter(sb, dvmaddr, pa, flags | IOTTE_DEBUG(0x8000));
+ needsflush = 1;
dvmaddr += pagesz;
sgsize -= pagesz;
}
+ if (needsflush)
+ iommu_strbuf_flush_done(sb);
map->dm_mapsize = size;
map->dm_nsegs = i+1;
#ifdef DIAGNOSTIC
Home |
Main Index |
Thread Index |
Old Index