#
1.19 |
|
11-Mar-2021 |
jsg |
spelling
|
Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
|
#
1.18 |
|
25-Jun-2019 |
dlg |
add support for bypassing iommu translation
managing the translation table entries (TTEs) on an iommu is not free, and is in fact extremely expensive on some platforms. the flip side of this is that forcing dma through TTEs does provide some safety and can help during the development of drivers. however, this has been less true in recent years than it used to be and is less of a concern now, especially considering the performance differences on some platforms.
devices have to create dmamaps with BUS_DMA_64BIT to bypass the iommu because the memory window presented to hardware with direct access to memory is at an extremely high address. there's no 32bit bypass access to memory, it has to go through TTEs otherwise.
on an m4000 there are several orders of magnitude performance difference between a driver with BUS_DMA_64BIT set and one without it.
hilariously, sun used a pci bridge on a whole generation of machines that had broken support for dma addresses over 40 bits (or around there), so devices behind those pci bridges need to have their dmamap_creates intercepted and any potential BUS_DMA_64BIT flags cleared on the way to the iommu drivers. this affects at least v215, v245, and v445, and probably u25s and u45s. it probably explains why all their onboard nics and disk controllers feel super slow, and why there was a meme at sun that bcopy was cheaper than dma when moving packets on and off a nic.
ok kettenis@ deraadt@
|
Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.17 |
|
04-May-2016 |
kettenis |
Some hardware (such as the onboard dc(4) of the Netra X1) has a broken DMA engine that might attempt to read beyond the end of the buffer that was programmed. The IOMMU catches this "DMA overrun" and throws an unrecoverable error at us, at which point we have no choice but to panic. To avoid this implement a BUS_DMA_OVERRUN flag that maps an additional scratch page at the end of the vdma address range. DMA requests will spill over into this page, which just returns zeroes.
Thanks to matthieu@ for giving me access to a machine with the problem.
ok deraadt@, beck@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
|
#
1.16 |
|
22-Jan-2014 |
kettenis |
Use extent_alloc_subregion_with_descr(9). This should make bus_dmamap_load(9) and bus_dmamap_unload(9) "mpsafe".
|
Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
|
#
1.15 |
|
04-May-2009 |
oga |
type pedantry.
the type we bind to an iommu or a GART is paddr_t, by definition, on the other hand, the type we get out of it is not a vaddr_t, it's bus_addr_t.
fix up sparc64 iommu, amd64 iommu and the sg_dma backedn that uses it to realise this.
ok kettenis@
|
Revision tags: OPENBSD_4_5_BASE
|
#
1.14 |
|
02-Jan-2009 |
kettenis |
Make IOMMU code use the generic _bus_dmamem_map() and _bus_dmamem_unmap().
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.13 |
|
12-Jul-2008 |
kettenis |
Perform IOMMU cache flushes on Oberon.
|
#
1.12 |
|
09-Mar-2008 |
kettenis |
Add some members needed by the sunv IOMMU code.
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.11 |
|
05-Dec-2007 |
deraadt |
use mutexes to protect the iommu's extent map and the streaming buffer, so that busdma is most likely MP_SAFE now. (while there, fix an extent map race... the ranges were selected outside splhigh) ok kettenis
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.10 |
|
29-May-2007 |
sobrado |
use the right capitalization for `SBus'
ok jmc@
|
Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE SMP_SYNC_A SMP_SYNC_B
|
#
1.9 |
|
11-Jun-2003 |
henric |
Much of the sbus, psycho, and schizo bus_dma code is the same, so let's call the real implementation functions directly instead of duplicating lots of code that only calls the real stuff anyway.
tested by miod@ henning@ ok jason@
|
Revision tags: OPENBSD_3_3_BASE UBC_SYNC_A
|
#
1.8 |
|
06-Mar-2003 |
henric |
The existing IOMMU code had a rounding problem that was most noticeable on faster systems under heavy network load. This replaces some of the unreadable iommu functions with something a little less dense and a lot less crash prone.
The bus_dma function pointer/cookie handling was broken. Change them to work like the stacked bus_space drivers (where "work" is the key word).
Tested my many (thanks).
ok jason@ deraadt@
|
#
1.7 |
|
17-Feb-2003 |
henric |
Add support for the Sun Enterprise 450 Reduce the size of a GENERIC kernel by ~190k Remove the nasty pointer/bus_space_handle_t casts Adds debug bus_space code including the ability to trace bus operations (it actually works now).
The following rules are now followed (and verfified by the debug code):
1. A "bus_space_handle_t" may only be used with the "bus_space_tag_t" that created it. 2. Only "bus_space_map()" may create "bus_space_handle_t"s. 3. A "bus_space_handle_t" may not be modified after it has been created (other than being destroyed by "bus_space_unmap()").
Thanks to help from mcbride, marc, jason, drahn, to anyone that might have slipped my mind at the moment.
ok jason@, deraadt@
|
Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE UBC_SYNC_B
|
#
1.6 |
|
14-Mar-2002 |
millert |
First round of __P removal in sys
|
#
1.5 |
|
22-Feb-2002 |
jason |
From NetBSD: - Fix pr sparc64/15633: datafault at tlp_start causes panic - Also clean up some additional 32-bit kernel printf issues. - Handle the case where a DMA operation wraps from the end of a page to the beginning of the same page properly by double-mapping that page. - Move a brace so this will compile w/o DEBUG. - Overhaul iommu_dvmamap_load_raw(). From Me: - Verify the streaming cache exists before waiting on it to clear during flush. - Force sync of flush status (hardware sets it to 1 when its done) - Force sync flush of registers (bus_space_barrier) - Flush ALL segments on BUS_DMA_POSTREAD operations (not just the first!)
|
Revision tags: OPENBSD_3_0_BASE UBC_BASE
|
#
1.4 |
|
15-Oct-2001 |
jason |
branches: 1.4.4; 1.4.6; Pull in several changes from NetBSD: - Clear the dmamap inside splhigh() protection. - Manage both streaming caches on psycho/psycho+. And fix a botch I created when merging iommu changes last time.
|
#
1.3 |
|
26-Sep-2001 |
jason |
Merge with NetBSD: better handling of boundary conditions add iommu_extract debugging function
|
#
1.2 |
|
18-Aug-2001 |
jason |
RCSids
|
#
1.1 |
|
18-Aug-2001 |
jason |
enough to get sbus.o from NetBSD
|
#
1.18 |
|
25-Jun-2019 |
dlg |
add support for bypassing iommu translation
managing the translation table entries (TTEs) on an iommu is not free, and is in fact extremely expensive on some platforms. the flip side of this is that forcing dma through TTEs does provide some safety and can help during the development of drivers. however, this has been less true in recent years than it used to be and is less of a concern now, especially considering the performance differences on some platforms.
devices have to create dmamaps with BUS_DMA_64BIT to bypass the iommu because the memory window presented to hardware with direct access to memory is at an extremely high address. there's no 32bit bypass access to memory, it has to go through TTEs otherwise.
on an m4000 there are several orders of magnitude performance difference between a driver with BUS_DMA_64BIT set and one without it.
hilariously, sun used a pci bridge on a whole generation of machines that had broken support for dma addresses over 40 bits (or around there), so devices behind those pci bridges need to have their dmamap_creates intercepted and any potential BUS_DMA_64BIT flags cleared on the way to the iommu drivers. this affects at least v215, v245, and v445, and probably u25s and u45s. it probably explains why all their onboard nics and disk controllers feel super slow, and why there was a meme at sun that bcopy was cheaper than dma when moving packets on and off a nic.
ok kettenis@ deraadt@
|
Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.17 |
|
04-May-2016 |
kettenis |
Some hardware (such as the onboard dc(4) of the Netra X1) has a broken DMA engine that might attempt to read beyond the end of the buffer that was programmed. The IOMMU catches this "DMA overrun" and throws an unrecoverable error at us, at which point we have no choice but to panic. To avoid this implement a BUS_DMA_OVERRUN flag that maps an additional scratch page at the end of the vdma address range. DMA requests will spill over into this page, which just returns zeroes.
Thanks to matthieu@ for giving me access to a machine with the problem.
ok deraadt@, beck@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
|
#
1.16 |
|
22-Jan-2014 |
kettenis |
Use extent_alloc_subregion_with_descr(9). This should make bus_dmamap_load(9) and bus_dmamap_unload(9) "mpsafe".
|
Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
|
#
1.15 |
|
04-May-2009 |
oga |
type pedantry.
the type we bind to an iommu or a GART is paddr_t, by definition, on the other hand, the type we get out of it is not a vaddr_t, it's bus_addr_t.
fix up sparc64 iommu, amd64 iommu and the sg_dma backedn that uses it to realise this.
ok kettenis@
|
Revision tags: OPENBSD_4_5_BASE
|
#
1.14 |
|
02-Jan-2009 |
kettenis |
Make IOMMU code use the generic _bus_dmamem_map() and _bus_dmamem_unmap().
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.13 |
|
12-Jul-2008 |
kettenis |
Perform IOMMU cache flushes on Oberon.
|
#
1.12 |
|
09-Mar-2008 |
kettenis |
Add some members needed by the sunv IOMMU code.
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.11 |
|
05-Dec-2007 |
deraadt |
use mutexes to protect the iommu's extent map and the streaming buffer, so that busdma is most likely MP_SAFE now. (while there, fix an extent map race... the ranges were selected outside splhigh) ok kettenis
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.10 |
|
29-May-2007 |
sobrado |
use the right capitalization for `SBus'
ok jmc@
|
Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE SMP_SYNC_A SMP_SYNC_B
|
#
1.9 |
|
11-Jun-2003 |
henric |
Much of the sbus, psycho, and schizo bus_dma code is the same, so let's call the real implementation functions directly instead of duplicating lots of code that only calls the real stuff anyway.
tested by miod@ henning@ ok jason@
|
Revision tags: OPENBSD_3_3_BASE UBC_SYNC_A
|
#
1.8 |
|
06-Mar-2003 |
henric |
The existing IOMMU code had a rounding problem that was most noticeable on faster systems under heavy network load. This replaces some of the unreadable iommu functions with something a little less dense and a lot less crash prone.
The bus_dma function pointer/cookie handling was broken. Change them to work like the stacked bus_space drivers (where "work" is the key word).
Tested my many (thanks).
ok jason@ deraadt@
|
#
1.7 |
|
17-Feb-2003 |
henric |
Add support for the Sun Enterprise 450 Reduce the size of a GENERIC kernel by ~190k Remove the nasty pointer/bus_space_handle_t casts Adds debug bus_space code including the ability to trace bus operations (it actually works now).
The following rules are now followed (and verfified by the debug code):
1. A "bus_space_handle_t" may only be used with the "bus_space_tag_t" that created it. 2. Only "bus_space_map()" may create "bus_space_handle_t"s. 3. A "bus_space_handle_t" may not be modified after it has been created (other than being destroyed by "bus_space_unmap()").
Thanks to help from mcbride, marc, jason, drahn, to anyone that might have slipped my mind at the moment.
ok jason@, deraadt@
|
Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE UBC_SYNC_B
|
#
1.6 |
|
14-Mar-2002 |
millert |
First round of __P removal in sys
|
#
1.5 |
|
22-Feb-2002 |
jason |
From NetBSD: - Fix pr sparc64/15633: datafault at tlp_start causes panic - Also clean up some additional 32-bit kernel printf issues. - Handle the case where a DMA operation wraps from the end of a page to the beginning of the same page properly by double-mapping that page. - Move a brace so this will compile w/o DEBUG. - Overhaul iommu_dvmamap_load_raw(). From Me: - Verify the streaming cache exists before waiting on it to clear during flush. - Force sync of flush status (hardware sets it to 1 when its done) - Force sync flush of registers (bus_space_barrier) - Flush ALL segments on BUS_DMA_POSTREAD operations (not just the first!)
|
Revision tags: OPENBSD_3_0_BASE UBC_BASE
|
#
1.4 |
|
15-Oct-2001 |
jason |
branches: 1.4.4; 1.4.6; Pull in several changes from NetBSD: - Clear the dmamap inside splhigh() protection. - Manage both streaming caches on psycho/psycho+. And fix a botch I created when merging iommu changes last time.
|
#
1.3 |
|
26-Sep-2001 |
jason |
Merge with NetBSD: better handling of boundary conditions add iommu_extract debugging function
|
#
1.2 |
|
18-Aug-2001 |
jason |
RCSids
|
#
1.1 |
|
18-Aug-2001 |
jason |
enough to get sbus.o from NetBSD
|
Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
|
#
1.17 |
|
04-May-2016 |
kettenis |
Some hardware (such as the onboard dc(4) of the Netra X1) has a broken DMA engine that might attempt to read beyond the end of the buffer that was programmed. The IOMMU catches this "DMA overrun" and throws an unrecoverable error at us, at which point we have no choice but to panic. To avoid this implement a BUS_DMA_OVERRUN flag that maps an additional scratch page at the end of the vdma address range. DMA requests will spill over into this page, which just returns zeroes.
Thanks to matthieu@ for giving me access to a machine with the problem.
ok deraadt@, beck@
|
Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
|
#
1.16 |
|
22-Jan-2014 |
kettenis |
Use extent_alloc_subregion_with_descr(9). This should make bus_dmamap_load(9) and bus_dmamap_unload(9) "mpsafe".
|
Revision tags: OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE
|
#
1.15 |
|
04-May-2009 |
oga |
type pedantry.
the type we bind to an iommu or a GART is paddr_t, by definition, on the other hand, the type we get out of it is not a vaddr_t, it's bus_addr_t.
fix up sparc64 iommu, amd64 iommu and the sg_dma backedn that uses it to realise this.
ok kettenis@
|
Revision tags: OPENBSD_4_5_BASE
|
#
1.14 |
|
02-Jan-2009 |
kettenis |
Make IOMMU code use the generic _bus_dmamem_map() and _bus_dmamem_unmap().
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.13 |
|
12-Jul-2008 |
kettenis |
Perform IOMMU cache flushes on Oberon.
|
#
1.12 |
|
09-Mar-2008 |
kettenis |
Add some members needed by the sunv IOMMU code.
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.11 |
|
05-Dec-2007 |
deraadt |
use mutexes to protect the iommu's extent map and the streaming buffer, so that busdma is most likely MP_SAFE now. (while there, fix an extent map race... the ranges were selected outside splhigh) ok kettenis
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.10 |
|
29-May-2007 |
sobrado |
use the right capitalization for `SBus'
ok jmc@
|
Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE SMP_SYNC_A SMP_SYNC_B
|
#
1.9 |
|
11-Jun-2003 |
henric |
Much of the sbus, psycho, and schizo bus_dma code is the same, so let's call the real implementation functions directly instead of duplicating lots of code that only calls the real stuff anyway.
tested by miod@ henning@ ok jason@
|
Revision tags: OPENBSD_3_3_BASE UBC_SYNC_A
|
#
1.8 |
|
06-Mar-2003 |
henric |
The existing IOMMU code had a rounding problem that was most noticeable on faster systems under heavy network load. This replaces some of the unreadable iommu functions with something a little less dense and a lot less crash prone.
The bus_dma function pointer/cookie handling was broken. Change them to work like the stacked bus_space drivers (where "work" is the key word).
Tested my many (thanks).
ok jason@ deraadt@
|
#
1.7 |
|
17-Feb-2003 |
henric |
Add support for the Sun Enterprise 450 Reduce the size of a GENERIC kernel by ~190k Remove the nasty pointer/bus_space_handle_t casts Adds debug bus_space code including the ability to trace bus operations (it actually works now).
The following rules are now followed (and verfified by the debug code):
1. A "bus_space_handle_t" may only be used with the "bus_space_tag_t" that created it. 2. Only "bus_space_map()" may create "bus_space_handle_t"s. 3. A "bus_space_handle_t" may not be modified after it has been created (other than being destroyed by "bus_space_unmap()").
Thanks to help from mcbride, marc, jason, drahn, to anyone that might have slipped my mind at the moment.
ok jason@, deraadt@
|
Revision tags: OPENBSD_3_1_BASE OPENBSD_3_2_BASE UBC_SYNC_B
|
#
1.6 |
|
14-Mar-2002 |
millert |
First round of __P removal in sys
|
#
1.5 |
|
22-Feb-2002 |
jason |
From NetBSD: - Fix pr sparc64/15633: datafault at tlp_start causes panic - Also clean up some additional 32-bit kernel printf issues. - Handle the case where a DMA operation wraps from the end of a page to the beginning of the same page properly by double-mapping that page. - Move a brace so this will compile w/o DEBUG. - Overhaul iommu_dvmamap_load_raw(). From Me: - Verify the streaming cache exists before waiting on it to clear during flush. - Force sync of flush status (hardware sets it to 1 when its done) - Force sync flush of registers (bus_space_barrier) - Flush ALL segments on BUS_DMA_POSTREAD operations (not just the first!)
|
Revision tags: OPENBSD_3_0_BASE UBC_BASE
|
#
1.4 |
|
15-Oct-2001 |
jason |
branches: 1.4.4; 1.4.6; Pull in several changes from NetBSD: - Clear the dmamap inside splhigh() protection. - Manage both streaming caches on psycho/psycho+. And fix a botch I created when merging iommu changes last time.
|
#
1.3 |
|
26-Sep-2001 |
jason |
Merge with NetBSD: better handling of boundary conditions add iommu_extract debugging function
|
#
1.2 |
|
18-Aug-2001 |
jason |
RCSids
|
#
1.1 |
|
18-Aug-2001 |
jason |
enough to get sbus.o from NetBSD
|