freebsd-dev/sys/sparc64/sparc64
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
..
autoconf.c Run configure at SI_SUB_THIRD instead of SI_SUB_ANY like other 2002-11-18 03:28:23 +00:00
bus_machdep.c Lock down the IOMMU bus_dma implementation to make it safe to use 2003-07-10 23:27:35 +00:00
cache.c - Move the routine for flushing all user mappings from the tlb from pmap to 2003-04-13 21:54:58 +00:00
cheetah.c - Move the routine for flushing all user mappings from the tlb from pmap to 2003-04-13 21:54:58 +00:00
clock.c Split statclock into statclock and profclock, and made the method for driving 2003-02-03 17:53:15 +00:00
counter.c Back out M_* changes, per decision of the TRB. 2003-02-19 05:47:46 +00:00
critical.c Include machine/critical.h to get missing prototypes. 2002-06-23 14:38:41 +00:00
db_disasm.c The abs() function isn't defined locally; include a header file that 2003-01-16 08:53:03 +00:00
db_hwwatch.c Use vm_paddr_t for physical addresses. 2003-04-08 06:35:09 +00:00
db_interface.c Add support for starting and stopping cpus with ipis. 2002-03-13 04:59:01 +00:00
db_trace.c Rename pcb_fp to pcb_sp, so as to not be confused with floating point 2003-04-01 03:05:46 +00:00
dump_machdep.c - Declare sparc64_memreg and sparc64_nmemreg in machine/ofw_mem.h. 2003-06-07 18:29:29 +00:00
eeprom_ebus.c Add MD frontents for the mk48txx driver, ported from NetBSD, and remove 2002-04-04 23:58:50 +00:00
eeprom_fhc.c Add drivers for the central and fhc busses found in enterprise class 2003-02-18 09:01:01 +00:00
eeprom_sbus.c Add MD frontents for the mk48txx driver, ported from NetBSD, and remove 2002-04-04 23:58:50 +00:00
eeprom.c Add MD frontents for the mk48txx driver, ported from NetBSD, and remove 2002-04-04 23:58:50 +00:00
elf_machdep.c Resolve relative relocations in klds before trying to parse the module's 2003-01-21 02:42:44 +00:00
exception.S Avoid using v8 opcodes; use ba instead of b for unconditional branches. 2003-06-19 19:11:21 +00:00
genassym.c - Fix placement of cvs ids in previous commit to match .S files in libc. 2003-04-29 00:37:41 +00:00
identcpu.c - Set cpu_impl early in sparc64_init so that we can use it to detect 2003-03-19 05:51:21 +00:00
in_cksum.c Add optimized implementations of in_cksum_skip() and related functions 2001-11-06 20:05:01 +00:00
interrupt.S - Fix placement of cvs ids in previous commit to match .S files in libc. 2003-04-29 00:37:41 +00:00
intr_machdep.c - Expand struct trapframe to 256 bytes, make all fields fixed width and the 2002-10-22 18:03:15 +00:00
iommu.c Lock down the IOMMU bus_dma implementation to make it safe to use 2003-07-10 23:27:35 +00:00
locore.S - Fix placement of cvs ids in previous commit to match .S files in libc. 2003-04-29 00:37:41 +00:00
machdep.c Add a machine depended function thread_siginfo, SA signal code 2003-06-28 06:34:08 +00:00
mem.c Use vm_paddr_t for physical addresses. 2003-04-08 06:35:09 +00:00
mp_exception.S - Rename the IPI_WAIT macro to IPI_DONE. 2003-06-19 05:27:04 +00:00
mp_locore.S - Fix placement of cvs ids in previous commit to match .S files in libc. 2003-04-29 00:37:41 +00:00
mp_machdep.c Use vm_paddr_t for physical addresses. 2003-04-08 06:35:09 +00:00
nexus.c free type too if we can't add the child. 2003-06-16 19:18:06 +00:00
ofw_bus.c Add the new sparc64 OFW PCI framework, conditional on options OFW_NEWPCI 2003-07-01 14:52:47 +00:00
ofw_machdep.c Fix a bug that was indroduced while moving this code around (use the 2001-12-21 21:31:44 +00:00
pmap.c MFi386 2003-07-06 20:32:42 +00:00
prof_machdep.c Add routines needed for high resolution profiling. 2002-07-29 00:45:13 +00:00
rwindow.c Greatly improve readability of trap() by using a table to convert between 2002-10-25 16:00:47 +00:00
spitfire.c - Move the routine for flushing all user mappings from the tlb from pmap to 2003-04-13 21:54:58 +00:00
support.S add support for peeking at pci busses on UltraSparc systems. This prevents 2003-06-22 01:26:08 +00:00
swtch.S - Fix placement of cvs ids in previous commit to match .S files in libc. 2003-04-29 00:37:41 +00:00
sys_machdep.c - Push down Giant into the sysarch() calls that still need Giant. 2003-04-25 20:04:02 +00:00
tick.c Completely disable interrupts (not just raise %pil) when calculating the 2003-05-29 17:49:21 +00:00
tlb.c - Move the routine for flushing all user mappings from the tlb from pmap to 2003-04-13 21:54:58 +00:00
trap.c remove unnecessary comment. We do what the comments says we need to. 2003-06-24 21:37:49 +00:00
tsb.c - Mirror vm_page_queue_mtx assertions added to the i386 pmap. 2003-06-15 19:54:50 +00:00
vm_machdep.c Fix a performance bug in all of the various implementations of 2003-06-18 02:57:38 +00:00