This is a port of libvfn for macOS and implemented into xNVMe. It utilizes DriverKit to hook an external PCI NVMe device (through PCIDriverKit), and allows user-space applications to take control of the device.
This is not suitable for production, as it requires disabling SIP, and everything has to be self-signed. The code might also be buggy or have improper memory management, as this is just a proof-of-concept at this point.
Consider this a beta release. It works fine for prototyping, testing, and development.
Although it's a port of libvfn, there is no way of running any of the example code from the libvfn project, as they heavily depend on Linux-only APIs. Instead, MacVFN has been implemented in xNVMe as a reference solution. All the examples from xNVMe should work.
- Interrupts
- Timeouts
- Register with BlockStorageDeviceDriverKit
These are the basic steps to build and install the driver:
- Disable SIP
- Run
systemextensionsctl developer on
to allow System Extensions from any directory - Identify the newest or matching tagged xNVMe version of MacVFN (or go with
master
) - Git clone this repo with submodules:
git clone --recurse-submodules --branch xnvme_vX.Y.Z https://github.com/SamsungDS/MacVFN.git
- Run
make build install kill log
, approve system extension and type sudo-password as needed - Clone xNVMe with the
next
branch:git clone -b next https://github.com/xnvme/xnvme
- Run
make config build install
- Check your NVMe device enumerates
xnvme enum
- Then take the 'uri' and run a command:
xnvme idfy MacVFN-1234ABCD --cns 0 --be=driverkit
- Or two
xnvme_single_sync MacVFN-1234ABCD
- Or three
xnvme_single_async MacVFN-1234ABCD
Optionally, you can clone and build fio with xNVMe support:
- Git clone fio:
git clone https://github.com/axboe/fio
- Install GNU-make:
brew install make
- Use
gmake
to build it:gmake -j
- Run a test:
./fio --name=test1 --iodepth=64 --rw=write --bs=512 --size=1GB --loops=1 --numjobs=1 --direct=1 --ioengine=xnvme --filename=MacVFN-1234ABCD --thread=1 --xnvme_dev_nsid=1 --xnvme_be=driverkit --xnvme_sync=driverkit --xnvme_async=driverkit --verify=crc32