History log of /haiku/src/system/kernel/device_manager/dma_resources.cpp
Revision Date Author Comments
# 831bb207 29-May-2023 Augustin Cavalier <waddlesplash@gmail.com>

kernel/dma_resource: Add an assertion to prevent Init() from being called twice.


# 92b8f3e7 29-May-2023 Augustin Cavalier <waddlesplash@gmail.com>

kernel/dma_resource: Fix tracing.


# 0786d503 20-Jun-2020 Augustin Cavalier <waddlesplash@gmail.com>

DMAResource: Validate that alignment <= block_size.

The code here cannot handle the case where alignment > block_size,
so anything calling Init() with these parameters is invalid.

Fixes #15902 (nvme_disk was long since adjusted, so this is a defense
against code being written in the future.)


# 943383c8 27-Apr-2020 Michael Lotz <mmlr@mlotz.ch>

DMAResource: Remove incorrect early unlock.

When bounce buffers were changed from fixed to dynamic in hrev27185, the
early unlock in case of physical vectors was not removed. This would
lead to an unprotected fBounceBuffers list and the possibility for
multiple operations to share the same bounce buffer vecs, leading to
disk corruption. This would not happen when used purely under the
IOScheduler as all translations are done from a single thread there.
With the nvme_disk driver that runs requests in parallel, this was
however easy to trigger.

Change-Id: I46bd55cd5d86174523d3f745b6c8800dae02babc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2524
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 718d7149 10-Feb-2018 Jérôme Duval <jerome.duval@gmail.com>

white space cleanup


# 3c47ce84 02-Jul-2013 Jérôme Duval <jerome.duval@gmail.com>

DMAResource: mutex_lock() before calling mutex_destroy().


# 6121ae66 15-Jun-2013 Jérôme Duval <jerome.duval@gmail.com>

device_manager: init DMAResource::fScratchVecs.


# d1f280c8 01-Apr-2012 Hamish Morrison <hamishm53@gmail.com>

Add support for pthread_attr_get/setguardsize()

* Added the aforementioned functions.
* create_area_etc() now takes a guard size parameter.
* The thread_info::stack_base/end range now refers to the usable range
only.


# 4be4fc6b 15-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

More 64-bit compilation/safety fixes.


# 4535495d 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ce97aa12 14-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

DMAResource::Init(): Also evaluate the device node's B_DMA_LOW_ADDRESS and
B_DMA_HIGH_ADDRESS attributes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37143 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a8ad734f 14-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced structures {virtual,physical}_address_restrictions, which specify
restrictions for virtual/physical addresses.
* vm_page_allocate_page_run():
- Fixed conversion of base/limit to array indexes. sPhysicalPageOffset was not
taken into account.
- Takes a physical_address_restrictions instead of base/limit and also
supports alignment and boundary restrictions, now.
* map_backing_store(), VM[User,Kernel]AddressSpace::InsertArea()/
ReserveAddressRange() take a virtual_address_restrictions parameter, now. They
also support an alignment independent from the range size.
* create_area_etc(), vm_create_anonymous_area(): Take
{virtual,physical}_address_restrictions parameters, now.
* Removed no longer needed B_PHYSICAL_BASE_ADDRESS.
* DMAResources:
- Fixed potential overflows of uint32 when initializing from device node
attributes.
- Fixed bounce buffer creation TODOs: By using create_area_etc() with the
new restrictions parameters we can directly support physical high address,
boundary, and alignment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37131 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1d578e15 02-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed more address types related issues. Mostly printf() or comparison
warnings, but also some oversights from earlier changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37000 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 435c43f5 02-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced type generic_io_vec, which is similar to iovec, but uses types
that are wide enough for both virtual and physical addresses.
* DMABuffer, IORequest, IOScheduler,... and code using them: Use
generic_io_vec and generic_{addr,size}_t where necessary.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36997 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 64d79eff 27-May-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed physical_entry::{address,size} to phys_{addr,size}_t and changed
map_physical_memory()'s physicalAddress parameter type from void* to
phys_addr_t. This breaks source compatibility, but -- as long as
phys_{addr,size}_t remain 32 bit wide -- keeps binary compatibility with
BeOS.
* Adjusted all code using the affected interfaces (Oh what fun!). Added a few
TODOs in places where the wrong types (e.g. void* for physical addresses
are used). Looks like quite a few drivers aren't 64 bit safe and others
will break with PAE.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36960 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aa4ba93e 08-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed src/system/kernel/device_manager/io_requests.{h,cpp} to
IORequest.{h,cpp}.
* Introduced public <io_requests.h> header. Currently it only declares the
single function BFS uses.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29446 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0316483f 27-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* DMAResource::TranslateNext(): Added parameter to limit the maximum
operation length.
* IORequest: Added owner (IORequestOwner). Also added a SetUnfinished()
method, which is invoked by the I/O scheduler after all operations of
the request have been finished, but the request isn't done yet.
* Added debugger commands "io_request_owner" and "io_scheduler" printing
information for a IORequestOwner and IOScheduler object respectively.
* Implemented an actual I/O scheduling algorithm. It's a simple round
robin strategy (a queue per thread) with a unidirectional elevator
serializing the operations. ATM priorities are ignored, the bandwidth
isn't adjusted to the device, and there are TODOs all over the place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27216 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 025f7c32 24-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

