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 replace splhigh() usage with an IPL_HIG...
details: https://anonhg.NetBSD.org/src/rev/4cd0e2efe672
branches: trunk
changeset: 778407:4cd0e2efe672
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Mar 25 03:51:33 2012 +0000
description:
replace splhigh() usage with an IPL_HIGH mutex.
diffstat:
sys/arch/sparc64/dev/iommu.c | 31 ++++++++++++++++---------------
sys/arch/sparc64/dev/iommuvar.h | 3 ++-
2 files changed, 18 insertions(+), 16 deletions(-)
diffs (147 lines):
diff -r dbc844912c29 -r 4cd0e2efe672 sys/arch/sparc64/dev/iommu.c
--- a/sys/arch/sparc64/dev/iommu.c Sun Mar 25 03:13:08 2012 +0000
+++ b/sys/arch/sparc64/dev/iommu.c Sun Mar 25 03:51:33 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iommu.c,v 1.106 2012/01/27 18:53:03 para Exp $ */
+/* $NetBSD: iommu.c,v 1.107 2012/03/25 03:51:33 mrg Exp $ */
/*
* Copyright (c) 1999, 2000 Matthew R. Green
@@ -59,7 +59,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.106 2012/01/27 18:53:03 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.107 2012/03/25 03:51:33 mrg Exp $");
#include "opt_ddb.h"
@@ -203,6 +203,8 @@
0, 0, EX_NOWAIT);
/* XXXMRG Check is_dvmamap is valid. */
+ mutex_init(&is->is_lock, MUTEX_DEFAULT, IPL_HIGH);
+
/*
* Set the TSB size. The relevant bits were moved to the TSB
* base register in the PCIe host bridges.
@@ -456,7 +458,6 @@
{
struct strbuf_ctl *sb = (struct strbuf_ctl *)map->_dm_cookie;
struct iommu_state *is = sb->sb_is;
- int s;
int err, needsflush;
bus_size_t sgsize;
paddr_t curaddr;
@@ -503,11 +504,11 @@
* split the transfer up int little pieces ourselves.
*/
KASSERT(is->is_dvmamap);
- s = splhigh();
+ mutex_enter(&is->is_lock);
err = extent_alloc(is->is_dvmamap, sgsize, align,
(sgsize > boundary) ? 0 : boundary,
EX_NOWAIT|EX_BOUNDZERO, &dvmaddr);
- splx(s);
+ mutex_exit(&is->is_lock);
#ifdef DEBUG
if (err || (dvmaddr == (u_long)-1)) {
@@ -555,12 +556,12 @@
/* Too many segments. Fail the operation. */
DPRINTF(IDB_INFO, ("iommu_dvmamap_load: "
"too many segments %d\n", seg));
- s = splhigh();
+ mutex_enter(&is->is_lock);
err = extent_free(is->is_dvmamap,
dvmaddr, sgsize, EX_NOWAIT);
map->_dm_dvmastart = 0;
map->_dm_dvmasize = 0;
- splx(s);
+ mutex_exit(&is->is_lock);
if (err != 0)
printf("warning: %s: %" PRId64
" of DVMA space lost\n", __func__, sgsize);
@@ -647,7 +648,7 @@
{
struct strbuf_ctl *sb = (struct strbuf_ctl *)map->_dm_cookie;
struct iommu_state *is = sb->sb_is;
- int error, s;
+ int error;
bus_size_t sgsize = map->_dm_dvmasize;
/* Flush the iommu */
@@ -664,12 +665,12 @@
/* Flush the caches */
bus_dmamap_unload(t->_parent, map);
- s = splhigh();
+ mutex_enter(&is->is_lock);
error = extent_free(is->is_dvmamap, map->_dm_dvmastart,
map->_dm_dvmasize, EX_NOWAIT);
map->_dm_dvmastart = 0;
map->_dm_dvmasize = 0;
- splx(s);
+ mutex_exit(&is->is_lock);
if (error != 0)
printf("warning: %s: %" PRId64 " of DVMA space lost\n",
__func__, sgsize);
@@ -685,7 +686,7 @@
struct strbuf_ctl *sb = (struct strbuf_ctl *)map->_dm_cookie;
struct iommu_state *is = sb->sb_is;
struct vm_page *pg;
- int i, j, s;
+ int i, j;
int left;
int err, needsflush;
bus_size_t sgsize;
@@ -734,7 +735,7 @@
}
sgsize = round_page(sgsize);
- s = splhigh();
+ mutex_enter(&is->is_lock);
/*
* If our segment size is larger than the boundary we need to
* split the transfer up into little pieces ourselves.
@@ -743,7 +744,7 @@
(sgsize > boundary) ? 0 : boundary,
((flags & BUS_DMA_NOWAIT) == 0 ? EX_WAITOK : EX_NOWAIT) |
EX_BOUNDZERO, &dvmaddr);
- splx(s);
+ mutex_exit(&is->is_lock);
if (err != 0)
return (err);
@@ -976,12 +977,12 @@
return (0);
fail:
- s = splhigh();
+ mutex_enter(&is->is_lock);
err = extent_free(is->is_dvmamap, map->_dm_dvmastart, sgsize,
EX_NOWAIT);
map->_dm_dvmastart = 0;
map->_dm_dvmasize = 0;
- splx(s);
+ mutex_exit(&is->is_lock);
if (err != 0)
printf("warning: %s: %" PRId64 " of DVMA space lost\n",
__func__, sgsize);
diff -r dbc844912c29 -r 4cd0e2efe672 sys/arch/sparc64/dev/iommuvar.h
--- a/sys/arch/sparc64/dev/iommuvar.h Sun Mar 25 03:13:08 2012 +0000
+++ b/sys/arch/sparc64/dev/iommuvar.h Sun Mar 25 03:51:33 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: iommuvar.h,v 1.20 2011/03/20 20:47:10 mrg Exp $ */
+/* $NetBSD: iommuvar.h,v 1.21 2012/03/25 03:51:33 mrg Exp $ */
/*
* Copyright (c) 1999 Matthew R. Green
@@ -55,6 +55,7 @@
u_int is_dvmaend;
int64_t is_cr; /* IOMMU control regiter value */
struct extent *is_dvmamap; /* DVMA map for this instance */
+ kmutex_t is_lock; /* lock for DVMA map */
int is_flags;
#define IOMMU_FLUSH_CACHE 0x00000001
#define IOMMU_TSBSIZE_IN_PTSB 0x00000002 /* PCIe */
Home |
Main Index |
Thread Index |
Old Index