lib/ukfile: Add backing buffer shared memory API #1411
+113
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes
This change expands the ukfile API to provide direct shared memory access to file backing buffers, useful for implementing memory mappings (mmap) or single-copy file-to-file transfers (sendfile).
In broad strokes, consumers would use it as such:
sendfile
):iomem(BORROW)
mmap
s):mmap()
doesiomem(ACQUIRE)
; this ensures(1) backing buffer is mapped by the file for the respective area and
(2) addresses returned by
iomem(RETRIEVE)
are stable until RELEASEmunmap()
doesiomem(RELEASE)
mmap
and paging in the memory, doiomem(RETRIEVE)
to get specific memory rangesiomem(GIFT)
with memory you own and want the file to take overA boilerplate no-op implementation is provided, and existing ukfiles are patched to use it.
No actual implementations or consumers of this API are included. Rather, the intent of this PR is to review the API and ensure it is properly documented in isolation.
Prerequisite checklist
checkpatch.uk
on your commit series before opening this PR;Base target
x86_64
or N/A]kvm
,xen
or N/A]app-python3
or N/A]Additional configuration
N/A