Skip to content
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

NVMe disk driver: various improvements #62820

Merged
merged 6 commits into from Sep 22, 2023

Conversation

tbursztyka
Copy link
Collaborator

@tbursztyka tbursztyka commented Sep 19, 2023

Various driver improvements.

Note the 2 last commits which are about data buffer pointer alignment.

Tomasz Bursztyka added 4 commits September 20, 2023 08:31
This will provide a detailed error status report.

As for most of the original code of the driver, this is a backport of
the work done by Jim Harris in FreeBSD.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Getting rid of 4Kib page size hardcoded value on PRP handling.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
To avoid issue in address translation when CPU is running in big endian.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Former way was difficult to read, so let's have a better way which
easily follows the specifications.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Tomasz Bursztyka added 2 commits September 20, 2023 10:33
This is a specific case for NVMe where given data buffer pointers must
be dword (4 bytes) aligned.

There is no virtual memory management between the user thread and NVMe
driver (which one could detect such wrong alignement on physical memory
and thus reallocate the memory properly, so it would be fully
transparent for the user thread), thus the need to push that check to
the user.

This has been going under the radar so far as Qemu does not seem to
follow NVMe specifications where PRP1 (in DPTR) must always be
dword-aligned. It really does not follow the rule: specifications
details that if bits 1:0 of PRP1 are set, the controller may generate
an error or treat the address as if these bits were unset. Seems like
a bug in Qemu, I did not check the code there however.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
In Zephyr, this is let to the disk access API user. There is nothing the
driver can do about it.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
@tbursztyka tbursztyka changed the title NVMe disk driver: various improvments NVMe disk driver: various improvements Sep 20, 2023
@@ -63,6 +63,9 @@ int disk_access_status(const char *pdrv);
*
* Function to read data from disk to a memory buffer.
*
* Note: if he disk is of NVMe type, user will need to ensure data_buf
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: if the disk ?

@carlescufi carlescufi merged commit ba02d85 into zephyrproject-rtos:main Sep 22, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants