(GSoC 2024) NVMe Driver Implementation Status

Devices programming
  • Okay, so during the first half I'll primarily focus on finishing the initialization work, creation of the I/O queues and implementing some of the basic commands such as read, write, reset, to get it to a minimal working state and implement the API for the kernel to access the data on the disk. I'll post an attachment with the disk image as soon as it's complete (or just modify my Makefile to automatically add the driver to the image) so that it can be tested. Then, in the second phase, I can focus on fixing bugs and implementing more necessary features.

    I will try my absolute best to make the driver compatible with all 1.x NVMe controllers, but I'm testing it solely on QEMU for now which uses 1.4, so if you have a older version unused NVMe SSD lying around, I would greatly appreciate it if you could test it to make sure it works on there as well. Obviously, I'm not responsible for any data loss or damage done, so please test at your own discretion.
  • (EDIT: tar screwed up the disk image... will reattach it immediately once I fix that.. should work now! BTW, the image attached is buggy and slow, don't use it. See my comment below for the better one.)

    Hi everybody,

    I'm pleased to announce that the driver now has support for most of the important NVMe administrator commands (i.e., get/set features, deletion and creation of I/O queues, identify, and abort). Also added IRQ support. Initialization is finished, so what's next is to implement the important I/O commands such as read, write, and some others. Should be compatible with all controller versions, but I'm not simultaneously reading all the specifications at once so I can't know for sure. So please do test on older versions if you have one.

    I would appreciate it if you could test the driver and provide feedback on any bugs you encounter, problems, etc. I'm not responsible for any damage or data loss. This driver is intended to be tested among KolibriOS developers and enthusiasts. Also, please make sure you only have one NVMe device plugged in, otherwise the driver will just initialize the first NVMe device it finds (support for multiple NVMe devices is technically implemented but I commented out those codepaths to make debugging a bit easier for now).

    Also, you'll notice I added a fair bit of delay between some of the command submissions. It's just a temporary (ugly) bandaid for checking if command completion works as expected.

    I've attached the floppy disk image here (14 Jun 2024) snapshot, which is the latest version as of this writing. It contains the driver (commit 7cc4b713). If everything works as expected, you should see an output like this:
    28200.png
    28200.png (11.73 KiB)
    Viewed 4387 times
    Make sure the model name and serial number are correct, no freezing should occur, and at the end of the output log you should see a message if the NVMe driver has successfully been initialized or not.

    When you've finished testing, I would greatly appreciate a screenshot of the output and your NVMe controller version, regardless if it worked fine or not. This lets me know where I need to fix certain incompatibilities and such.
    Attachments
    Downloaded 101 times
    Last edited by ramenu on Sat Jun 22, 2024 1:08 am, edited 1 time in total.
  • OK, a little update. I've been debugging the driver for a little while and it seems like opening certain applications like NetSurf just causes interrupts to constantly be generated.

    Also, I've noticed the system freezes when creating the I/O queues sometimes (this doesn't happen with the other administrator commands, at least not with Identify/Set Features, also encountered some other bugs in my code, which have been fixed). So I need to sort these issues out. Feel free to test nonetheless.
  • Great. I will try it on real hardware, but on weekends.
    to infinity and beyond
  • Thank you, @punk_joker.

    I've reattached a new image here with the driver (commit 86fde0b701). It has lots of bug fixes related to IRQ handling, the occasional freezing, and significant performance improvements in the initialization. I believe the occasional freezing should go away now, but feel free to let me know if it pops up and I'll be sure to fix it ASAP. :)
    Attachments
    Downloaded 101 times
  • Unfortunately, KolibriOS cannot boot on both of my computers.
    I will try to set up UEFI boot on my main PC again, and hope it will help to test the driver.
    to infinity and beyond
  • EDIT: I've attached the floppy disk image (as of 23 Jul 2024) which contains the NVMe driver (commit bacd08902f).

    Hi everyone, it's been a while so I thought I should post an update.

    I'm pleased to announce the driver now has support for read and write operations. Multiple NVMe devices can also be used now. Here is a screenshot:
    22129.png
    22129.png (63.46 KiB)
    Viewed 3178 times
    As I'm pretty happy with the current feature set, I'll be focusing primarily on significant performance improvements and bug fixes for the rest of the GSoC period (and onwards). As always, feedback and tests would be greatly appreciated! If you have any problems, you can open an issue on the Git repository, post a message here, or ping me on IRC and I will be happy to help.

    There is currently a known issue where the driver fails to complete any commands on Virtualbox. This is currently being investigated and you can keep track of this issue here. If you can replicate this issue on any other hardware, please do let us know as that would be tremendously helpful in identifying what the problem may be. :)

    NOTE: Please avoid testing on any drives containing important information unless you know what you're doing. I'm not responsible for any damages done.
    Attachments
    kolibri.7z (1.25 MiB)
    Downloaded 94 times
  • Who is online

    Users browsing this forum: No registered users and 1 guest