TIL about top-posting. Thanks for enlightening me!
We've explored options such as VFIO for this use case. Although VFIO works great on PCs with hardware peripherals on an I/O bus such as PCI behind an IOMMU, we're looking to passthrough a platform device (SDIO wireless specifically, but potentially others as well) on an embedded system, such as a Raspberry Pi 4.
We've investigated vfio-platform intended for this, but based on a paper [1] describing the architecture and use cases, it seems to require specific hardware that implements DMA translation functionality, such as an IOMMU or SMMU, along with the appropriate driver. As we understand, a lot of the platforms we support don't have an IOMMU.
The kernel docs [2] describe the programming interface of devices as generally composed of I/O access, interrupts, and DMA.
Devices are the main target of any I/O driver. Devices typically
create a programming interface made up of I/O access, interrupts,
and DMA. Without going into the details of each of these, DMA is
by far the most critical aspect for maintaining a secure environment
as allowing a device read-write access to system memory imposes the
greatest risk to the overall system integrity.
This seems to explain the need for an IOMMU to passthrough a device to a virtualized guest, as any DMA done by a device would need guest physical-addresses translated to host-physical addresses.
However, we don't know for certain if the driver for our wireless adapter (mwifiex) uses DMA. Grepping the source shows references to DMA, but the fact that SDIO devices can be connected over a USB bridge seems to indicate it either doesn't, or we're not completely understanding.
We really don't know how feasible this idea is given our hardware constraints. Greybus may very likely be solving an entirely different issue, but it seemed to have enough overlap to be worth investigating. We're looking to understand if this is possible given our hardware constraints, or if we're barking up the wrong tree.
[1]:
http://www.fp7-save.eu/papers/EUC2014B.pdf[2]:
https://www.kernel.org/doc/Documentation/driver-api/vfio.rst