A DMABuffer doesn't have a fixed bounce buffer assigned anymore. We do
dynamically assign one when needed. Under the assumption that in most
cases a bounce buffer isn't needed, we can thus prepare a lot more
operations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27185 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ff388d51 18-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

DMAResource::TranslateNext(): Fixed several bugs that could cause too
many bytes to be read/written, which, among other things, could trigger
an assert in the IORequest code:
* In case of a partial (i.e. non-block-aligned) begin, transferLeft was
not adjusted correctly.
* The main loop was lacking a transferLeft check.
* Main loop: When finally using a bounce buffer, the unrestricted vec
length was used as base length for the bounce buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27042 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 70e2d4ac 14-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced the B_BLOCK_DEVICE_* defines with B_DMA_* defines that better match
our dma_restrictions structure (but we're using blocks instead of bytes,
since unlike the block size, the restrictions attributes are constant).
* We might want to use blocks for the dma_restrictions structure as well in
the future...
* Fixed another bug in the device_node variant of DMAResource::Init(): the max
segment size was specified in blocks as well.
* Removed the "hardcode" block_io module and header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26973 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 61b1a536 14-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed the mix of bufferCount vs. max_segment_count with regards to
B_BLOCK_DEVICE_MAX_SG_BLOCKS as pointed out by Ingo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26972 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2fc2b436 09-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Another hard code (DMAResource::TranslateNext()) fix: In the write case
if after the main loop the transfer is already block aligned, we still
have to check whether the last vec is a bounce buffer that is shorter
than a complete block, but exceeds the original end of the request. If
so, we have to cut back to the previous block and add a block-sized
bounce buffer instead. Actually that's almost the same case as when the
transfer length is not yet block aligned, and thus we let the same code
handle it. Fixes bug #2584.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26910 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ed0303d1 09-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* When creating the physical vector array, we did not advance "base" in the
loop.
* This is probably the cause for file corruptions as well as bug #2595; will
have another look tomorrow.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26905 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b328324d 08-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

DMAResource::TranslateNext(), in case of given physical vecs:
* segmentCount was potentially set incorrectly. It could be too big,
since we considered all vecs, not only those remaining.
* The main loop condition was incorrect. This would lead to too few
DMABuffer vecs (or none at all) for any but the first IOOperation of a
request. Should fix #2586.
* Correctly offset by vecIndex in debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26881 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f8a59924 06-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added Dump() method to IORequest, IOOperation, IOBuffer, and DMABuffer.
* Added KDL commands "io_request", "io_operation", "io_buffer", and
"dma_buffer".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26838 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 39b5c374 05-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a DMAResource::Init() method that gets a device node - for now, it will
reuse the block_io attributes in the node to build the dma_restrictions.
* DMAResource::Init() now dumps the dma_resources (should be done with the
TRACE() macro later).
* Turned off IOScheduler debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26825 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f12cc54 30-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* It is now supported that I/O operations and requests are only handled
partially (e.g. due to hitting the end of file). The respective
classes have grown new methods and attributes to deal with that. The
"finished" callbacks have got additional parameters to indicate
whether the transfer was only partial and how much has been
transferred. Other callbacks and functions have a size_t* in/out
parameter instead of a simple size_t, now.
* vfs_{read,write}_pages() do now use the I/O request framework instead
of the underlying FS's {read,write}_pages() hooks (those should be
unused now). Furthermore they've got an additional "flags" parameter,
which is passed to IORequest::Init(), i.e. it allows to specify that
the given vecs refer to physical addresses.
* The file cache's read_into_cache() reads directly into physical
pages, now.
* Fixed bug in DoIO::IO(): The offset was not adjusted, so that all
pages were incorrectly transferred from/to the same location.
* Fixed broken subrequest scheduling loop head in
do_iterative_fd_io_iterate().
* Adjusted the test driver and implemented its io() hook. Using this
driver I/O requests are passed all the way from the VFS/VM to the
driver and through the I/O scheduler. It even seems to work. :-)
* Added missing const to the iovec* parameter of the IORequest::Init()
methods.
* Disabled some debug output by default. Added new optional debug
output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26692 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9951d585 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* We have to use get_memory_map_etc() instead of get_memory_map(), since
the scheduler thread doing that has no direct access to the
destination team's address space.
* Improved some debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26601 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 86cea5c5 21-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Renamed IOOperation::SetRequest() to Prepare().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26557 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8faff60c 21-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Enabled all DMA tests, wrote some more.
* Moved data buffer creation to a TestSuiteContext class.
* Added checks if the I/O operation does the correct thing, ie. reads/writes
the data to the right offset.
* Rearranged DMA translation: we now handle the partial write case correctly
(bounce buffer must always span over the whole block), and are able to join
adjacent bounce buffers together.
* The new _AddBounceBuffer() method also respects boundary and segment size
restrictions for bounce buffers.
* IOOperation now prepares the outgoing vecs/offset/length to contain the
right data for the current phase (partial read begin/end/do-all); it will
also make sure that the lengths of the vecs are of the same size than the
whole request.
* All tests are now passed, the I/O request implementation seems to be ready
for integration now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26556 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45a206a7 19-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

