Bug while creating the first i/o completion queue (NVMe over PCIe)
Bug while creating the first i/o completion queue (NVMe over PCIe)
Hi, in my nvme driver, while creating the first i/o completion queue, it is failing with the status code 2 (Invalid Field in Command). I have double checked my commands and still can't figure out which cmd is invalid.
Here are my commands: https://pastebin.com/PYiL0WJA . I'm testing my driver on my real machine.
Here are my commands: https://pastebin.com/PYiL0WJA . I'm testing my driver on my real machine.
-
- Member
- Posts: 5494
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
status code type is 1 (Command Specific Status).
-
- Member
- Posts: 5494
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
When the status code type is 1, status code 2 means "Maximum Queue Size Exceeded". Use CAP.MQES to choose a valid queue size.
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
Thank you. Before creating the i/o completion queue, I was reading the CAP register value. Accidentally I was doing `*addr = value` instead of `value = *addr`. I fixed this and I checked that the queue size i.e. 64 commands is valid. Still I'm getting the same error status.
-
- Member
- Posts: 5494
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
What is the value of the CAP register?
Have you tried your driver in a virtual machine like QEMU?
Have you tried your driver in a virtual machine like QEMU?
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
CAP register value = 0x300a0103ff
I have tried running it on qemu too but launching qemu fails with "gtk initialization failed". I haven't been able to solve this issue yet!
I have tried running it on qemu too but launching qemu fails with "gtk initialization failed". I haven't been able to solve this issue yet!
-
- Member
- Posts: 5494
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
How are you launching QEMU? How did you install QEMU?
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
Code: Select all
$ qemu-system-x86_64 -M q35 -smbios type=0,uefi=on -bios /usr/share/ovmf/OVMF.fd -enable-kvm -cpu host -drive format=raw,file=disk.img,if=none,id=NVME1 -device nvme,drive=NVME1,serial=nvme-1 -trace pci_nvme*
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
After asking on #qemu irc channel, I changed the DISPLAY value to 1 and it worked. Now in qemu, while resetting the controller during initialization, on clearing the CC.EN (bit #0) to 0, and writing it back, the new CC register value becomes 0 don't know why. However, the driver halts a bit later on the fatal error: CSTS.CFS is not 0!
I'm pasting the screenshot: https://drive.google.com/file/d/1Ay_8w7 ... sp=sharing
I'm pasting the screenshot: https://drive.google.com/file/d/1Ay_8w7 ... sp=sharing
-
- Member
- Posts: 5494
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
You need to choose reasonable values for CC.IOSQES and CC.IOCQES.
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
Please take a look at my code on this matter: https://github.com/MaciekLeks/bebok/blo ... e.zig#L905 . I have resolved the issue with sc=0x02 for sct=0x01. Now I'm struggling with sc=0x08. Good luck!
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
I don't like the virtual machine.
The others drivers I have checked have the same commands as mine and they are working fine.
If so, then why am I getting the error?
The others drivers I have checked have the same commands as mine and they are working fine.
If so, then why am I getting the error?
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
You can also resume the discussion in the issue that I have opened in the project:
https://github.com/robstat7/Raam/issues/4
https://github.com/robstat7/Raam/issues/4
-
- Member
- Posts: 5494
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Bug while creating the first i/o completion queue (NVMe over PCIe)
Invalid Interrupt Vector. You're using pin-based interrutps, so the interrupt vector needs to be 0. If you switch to MSI or MSI-X, the interrupt vector is the index in the list of MSI(-X) interrupts you've configured on the NVMe controller. The interrupt vector you need to use here is not the same as a CPU interrupt vector.
Does your code work in the virtual machine?