rust: add support for USB device drivers#884
Conversation
adamrk
left a comment
There was a problem hiding this comment.
Hey @YakoYakoYokuYoku, thanks for working on this! I left some initial comments.
fd24f28 to
53c7103
Compare
bc035c5 to
e4bae40
Compare
Many places of the kernel make use of `gfp_t` and its flags to perform certain types of allocations. On the other hand the `kernel` crate does not expose them for consumers, in particular, they are needed for the USB abstractions. For now `gfp_t` and some common flags will be available through `kernel` while in the future more flags can be added. Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
The XArray is an abstract data type which behaves like a very large array of pointers. Add a Rust abstraction for this data type. The initial implementation uses explicit locking on get operations and returns a guard which blocks mutation, ensuring that the referenced object remains alive. To avoid excessive serialization, users are expected to use an inner type that can be efficiently cloned (such as Arc<T>), and eagerly clone and drop the guard to unblock other users after a lookup. Future variants may support using RCU instead to avoid mutex locking. This abstraction also introduces a reservation mechanism, which can be used by alloc-capable XArrays to reserve a free slot without immediately filling it, and then do so at a later time. If the reservation is dropped without being filled, the slot is freed again for other users, which eliminates the need for explicit cleanup code. Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Signed-off-by: Asahi Lina <lina@asahilina.net>
Introduces APIs for USB devices and interfaces. Driver traits and implementations are aimed at interfaces only. Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Adds an API for creating, filling and submitting USB Request Blocks. With support for URB contexts, specialized trait for transport buffers, which mimics ForeignWrapper and completion routines. Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Adds a few useful descriptors for querying data upon USB abstract types. Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Adds a sample USB driver that catches incoming bulk requests and writes their transport data to a miscellaneous device. Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
e4bae40 to
d1abc00
Compare
|
Are there any updates on the state of this PR, since it fails to build after syncing with master. |
I've forgot to bring any updates, happens that I've been waiting for some of the dependencies of But, if you want to see the fix, let me know. Also there's a thread on Zulip on the topic of USB bindings. |
|
Which dependencies are you referring to? |
|
I was referring to the dependency on |
|
There have been USB abstractions in the kernel since e7e2296, this PR can likely be closed now. |
Introduces a basic API for USB devices, drivers and interfaces. Features will be added on demand.