#
1.83 |
|
18-Oct-2023 |
jan |
Avoid segments greater than maxsegsz during map merging
Found with hints from kettenis@
Tested on Sun-Fire-V215. Also tested on U2 and UltraBook IIe by miod@
ok miod@
|
Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE
|
#
1.82 |
|
16-May-2021 |
deraadt |
panic does not require a \n at the end. When one is provided, it looks wrong.
|
Revision tags: OPENBSD_6_9_BASE
|
#
1.81 |
|
11-Mar-2021 |
jsg |
spelling
|
Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
|
#
1.80 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: use %x not %lx with int
|
#
1.79 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: do not use undefined pa
introduced iommu_dvmamap_insert() using an undefined paddr_t pa under DEBUG; since it cannot be introduced it (easily), remove it from the printf().
|
#
1.78 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: Format bus_{addr,size}_t as long
|
#
1.77 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: format time_t as long long
Feedback guenther
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.76 |
|
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_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.75 |
|
25-May-2017 |
dlg |
tweak sparc64 membars as a step toward making them usable in userland.
specifically, dont rely on magic in ctlreg to implement membars. moving that to atomic.h would add a lot of pollution to the namespace, so move to passing the membar options to a single __membar macro.
this tweaks everything that was using the ctlreg backend to either use an appropriate membar_foo(), or to use __membar() in the MD code.
ok kettenis@
|
#
1.74 |
|
30-Apr-2017 |
mpi |
Rename Debugger() into db_enter().
Using a name with the 'db_' prefix makes it invisible from the dynamic profiler.
ok deraadt@, kettenis@, visa@
|
Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
|
#
1.73 |
|
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_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
|
#
1.72 |
|
09-Jan-2015 |
kettenis |
Fix loading memory allocated with bus_dmamem_alloc(9). The old could would always load all allocated pages instead of the size specified in the bus_dmamap_load_raw(9) call. Also fixes the corner case where a specified boundary is less than the page size, which would always create multiple segments, even if the specified size was smaller than the boundary.
Fixes xhci(4) on sparc64.
|
#
1.71 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
#
1.70 |
|
26-Oct-2014 |
kettenis |
uvm_km_valloc -> km_alloc
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.69 |
|
12-Jul-2014 |
tedu |
add a size argument to free. will be used soon, but for now default to 0. after discussions with beck deraadt kettenis.
|
#
1.68 |
|
10-May-2014 |
kettenis |
Format string fixes for bus_addr_t and bus_size_t, which are u_long everywhere.
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.67 |
|
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_5_3_BASE OPENBSD_5_4_BASE
|
#
1.66 |
|
15-Jan-2013 |
kettenis |
Fix segmentation of buffers that straddle a boundary.
ok dlg@
|
#
1.65 |
|
17-Aug-2012 |
kettenis |
Properly initialize the IOMMU control and status register for pyro(4). Fixes DMA problems spotted on the v445.
|
Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.64 |
|
18-May-2011 |
ariane |
When the sparc64 iommu fails to lookup a vaddr, it prints a message and returns EFBIG. This cannot be recovered from and is usually indicative of a damaged pmap. Therefor, panic right here instead.
This diff meant the difference between dropping into single-user mode versus getting a traceable panic.
ok kettenis@
|
#
1.63 |
|
07-Apr-2011 |
miod |
Do not use NULL in integer comparisons. No functional change. ok matthew@ tedu@, also eyeballed by at least krw@ oga@ kettenis@ jsg@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
|
#
1.62 |
|
20-Apr-2010 |
deraadt |
cleanup more confusion regarding user.h before proc.h, or missing proc.h ok tedu
|
Revision tags: OPENBSD_4_7_BASE
|
#
1.61 |
|
09-Aug-2009 |
oga |
if extent_alloc() fails, we don't clear the iomap properly before returning an error. so next time we mess around, we may get annoying printfs.
Fix this.
ok kettenis@
|
Revision tags: OPENBSD_4_6_BASE
|
#
1.60 |
|
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@
|
#
1.59 |
|
03-May-2009 |
kettenis |
Avoid clobbering error return values with the result from extent_free(), by simply calling iommu_dvma_unload(). Solution suggested by oga@.
While there, also unwrap a line that isn't long enough to need wrapping.
|
#
1.58 |
|
02-May-2009 |
kettenis |
Avoid clobbering error return values with the result from extent_free(), by simply calling iommu_dvma_unload(). Solution suggested by oga@.
|
#
1.57 |
|
14-Apr-2009 |
oga |
Convert the waitok field of uvm_pglistalloc to "flags", more will be added soon.
For the possibility of sleeping, the first two flags are UVM_PLA_WAITOK and UVM_PLA_NOWAIT. It is an error not to show intention, so assert that one of the two is provided. Switch over every caller in the tree to using the appropriate flag.
ok art@, ariane@
|
#
1.56 |
|
05-Apr-2009 |
oga |
In the rare case where after we've loaded the iomap into the hardware, if we fail while assembling the dmamap due to the memory not fitting into our constraints we'll return from the function with the iomap still loaded, and more importantly with memory still allocated from the extent(9). So in such a case, make sure we clean up after outselves.
In order to make this cleaner, remove an impossible condition check (kettenis and myself are satisfied that it will never happen), and make iomap_load_map void (it can't fail), so that we can only fail after both the extent is allocated and the iomap is loaded, and not inbetween the two.
I tested iommu, kettenis tested viommu.
ok kettenis@.
|
#
1.55 |
|
16-Mar-2009 |
oga |
Trivial malloc + memset -> malloc(,,M_ZERO) conversion.
As a small bonus this now actually zeroes the whole struct, not just the non-varying sized part.
|
#
1.54 |
|
16-Mar-2009 |
oga |
pmap = (conditional ? user_way : pmap = pmap_kernel());
doesn't need the second pmap =. "ok if you tested it" kettenis@
|
Revision tags: OPENBSD_4_5_BASE
|
#
1.53 |
|
02-Jan-2009 |
kettenis |
Make IOMMU code use the generic _bus_dmamem_map() and _bus_dmamem_unmap().
|
#
1.52 |
|
25-Nov-2008 |
kettenis |
Fix dmesg ugliness caused by not printing iotdb stuff.
|
#
1.51 |
|
11-Aug-2008 |
kettenis |
Only print iotdb stuff when DEBUG.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.50 |
|
12-Jul-2008 |
kettenis |
Perform IOMMU cache flushes on Oberon.
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.49 |
|
15-Dec-2007 |
deraadt |
move some iommu_dvmamap_validate_map()'s into DEBUG instead of DIAGNOSTIC, to slightly improve performance ok kettenis
|
#
1.48 |
|
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.47 |
|
29-May-2007 |
sobrado |
use the right capitalization for `SBus'
ok jmc@
|
#
1.46 |
|
04-Apr-2007 |
kettenis |
Correctly set the TSB size on pyro(4).
|
#
1.45 |
|
02-Apr-2007 |
claudio |
Return EFBIG in case not enough segments are present to load a DMA request instead of ENOMEM and remove/shortcut the additional debug printfs. Some network drivers will try to load the mbuf chain and linearize the mbufs if EFBIG is returned. OK miod@ kettenis@
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.44 |
|
26-Jan-2007 |
tsi |
Deal with zero wraparound in DVMA range checks; Fix default DVMA range for Schizo's with no "virtual-dma" property; Add TSB size indicator to Schizo & Psycho debugging messages.
ok jason@
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.43 |
|
01-Sep-2006 |
miod |
Standardize on EFBIG in bus_dmamap_load* if caller is too greedy; I had done this 4.5 years ago already but regressions happened; reminded by a similar commit in NetBSD (from mrg@); ok damien@ deraadt@ jason@
|
#
1.42 |
|
15-Aug-2006 |
miod |
Allocate as many iommu page lists as necessary to match the size request in bus_dmamap_create() again, but this time add a few extra pages to cope with fragmented data (such as mbufs). Tested by many.
|
#
1.41 |
|
02-Jul-2006 |
dlg |
get rid of an unused variable.
ok deraadt@
|
#
1.40 |
|
01-Jul-2006 |
deraadt |
clean dmesg output for iommu more; tested miod dlg
|
#
1.39 |
|
28-Jun-2006 |
deraadt |
cleanup dmesg logging for iommu goo, make it follow the standard form
|
Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
|
#
1.38 |
|
07-Jun-2005 |
kurt |
revert previous commit and unbreak sparc64.
okay deraadt
|
#
1.37 |
|
02-Jun-2005 |
mickey |
allow for dma maps larger than 64 pages; jason@ ok
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
25-Dec-2004 |
miod |
Use list and queue macros where applicable to make the code easier to read; no functional change.
|
Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
|
#
1.35 |
|
19-Mar-2004 |
miod |
Off-by-ones, requests for (x * PAGE_SIZE) + 1 bytes would not allocate the last page. Found the hard way by chris@ and claudio@.
ok jason@ deraadt@
|
#
1.34 |
|
20-Dec-2003 |
miod |
Pass -Wformat
|
#
1.33 |
|
04-Dec-2003 |
miod |
Typos
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.32 |
|
11-Jun-2003 |
henric |
It is important not to forget "membar(MemIssue)". Got missed when extracting the minimal diff for the previous iommu change.
ok jason@
|
#
1.31 |
|
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@
|
#
1.30 |
|
11-Jun-2003 |
henric |
The "min" and "max" functions cast to "u_int", which can lead to surprising results. Use the MIN/MAX macros instead.
tested by miod@ ok jason@ millert@
|
#
1.29 |
|
22-May-2003 |
henric |
There's an off-by-one in the diagnostic code that can cause grief, especially for NIC drivers that aren't careful about handling load failures.
Bug reported and diff tested by Holger Burde.
ok jason@.
|
Revision tags: OPENBSD_3_3_BASE UBC_SYNC_A
|
#
1.28 |
|
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.27 |
|
22-Feb-2003 |
jason |
don't use home grown timeval comparison when timercmp() is available; pointed out by henric
|
#
1.26 |
|
21-Feb-2003 |
jason |
Print the pa not ldxa(pa)
|
#
1.25 |
|
21-Feb-2003 |
jason |
- kill several unnecessary static's - fix debugging code so it doesn't generate crashes itself
|
#
1.24 |
|
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: UBC_SYNC_B
|
#
1.23 |
|
12-Oct-2002 |
krw |
Remove more '\n's from panic() statements. Both trailing and leading.
Diff generated by Chris Kuethe.
|
#
1.22 |
|
07-Oct-2002 |
mickey |
this removes the functionality of adding allocated pages into the queue already containing allocated pages. breaks i386:setup_buffers() because of this.
|
#
1.21 |
|
06-Oct-2002 |
art |
No more need to initialize the result list before uvm_pglistalloc.
|
#
1.20 |
|
04-Oct-2002 |
jason |
Aasking to load an already loaded map is not a "warn and pray" kinda thing.
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.19 |
|
19-Aug-2002 |
jason |
From NetBSD: -Fix some corner cases in bus_dmamap_load_mbuf(). From Takeshi Nakayama <tn@catvmics.ne.jp> -Fix off-by-one error in iommu_dvmamap_load_raw() where if a DMA segment has just one byte on a page the page is never mapped into the IOMMU.
|
#
1.18 |
|
24-Jul-2002 |
jason |
No need to cast &thing to paddr_t* when thing IS a paddr_t
|
#
1.17 |
|
13-May-2002 |
jason |
Deal with 24bit dvma requests
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.16 |
|
26-Mar-2002 |
jason |
Permit compiling with DEBUG; Joey Coleman <joeycoleman@acm.org>
|
#
1.15 |
|
14-Mar-2002 |
millert |
First round of __P removal in sys
|
#
1.14 |
|
12-Mar-2002 |
jason |
Look up the TTE and only do the streaming cache dance if the mapping is marked as streaming.
|
#
1.13 |
|
07-Mar-2002 |
jason |
Remove some debugging code accidentally committed in previous
|
#
1.12 |
|
07-Mar-2002 |
jason |
From NetBSD: Fix calculation of dma segment length when the DVMA range is crossing the boundary.
|
#
1.11 |
|
22-Feb-2002 |
jason |
Be sure to wait the whole 0.5 seconds (half a second!) for the streaming cache to flush, not some fraction of it, before giving up.
|
#
1.10 |
|
22-Feb-2002 |
deraadt |
Debugger() is #ifdef DDB
|
#
1.9 |
|
22-Feb-2002 |
jason |
- don't call strbuf_flush_done for each segment, call it once per map (and then only if necessary) - When flushing a partial segment make sure we flush all of the necessary pages (the case where len < NBPG would not correctly flush both pages if va + off <-> va + off + len crossed a page boundary)
|
#
1.8 |
|
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: UBC_BASE
|
#
1.7 |
|
04-Dec-2001 |
art |
branches: 1.7.2; Yet another sync to NetBSD uvm. Today we add a pmap argument to pmap_update() and allocate map entries for kernel_map from kmem_map instead of using the static entries. This should get rid of MAX_KMAPENT panics. Also some uvm_loan problems are fixed.
|
#
1.6 |
|
06-Nov-2001 |
miod |
Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary. (Look ma, I might have broken the tree)
|
Revision tags: OPENBSD_3_0_BASE
|
#
1.5 |
|
15-Oct-2001 |
jason |
branches: 1.5.4; 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.4 |
|
26-Sep-2001 |
jason |
Merge with NetBSD: better handling of boundary conditions add iommu_extract debugging function
|
#
1.3 |
|
19-Sep-2001 |
mickey |
merge vm/vm_kern.h into uvm/uvm_extern.h; art@ ok
|
#
1.2 |
|
18-Aug-2001 |
jason |
RCSids
|
#
1.1 |
|
18-Aug-2001 |
jason |
compiles with minimal mods (From NetBSD)
|
#
1.82 |
|
16-May-2021 |
deraadt |
panic does not require a \n at the end. When one is provided, it looks wrong.
|
Revision tags: OPENBSD_6_9_BASE
|
#
1.81 |
|
11-Mar-2021 |
jsg |
spelling
|
Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
|
#
1.80 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: use %x not %lx with int
|
#
1.79 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: do not use undefined pa
introduced iommu_dvmamap_insert() using an undefined paddr_t pa under DEBUG; since it cannot be introduced it (easily), remove it from the printf().
|
#
1.78 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: Format bus_{addr,size}_t as long
|
#
1.77 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: format time_t as long long
Feedback guenther
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.76 |
|
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_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.75 |
|
25-May-2017 |
dlg |
tweak sparc64 membars as a step toward making them usable in userland.
specifically, dont rely on magic in ctlreg to implement membars. moving that to atomic.h would add a lot of pollution to the namespace, so move to passing the membar options to a single __membar macro.
this tweaks everything that was using the ctlreg backend to either use an appropriate membar_foo(), or to use __membar() in the MD code.
ok kettenis@
|
#
1.74 |
|
30-Apr-2017 |
mpi |
Rename Debugger() into db_enter().
Using a name with the 'db_' prefix makes it invisible from the dynamic profiler.
ok deraadt@, kettenis@, visa@
|
Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
|
#
1.73 |
|
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_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
|
#
1.72 |
|
09-Jan-2015 |
kettenis |
Fix loading memory allocated with bus_dmamem_alloc(9). The old could would always load all allocated pages instead of the size specified in the bus_dmamap_load_raw(9) call. Also fixes the corner case where a specified boundary is less than the page size, which would always create multiple segments, even if the specified size was smaller than the boundary.
Fixes xhci(4) on sparc64.
|
#
1.71 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
#
1.70 |
|
26-Oct-2014 |
kettenis |
uvm_km_valloc -> km_alloc
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.69 |
|
12-Jul-2014 |
tedu |
add a size argument to free. will be used soon, but for now default to 0. after discussions with beck deraadt kettenis.
|
#
1.68 |
|
10-May-2014 |
kettenis |
Format string fixes for bus_addr_t and bus_size_t, which are u_long everywhere.
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.67 |
|
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_5_3_BASE OPENBSD_5_4_BASE
|
#
1.66 |
|
15-Jan-2013 |
kettenis |
Fix segmentation of buffers that straddle a boundary.
ok dlg@
|
#
1.65 |
|
17-Aug-2012 |
kettenis |
Properly initialize the IOMMU control and status register for pyro(4). Fixes DMA problems spotted on the v445.
|
Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.64 |
|
18-May-2011 |
ariane |
When the sparc64 iommu fails to lookup a vaddr, it prints a message and returns EFBIG. This cannot be recovered from and is usually indicative of a damaged pmap. Therefor, panic right here instead.
This diff meant the difference between dropping into single-user mode versus getting a traceable panic.
ok kettenis@
|
#
1.63 |
|
07-Apr-2011 |
miod |
Do not use NULL in integer comparisons. No functional change. ok matthew@ tedu@, also eyeballed by at least krw@ oga@ kettenis@ jsg@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
|
#
1.62 |
|
20-Apr-2010 |
deraadt |
cleanup more confusion regarding user.h before proc.h, or missing proc.h ok tedu
|
Revision tags: OPENBSD_4_7_BASE
|
#
1.61 |
|
09-Aug-2009 |
oga |
if extent_alloc() fails, we don't clear the iomap properly before returning an error. so next time we mess around, we may get annoying printfs.
Fix this.
ok kettenis@
|
Revision tags: OPENBSD_4_6_BASE
|
#
1.60 |
|
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@
|
#
1.59 |
|
03-May-2009 |
kettenis |
Avoid clobbering error return values with the result from extent_free(), by simply calling iommu_dvma_unload(). Solution suggested by oga@.
While there, also unwrap a line that isn't long enough to need wrapping.
|
#
1.58 |
|
02-May-2009 |
kettenis |
Avoid clobbering error return values with the result from extent_free(), by simply calling iommu_dvma_unload(). Solution suggested by oga@.
|
#
1.57 |
|
14-Apr-2009 |
oga |
Convert the waitok field of uvm_pglistalloc to "flags", more will be added soon.
For the possibility of sleeping, the first two flags are UVM_PLA_WAITOK and UVM_PLA_NOWAIT. It is an error not to show intention, so assert that one of the two is provided. Switch over every caller in the tree to using the appropriate flag.
ok art@, ariane@
|
#
1.56 |
|
05-Apr-2009 |
oga |
In the rare case where after we've loaded the iomap into the hardware, if we fail while assembling the dmamap due to the memory not fitting into our constraints we'll return from the function with the iomap still loaded, and more importantly with memory still allocated from the extent(9). So in such a case, make sure we clean up after outselves.
In order to make this cleaner, remove an impossible condition check (kettenis and myself are satisfied that it will never happen), and make iomap_load_map void (it can't fail), so that we can only fail after both the extent is allocated and the iomap is loaded, and not inbetween the two.
I tested iommu, kettenis tested viommu.
ok kettenis@.
|
#
1.55 |
|
16-Mar-2009 |
oga |
Trivial malloc + memset -> malloc(,,M_ZERO) conversion.
As a small bonus this now actually zeroes the whole struct, not just the non-varying sized part.
|
#
1.54 |
|
16-Mar-2009 |
oga |
pmap = (conditional ? user_way : pmap = pmap_kernel());
doesn't need the second pmap =. "ok if you tested it" kettenis@
|
Revision tags: OPENBSD_4_5_BASE
|
#
1.53 |
|
02-Jan-2009 |
kettenis |
Make IOMMU code use the generic _bus_dmamem_map() and _bus_dmamem_unmap().
|
#
1.52 |
|
25-Nov-2008 |
kettenis |
Fix dmesg ugliness caused by not printing iotdb stuff.
|
#
1.51 |
|
11-Aug-2008 |
kettenis |
Only print iotdb stuff when DEBUG.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.50 |
|
12-Jul-2008 |
kettenis |
Perform IOMMU cache flushes on Oberon.
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.49 |
|
15-Dec-2007 |
deraadt |
move some iommu_dvmamap_validate_map()'s into DEBUG instead of DIAGNOSTIC, to slightly improve performance ok kettenis
|
#
1.48 |
|
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.47 |
|
29-May-2007 |
sobrado |
use the right capitalization for `SBus'
ok jmc@
|
#
1.46 |
|
04-Apr-2007 |
kettenis |
Correctly set the TSB size on pyro(4).
|
#
1.45 |
|
02-Apr-2007 |
claudio |
Return EFBIG in case not enough segments are present to load a DMA request instead of ENOMEM and remove/shortcut the additional debug printfs. Some network drivers will try to load the mbuf chain and linearize the mbufs if EFBIG is returned. OK miod@ kettenis@
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.44 |
|
26-Jan-2007 |
tsi |
Deal with zero wraparound in DVMA range checks; Fix default DVMA range for Schizo's with no "virtual-dma" property; Add TSB size indicator to Schizo & Psycho debugging messages.
ok jason@
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.43 |
|
01-Sep-2006 |
miod |
Standardize on EFBIG in bus_dmamap_load* if caller is too greedy; I had done this 4.5 years ago already but regressions happened; reminded by a similar commit in NetBSD (from mrg@); ok damien@ deraadt@ jason@
|
#
1.42 |
|
15-Aug-2006 |
miod |
Allocate as many iommu page lists as necessary to match the size request in bus_dmamap_create() again, but this time add a few extra pages to cope with fragmented data (such as mbufs). Tested by many.
|
#
1.41 |
|
02-Jul-2006 |
dlg |
get rid of an unused variable.
ok deraadt@
|
#
1.40 |
|
01-Jul-2006 |
deraadt |
clean dmesg output for iommu more; tested miod dlg
|
#
1.39 |
|
28-Jun-2006 |
deraadt |
cleanup dmesg logging for iommu goo, make it follow the standard form
|
Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
|
#
1.38 |
|
07-Jun-2005 |
kurt |
revert previous commit and unbreak sparc64.
okay deraadt
|
#
1.37 |
|
02-Jun-2005 |
mickey |
allow for dma maps larger than 64 pages; jason@ ok
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
25-Dec-2004 |
miod |
Use list and queue macros where applicable to make the code easier to read; no functional change.
|
Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
|
#
1.35 |
|
19-Mar-2004 |
miod |
Off-by-ones, requests for (x * PAGE_SIZE) + 1 bytes would not allocate the last page. Found the hard way by chris@ and claudio@.
ok jason@ deraadt@
|
#
1.34 |
|
20-Dec-2003 |
miod |
Pass -Wformat
|
#
1.33 |
|
04-Dec-2003 |
miod |
Typos
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.32 |
|
11-Jun-2003 |
henric |
It is important not to forget "membar(MemIssue)". Got missed when extracting the minimal diff for the previous iommu change.
ok jason@
|
#
1.31 |
|
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@
|
#
1.30 |
|
11-Jun-2003 |
henric |
The "min" and "max" functions cast to "u_int", which can lead to surprising results. Use the MIN/MAX macros instead.
tested by miod@ ok jason@ millert@
|
#
1.29 |
|
22-May-2003 |
henric |
There's an off-by-one in the diagnostic code that can cause grief, especially for NIC drivers that aren't careful about handling load failures.
Bug reported and diff tested by Holger Burde.
ok jason@.
|
Revision tags: OPENBSD_3_3_BASE UBC_SYNC_A
|
#
1.28 |
|
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.27 |
|
22-Feb-2003 |
jason |
don't use home grown timeval comparison when timercmp() is available; pointed out by henric
|
#
1.26 |
|
21-Feb-2003 |
jason |
Print the pa not ldxa(pa)
|
#
1.25 |
|
21-Feb-2003 |
jason |
- kill several unnecessary static's - fix debugging code so it doesn't generate crashes itself
|
#
1.24 |
|
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: UBC_SYNC_B
|
#
1.23 |
|
12-Oct-2002 |
krw |
Remove more '\n's from panic() statements. Both trailing and leading.
Diff generated by Chris Kuethe.
|
#
1.22 |
|
07-Oct-2002 |
mickey |
this removes the functionality of adding allocated pages into the queue already containing allocated pages. breaks i386:setup_buffers() because of this.
|
#
1.21 |
|
06-Oct-2002 |
art |
No more need to initialize the result list before uvm_pglistalloc.
|
#
1.20 |
|
04-Oct-2002 |
jason |
Aasking to load an already loaded map is not a "warn and pray" kinda thing.
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.19 |
|
19-Aug-2002 |
jason |
From NetBSD: -Fix some corner cases in bus_dmamap_load_mbuf(). From Takeshi Nakayama <tn@catvmics.ne.jp> -Fix off-by-one error in iommu_dvmamap_load_raw() where if a DMA segment has just one byte on a page the page is never mapped into the IOMMU.
|
#
1.18 |
|
24-Jul-2002 |
jason |
No need to cast &thing to paddr_t* when thing IS a paddr_t
|
#
1.17 |
|
13-May-2002 |
jason |
Deal with 24bit dvma requests
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.16 |
|
26-Mar-2002 |
jason |
Permit compiling with DEBUG; Joey Coleman <joeycoleman@acm.org>
|
#
1.15 |
|
14-Mar-2002 |
millert |
First round of __P removal in sys
|
#
1.14 |
|
12-Mar-2002 |
jason |
Look up the TTE and only do the streaming cache dance if the mapping is marked as streaming.
|
#
1.13 |
|
07-Mar-2002 |
jason |
Remove some debugging code accidentally committed in previous
|
#
1.12 |
|
07-Mar-2002 |
jason |
From NetBSD: Fix calculation of dma segment length when the DVMA range is crossing the boundary.
|
#
1.11 |
|
22-Feb-2002 |
jason |
Be sure to wait the whole 0.5 seconds (half a second!) for the streaming cache to flush, not some fraction of it, before giving up.
|
#
1.10 |
|
22-Feb-2002 |
deraadt |
Debugger() is #ifdef DDB
|
#
1.9 |
|
22-Feb-2002 |
jason |
- don't call strbuf_flush_done for each segment, call it once per map (and then only if necessary) - When flushing a partial segment make sure we flush all of the necessary pages (the case where len < NBPG would not correctly flush both pages if va + off <-> va + off + len crossed a page boundary)
|
#
1.8 |
|
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: UBC_BASE
|
#
1.7 |
|
04-Dec-2001 |
art |
branches: 1.7.2; Yet another sync to NetBSD uvm. Today we add a pmap argument to pmap_update() and allocate map entries for kernel_map from kmem_map instead of using the static entries. This should get rid of MAX_KMAPENT panics. Also some uvm_loan problems are fixed.
|
#
1.6 |
|
06-Nov-2001 |
miod |
Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary. (Look ma, I might have broken the tree)
|
Revision tags: OPENBSD_3_0_BASE
|
#
1.5 |
|
15-Oct-2001 |
jason |
branches: 1.5.4; 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.4 |
|
26-Sep-2001 |
jason |
Merge with NetBSD: better handling of boundary conditions add iommu_extract debugging function
|
#
1.3 |
|
19-Sep-2001 |
mickey |
merge vm/vm_kern.h into uvm/uvm_extern.h; art@ ok
|
#
1.2 |
|
18-Aug-2001 |
jason |
RCSids
|
#
1.1 |
|
18-Aug-2001 |
jason |
compiles with minimal mods (From NetBSD)
|
#
1.81 |
|
11-Mar-2021 |
jsg |
spelling
|
Revision tags: OPENBSD_6_7_BASE OPENBSD_6_8_BASE
|
#
1.80 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: use %x not %lx with int
|
#
1.79 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: do not use undefined pa
introduced iommu_dvmamap_insert() using an undefined paddr_t pa under DEBUG; since it cannot be introduced it (easily), remove it from the printf().
|
#
1.78 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: Format bus_{addr,size}_t as long
|
#
1.77 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: format time_t as long long
Feedback guenther
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.76 |
|
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_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.75 |
|
25-May-2017 |
dlg |
tweak sparc64 membars as a step toward making them usable in userland.
specifically, dont rely on magic in ctlreg to implement membars. moving that to atomic.h would add a lot of pollution to the namespace, so move to passing the membar options to a single __membar macro.
this tweaks everything that was using the ctlreg backend to either use an appropriate membar_foo(), or to use __membar() in the MD code.
ok kettenis@
|
#
1.74 |
|
30-Apr-2017 |
mpi |
Rename Debugger() into db_enter().
Using a name with the 'db_' prefix makes it invisible from the dynamic profiler.
ok deraadt@, kettenis@, visa@
|
Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
|
#
1.73 |
|
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_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
|
#
1.72 |
|
09-Jan-2015 |
kettenis |
Fix loading memory allocated with bus_dmamem_alloc(9). The old could would always load all allocated pages instead of the size specified in the bus_dmamap_load_raw(9) call. Also fixes the corner case where a specified boundary is less than the page size, which would always create multiple segments, even if the specified size was smaller than the boundary.
Fixes xhci(4) on sparc64.
|
#
1.71 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
#
1.70 |
|
26-Oct-2014 |
kettenis |
uvm_km_valloc -> km_alloc
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.69 |
|
12-Jul-2014 |
tedu |
add a size argument to free. will be used soon, but for now default to 0. after discussions with beck deraadt kettenis.
|
#
1.68 |
|
10-May-2014 |
kettenis |
Format string fixes for bus_addr_t and bus_size_t, which are u_long everywhere.
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.67 |
|
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_5_3_BASE OPENBSD_5_4_BASE
|
#
1.66 |
|
15-Jan-2013 |
kettenis |
Fix segmentation of buffers that straddle a boundary.
ok dlg@
|
#
1.65 |
|
17-Aug-2012 |
kettenis |
Properly initialize the IOMMU control and status register for pyro(4). Fixes DMA problems spotted on the v445.
|
Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.64 |
|
18-May-2011 |
ariane |
When the sparc64 iommu fails to lookup a vaddr, it prints a message and returns EFBIG. This cannot be recovered from and is usually indicative of a damaged pmap. Therefor, panic right here instead.
This diff meant the difference between dropping into single-user mode versus getting a traceable panic.
ok kettenis@
|
#
1.63 |
|
07-Apr-2011 |
miod |
Do not use NULL in integer comparisons. No functional change. ok matthew@ tedu@, also eyeballed by at least krw@ oga@ kettenis@ jsg@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
|
#
1.62 |
|
20-Apr-2010 |
deraadt |
cleanup more confusion regarding user.h before proc.h, or missing proc.h ok tedu
|
Revision tags: OPENBSD_4_7_BASE
|
#
1.61 |
|
09-Aug-2009 |
oga |
if extent_alloc() fails, we don't clear the iomap properly before returning an error. so next time we mess around, we may get annoying printfs.
Fix this.
ok kettenis@
|
Revision tags: OPENBSD_4_6_BASE
|
#
1.60 |
|
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@
|
#
1.59 |
|
03-May-2009 |
kettenis |
Avoid clobbering error return values with the result from extent_free(), by simply calling iommu_dvma_unload(). Solution suggested by oga@.
While there, also unwrap a line that isn't long enough to need wrapping.
|
#
1.58 |
|
02-May-2009 |
kettenis |
Avoid clobbering error return values with the result from extent_free(), by simply calling iommu_dvma_unload(). Solution suggested by oga@.
|
#
1.57 |
|
14-Apr-2009 |
oga |
Convert the waitok field of uvm_pglistalloc to "flags", more will be added soon.
For the possibility of sleeping, the first two flags are UVM_PLA_WAITOK and UVM_PLA_NOWAIT. It is an error not to show intention, so assert that one of the two is provided. Switch over every caller in the tree to using the appropriate flag.
ok art@, ariane@
|
#
1.56 |
|
05-Apr-2009 |
oga |
In the rare case where after we've loaded the iomap into the hardware, if we fail while assembling the dmamap due to the memory not fitting into our constraints we'll return from the function with the iomap still loaded, and more importantly with memory still allocated from the extent(9). So in such a case, make sure we clean up after outselves.
In order to make this cleaner, remove an impossible condition check (kettenis and myself are satisfied that it will never happen), and make iomap_load_map void (it can't fail), so that we can only fail after both the extent is allocated and the iomap is loaded, and not inbetween the two.
I tested iommu, kettenis tested viommu.
ok kettenis@.
|
#
1.55 |
|
16-Mar-2009 |
oga |
Trivial malloc + memset -> malloc(,,M_ZERO) conversion.
As a small bonus this now actually zeroes the whole struct, not just the non-varying sized part.
|
#
1.54 |
|
16-Mar-2009 |
oga |
pmap = (conditional ? user_way : pmap = pmap_kernel());
doesn't need the second pmap =. "ok if you tested it" kettenis@
|
Revision tags: OPENBSD_4_5_BASE
|
#
1.53 |
|
02-Jan-2009 |
kettenis |
Make IOMMU code use the generic _bus_dmamem_map() and _bus_dmamem_unmap().
|
#
1.52 |
|
25-Nov-2008 |
kettenis |
Fix dmesg ugliness caused by not printing iotdb stuff.
|
#
1.51 |
|
11-Aug-2008 |
kettenis |
Only print iotdb stuff when DEBUG.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.50 |
|
12-Jul-2008 |
kettenis |
Perform IOMMU cache flushes on Oberon.
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.49 |
|
15-Dec-2007 |
deraadt |
move some iommu_dvmamap_validate_map()'s into DEBUG instead of DIAGNOSTIC, to slightly improve performance ok kettenis
|
#
1.48 |
|
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.47 |
|
29-May-2007 |
sobrado |
use the right capitalization for `SBus'
ok jmc@
|
#
1.46 |
|
04-Apr-2007 |
kettenis |
Correctly set the TSB size on pyro(4).
|
#
1.45 |
|
02-Apr-2007 |
claudio |
Return EFBIG in case not enough segments are present to load a DMA request instead of ENOMEM and remove/shortcut the additional debug printfs. Some network drivers will try to load the mbuf chain and linearize the mbufs if EFBIG is returned. OK miod@ kettenis@
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.44 |
|
26-Jan-2007 |
tsi |
Deal with zero wraparound in DVMA range checks; Fix default DVMA range for Schizo's with no "virtual-dma" property; Add TSB size indicator to Schizo & Psycho debugging messages.
ok jason@
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.43 |
|
01-Sep-2006 |
miod |
Standardize on EFBIG in bus_dmamap_load* if caller is too greedy; I had done this 4.5 years ago already but regressions happened; reminded by a similar commit in NetBSD (from mrg@); ok damien@ deraadt@ jason@
|
#
1.42 |
|
15-Aug-2006 |
miod |
Allocate as many iommu page lists as necessary to match the size request in bus_dmamap_create() again, but this time add a few extra pages to cope with fragmented data (such as mbufs). Tested by many.
|
#
1.41 |
|
02-Jul-2006 |
dlg |
get rid of an unused variable.
ok deraadt@
|
#
1.40 |
|
01-Jul-2006 |
deraadt |
clean dmesg output for iommu more; tested miod dlg
|
#
1.39 |
|
28-Jun-2006 |
deraadt |
cleanup dmesg logging for iommu goo, make it follow the standard form
|
Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
|
#
1.38 |
|
07-Jun-2005 |
kurt |
revert previous commit and unbreak sparc64.
okay deraadt
|
#
1.37 |
|
02-Jun-2005 |
mickey |
allow for dma maps larger than 64 pages; jason@ ok
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
25-Dec-2004 |
miod |
Use list and queue macros where applicable to make the code easier to read; no functional change.
|
Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
|
#
1.35 |
|
19-Mar-2004 |
miod |
Off-by-ones, requests for (x * PAGE_SIZE) + 1 bytes would not allocate the last page. Found the hard way by chris@ and claudio@.
ok jason@ deraadt@
|
#
1.34 |
|
20-Dec-2003 |
miod |
Pass -Wformat
|
#
1.33 |
|
04-Dec-2003 |
miod |
Typos
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.32 |
|
11-Jun-2003 |
henric |
It is important not to forget "membar(MemIssue)". Got missed when extracting the minimal diff for the previous iommu change.
ok jason@
|
#
1.31 |
|
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@
|
#
1.30 |
|
11-Jun-2003 |
henric |
The "min" and "max" functions cast to "u_int", which can lead to surprising results. Use the MIN/MAX macros instead.
tested by miod@ ok jason@ millert@
|
#
1.29 |
|
22-May-2003 |
henric |
There's an off-by-one in the diagnostic code that can cause grief, especially for NIC drivers that aren't careful about handling load failures.
Bug reported and diff tested by Holger Burde.
ok jason@.
|
Revision tags: OPENBSD_3_3_BASE UBC_SYNC_A
|
#
1.28 |
|
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.27 |
|
22-Feb-2003 |
jason |
don't use home grown timeval comparison when timercmp() is available; pointed out by henric
|
#
1.26 |
|
21-Feb-2003 |
jason |
Print the pa not ldxa(pa)
|
#
1.25 |
|
21-Feb-2003 |
jason |
- kill several unnecessary static's - fix debugging code so it doesn't generate crashes itself
|
#
1.24 |
|
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: UBC_SYNC_B
|
#
1.23 |
|
12-Oct-2002 |
krw |
Remove more '\n's from panic() statements. Both trailing and leading.
Diff generated by Chris Kuethe.
|
#
1.22 |
|
07-Oct-2002 |
mickey |
this removes the functionality of adding allocated pages into the queue already containing allocated pages. breaks i386:setup_buffers() because of this.
|
#
1.21 |
|
06-Oct-2002 |
art |
No more need to initialize the result list before uvm_pglistalloc.
|
#
1.20 |
|
04-Oct-2002 |
jason |
Aasking to load an already loaded map is not a "warn and pray" kinda thing.
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.19 |
|
19-Aug-2002 |
jason |
From NetBSD: -Fix some corner cases in bus_dmamap_load_mbuf(). From Takeshi Nakayama <tn@catvmics.ne.jp> -Fix off-by-one error in iommu_dvmamap_load_raw() where if a DMA segment has just one byte on a page the page is never mapped into the IOMMU.
|
#
1.18 |
|
24-Jul-2002 |
jason |
No need to cast &thing to paddr_t* when thing IS a paddr_t
|
#
1.17 |
|
13-May-2002 |
jason |
Deal with 24bit dvma requests
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.16 |
|
26-Mar-2002 |
jason |
Permit compiling with DEBUG; Joey Coleman <joeycoleman@acm.org>
|
#
1.15 |
|
14-Mar-2002 |
millert |
First round of __P removal in sys
|
#
1.14 |
|
12-Mar-2002 |
jason |
Look up the TTE and only do the streaming cache dance if the mapping is marked as streaming.
|
#
1.13 |
|
07-Mar-2002 |
jason |
Remove some debugging code accidentally committed in previous
|
#
1.12 |
|
07-Mar-2002 |
jason |
From NetBSD: Fix calculation of dma segment length when the DVMA range is crossing the boundary.
|
#
1.11 |
|
22-Feb-2002 |
jason |
Be sure to wait the whole 0.5 seconds (half a second!) for the streaming cache to flush, not some fraction of it, before giving up.
|
#
1.10 |
|
22-Feb-2002 |
deraadt |
Debugger() is #ifdef DDB
|
#
1.9 |
|
22-Feb-2002 |
jason |
- don't call strbuf_flush_done for each segment, call it once per map (and then only if necessary) - When flushing a partial segment make sure we flush all of the necessary pages (the case where len < NBPG would not correctly flush both pages if va + off <-> va + off + len crossed a page boundary)
|
#
1.8 |
|
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: UBC_BASE
|
#
1.7 |
|
04-Dec-2001 |
art |
branches: 1.7.2; Yet another sync to NetBSD uvm. Today we add a pmap argument to pmap_update() and allocate map entries for kernel_map from kmem_map instead of using the static entries. This should get rid of MAX_KMAPENT panics. Also some uvm_loan problems are fixed.
|
#
1.6 |
|
06-Nov-2001 |
miod |
Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary. (Look ma, I might have broken the tree)
|
Revision tags: OPENBSD_3_0_BASE
|
#
1.5 |
|
15-Oct-2001 |
jason |
branches: 1.5.4; 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.4 |
|
26-Sep-2001 |
jason |
Merge with NetBSD: better handling of boundary conditions add iommu_extract debugging function
|
#
1.3 |
|
19-Sep-2001 |
mickey |
merge vm/vm_kern.h into uvm/uvm_extern.h; art@ ok
|
#
1.2 |
|
18-Aug-2001 |
jason |
RCSids
|
#
1.1 |
|
18-Aug-2001 |
jason |
compiles with minimal mods (From NetBSD)
|
#
1.80 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: use %x not %lx with int
|
#
1.79 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: do not use undefined pa
introduced iommu_dvmamap_insert() using an undefined paddr_t pa under DEBUG; since it cannot be introduced it (easily), remove it from the printf().
|
#
1.78 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: Format bus_{addr,size}_t as long
|
#
1.77 |
|
01-Jan-2020 |
kn |
Unbreak DEBUG build: format time_t as long long
Feedback guenther
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.76 |
|
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_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.75 |
|
25-May-2017 |
dlg |
tweak sparc64 membars as a step toward making them usable in userland.
specifically, dont rely on magic in ctlreg to implement membars. moving that to atomic.h would add a lot of pollution to the namespace, so move to passing the membar options to a single __membar macro.
this tweaks everything that was using the ctlreg backend to either use an appropriate membar_foo(), or to use __membar() in the MD code.
ok kettenis@
|
#
1.74 |
|
30-Apr-2017 |
mpi |
Rename Debugger() into db_enter().
Using a name with the 'db_' prefix makes it invisible from the dynamic profiler.
ok deraadt@, kettenis@, visa@
|
Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
|
#
1.73 |
|
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_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
|
#
1.72 |
|
09-Jan-2015 |
kettenis |
Fix loading memory allocated with bus_dmamem_alloc(9). The old could would always load all allocated pages instead of the size specified in the bus_dmamap_load_raw(9) call. Also fixes the corner case where a specified boundary is less than the page size, which would always create multiple segments, even if the specified size was smaller than the boundary.
Fixes xhci(4) on sparc64.
|
#
1.71 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
#
1.70 |
|
26-Oct-2014 |
kettenis |
uvm_km_valloc -> km_alloc
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.69 |
|
12-Jul-2014 |
tedu |
add a size argument to free. will be used soon, but for now default to 0. after discussions with beck deraadt kettenis.
|
#
1.68 |
|
10-May-2014 |
kettenis |
Format string fixes for bus_addr_t and bus_size_t, which are u_long everywhere.
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.67 |
|
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_5_3_BASE OPENBSD_5_4_BASE
|
#
1.66 |
|
15-Jan-2013 |
kettenis |
Fix segmentation of buffers that straddle a boundary.
ok dlg@
|
#
1.65 |
|
17-Aug-2012 |
kettenis |
Properly initialize the IOMMU control and status register for pyro(4). Fixes DMA problems spotted on the v445.
|
Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.64 |
|
18-May-2011 |
ariane |
When the sparc64 iommu fails to lookup a vaddr, it prints a message and returns EFBIG. This cannot be recovered from and is usually indicative of a damaged pmap. Therefor, panic right here instead.
This diff meant the difference between dropping into single-user mode versus getting a traceable panic.
ok kettenis@
|
#
1.63 |
|
07-Apr-2011 |
miod |
Do not use NULL in integer comparisons. No functional change. ok matthew@ tedu@, also eyeballed by at least krw@ oga@ kettenis@ jsg@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
|
#
1.62 |
|
20-Apr-2010 |
deraadt |
cleanup more confusion regarding user.h before proc.h, or missing proc.h ok tedu
|
Revision tags: OPENBSD_4_7_BASE
|
#
1.61 |
|
09-Aug-2009 |
oga |
if extent_alloc() fails, we don't clear the iomap properly before returning an error. so next time we mess around, we may get annoying printfs.
Fix this.
ok kettenis@
|
Revision tags: OPENBSD_4_6_BASE
|
#
1.60 |
|
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@
|
#
1.59 |
|
03-May-2009 |
kettenis |
Avoid clobbering error return values with the result from extent_free(), by simply calling iommu_dvma_unload(). Solution suggested by oga@.
While there, also unwrap a line that isn't long enough to need wrapping.
|
#
1.58 |
|
02-May-2009 |
kettenis |
Avoid clobbering error return values with the result from extent_free(), by simply calling iommu_dvma_unload(). Solution suggested by oga@.
|
#
1.57 |
|
14-Apr-2009 |
oga |
Convert the waitok field of uvm_pglistalloc to "flags", more will be added soon.
For the possibility of sleeping, the first two flags are UVM_PLA_WAITOK and UVM_PLA_NOWAIT. It is an error not to show intention, so assert that one of the two is provided. Switch over every caller in the tree to using the appropriate flag.
ok art@, ariane@
|
#
1.56 |
|
05-Apr-2009 |
oga |
In the rare case where after we've loaded the iomap into the hardware, if we fail while assembling the dmamap due to the memory not fitting into our constraints we'll return from the function with the iomap still loaded, and more importantly with memory still allocated from the extent(9). So in such a case, make sure we clean up after outselves.
In order to make this cleaner, remove an impossible condition check (kettenis and myself are satisfied that it will never happen), and make iomap_load_map void (it can't fail), so that we can only fail after both the extent is allocated and the iomap is loaded, and not inbetween the two.
I tested iommu, kettenis tested viommu.
ok kettenis@.
|
#
1.55 |
|
16-Mar-2009 |
oga |
Trivial malloc + memset -> malloc(,,M_ZERO) conversion.
As a small bonus this now actually zeroes the whole struct, not just the non-varying sized part.
|
#
1.54 |
|
16-Mar-2009 |
oga |
pmap = (conditional ? user_way : pmap = pmap_kernel());
doesn't need the second pmap =. "ok if you tested it" kettenis@
|
Revision tags: OPENBSD_4_5_BASE
|
#
1.53 |
|
02-Jan-2009 |
kettenis |
Make IOMMU code use the generic _bus_dmamem_map() and _bus_dmamem_unmap().
|
#
1.52 |
|
25-Nov-2008 |
kettenis |
Fix dmesg ugliness caused by not printing iotdb stuff.
|
#
1.51 |
|
11-Aug-2008 |
kettenis |
Only print iotdb stuff when DEBUG.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.50 |
|
12-Jul-2008 |
kettenis |
Perform IOMMU cache flushes on Oberon.
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.49 |
|
15-Dec-2007 |
deraadt |
move some iommu_dvmamap_validate_map()'s into DEBUG instead of DIAGNOSTIC, to slightly improve performance ok kettenis
|
#
1.48 |
|
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.47 |
|
29-May-2007 |
sobrado |
use the right capitalization for `SBus'
ok jmc@
|
#
1.46 |
|
04-Apr-2007 |
kettenis |
Correctly set the TSB size on pyro(4).
|
#
1.45 |
|
02-Apr-2007 |
claudio |
Return EFBIG in case not enough segments are present to load a DMA request instead of ENOMEM and remove/shortcut the additional debug printfs. Some network drivers will try to load the mbuf chain and linearize the mbufs if EFBIG is returned. OK miod@ kettenis@
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.44 |
|
26-Jan-2007 |
tsi |
Deal with zero wraparound in DVMA range checks; Fix default DVMA range for Schizo's with no "virtual-dma" property; Add TSB size indicator to Schizo & Psycho debugging messages.
ok jason@
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.43 |
|
01-Sep-2006 |
miod |
Standardize on EFBIG in bus_dmamap_load* if caller is too greedy; I had done this 4.5 years ago already but regressions happened; reminded by a similar commit in NetBSD (from mrg@); ok damien@ deraadt@ jason@
|
#
1.42 |
|
15-Aug-2006 |
miod |
Allocate as many iommu page lists as necessary to match the size request in bus_dmamap_create() again, but this time add a few extra pages to cope with fragmented data (such as mbufs). Tested by many.
|
#
1.41 |
|
02-Jul-2006 |
dlg |
get rid of an unused variable.
ok deraadt@
|
#
1.40 |
|
01-Jul-2006 |
deraadt |
clean dmesg output for iommu more; tested miod dlg
|
#
1.39 |
|
28-Jun-2006 |
deraadt |
cleanup dmesg logging for iommu goo, make it follow the standard form
|
Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
|
#
1.38 |
|
07-Jun-2005 |
kurt |
revert previous commit and unbreak sparc64.
okay deraadt
|
#
1.37 |
|
02-Jun-2005 |
mickey |
allow for dma maps larger than 64 pages; jason@ ok
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
25-Dec-2004 |
miod |
Use list and queue macros where applicable to make the code easier to read; no functional change.
|
Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
|
#
1.35 |
|
19-Mar-2004 |
miod |
Off-by-ones, requests for (x * PAGE_SIZE) + 1 bytes would not allocate the last page. Found the hard way by chris@ and claudio@.
ok jason@ deraadt@
|
#
1.34 |
|
20-Dec-2003 |
miod |
Pass -Wformat
|
#
1.33 |
|
04-Dec-2003 |
miod |
Typos
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.32 |
|
11-Jun-2003 |
henric |
It is important not to forget "membar(MemIssue)". Got missed when extracting the minimal diff for the previous iommu change.
ok jason@
|
#
1.31 |
|
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@
|
#
1.30 |
|
11-Jun-2003 |
henric |
The "min" and "max" functions cast to "u_int", which can lead to surprising results. Use the MIN/MAX macros instead.
tested by miod@ ok jason@ millert@
|
#
1.29 |
|
22-May-2003 |
henric |
There's an off-by-one in the diagnostic code that can cause grief, especially for NIC drivers that aren't careful about handling load failures.
Bug reported and diff tested by Holger Burde.
ok jason@.
|
Revision tags: OPENBSD_3_3_BASE UBC_SYNC_A
|
#
1.28 |
|
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.27 |
|
22-Feb-2003 |
jason |
don't use home grown timeval comparison when timercmp() is available; pointed out by henric
|
#
1.26 |
|
21-Feb-2003 |
jason |
Print the pa not ldxa(pa)
|
#
1.25 |
|
21-Feb-2003 |
jason |
- kill several unnecessary static's - fix debugging code so it doesn't generate crashes itself
|
#
1.24 |
|
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: UBC_SYNC_B
|
#
1.23 |
|
12-Oct-2002 |
krw |
Remove more '\n's from panic() statements. Both trailing and leading.
Diff generated by Chris Kuethe.
|
#
1.22 |
|
07-Oct-2002 |
mickey |
this removes the functionality of adding allocated pages into the queue already containing allocated pages. breaks i386:setup_buffers() because of this.
|
#
1.21 |
|
06-Oct-2002 |
art |
No more need to initialize the result list before uvm_pglistalloc.
|
#
1.20 |
|
04-Oct-2002 |
jason |
Aasking to load an already loaded map is not a "warn and pray" kinda thing.
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.19 |
|
19-Aug-2002 |
jason |
From NetBSD: -Fix some corner cases in bus_dmamap_load_mbuf(). From Takeshi Nakayama <tn@catvmics.ne.jp> -Fix off-by-one error in iommu_dvmamap_load_raw() where if a DMA segment has just one byte on a page the page is never mapped into the IOMMU.
|
#
1.18 |
|
24-Jul-2002 |
jason |
No need to cast &thing to paddr_t* when thing IS a paddr_t
|
#
1.17 |
|
13-May-2002 |
jason |
Deal with 24bit dvma requests
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.16 |
|
26-Mar-2002 |
jason |
Permit compiling with DEBUG; Joey Coleman <joeycoleman@acm.org>
|
#
1.15 |
|
14-Mar-2002 |
millert |
First round of __P removal in sys
|
#
1.14 |
|
12-Mar-2002 |
jason |
Look up the TTE and only do the streaming cache dance if the mapping is marked as streaming.
|
#
1.13 |
|
07-Mar-2002 |
jason |
Remove some debugging code accidentally committed in previous
|
#
1.12 |
|
07-Mar-2002 |
jason |
From NetBSD: Fix calculation of dma segment length when the DVMA range is crossing the boundary.
|
#
1.11 |
|
22-Feb-2002 |
jason |
Be sure to wait the whole 0.5 seconds (half a second!) for the streaming cache to flush, not some fraction of it, before giving up.
|
#
1.10 |
|
22-Feb-2002 |
deraadt |
Debugger() is #ifdef DDB
|
#
1.9 |
|
22-Feb-2002 |
jason |
- don't call strbuf_flush_done for each segment, call it once per map (and then only if necessary) - When flushing a partial segment make sure we flush all of the necessary pages (the case where len < NBPG would not correctly flush both pages if va + off <-> va + off + len crossed a page boundary)
|
#
1.8 |
|
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: UBC_BASE
|
#
1.7 |
|
04-Dec-2001 |
art |
branches: 1.7.2; Yet another sync to NetBSD uvm. Today we add a pmap argument to pmap_update() and allocate map entries for kernel_map from kmem_map instead of using the static entries. This should get rid of MAX_KMAPENT panics. Also some uvm_loan problems are fixed.
|
#
1.6 |
|
06-Nov-2001 |
miod |
Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary. (Look ma, I might have broken the tree)
|
Revision tags: OPENBSD_3_0_BASE
|
#
1.5 |
|
15-Oct-2001 |
jason |
branches: 1.5.4; 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.4 |
|
26-Sep-2001 |
jason |
Merge with NetBSD: better handling of boundary conditions add iommu_extract debugging function
|
#
1.3 |
|
19-Sep-2001 |
mickey |
merge vm/vm_kern.h into uvm/uvm_extern.h; art@ ok
|
#
1.2 |
|
18-Aug-2001 |
jason |
RCSids
|
#
1.1 |
|
18-Aug-2001 |
jason |
compiles with minimal mods (From NetBSD)
|
#
1.76 |
|
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_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.75 |
|
25-May-2017 |
dlg |
tweak sparc64 membars as a step toward making them usable in userland.
specifically, dont rely on magic in ctlreg to implement membars. moving that to atomic.h would add a lot of pollution to the namespace, so move to passing the membar options to a single __membar macro.
this tweaks everything that was using the ctlreg backend to either use an appropriate membar_foo(), or to use __membar() in the MD code.
ok kettenis@
|
#
1.74 |
|
30-Apr-2017 |
mpi |
Rename Debugger() into db_enter().
Using a name with the 'db_' prefix makes it invisible from the dynamic profiler.
ok deraadt@, kettenis@, visa@
|
Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
|
#
1.73 |
|
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_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
|
#
1.72 |
|
09-Jan-2015 |
kettenis |
Fix loading memory allocated with bus_dmamem_alloc(9). The old could would always load all allocated pages instead of the size specified in the bus_dmamap_load_raw(9) call. Also fixes the corner case where a specified boundary is less than the page size, which would always create multiple segments, even if the specified size was smaller than the boundary.
Fixes xhci(4) on sparc64.
|
#
1.71 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
#
1.70 |
|
26-Oct-2014 |
kettenis |
uvm_km_valloc -> km_alloc
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.69 |
|
12-Jul-2014 |
tedu |
add a size argument to free. will be used soon, but for now default to 0. after discussions with beck deraadt kettenis.
|
#
1.68 |
|
10-May-2014 |
kettenis |
Format string fixes for bus_addr_t and bus_size_t, which are u_long everywhere.
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.67 |
|
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_5_3_BASE OPENBSD_5_4_BASE
|
#
1.66 |
|
15-Jan-2013 |
kettenis |
Fix segmentation of buffers that straddle a boundary.
ok dlg@
|
#
1.65 |
|
17-Aug-2012 |
kettenis |
Properly initialize the IOMMU control and status register for pyro(4). Fixes DMA problems spotted on the v445.
|
Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.64 |
|
18-May-2011 |
ariane |
When the sparc64 iommu fails to lookup a vaddr, it prints a message and returns EFBIG. This cannot be recovered from and is usually indicative of a damaged pmap. Therefor, panic right here instead.
This diff meant the difference between dropping into single-user mode versus getting a traceable panic.
ok kettenis@
|
#
1.63 |
|
07-Apr-2011 |
miod |
Do not use NULL in integer comparisons. No functional change. ok matthew@ tedu@, also eyeballed by at least krw@ oga@ kettenis@ jsg@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
|
#
1.62 |
|
20-Apr-2010 |
deraadt |
cleanup more confusion regarding user.h before proc.h, or missing proc.h ok tedu
|
Revision tags: OPENBSD_4_7_BASE
|
#
1.61 |
|
09-Aug-2009 |
oga |
if extent_alloc() fails, we don't clear the iomap properly before returning an error. so next time we mess around, we may get annoying printfs.
Fix this.
ok kettenis@
|
Revision tags: OPENBSD_4_6_BASE
|
#
1.60 |
|
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@
|
#
1.59 |
|
03-May-2009 |
kettenis |
Avoid clobbering error return values with the result from extent_free(), by simply calling iommu_dvma_unload(). Solution suggested by oga@.
While there, also unwrap a line that isn't long enough to need wrapping.
|
#
1.58 |
|
02-May-2009 |
kettenis |
Avoid clobbering error return values with the result from extent_free(), by simply calling iommu_dvma_unload(). Solution suggested by oga@.
|
#
1.57 |
|
14-Apr-2009 |
oga |
Convert the waitok field of uvm_pglistalloc to "flags", more will be added soon.
For the possibility of sleeping, the first two flags are UVM_PLA_WAITOK and UVM_PLA_NOWAIT. It is an error not to show intention, so assert that one of the two is provided. Switch over every caller in the tree to using the appropriate flag.
ok art@, ariane@
|
#
1.56 |
|
05-Apr-2009 |
oga |
In the rare case where after we've loaded the iomap into the hardware, if we fail while assembling the dmamap due to the memory not fitting into our constraints we'll return from the function with the iomap still loaded, and more importantly with memory still allocated from the extent(9). So in such a case, make sure we clean up after outselves.
In order to make this cleaner, remove an impossible condition check (kettenis and myself are satisfied that it will never happen), and make iomap_load_map void (it can't fail), so that we can only fail after both the extent is allocated and the iomap is loaded, and not inbetween the two.
I tested iommu, kettenis tested viommu.
ok kettenis@.
|
#
1.55 |
|
16-Mar-2009 |
oga |
Trivial malloc + memset -> malloc(,,M_ZERO) conversion.
As a small bonus this now actually zeroes the whole struct, not just the non-varying sized part.
|
#
1.54 |
|
16-Mar-2009 |
oga |
pmap = (conditional ? user_way : pmap = pmap_kernel());
doesn't need the second pmap =. "ok if you tested it" kettenis@
|
Revision tags: OPENBSD_4_5_BASE
|
#
1.53 |
|
02-Jan-2009 |
kettenis |
Make IOMMU code use the generic _bus_dmamem_map() and _bus_dmamem_unmap().
|
#
1.52 |
|
25-Nov-2008 |
kettenis |
Fix dmesg ugliness caused by not printing iotdb stuff.
|
#
1.51 |
|
11-Aug-2008 |
kettenis |
Only print iotdb stuff when DEBUG.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.50 |
|
12-Jul-2008 |
kettenis |
Perform IOMMU cache flushes on Oberon.
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.49 |
|
15-Dec-2007 |
deraadt |
move some iommu_dvmamap_validate_map()'s into DEBUG instead of DIAGNOSTIC, to slightly improve performance ok kettenis
|
#
1.48 |
|
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.47 |
|
29-May-2007 |
sobrado |
use the right capitalization for `SBus'
ok jmc@
|
#
1.46 |
|
04-Apr-2007 |
kettenis |
Correctly set the TSB size on pyro(4).
|
#
1.45 |
|
02-Apr-2007 |
claudio |
Return EFBIG in case not enough segments are present to load a DMA request instead of ENOMEM and remove/shortcut the additional debug printfs. Some network drivers will try to load the mbuf chain and linearize the mbufs if EFBIG is returned. OK miod@ kettenis@
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.44 |
|
26-Jan-2007 |
tsi |
Deal with zero wraparound in DVMA range checks; Fix default DVMA range for Schizo's with no "virtual-dma" property; Add TSB size indicator to Schizo & Psycho debugging messages.
ok jason@
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.43 |
|
01-Sep-2006 |
miod |
Standardize on EFBIG in bus_dmamap_load* if caller is too greedy; I had done this 4.5 years ago already but regressions happened; reminded by a similar commit in NetBSD (from mrg@); ok damien@ deraadt@ jason@
|
#
1.42 |
|
15-Aug-2006 |
miod |
Allocate as many iommu page lists as necessary to match the size request in bus_dmamap_create() again, but this time add a few extra pages to cope with fragmented data (such as mbufs). Tested by many.
|
#
1.41 |
|
02-Jul-2006 |
dlg |
get rid of an unused variable.
ok deraadt@
|
#
1.40 |
|
01-Jul-2006 |
deraadt |
clean dmesg output for iommu more; tested miod dlg
|
#
1.39 |
|
28-Jun-2006 |
deraadt |
cleanup dmesg logging for iommu goo, make it follow the standard form
|
Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
|
#
1.38 |
|
07-Jun-2005 |
kurt |
revert previous commit and unbreak sparc64.
okay deraadt
|
#
1.37 |
|
02-Jun-2005 |
mickey |
allow for dma maps larger than 64 pages; jason@ ok
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
25-Dec-2004 |
miod |
Use list and queue macros where applicable to make the code easier to read; no functional change.
|
Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
|
#
1.35 |
|
19-Mar-2004 |
miod |
Off-by-ones, requests for (x * PAGE_SIZE) + 1 bytes would not allocate the last page. Found the hard way by chris@ and claudio@.
ok jason@ deraadt@
|
#
1.34 |
|
20-Dec-2003 |
miod |
Pass -Wformat
|
#
1.33 |
|
04-Dec-2003 |
miod |
Typos
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.32 |
|
11-Jun-2003 |
henric |
It is important not to forget "membar(MemIssue)". Got missed when extracting the minimal diff for the previous iommu change.
ok jason@
|
#
1.31 |
|
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@
|
#
1.30 |
|
11-Jun-2003 |
henric |
The "min" and "max" functions cast to "u_int", which can lead to surprising results. Use the MIN/MAX macros instead.
tested by miod@ ok jason@ millert@
|
#
1.29 |
|
22-May-2003 |
henric |
There's an off-by-one in the diagnostic code that can cause grief, especially for NIC drivers that aren't careful about handling load failures.
Bug reported and diff tested by Holger Burde.
ok jason@.
|
Revision tags: OPENBSD_3_3_BASE UBC_SYNC_A
|
#
1.28 |
|
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.27 |
|
22-Feb-2003 |
jason |
don't use home grown timeval comparison when timercmp() is available; pointed out by henric
|
#
1.26 |
|
21-Feb-2003 |
jason |
Print the pa not ldxa(pa)
|
#
1.25 |
|
21-Feb-2003 |
jason |
- kill several unnecessary static's - fix debugging code so it doesn't generate crashes itself
|
#
1.24 |
|
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: UBC_SYNC_B
|
#
1.23 |
|
12-Oct-2002 |
krw |
Remove more '\n's from panic() statements. Both trailing and leading.
Diff generated by Chris Kuethe.
|
#
1.22 |
|
07-Oct-2002 |
mickey |
this removes the functionality of adding allocated pages into the queue already containing allocated pages. breaks i386:setup_buffers() because of this.
|
#
1.21 |
|
06-Oct-2002 |
art |
No more need to initialize the result list before uvm_pglistalloc.
|
#
1.20 |
|
04-Oct-2002 |
jason |
Aasking to load an already loaded map is not a "warn and pray" kinda thing.
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.19 |
|
19-Aug-2002 |
jason |
From NetBSD: -Fix some corner cases in bus_dmamap_load_mbuf(). From Takeshi Nakayama <tn@catvmics.ne.jp> -Fix off-by-one error in iommu_dvmamap_load_raw() where if a DMA segment has just one byte on a page the page is never mapped into the IOMMU.
|
#
1.18 |
|
24-Jul-2002 |
jason |
No need to cast &thing to paddr_t* when thing IS a paddr_t
|
#
1.17 |
|
13-May-2002 |
jason |
Deal with 24bit dvma requests
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.16 |
|
26-Mar-2002 |
jason |
Permit compiling with DEBUG; Joey Coleman <joeycoleman@acm.org>
|
#
1.15 |
|
14-Mar-2002 |
millert |
First round of __P removal in sys
|
#
1.14 |
|
12-Mar-2002 |
jason |
Look up the TTE and only do the streaming cache dance if the mapping is marked as streaming.
|
#
1.13 |
|
07-Mar-2002 |
jason |
Remove some debugging code accidentally committed in previous
|
#
1.12 |
|
07-Mar-2002 |
jason |
From NetBSD: Fix calculation of dma segment length when the DVMA range is crossing the boundary.
|
#
1.11 |
|
22-Feb-2002 |
jason |
Be sure to wait the whole 0.5 seconds (half a second!) for the streaming cache to flush, not some fraction of it, before giving up.
|
#
1.10 |
|
22-Feb-2002 |
deraadt |
Debugger() is #ifdef DDB
|
#
1.9 |
|
22-Feb-2002 |
jason |
- don't call strbuf_flush_done for each segment, call it once per map (and then only if necessary) - When flushing a partial segment make sure we flush all of the necessary pages (the case where len < NBPG would not correctly flush both pages if va + off <-> va + off + len crossed a page boundary)
|
#
1.8 |
|
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: UBC_BASE
|
#
1.7 |
|
04-Dec-2001 |
art |
branches: 1.7.2; Yet another sync to NetBSD uvm. Today we add a pmap argument to pmap_update() and allocate map entries for kernel_map from kmem_map instead of using the static entries. This should get rid of MAX_KMAPENT panics. Also some uvm_loan problems are fixed.
|
#
1.6 |
|
06-Nov-2001 |
miod |
Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary. (Look ma, I might have broken the tree)
|
Revision tags: OPENBSD_3_0_BASE
|
#
1.5 |
|
15-Oct-2001 |
jason |
branches: 1.5.4; 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.4 |
|
26-Sep-2001 |
jason |
Merge with NetBSD: better handling of boundary conditions add iommu_extract debugging function
|
#
1.3 |
|
19-Sep-2001 |
mickey |
merge vm/vm_kern.h into uvm/uvm_extern.h; art@ ok
|
#
1.2 |
|
18-Aug-2001 |
jason |
RCSids
|
#
1.1 |
|
18-Aug-2001 |
jason |
compiles with minimal mods (From NetBSD)
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.75 |
|
25-May-2017 |
dlg |
tweak sparc64 membars as a step toward making them usable in userland.
specifically, dont rely on magic in ctlreg to implement membars. moving that to atomic.h would add a lot of pollution to the namespace, so move to passing the membar options to a single __membar macro.
this tweaks everything that was using the ctlreg backend to either use an appropriate membar_foo(), or to use __membar() in the MD code.
ok kettenis@
|
#
1.74 |
|
30-Apr-2017 |
mpi |
Rename Debugger() into db_enter().
Using a name with the 'db_' prefix makes it invisible from the dynamic profiler.
ok deraadt@, kettenis@, visa@
|
Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE
|
#
1.73 |
|
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_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
|
#
1.72 |
|
09-Jan-2015 |
kettenis |
Fix loading memory allocated with bus_dmamem_alloc(9). The old could would always load all allocated pages instead of the size specified in the bus_dmamap_load_raw(9) call. Also fixes the corner case where a specified boundary is less than the page size, which would always create multiple segments, even if the specified size was smaller than the boundary.
Fixes xhci(4) on sparc64.
|
#
1.71 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
#
1.70 |
|
26-Oct-2014 |
kettenis |
uvm_km_valloc -> km_alloc
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.69 |
|
12-Jul-2014 |
tedu |
add a size argument to free. will be used soon, but for now default to 0. after discussions with beck deraadt kettenis.
|
#
1.68 |
|
10-May-2014 |
kettenis |
Format string fixes for bus_addr_t and bus_size_t, which are u_long everywhere.
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.67 |
|
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_5_3_BASE OPENBSD_5_4_BASE
|
#
1.66 |
|
15-Jan-2013 |
kettenis |
Fix segmentation of buffers that straddle a boundary.
ok dlg@
|
#
1.65 |
|
17-Aug-2012 |
kettenis |
Properly initialize the IOMMU control and status register for pyro(4). Fixes DMA problems spotted on the v445.
|
Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.64 |
|
18-May-2011 |
ariane |
When the sparc64 iommu fails to lookup a vaddr, it prints a message and returns EFBIG. This cannot be recovered from and is usually indicative of a damaged pmap. Therefor, panic right here instead.
This diff meant the difference between dropping into single-user mode versus getting a traceable panic.
ok kettenis@
|
#
1.63 |
|
07-Apr-2011 |
miod |
Do not use NULL in integer comparisons. No functional change. ok matthew@ tedu@, also eyeballed by at least krw@ oga@ kettenis@ jsg@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
|
#
1.62 |
|
20-Apr-2010 |
deraadt |
cleanup more confusion regarding user.h before proc.h, or missing proc.h ok tedu
|
Revision tags: OPENBSD_4_7_BASE
|
#
1.61 |
|
09-Aug-2009 |
oga |
if extent_alloc() fails, we don't clear the iomap properly before returning an error. so next time we mess around, we may get annoying printfs.
Fix this.
ok kettenis@
|
Revision tags: OPENBSD_4_6_BASE
|
#
1.60 |
|
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@
|
#
1.59 |
|
03-May-2009 |
kettenis |
Avoid clobbering error return values with the result from extent_free(), by simply calling iommu_dvma_unload(). Solution suggested by oga@.
While there, also unwrap a line that isn't long enough to need wrapping.
|
#
1.58 |
|
02-May-2009 |
kettenis |
Avoid clobbering error return values with the result from extent_free(), by simply calling iommu_dvma_unload(). Solution suggested by oga@.
|
#
1.57 |
|
14-Apr-2009 |
oga |
Convert the waitok field of uvm_pglistalloc to "flags", more will be added soon.
For the possibility of sleeping, the first two flags are UVM_PLA_WAITOK and UVM_PLA_NOWAIT. It is an error not to show intention, so assert that one of the two is provided. Switch over every caller in the tree to using the appropriate flag.
ok art@, ariane@
|
#
1.56 |
|
05-Apr-2009 |
oga |
In the rare case where after we've loaded the iomap into the hardware, if we fail while assembling the dmamap due to the memory not fitting into our constraints we'll return from the function with the iomap still loaded, and more importantly with memory still allocated from the extent(9). So in such a case, make sure we clean up after outselves.
In order to make this cleaner, remove an impossible condition check (kettenis and myself are satisfied that it will never happen), and make iomap_load_map void (it can't fail), so that we can only fail after both the extent is allocated and the iomap is loaded, and not inbetween the two.
I tested iommu, kettenis tested viommu.
ok kettenis@.
|
#
1.55 |
|
16-Mar-2009 |
oga |
Trivial malloc + memset -> malloc(,,M_ZERO) conversion.
As a small bonus this now actually zeroes the whole struct, not just the non-varying sized part.
|
#
1.54 |
|
16-Mar-2009 |
oga |
pmap = (conditional ? user_way : pmap = pmap_kernel());
doesn't need the second pmap =. "ok if you tested it" kettenis@
|
Revision tags: OPENBSD_4_5_BASE
|
#
1.53 |
|
02-Jan-2009 |
kettenis |
Make IOMMU code use the generic _bus_dmamem_map() and _bus_dmamem_unmap().
|
#
1.52 |
|
25-Nov-2008 |
kettenis |
Fix dmesg ugliness caused by not printing iotdb stuff.
|
#
1.51 |
|
11-Aug-2008 |
kettenis |
Only print iotdb stuff when DEBUG.
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.50 |
|
12-Jul-2008 |
kettenis |
Perform IOMMU cache flushes on Oberon.
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.49 |
|
15-Dec-2007 |
deraadt |
move some iommu_dvmamap_validate_map()'s into DEBUG instead of DIAGNOSTIC, to slightly improve performance ok kettenis
|
#
1.48 |
|
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.47 |
|
29-May-2007 |
sobrado |
use the right capitalization for `SBus'
ok jmc@
|
#
1.46 |
|
04-Apr-2007 |
kettenis |
Correctly set the TSB size on pyro(4).
|
#
1.45 |
|
02-Apr-2007 |
claudio |
Return EFBIG in case not enough segments are present to load a DMA request instead of ENOMEM and remove/shortcut the additional debug printfs. Some network drivers will try to load the mbuf chain and linearize the mbufs if EFBIG is returned. OK miod@ kettenis@
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.44 |
|
26-Jan-2007 |
tsi |
Deal with zero wraparound in DVMA range checks; Fix default DVMA range for Schizo's with no "virtual-dma" property; Add TSB size indicator to Schizo & Psycho debugging messages.
ok jason@
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.43 |
|
01-Sep-2006 |
miod |
Standardize on EFBIG in bus_dmamap_load* if caller is too greedy; I had done this 4.5 years ago already but regressions happened; reminded by a similar commit in NetBSD (from mrg@); ok damien@ deraadt@ jason@
|
#
1.42 |
|
15-Aug-2006 |
miod |
Allocate as many iommu page lists as necessary to match the size request in bus_dmamap_create() again, but this time add a few extra pages to cope with fragmented data (such as mbufs). Tested by many.
|
#
1.41 |
|
02-Jul-2006 |
dlg |
get rid of an unused variable.
ok deraadt@
|
#
1.40 |
|
01-Jul-2006 |
deraadt |
clean dmesg output for iommu more; tested miod dlg
|
#
1.39 |
|
28-Jun-2006 |
deraadt |
cleanup dmesg logging for iommu goo, make it follow the standard form
|
Revision tags: OPENBSD_3_8_BASE OPENBSD_3_9_BASE
|
#
1.38 |
|
07-Jun-2005 |
kurt |
revert previous commit and unbreak sparc64.
okay deraadt
|
#
1.37 |
|
02-Jun-2005 |
mickey |
allow for dma maps larger than 64 pages; jason@ ok
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.36 |
|
25-Dec-2004 |
miod |
Use list and queue macros where applicable to make the code easier to read; no functional change.
|
Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE SMP_SYNC_A SMP_SYNC_B
|
#
1.35 |
|
19-Mar-2004 |
miod |
Off-by-ones, requests for (x * PAGE_SIZE) + 1 bytes would not allocate the last page. Found the hard way by chris@ and claudio@.
ok jason@ deraadt@
|
#
1.34 |
|
20-Dec-2003 |
miod |
Pass -Wformat
|
#
1.33 |
|
04-Dec-2003 |
miod |
Typos
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.32 |
|
11-Jun-2003 |
henric |
It is important not to forget "membar(MemIssue)". Got missed when extracting the minimal diff for the previous iommu change.
ok jason@
|
#
1.31 |
|
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@
|
#
1.30 |
|
11-Jun-2003 |
henric |
The "min" and "max" functions cast to "u_int", which can lead to surprising results. Use the MIN/MAX macros instead.
tested by miod@ ok jason@ millert@
|
#
1.29 |
|
22-May-2003 |
henric |
There's an off-by-one in the diagnostic code that can cause grief, especially for NIC drivers that aren't careful about handling load failures.
Bug reported and diff tested by Holger Burde.
ok jason@.
|
Revision tags: OPENBSD_3_3_BASE UBC_SYNC_A
|
#
1.28 |
|
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.27 |
|
22-Feb-2003 |
jason |
don't use home grown timeval comparison when timercmp() is available; pointed out by henric
|
#
1.26 |
|
21-Feb-2003 |
jason |
Print the pa not ldxa(pa)
|
#
1.25 |
|
21-Feb-2003 |
jason |
- kill several unnecessary static's - fix debugging code so it doesn't generate crashes itself
|
#
1.24 |
|
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: UBC_SYNC_B
|
#
1.23 |
|
12-Oct-2002 |
krw |
Remove more '\n's from panic() statements. Both trailing and leading.
Diff generated by Chris Kuethe.
|
#
1.22 |
|
07-Oct-2002 |
mickey |
this removes the functionality of adding allocated pages into the queue already containing allocated pages. breaks i386:setup_buffers() because of this.
|
#
1.21 |
|
06-Oct-2002 |
art |
No more need to initialize the result list before uvm_pglistalloc.
|
#
1.20 |
|
04-Oct-2002 |
jason |
Aasking to load an already loaded map is not a "warn and pray" kinda thing.
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.19 |
|
19-Aug-2002 |
jason |
From NetBSD: -Fix some corner cases in bus_dmamap_load_mbuf(). From Takeshi Nakayama <tn@catvmics.ne.jp> -Fix off-by-one error in iommu_dvmamap_load_raw() where if a DMA segment has just one byte on a page the page is never mapped into the IOMMU.
|
#
1.18 |
|
24-Jul-2002 |
jason |
No need to cast &thing to paddr_t* when thing IS a paddr_t
|
#
1.17 |
|
13-May-2002 |
jason |
Deal with 24bit dvma requests
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.16 |
|
26-Mar-2002 |
jason |
Permit compiling with DEBUG; Joey Coleman <joeycoleman@acm.org>
|
#
1.15 |
|
14-Mar-2002 |
millert |
First round of __P removal in sys
|
#
1.14 |
|
12-Mar-2002 |
jason |
Look up the TTE and only do the streaming cache dance if the mapping is marked as streaming.
|
#
1.13 |
|
07-Mar-2002 |
jason |
Remove some debugging code accidentally committed in previous
|
#
1.12 |
|
07-Mar-2002 |
jason |
From NetBSD: Fix calculation of dma segment length when the DVMA range is crossing the boundary.
|
#
1.11 |
|
22-Feb-2002 |
jason |
Be sure to wait the whole 0.5 seconds (half a second!) for the streaming cache to flush, not some fraction of it, before giving up.
|
#
1.10 |
|
22-Feb-2002 |
deraadt |
Debugger() is #ifdef DDB
|
#
1.9 |
|
22-Feb-2002 |
jason |
- don't call strbuf_flush_done for each segment, call it once per map (and then only if necessary) - When flushing a partial segment make sure we flush all of the necessary pages (the case where len < NBPG would not correctly flush both pages if va + off <-> va + off + len crossed a page boundary)
|
#
1.8 |
|
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: UBC_BASE
|
#
1.7 |
|
04-Dec-2001 |
art |
branches: 1.7.2; Yet another sync to NetBSD uvm. Today we add a pmap argument to pmap_update() and allocate map entries for kernel_map from kmem_map instead of using the static entries. This should get rid of MAX_KMAPENT panics. Also some uvm_loan problems are fixed.
|
#
1.6 |
|
06-Nov-2001 |
miod |
Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary. (Look ma, I might have broken the tree)
|
Revision tags: OPENBSD_3_0_BASE
|
#
1.5 |
|
15-Oct-2001 |
jason |
branches: 1.5.4; 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.4 |
|
26-Sep-2001 |
jason |
Merge with NetBSD: better handling of boundary conditions add iommu_extract debugging function
|
#
1.3 |
|
19-Sep-2001 |
mickey |
merge vm/vm_kern.h into uvm/uvm_extern.h; art@ ok
|
#
1.2 |
|
18-Aug-2001 |
jason |
RCSids
|
#
1.1 |
|
18-Aug-2001 |
jason |
compiles with minimal mods (From NetBSD)
|