axeld + bonefish:
More work on the I/O scheduler, more precisely mainly the DMAResource class:
* When splitting requests into operations, we're now able to flexibly mix
bounce buffer segments and the given physical vectors in a single
operation. This reduces the number of operations.
* Squashed several TODO and fleshed out more of the implementation.
* Added a test driver running unit tests. There are only a few tests yet,
but those pass.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26519 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6969690a 18-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

bonefish + axeld:
* Moved the old I/O scheduler code into the device manager, and replaced its
contents completely :-)
* Implemented the DMA and I/O requests/scheduler framework - for now in C++
only. It's a work in progress and not used anywhere yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26488 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3c47ce8421df03bf27f3e26238f9ec8637779525 02-Jul-2013 Jérôme Duval <jerome.duval@gmail.com>

DMAResource: mutex_lock() before calling mutex_destroy().


# 6121ae660c7e10d5101d8b67143b7be290433ed9 15-Jun-2013 Jérôme Duval <jerome.duval@gmail.com>

device_manager: init DMAResource::fScratchVecs.


# d1f280c80529d5f0bc55030c2934f9255bc7f6a2 01-Apr-2012 Hamish Morrison <hamishm53@gmail.com>

Add support for pthread_attr_get/setguardsize()

* Added the aforementioned functions.
* create_area_etc() now takes a guard size parameter.
* The thread_info::stack_base/end range now refers to the usable range
only.


# 4be4fc6b1faddbd037146214a0011d320842b4f3 15-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

More 64-bit compilation/safety fixes.


# 4535495d80c86e19e2610e7444a4fcefe3e0f8e6 10-Jan-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged the signals branch into trunk, with these changes:
* The team and thread kernel structures have been renamed to Team and Thread
respectively and moved into the new BKernel namespace.
* Several (kernel add-on) sources have been converted from C to C++ since
private kernel headers are included that are no longer C compatible.

Changes after merging:
* Fixed gcc 2 build (warnings mainly in the scary firewire bus manager).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40196 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ce97aa1274f6fa8b16fd05d0749c3d4fd85af88a 14-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

DMAResource::Init(): Also evaluate the device node's B_DMA_LOW_ADDRESS and
B_DMA_HIGH_ADDRESS attributes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37143 a95241bf-73f2-0310-859d-f6bbb57e9c96


# a8ad734f1c698917badb15e1641e0f38b3e9a013 14-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced structures {virtual,physical}_address_restrictions, which specify
restrictions for virtual/physical addresses.
* vm_page_allocate_page_run():
- Fixed conversion of base/limit to array indexes. sPhysicalPageOffset was not
taken into account.
- Takes a physical_address_restrictions instead of base/limit and also
supports alignment and boundary restrictions, now.
* map_backing_store(), VM[User,Kernel]AddressSpace::InsertArea()/
ReserveAddressRange() take a virtual_address_restrictions parameter, now. They
also support an alignment independent from the range size.
* create_area_etc(), vm_create_anonymous_area(): Take
{virtual,physical}_address_restrictions parameters, now.
* Removed no longer needed B_PHYSICAL_BASE_ADDRESS.
* DMAResources:
- Fixed potential overflows of uint32 when initializing from device node
attributes.
- Fixed bounce buffer creation TODOs: By using create_area_etc() with the
new restrictions parameters we can directly support physical high address,
boundary, and alignment.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37131 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1d578e15fe5b5c3ff62866ae81aef529d00d7762 02-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

