Tyr: consider using the DMA allocator for the firmware sections
Tyr currently uses GEM to get buffers to place the firmware sections into.
This design is taken from Panthor, but things are a bit more complicated in Rust, and the current code relies on a workaround that must be addressed rather soon.
The problem is that allocating GEM objects in Rust requires an instance of the driver's Device struct, i.e.: TyrDevice.
To get a TyrDevice, we need to pass a fully-constructed T::Data, which is the driver's private data struct. To build T::Data, we need a TyrDevice to allocate the GEMs for the firmware sections. This is clearly a catch-22.
Danilo Krummich pointed out that we can avoid this situation entirely by using the DMA allocator instead of GEM. This should suffice, as Tyr only needs a buffer that can be shared with the GPU for this.
There is already some work-in-progress from Abdiel to get Rust abstractions for dma_alloc_coherent(). It is likely to get merged soon.
This task encompasses the work of replacing our use of GEM in with that allocator instead. In other words, we should replace the code below (in fw/parse.rs)
let mut mem = gem::new_kernel_object(
tdev,
iomem,
bo_len,
vm,
KernelVaPlacement::At(hdr.va.start as u64..hdr.va.end as u64),
vm_map_flags,
)?;
...with something that uses Abdiel's code instead. This will allow us to revisit the T::Data vs TyrDevice conundrum.