-
Notifications
You must be signed in to change notification settings - Fork 269
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
[feat] add nvme support #205
base: main
Are you sure you want to change the base?
Conversation
ZR233
commented
Nov 27, 2024
- add aarch64 dcache clean and invalid funcs.
- add nvme driver.
4aee9a5
to
bd39c2b
Compare
@@ -57,6 +57,9 @@ pub mod irq; | |||
#[cfg(feature = "paging")] | |||
pub mod paging; | |||
|
|||
#[cfg(feature = "alloc")] | |||
mod dma; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is extremely strange, why the dma mod is decorated under #[cfg(feature = "alloc")]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dma-api use normal alloc api to alloc Vec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dma-api use normal alloc api to alloc Vec.
I just do not get it, generally, the size of dma region is known and fixed, why a Vec
is needed since it's usually related to dynamically arrays with unknown size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dma use global allocator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can delete this now?
@@ -0,0 +1,26 @@ | |||
use dma_api::Impl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the Impl
trait exposed by dma-api
crate is strange.
I believe that you want to use this trait for the translation from IOVA
to actual PA
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you can refer to the DMA addr related trait defined in virtio-drivers
?
https://github.com/rcore-os/virtio-drivers/blob/master/src/hal.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This crate is not just about converting virtual addresses into physical addresses,but also got dma direction usage by map
func, when read from data, crate will invlid cache, when write, it will flush back from cache to memory, so that we can use normal type memory for dma, and direct use upstream &[u8] without copy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When use &mut [u8]
from os, map
to dma slice type, and when give back &[u8] to os, umap
to normal memory. If use like virtio-drivers
, we need to copy &[u8]
to no cache type memory for dma and copy back to &[u8]
for send to os.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I need to learn how dma_api
works before offering any more valuable suggestions.
kind of busy lately, so this may take a little bit longer
c55cdad
to
3f0576d
Compare
@@ -57,6 +57,9 @@ pub mod irq; | |||
#[cfg(feature = "paging")] | |||
pub mod paging; | |||
|
|||
#[cfg(feature = "alloc")] | |||
mod dma; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can delete this now?
@@ -0,0 +1,26 @@ | |||
use dma_api::Impl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I need to learn how dma_api
works before offering any more valuable suggestions.
kind of busy lately, so this may take a little bit longer
} | ||
} | ||
|
||
dma_api::set_impl!(DmaImpl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, this is kind of strange, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It a good way for singleton trait. It is widely used in embedded-hal group, like critical-section