Fixed more address types related issues. Mostly printf() or comparison
warnings, but also some oversights from earlier changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37000 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 435c43f5912b109e7d5cf682865d2061e62fad8c 02-Jun-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced type generic_io_vec, which is similar to iovec, but uses types
that are wide enough for both virtual and physical addresses.
* DMABuffer, IORequest, IOScheduler,... and code using them: Use
generic_io_vec and generic_{addr,size}_t where necessary.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36997 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 64d79eff7290437d24b1a420537c3ed5c144ab96 27-May-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed physical_entry::{address,size} to phys_{addr,size}_t and changed
map_physical_memory()'s physicalAddress parameter type from void* to
phys_addr_t. This breaks source compatibility, but -- as long as
phys_{addr,size}_t remain 32 bit wide -- keeps binary compatibility with
BeOS.
* Adjusted all code using the affected interfaces (Oh what fun!). Added a few
TODOs in places where the wrong types (e.g. void* for physical addresses
are used). Looks like quite a few drivers aren't 64 bit safe and others
will break with PAE.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36960 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aa4ba93e25c1c63730ba69e04d3d96c3253924fd 08-Mar-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Renamed src/system/kernel/device_manager/io_requests.{h,cpp} to
IORequest.{h,cpp}.
* Introduced public <io_requests.h> header. Currently it only declares the
single function BFS uses.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29446 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 0316483f0ade2904583955b57cc396bf060f9027 27-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* DMAResource::TranslateNext(): Added parameter to limit the maximum
operation length.
* IORequest: Added owner (IORequestOwner). Also added a SetUnfinished()
method, which is invoked by the I/O scheduler after all operations of
the request have been finished, but the request isn't done yet.
* Added debugger commands "io_request_owner" and "io_scheduler" printing
information for a IORequestOwner and IOScheduler object respectively.
* Implemented an actual I/O scheduling algorithm. It's a simple round
robin strategy (a queue per thread) with a unidirectional elevator
serializing the operations. ATM priorities are ignored, the bandwidth
isn't adjusted to the device, and there are TODOs all over the place.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27216 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 025f7c3289220e25bc02d546d9f3acbcf605ae50 24-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

A DMABuffer doesn't have a fixed bounce buffer assigned anymore. We do
dynamically assign one when needed. Under the assumption that in most
cases a bounce buffer isn't needed, we can thus prepare a lot more
operations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27185 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ff388d5189c5feedae807276e0893cbc7356f21d 18-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

DMAResource::TranslateNext(): Fixed several bugs that could cause too
many bytes to be read/written, which, among other things, could trigger
an assert in the IORequest code:
* In case of a partial (i.e. non-block-aligned) begin, transferLeft was
not adjusted correctly.
* The main loop was lacking a transferLeft check.
* Main loop: When finally using a bounce buffer, the unrestricted vec
length was used as base length for the bounce buffer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27042 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 70e2d4ac43aa54d8c567ec12e6b24155d3171dd9 14-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Replaced the B_BLOCK_DEVICE_* defines with B_DMA_* defines that better match
our dma_restrictions structure (but we're using blocks instead of bytes,
since unlike the block size, the restrictions attributes are constant).
* We might want to use blocks for the dma_restrictions structure as well in
the future...
* Fixed another bug in the device_node variant of DMAResource::Init(): the max
segment size was specified in blocks as well.
* Removed the "hardcode" block_io module and header.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26973 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 61b1a536e8e346af6559e8353786091b85629a9d 14-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Fixed the mix of bufferCount vs. max_segment_count with regards to
B_BLOCK_DEVICE_MAX_SG_BLOCKS as pointed out by Ingo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26972 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 2fc2b436d27500753d17fb4ede98f72c6c203467 09-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Another hard code (DMAResource::TranslateNext()) fix: In the write case
if after the main loop the transfer is already block aligned, we still
have to check whether the last vec is a bounce buffer that is shorter
than a complete block, but exceeds the original end of the request. If
so, we have to cut back to the previous block and add a block-sized
bounce buffer instead. Actually that's almost the same case as when the
transfer length is not yet block aligned, and thus we let the same code
handle it. Fixes bug #2584.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26910 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ed0303d19d6591c38891a79b2409fcf905a7cf0d 09-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* When creating the physical vector array, we did not advance "base" in the
loop.
* This is probably the cause for file corruptions as well as bug #2595; will
have another look tomorrow.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26905 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b328324d193489665fecc90a7425fa921d98bd12 08-Aug-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

