io_uring: add IORING_REGISTER_{MAP,UNMAP}_BUFFERS
If supported by the file used for IO, pre-map registered buffers for
DMA. This ties in with registered buffers, and this is only feasible
on a range of buffers that have been registered with
IORING_REGISTER_BUFFERS or IORING_REGISTER_BUFFERS2.
By pre-mapping the buffers for DMA, we retain any DMA mappings across
IO. This means that we no longer have to do a DMA map+unmap for each
IO.
The buffers can be unmapped with IORING_REGISTER_UNMAP_BUFFERS, or
simply just unregistered as per usual and unmapping will happen as
part of that.
This goes for updates through IORING_REGISTER_BUFFERS_UPDATE as well,
if the existing buffer being replaced is DMA mapped, it is unmapped
as part of the update. The new buffer must be DMA mapped afterwards,
if so desired.
Signed-off-by: Jens Axboe <axboe@kernel.dk>