cpointersosdevpci-envme

Checking admin completion queue is going into infinite loop (NVMe over PCIe)


I'm creating a 64-bit x86-64 kernel and I'm testing it on my real machine. In my nvme driver code, I'm creating the I/O completion queue and calling the `nvme_admin' function at line no. 312 (please see 0).

I'm checking the admin completion queue after submitting the commands to the controller. I'm submitting the commands to the admin submission queue starting from line no. 258 and I'm writing the new tail value at line no. 221. Then I'm checking the completion queue in the call to the function nvme_admin_wait at line 234. Here, the do-while loop at line no. 206 is an infinite loop.

How to identify why the admin entry was never processed? After writing to the doorbell register, processing paused bit (CSTS.PP) is 0. Also the controller is enabled, ready, and fault free (CSTS.CFS). Is there something wrong with the commands I submitted to the nvme controller?

Edit: After fixing the function to get the nvme base address, it is working on qemu but still not on my real machine.

Thanks.


Solution

  • I solved this NVMe driver problem. I rewrote the driver from scratch following the wiki and the specification and this commit (please see [0]) finally made it worked.

    Thank you so much for the help in the comments above :) I learned a lot along the way.

    [0]: https://github.com/robstat7/Raam/commit/eb9bd8c725808d963abd1c87ec2a5e2bcb899d9b