DMAResource::TranslateNext(), in case of given physical vecs:
* segmentCount was potentially set incorrectly. It could be too big,
since we considered all vecs, not only those remaining.
* The main loop condition was incorrect. This would lead to too few
DMABuffer vecs (or none at all) for any but the first IOOperation of a
request. Should fix #2586.
* Correctly offset by vecIndex in debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26881 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f8a59924e5a8afacf7c966c00156cf55b151cf9a 06-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added Dump() method to IORequest, IOOperation, IOBuffer, and DMABuffer.
* Added KDL commands "io_request", "io_operation", "io_buffer", and
"dma_buffer".


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26838 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 39b5c374187b8c7d7a13e8159a70eadb0f06ecb0 05-Aug-2008 Axel Dörfler <axeld@pinc-software.de>

* Added a DMAResource::Init() method that gets a device node - for now, it will
reuse the block_io attributes in the node to build the dma_restrictions.
* DMAResource::Init() now dumps the dma_resources (should be done with the
TRACE() macro later).
* Turned off IOScheduler debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26825 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f12cc54a729622cd04940ee9400958413d99b21 30-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* It is now supported that I/O operations and requests are only handled
partially (e.g. due to hitting the end of file). The respective
classes have grown new methods and attributes to deal with that. The
"finished" callbacks have got additional parameters to indicate
whether the transfer was only partial and how much has been
transferred. Other callbacks and functions have a size_t* in/out
parameter instead of a simple size_t, now.
* vfs_{read,write}_pages() do now use the I/O request framework instead
of the underlying FS's {read,write}_pages() hooks (those should be
unused now). Furthermore they've got an additional "flags" parameter,
which is passed to IORequest::Init(), i.e. it allows to specify that
the given vecs refer to physical addresses.
* The file cache's read_into_cache() reads directly into physical
pages, now.
* Fixed bug in DoIO::IO(): The offset was not adjusted, so that all
pages were incorrectly transferred from/to the same location.
* Fixed broken subrequest scheduling loop head in
do_iterative_fd_io_iterate().
* Adjusted the test driver and implemented its io() hook. Using this
driver I/O requests are passed all the way from the VFS/VM to the
driver and through the I/O scheduler. It even seems to work. :-)
* Added missing const to the iovec* parameter of the IORequest::Init()
methods.
* Disabled some debug output by default. Added new optional debug
output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26692 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9951d585b6e7275de6f8b86967ea16527770c97c 23-Jul-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* We have to use get_memory_map_etc() instead of get_memory_map(), since
the scheduler thread doing that has no direct access to the
destination team's address space.
* Improved some debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26601 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 86cea5c5f192ce43ce1965d47aadd1f1f55c6e86 21-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Renamed IOOperation::SetRequest() to Prepare().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26557 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8faff60c7fe72c4dc62b3e823faac1fe244e43d5 21-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

* Enabled all DMA tests, wrote some more.
* Moved data buffer creation to a TestSuiteContext class.
* Added checks if the I/O operation does the correct thing, ie. reads/writes
the data to the right offset.
* Rearranged DMA translation: we now handle the partial write case correctly
(bounce buffer must always span over the whole block), and are able to join
adjacent bounce buffers together.
* The new _AddBounceBuffer() method also respects boundary and segment size
restrictions for bounce buffers.
* IOOperation now prepares the outgoing vecs/offset/length to contain the
right data for the current phase (partial read begin/end/do-all); it will
also make sure that the lengths of the vecs are of the same size than the
whole request.
* All tests are now passed, the I/O request implementation seems to be ready
for integration now.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26556 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 45a206a7420034118693e3bbc8976083e1045e51 19-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

axeld + bonefish:
More work on the I/O scheduler, more precisely mainly the DMAResource class:
* When splitting requests into operations, we're now able to flexibly mix
bounce buffer segments and the given physical vectors in a single
operation. This reduces the number of operations.
* Squashed several TODO and fleshed out more of the implementation.
* Added a test driver running unit tests. There are only a few tests yet,
but those pass.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26519 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6969690afee7ab446c14e04011cf5cadedb09c1b 18-Jul-2008 Axel Dörfler <axeld@pinc-software.de>

bonefish + axeld:
* Moved the old I/O scheduler code into the device manager, and replaced its
contents completely :-)
* Implemented the DMA and I/O requests/scheduler framework - for now in C++
only. It's a work in progress and not used anywhere yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26488 a95241bf-73f2-0310-859d-f6bbb57e9c96