I have a new DAQ(data acquisition) card, which can speed up special data calculation, and its driver in linux. Now, I want to write something like a "virtio-daq": VMs can recognize this device in guest side(like /dev/daq) and use read/wirte operation to get data processed by host. And host can receive those request and data from guest VMs. Then host sends data to responsed VMs respectively.
In fact, I have read virtio-blk.c and virtio-console.c in kernel code. But I still fall into confusion. I have some question about device emulation in qemu:
1. How to add new virtio device. The probe function of virtio driver should be triggered when OS detects this device.
2. How to know which guest VM sends requests to host. For example, VM1 and VM2 send requests, which include data. How does host distinguishs which request is sent by VM1?
Have any guide for me?