virt: acrn: support asyncio data match

Virtio legacy device (ver < 1.0) uses a single PIO for all virtqueues.
Notifications from different virtqueues are implemented by writing
virtqueue index to the PIO. Writing different values to the same addr
needs to be mapped to different eventfds by asyncio. This is called
data match feature of asyncio.

Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Signed-off-by: Gao, Shiqing <shiqing.gao@intel.com>
This commit is contained in:
Jian Jun Chen 2023-07-11 17:23:30 +08:00 committed by wenlingz
parent f528146c92
commit 2355d104a1
2 changed files with 8 additions and 0 deletions

View File

@ -93,6 +93,10 @@ static int acrn_ioeventfd_asyncio_config(struct acrn_vm *vm, struct acrn_ioevent
asyncio_info->type = ACRN_ASYNC_TYPE_PIO;
else
asyncio_info->type = ACRN_ASYNC_TYPE_MMIO;
if (args->flags & ACRN_IOEVENTFD_FLAG_DATAMATCH) {
asyncio_info->match_data = 1U;
asyncio_info->data = args->data;
}
if (args->flags & ACRN_IOEVENTFD_FLAG_DEASSIGN)
ret = hcall_asyncio_deassign(vm->vmid, virt_to_phys(asyncio_info));
else

View File

@ -484,13 +484,17 @@ struct acrn_vdev {
/*struct acrn_asyncio_reqinfo - Data for setting asyncio request of User VM
* @type: IO type, ACRN_ASYNC_PIO/ACRN_ASYNC_MMIO
* @match_data: Data matching or not. 0 indicates no data matching; 1 indicates exact matching.
* @addr: IO base address
* @fd: eventfd of this asynicio.
* @data: Data for matching
*/
struct acrn_asyncio_reqinfo {
__u32 type;
__u32 match_data;
__u64 addr;
__u64 fd;
__u64 data;
};
#define SBUF_MAGIC 0x5aa57aa71aa13aa3