freebsd-dev/sys
Thomas Moestl 928a49644f Lock down the IOMMU bus_dma implementation to make it safe to use
without Giant held.

A quick outline of the locking strategy:
Since all IOMMUs are synchronized, there is a single lock, iommu_mtx,
which protects the hardware registers (where needed) and the global and
per-IOMMU software states. As soon as the IOMMUs are divorced, each struct
iommu_state will have its own mutex (and the remaining global state
will be moved into the struct).
The dvma rman has its own internal mutex; the TSB slots may only be
accessed by the owner of the corresponding resource, so neither needs
extra protection.
Since there is a second access path to maps via LRU queues, the consumer-
provided locking is not sufficient; therefore, each map which is on a
queue is additionally protected by iommu_mtx (in part, there is one
member which only the map owner may access). Each map on a queue may
be accessed and removed from or repositioned in a queue in any context as
long as the lock is held; only the owner may insert a map.
To reduce lock contention, some bus_dma functions remove the map from
the queue temporarily (on behalf of the map owner) for some operations and
reinsert it when they are done. Shorter operations and operations which are
not done on behalf of the lock owner are completely covered by the lock.

To facilitate the locking, reorganize the streaming buffer handling;
while being there, fix an old oversight which would cause the streaming
buffer to always be flushed, regardless of whether streaming was enabled
in the TSB entry. The streaming buffer is still disabled for now, since
there are a number of drivers which lack critical bus_dmamp_sync() calls.

Additional testing by:	jake
2003-07-10 23:27:35 +00:00
..
alpha MFi386 2003-07-06 20:32:42 +00:00
amd64 Protect lint(1) from a #error. 2003-07-10 18:05:02 +00:00
arm sys/sys/limits.h: 2003-05-19 20:29:07 +00:00
boot Revert non-style part of the recent two deltas that dealt with 2003-07-02 12:45:45 +00:00
cam Merge common XPT_CALC_GEOMETRY functions into a single convenience function. 2003-06-14 22:17:41 +00:00
coda Remove in toto coda_strategy which incorrectly implemented vop_panic(); 2003-06-15 18:45:15 +00:00
compat Don't map LINUX_POSIX_VDISABLE to _POSIX_VDISABLE and vice versa for 2003-06-28 19:32:07 +00:00
conf unifdef -DLAZY_SWITCH and start to tidy up the associated glue. 2003-07-10 01:02:59 +00:00
contrib This commit was generated by cvs2svn to compensate for changes in r116801, 2003-06-25 06:06:52 +00:00
crypto Use __FBSDID(). 2003-06-10 21:44:29 +00:00
ddb Rename P_THREADED to P_SA. P_SA means a process is using scheduler 2003-06-15 00:31:24 +00:00
dev Regenerate. 2003-07-10 18:43:39 +00:00
fs If bread() returns a zero-length buffer, as can happen after a 2003-07-03 14:54:47 +00:00
geom Handle geoms which are withering away specially in the dump functions. 2003-07-08 21:12:40 +00:00
gnu Add the same KASSERT to all VOP_STRATEGY and VOP_SPECSTRATEGY implementations 2003-06-15 18:53:00 +00:00
i4b Mega busdma API commit. 2003-07-01 15:52:06 +00:00
i386 Protect lint(1) from a #error. 2003-07-10 18:05:02 +00:00
ia64 Don't call malloc() and free() while in the debugger and unwinding 2003-07-05 23:21:58 +00:00
isa - Make the isab devclass global to allow for multiple ISA bridge drivers. 2003-07-08 18:56:58 +00:00
isofs/cd9660 change dev_t to struct cdev * to match ufs. This fixes fstat for cd9660 2003-06-24 22:11:20 +00:00
kern unifdef -DLAZY_SWITCH and start to tidy up the associated glue. 2003-07-10 01:02:59 +00:00
libkern Use __FBSDID(). 2003-06-11 05:37:42 +00:00
modules tdkphy.c is missing from this module's Makefile. Add it. 2003-07-10 05:12:10 +00:00
net - In vlan_input(), always mask off all but the VLID bits from tags 2003-07-08 21:54:20 +00:00
net80211 insure ic_bss always has a "valid" channel; avoids problems where users could 2003-06-29 20:13:38 +00:00
netatalk - Use if_broadcastaddr from struct ifnet rather than relying on 2003-03-21 17:53:16 +00:00
netatm Use __FBSDID(). 2003-06-11 07:22:30 +00:00
netgraph Allow the caller to get an erro direclty if we sent the packet immediatly. 2003-07-03 22:09:47 +00:00
netinet Merge the handlers of O_IP_SRC_MASK and O_IP_DST_MASK opcodes, and 2003-07-08 07:44:42 +00:00
netinet6 Do not attempt to access to inp_socket fields if the socket is in the TIME_WAIT 2003-06-17 00:31:30 +00:00
netipsec consolidate callback optimization check in one location by adding a flag 2003-06-30 05:09:32 +00:00
netipx Use __FBSDID(). 2003-06-11 05:37:42 +00:00
netkey Use __FBSDID(). 2003-06-11 05:37:42 +00:00
netnatm Use __FBSDID(). 2003-06-11 05:37:42 +00:00
netncp Use __FBSDID(). 2003-06-11 05:37:42 +00:00
netsmb Add a f_vnode field to struct file. 2003-06-22 08:41:43 +00:00
nfs Back out M_* changes, per decision of the TRB. 2003-02-19 05:47:46 +00:00
nfsclient Change idle sleep indentifier to "-" for nfsiod 2003-07-02 08:09:20 +00:00
nfsserver Change idle state sleep identifier to "-" for nfsd. 2003-07-02 08:08:32 +00:00
opencrypto consolidate callback optimization check in one location by adding a flag 2003-06-30 05:09:32 +00:00
pc98 - Use the new resource_disabled() helper function to see if devices are 2003-07-02 16:09:02 +00:00
pccard OLDCARD is OBSOLETE_IN_6. Tag it as such. 2003-06-12 04:46:43 +00:00
pci Add support for the 8139C+ chipset. Unlike the other chips in the 8139 2003-07-10 20:38:48 +00:00
posix4 Use __FBSDID(). 2003-06-11 06:34:30 +00:00
powerpc Background: pmap_object_init_pt() premaps the pages of a object in 2003-07-03 20:18:02 +00:00
rpc
security Remove trailing whitespace. 2003-07-05 01:24:36 +00:00
sparc64 Lock down the IOMMU bus_dma implementation to make it safe to use 2003-07-10 23:27:35 +00:00
sys Replace custom field offset macro with the system __offsetof() macro. 2003-07-09 22:23:10 +00:00
tools Don't check the state of the vnode interlock if the specification says 2003-06-22 21:20:06 +00:00
ufs We just cached the inode pointer, no need to call VTOI() again. 2003-07-04 12:16:33 +00:00
vm - Complete the vm object locking in vm_pageout_object_deactivate_pages(). 2003-07-07 07:16:29 +00:00
Makefile Revert exclusion for amd64 that stopped boot/ being built. 2003-06-26 03:52:48 +00:00