On Wed, 17 Mar 2021 19:13:30 +0000 "Derrick, Jonathan" <jonathan.derrick@xxxxxxxxx> wrote: > Hi Kirti, Alex, > > I've written a host mdev driver for a pcie instrument that divides its > resources to a guest driver and manages per-instance interfacing. > > We have a use case where we might want to drive the instrument directly > from the host in the same application that the mdev guest would use. > > Is there a way to instantiate the emulated pci device in the host? > Or a recommended way to interface an existing pci (guest) driver to the > vfio-mdev device? No, mdev is exposing the device through the vfio API, you either need a driver for that API (ex. DPDK) or you need something to compose that API into a virtual PCI device for a guest (QEMU). mdev devices cannot make a new struct pci_dev in the host for a host drivers to bind to, you'd want something more like direct SR-IOV for that. Potentially if you're willing to run the application in a container, a Kata container could transparently include that re-composition in QEMU. This seems like the same problem your SIOV friends @Intel are facing, where creating separate userspace interfaces, one via mdev and one via device specific mechanism has been discouraged. You might look at how idxd development has been working to address this criticism. Thanks, Alex