au-ts / sddf

A collection of interfaces, libraries and tools for writing device drivers for seL4 that allow accessing devices securely and with low overhead.
Other
16 stars 12 forks source link

Add sound queue and virtualiser #83

Closed alexandermbrown closed 3 months ago

alexandermbrown commented 5 months ago

This PR adds sound support to the sDDF. It is based on @erichchan999 's block changes (https://github.com/au-ts/libvmm/pull/28) so those need to be merged in first. The virtualiser requires ARM cache ops on the Microkit dev branch https://github.com/Ivan-Velickovic/microkit/commit/9adb5f1c6286efadd7ddd976f4a9ee5647fb937f.

Files added

include/sddf/sound/queue.h
include/sddf/sound/sound.h
sound/components/virt.c

The following serial visualizers were extended to support 3 clients, as required by https://github.com/au-ts/libvmm/pull/37. This doesn't really belong in this PR, so I'm open to suggestions on how / where to make these changes.

serial/components/virt_rx.c
serial/components/virt_tx.c
Ivan-Velickovic commented 5 months ago

Due to both the block and audio device classes have been developed in parallel, using driver VMs and virtIO in libvmm as the environment for experimentation, things have gotten a bit messy with all the branches etc.

From here, the path is to merge all the block sDDF changes in order for this PR to be merged. The same thing will happen on libvmm (the virtIO block PR merged first, then virtIO sound).

Ivan-Velickovic commented 4 months ago

General comment: can you use printf instead of microkit_dbg_puts. For things like an invalid client can you always print out the client number (can understand why you didn't with microkit_dbg_puts but with printf this should be easy).

Ivan-Velickovic commented 4 months ago

In the virtualiser you refer to client_rings and driver_rings, should these be named *_queues instead?

Ivan-Velickovic commented 4 months ago

As discussed offline, remove the cookie from the queuing structure.

Ivan-Velickovic commented 4 months ago

As discussed offline, remove the cookie from the queuing structure.

Nevermind, the cookie is needed for commands which makes it not reasonable to remove it from the queue structure. While it would not be too bad to remove it from the PCM queues, we keep it for consistency and it makes the client side slightly easier to write as unlike when we removed the cookie in networking, there is some state tracking still necessary.

The only other motivation for removing the cookie is that it would reduce the memory footprint slightly as the identifier that the cookie is used for would only be present in the client and not in the virtualiser or the driver.

alexandermbrown commented 3 months ago

Missing checks that the DMA addresses passed around are valid and that the length of the buffer is valid.

Done in https://github.com/au-ts/sddf/pull/83/commits/c902600babf1c663c28de34db48033907342a6c9