-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add macOS/DriverKit through MacVFN #10
base: main
Are you sure you want to change the base?
Conversation
63b3c61
to
245a56f
Compare
.gitignore
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? These files are generated within the meson build directory where meson also generates a .gitignore
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In MacVFN, I'm only using meson to configure, but then I move those files to where Xcode can reach them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, but it doesn't belong in libvfn.
/** | ||
* @serial: Serial number from controller | ||
*/ | ||
char serial[20]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bloats struct nvme_ctrl
and it does not seem to be used in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I had put something in the commit message. It's for enumeration in xNVMe. MacVFN reads this serial and applies it to its name in macOS's "IO registry" of devices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, but it belongs in MacVFN then.
a9346ab
to
22794f5
Compare
1c7ebbd
to
136a863
Compare
Moved file without any changes to prepare for other platforms. Signed-off-by: Mads Ynddal <[email protected]>
…s into platform/linux Moved file without any changes to prepare for other platforms. Signed-off-by: Mads Ynddal <[email protected]>
Simple replacement using built-in byteswap. Signed-off-by: Mads Ynddal <[email protected]>
Sparsely added definitions needed on macOS+DriverKit. Signed-off-by: Mads Ynddal <[email protected]>
A port of the Linux log.h using DriverKit os_log. Signed-off-by: Mads Ynddal <[email protected]>
Added port of mem.h for macOS using DriverKit IOMallocZero and IOFree. Signed-off-by: Mads Ynddal <[email protected]>
Added port of mmio.h for macOS using faux BAR mappings. Signed-off-by: Mads Ynddal <[email protected]>
Added port of mutex.h for macOS using IOLock instead of pthread. Signed-off-by: Mads Ynddal <[email protected]>
…modate C++ For macOS we need to use C++, and it forces us to explicitly do type-casting etc. Signed-off-by: Mads Ynddal <[email protected]>
These files are normally ignored when compiling with meson on Linux, but on macOS, we need to copy them into our source code. Signed-off-by: Mads Ynddal <[email protected]>
context.h needs to be included from different places, so an include guard is required to not cause issues. Signed-off-by: Mads Ynddal <[email protected]>
9cdfbb5
to
476374a
Compare
Remove all redundant includes. Introduce ifdef's for __cplusplus. Signed-off-by: Mads Ynddal <[email protected]>
Change dma_map, iova_map_add and dma_unmap to take an iova_mapping instead of individual arguments. This simplified passing the context around, and adding more attributes transparently later. Signed-off-by: Mads Ynddal <[email protected]>
arc4 is a cryptographically secure RNG, which we don't need, but is what we have on macOS+DriverKit. Signed-off-by: Mads Ynddal <[email protected]>
Added include guard to skiplist.h to avoid duplicate definitions. Signed-off-by: Mads Ynddal <[email protected]>
Port timeout to macOS+DriverKit using clock_gettime_nsec_np. Signed-off-by: Mads Ynddal <[email protected]>
Change internal timekeeping to nanoseconds to be universal between Linux and macOS. Signed-off-by: Mads Ynddal <[email protected]>
Added serial string to nvme_ctrl to be able to identify the device. This value is copied from the already issued identify during nvme_init. Signed-off-by: Mads Ynddal <[email protected]>
Add support for passing opaque pointers around with the pgmap and iommu functions. This is needed for macOS, where the vaddr is not enough to free memory or map with the IOMMU. Signed-off-by: Mads Ynddal <[email protected]>
This commit introduces the bulk of macOS support to libvfn. This has to be used together with MacVFN, which introduces a System Extension through DriverKit. Signed-off-by: Mads Ynddal <[email protected]>
Change log-statements from 'log_debug' to 'log_error', when they are in relation to an unrecoverable error. As a rule of thumb, if the log is immediately followed by 'return -1', then it's an error. If we can continue but just log for helping, it's debug. Signed-off-by: Mads Ynddal <[email protected]>
By setting up the current PR branch as a submodule in MacVFN, we can build MacVFN and thereby verify the current libvfn branch is valid. No actual device or code test is performed. Signed-off-by: Mads Ynddal <[email protected]>
0f826bc
to
934f841
Compare
This works together with the
libvfn4
branch on the MacVFN repo: SamsungDS/MacVFN#1